Description
Platform fees accrue exclusively to the platform treasury, but invoice creators (e.g., freelancers or service providers deploying the dApp) have no on-chain mechanism to claim a portion of the collected total as their own service fee. A configurable creator_fee_bps field should allow the creator to declare a basis-point share deducted before recipient payouts, with a combined cap alongside the platform fee.
Technical Context
contracts/split/src/types.rs — add creator_fee_bps: u32 to the Invoice struct (valid range 0–10 000); contracts/split/src/lib.rs — release_funds() computes creator_fee = total_collected * creator_fee_bps / 10_000 using checked_mul/checked_div, transfers to invoice.creator, then distributes the remainder to recipients; contracts/split/src/validation.rs — at initialize(), assert creator_fee_bps + platform_fee_bps <= 10_000; contracts/split/src/events.rs — emit event::creator_fee_paid(invoice_id, creator, amount).
Acceptance Criteria
Description
Platform fees accrue exclusively to the platform treasury, but invoice creators (e.g., freelancers or service providers deploying the dApp) have no on-chain mechanism to claim a portion of the collected total as their own service fee. A configurable
creator_fee_bpsfield should allow the creator to declare a basis-point share deducted before recipient payouts, with a combined cap alongside the platform fee.Technical Context
contracts/split/src/types.rs— addcreator_fee_bps: u32to theInvoicestruct (valid range 0–10 000);contracts/split/src/lib.rs—release_funds()computescreator_fee = total_collected * creator_fee_bps / 10_000usingchecked_mul/checked_div, transfers toinvoice.creator, then distributes the remainder to recipients;contracts/split/src/validation.rs— atinitialize(), assertcreator_fee_bps + platform_fee_bps <= 10_000;contracts/split/src/events.rs— emitevent::creator_fee_paid(invoice_id, creator, amount).Acceptance Criteria
Invoicestorescreator_fee_bpsandinitialize()rejects values wherecreator_fee_bps + platform_fee_bps > 10_000withError::FeeSumExceedsCaprelease_funds()deducts the creator fee from gross collected funds before computing per-recipient sharesrelease_funds()creator_fee_paidevent is emitted with invoice ID, creator address, and exact fee amount on every successful releasecontracts/split/src/tests/creator_fee_tests.rscover zero fee, a representative non-zero fee, maximum combined fee, and over-cap rejection