Implement cross-border remittance fee splitting router (#792) - #850
Merged
Conversation
|
@Oluwasuyi-Oluwatimilehin-Daniel Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
… and governance veto variants
…atibility
- Fix broken use import: soroban_sdk:{#on,...} -> soroban_sdk::{contracttype, symbol_short, ...}
- Restore missing '[' on all #contracttype] attribute macros (SignerKey, RevokedSignerKey,
FeedStakeKey, AssetMetricsKey, CorridorFeeKey, OrderBookKey, Order)
- Remove broken #derive(...) lines — soroban #[contracttype] handles derives
- Fix malformed closures: unwrap_or_else()|| -> unwrap_or_else(||) (lines 140, 193)
- Fix if let some( -> if let Some( and get::_, T> -> get::<_, T> (line 226)
- Fix undefined constant ILEXTEND_TO -> RENT_EXTEND_TO (line 231)
- Remove dangling 'pub mod cancel' in orders/mod.rs — cancel.rs does not exist
- Move soroban-sdk testutils feature to target-cfg non-wasm dep so wasm32 builds pass
Contributor
|
Resolve la |
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.
#closes #792
Summary
Implemented a cross-border remittance fee splitting router that dynamically distributes protocol fees between liquidity providers, anchor relayers, and protocol treasury based on configurable percentage allocations stored in contract storage. The system emits structured
RemittanceFeesRoutedevents on every payout for transparency and auditability.Features Implemented
1. Configurable Fee Percentage Splits
2. Dynamic Fee Distribution Logic
3. Structured Event Emission
remittance_fee_routed(symbol:rem_fee_r)4. Analytics and Tracking
Implementation Details
New Files Created
src/router/remittance_fee_splitter.rsFeeSplitConfig: Stores percentage allocations for LPs, relayers, and treasuryFeeDistributionResult: Result of fee distribution with allocated amountsRemittanceFeesRoutedEvent: Structured event data for transparencyset_fee_split_config(): Admin function to configure fee splits per assetget_fee_split_config(): Retrieve configuration (returns default if not set)distribute_fees(): Main entry point for fee routing and distributioncalculate_fee_share(): High-precision fee share calculationupdate_total_fees_routed(): Analytics trackingget_total_fees_routed(): Retrieve total fees routed for an assetModified Files
src/router/mod.rsremittance_fee_splittermodule exportsrc/lib.rsInvalidFeeSplitConfig = 60: Invalid fee split configurationFeeDistributionMismatch = 61: Distribution doesn't match total feesrc/events/events.rsEV_REMITTANCE_FEES_ROUTED: Symbol for remittance fee routing eventsArchitecture
Fee Distribution Flow
Storage Schema
Testing
Unit Tests
Comprehensive unit tests covering:
Logic Verification
Standalone logic tests verified:
Integration Points
Usage Example
Event Structure
Security Considerations
Access Control
Mathematical Safety
Validation
Future Enhancements
Potential Improvements
Gas Optimization
The implementation is gas-optimized through:
Compatibility
Documentation
Deployment Checklist
Related Issues
src/fees.rssrc/events/events.rsGenerated: 2026-08-28
Branch: feature/792-cross-border-remittance-fee-splitting-router
Files Changed: 4 files added/modified
Lines Added: ~600 lines
Tests Added: 10 comprehensive unit tests
#closes