Description
CalloraSettlement is hard-wired to a single USDC token. To support stablecoin diversification (USDC + EURC + native XLM wrappers) we need per-asset accounting: a new (asset, developer) -> i128 balance map and an asset parameter on receive_payment and withdraw_developer_balance.
Requirements and Context
- New
StorageKey::DeveloperBalanceByAsset(Address, Address) and StorageKey::GlobalPoolByAsset(Address)
receive_payment(caller, asset, amount, to_pool, developer) — preserve old single-asset path behind a backwards-compat shim
- Must be secure, tested, and documented
- Should be efficient and easy to review
Suggested Execution
- Fork the repo and create a branch
git checkout -b feat/settlement-multi-asset
- Implement changes
contracts/settlement/src/lib.rs (new storage keys, function signatures, error variants)
contracts/settlement/src/test.rs (two-asset scenario)
- Update
INVARIANTS.md to scope conservation per-asset
- Test and commit
cargo test -p callora-settlement multi_asset
- Cover edge cases: same developer credited in two assets, single-asset legacy callers
- Include test output and notes in the PR
Example commit message
feat(settlement): add multi-asset receive_payment and per-asset balances
Acceptance Criteria
Guidelines
.rs only under contracts/.../src/, NatSpec-style /// doc comments, 95% coverage
- Use real Soroban SDK idioms; no
unwrap() in production paths
- Clear documentation and inline comments
- Timeframe: 96 hours
Description
CalloraSettlementis hard-wired to a single USDC token. To support stablecoin diversification (USDC + EURC + native XLM wrappers) we need per-asset accounting: a new(asset, developer) -> i128balance map and an asset parameter onreceive_paymentandwithdraw_developer_balance.Requirements and Context
StorageKey::DeveloperBalanceByAsset(Address, Address)andStorageKey::GlobalPoolByAsset(Address)receive_payment(caller, asset, amount, to_pool, developer)— preserve old single-asset path behind a backwards-compat shimSuggested Execution
contracts/settlement/src/lib.rs(new storage keys, function signatures, error variants)contracts/settlement/src/test.rs(two-asset scenario)INVARIANTS.mdto scope conservation per-assetcargo test -p callora-settlement multi_assetExample commit message
Acceptance Criteria
Guidelines
.rsonly undercontracts/.../src/, NatSpec-style///doc comments, 95% coverageunwrap()in production paths