Skip to content

Implement protocol fee distribution to treasury address #326

Description

@Kingsman-99

Overview

Add a configurable protocol fee taken from each invoice release and forwarded to a treasury address. The fee rate and treasury address are set by the admin and updatable without a contract upgrade.

Acceptance Criteria

  • Admin function set_fee(rate_bps: u32, treasury: Address) configures the fee (basis points, max 500 = 5%)
  • Fee deducted from total release amount before distributing to recipients
  • Fee amount transferred to treasury address in the same transaction as recipient payouts
  • Fee of 0 bps disables the mechanism entirely (default on deploy)
  • get_fee_config() view function returns { rate_bps, treasury }
  • Emits FeePaid { invoice_id, amount, treasury, ledger } event on each release
  • release_funds reverts if fee transfer fails (atomic)
  • Integration tests: fee calculation at 100 bps, 0 bps (no-op), fee + recipient split sum check

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programcomplexity: highComplex feature requiring deep knowledge - 200 ptsfeatureNew contract feature or operation

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions