Before you start
- An onboarded wallet, on the $TSY allowlist. Onboarding explains how to get there.
- USDC and ETH in that wallet, on Ethereum mainnet. The wallet pays network fees in ETH.
- The token addresses, from
GET /v1/swap/pairs?network=evm-mainnet, as Discovery describes. The USDC-to-$TSY pair lists one capital provider, the Treasury capital provider.
1. Quote
Fix the USDC to deposit asamountIn, in whole tokens with at most 6 decimal places, and pass the depositor’s wallet as user. 1,000 USDC is 1000.
Response
amountOut is 1000. The fees the depositor pays are already in the amounts, and here they are zero.
2. Build
Send the same deposit with theuser. Leave out receiver, so the $TSY goes to the depositor, the wallet that also holds the credits.
Response (quote omitted)
eligibility is ineligible and its action says what to do. Its swap reverts in simulation after the approval, so checks.simulation is reverted, and the swap’s gas and serialized are null: it cannot succeed as built. For an onboarded wallet, eligibility.status is eligible, reason is allowlisted, and there is no action; the simulation passes, and the swap carries its gas and serialized.
The depositor signs at most two transactions, in this order:
approval: lets the Treasury delegate take exactly the USDC this deposit needs. It isnullwhen the wallet has already approved enough.swap: the deposit itself. It mints the $TSY and records the credits.
checks:
A failed check never fails the build. Don’t ask a wallet that is
ineligible to sign: its approval would land and cost a network fee, and then its swap would fail.
3. Sign and submit
The wallet signs theapproval, when there is one, and the swap, without broadcasting either. Send both to POST /v1/submissions in one request, in signing order:
serialized as returned. Multiliquid broadcasts the approval and sends the swap once the approval is confirmed. Swap instantly covers what to do with a wallet that can only broadcast, such as a custody platform.
4. Track until final
Read the swap’s submission withGET /v1/submissions/{submissionId} until its state is finalized. Record the deposit as complete only then: a chain reorganization can return a confirmed swap to pending. Submissions lists every state.
Once the deposit is final:
- The wallet holds the $TSY. It can transfer it freely, but only the depositor can redeem it.
- The credits start earning 24 hours after the deposit. A deposit redeemed before then is redeemed at par, without yield.
- To redeem, quote $TSY for USDC with the depositor as
user, as Redeem shows.
Deposit an RWA
The Treasury capital provider also takes tokenized money market funds in kind.GET /v1/swap/pairs lists each RWA-to-$TSY pair, such as WTGXX to $TSY. The flow is the same: quote, build, sign, submit. The build’s approval approves the RWA instead of USDC, and an RWA deposit earns from its deposit day. Credits from an RWA deposit are redeemable for USDC like any other.
When something goes wrong
Swap instantly and Errors list every other code.