Skip to content

Multi-asset settlement — accept token address per receive_payment and track per-token developer balances #417

Description

@greatest0fallt1me

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

  1. Fork the repo and create a branch
    git checkout -b feat/settlement-multi-asset
  2. 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
  3. 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

  • Backwards-compatible default-asset path still works
  • Per-asset pool and per-asset developer balance views added
  • Conservation invariant holds per-asset in tests

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

Metadata

Metadata

Assignees

Labels

GRANTFOX OSSGrantFox open-source campaign taskOFFICIAL CAMPAIGNOfficial GrantFox campaign issueStellar WaveIssues in the Stellar wave programenhancementNew feature or improvementrustRust implementationsmart-contractSoroban smart-contract worksorobanSoroban SDK / Stellar

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions