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
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
set_fee(rate_bps: u32, treasury: Address)configures the fee (basis points, max 500 = 5%)treasuryaddress in the same transaction as recipient payoutsget_fee_config()view function returns{ rate_bps, treasury }FeePaid { invoice_id, amount, treasury, ledger }event on each releaserelease_fundsreverts if fee transfer fails (atomic)