Description
Extend the escrow system to support multiple token contracts per shipment.
Different shipments can hold escrow in different SAC or custom token contracts.
Tasks
- Add
token_address: Address field to Shipment struct
- Add
token_address parameter to create_shipment() (required)
- Update escrow storage: key pattern
(Symbol("shipment_token"), shipment_id) → Address
- Update
deposit_escrow() to use per-shipment token address
- Update
release_escrow() and refund_escrow() to use per-shipment token
- Add
get_shipment_token(shipment_id) → Result<Address, NavinError> query
- Emit
token_address in: escrow_deposited, escrow_released, escrow_refunded events
Acceptance Criteria
- Different shipments hold escrow in different token contracts independently
- Token address stored immutably per shipment, used consistently in all escrow ops
- Escrow operations reject if token_address doesn't match shipment record
- Unit tests:
- Single shipment, single token
- Two shipments, two different tokens, verify independent balances
- Cross-token rejection (attempt wrong token on shipment)
get_shipment_token() returns correct address per shipment
PR Checklist
Description
Extend the escrow system to support multiple token contracts per shipment.
Different shipments can hold escrow in different SAC or custom token contracts.
Tasks
token_address: Addressfield toShipmentstructtoken_addressparameter tocreate_shipment()(required)(Symbol("shipment_token"), shipment_id) → Addressdeposit_escrow()to use per-shipment token addressrelease_escrow()andrefund_escrow()to use per-shipment tokenget_shipment_token(shipment_id) → Result<Address, NavinError>querytoken_addressin:escrow_deposited,escrow_released,escrow_refundedeventsAcceptance Criteria
get_shipment_token()returns correct address per shipmentPR Checklist
Shipmentstruct extended withtoken_address