feat: implement flexible fee destination routing for programs (supersedes #696)#715
Merged
Jagadeeshftw merged 2 commits intoJagadeeshftw:masterfrom Mar 5, 2026
Conversation
- Expanded traits.rs: added PauseInterface and FeeInterface with full doc comments referencing Grainlify internal spec - BountyEscrowContract now formally implements all four traits (EscrowInterface, UpgradeInterface, PauseInterface, FeeInterface) - soroban/contracts/escrow: added local EscrowInterface + UpgradeInterface trait definitions and implementations; added get_balance and get_escrow_info to satisfy standard surface - grainlify-core: added local UpgradeInterface trait and impl for GrainlifyContract (feature-gated to match existing contract gate) - contracts/view-facade: implemented ViewFacade contract with register/deregister/list/get_contract for cross-contract discovery
|
@Chucks1093 is attempting to deploy a commit to the Jagadeesh B's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supersedes #696
Closes #593
Why a new PR
The previous PR (#696) was closed and cannot be reopened because the branch history was rewritten after conflict resolution/rebase (force-push).
Changes
Flexible fee routing model added to bounty escrow.
1) Fee routing configuration model
Added
FeeRoutingConfigwith:treasury_recipienttreasury_bpspartner_recipient(optional)partner_bpsAdded storage key:
DataKey::FeeRouting(u64)for per-bounty routing.2) New admin configuration entrypoints
set_fee_routing(bounty_id, treasury_recipient, treasury_bps, partner_recipient, partner_bps)clear_fee_routing(bounty_id)get_fee_routing(bounty_id)3) Deterministic routing + validation
Routing config validation enforces:
treasury_bps >= 0partner_bps >= 0treasury_bps + partner_bps == 10_000partner_bps > 0requirespartner_recipientpartner_bps == 0requires nopartner_recipientDeterministic split behavior:
total_fee * treasury_bps / 10_000(floor)total_fee - treasury_fee(remainder-safe, no drift)4) Fee routing integrated into payout paths
Lock-side fee routing applied in:
lock_fundsbatch_lock_fundsRelease-side fee routing applied in:
release_fundsbatch_release_fundspartial_releaserelease_with_capabilityclaimclaim_with_capabilityclaim_with_ticket5) Backward-compatible default behavior
If no bounty-specific routing is configured, routing defaults to existing fee recipient:
FeeConfig.fee_recipient6) New events for full accounting visibility
FeeRoutingUpdatedemitted when routing config changesFeeRoutedemitted on fee distribution with full split detailsTesting
Added test module:
contracts/bounty_escrow/contracts/escrow/src/test_fee_routing.rsCoverage includes:
Validation run:
cargo test --lib test_fee_routing -- --nocapture✅cargo test --lib -- --nocapturein bounty escrow crate ✅Notes
Implementation is scoped to:
contracts/bounty_escrow/contracts/escrowExisting fee configuration APIs remain intact; routing extends behavior without breaking existing callers.