Context & Problem Statement
Enterprises dealing with international invoices frequently accept multiple stablecoins (e.g. USDC, EURC, USDS) for settlement. Currently, each escrow is strictly locked to a single payment asset at creation time.
This issue implements multi-token funding support where the seller specifies a list of accepted_tokens: Vec<Address>. Contributors can fund with any accepted token, and the first contribution locks the asset for all remaining payment, distribution, and refund accounting.
Architectural Motivation & Technical Requirements
- In
contracts/invoice-escrow/src/types.rs:
- Add
accepted_tokens: Vec<Address> to EscrowData.
- In
contracts/invoice-escrow/src/lib.rs:
- In
create_escrow, accept accepted_tokens: Vec<Address>, ensuring it is non-empty and contains payment_token.
- In
fund_escrow, accept funding_token: Address, validating that funding_token is included in accepted_tokens.
- Lock
data.token = funding_token upon initial contribution.
- Subsequent funding and settlement calls strictly enforce
data.token.
- In
contracts/invoice-escrow/src/errors.rs:
- Add
TokenNotAccepted with unique discriminant.
- In
contracts/invoice-escrow/src/test.rs:
- Test creation with multi-token whitelist.
- Test funding with accepted token (succeeds) vs unaccepted token (fails).
- Test locked token consistency across multiple funding transactions.
Acceptance Criteria
Target Branch: dev
Estimated Effort: 13–24 hours | Delivery: 6–7 days
Difficulty: Hard
Context & Problem Statement
Enterprises dealing with international invoices frequently accept multiple stablecoins (e.g. USDC, EURC, USDS) for settlement. Currently, each escrow is strictly locked to a single payment asset at creation time.
This issue implements multi-token funding support where the seller specifies a list of
accepted_tokens: Vec<Address>. Contributors can fund with any accepted token, and the first contribution locks the asset for all remaining payment, distribution, and refund accounting.Architectural Motivation & Technical Requirements
contracts/invoice-escrow/src/types.rs:accepted_tokens: Vec<Address>toEscrowData.contracts/invoice-escrow/src/lib.rs:create_escrow, acceptaccepted_tokens: Vec<Address>, ensuring it is non-empty and containspayment_token.fund_escrow, acceptfunding_token: Address, validating thatfunding_tokenis included inaccepted_tokens.data.token = funding_tokenupon initial contribution.data.token.contracts/invoice-escrow/src/errors.rs:TokenNotAcceptedwith unique discriminant.contracts/invoice-escrow/src/test.rs:Acceptance Criteria
create_escrowvalidates non-emptyaccepted_tokens.fund_escrowlocks token asset on first contribution.cargo test -p invoice-escrowpasses.Target Branch:
devEstimated Effort: 13–24 hours | Delivery: 6–7 days
Difficulty: Hard