Treasury is the $TSY ERC-20 token. TreasuryDelegate is the stablecoin delegate that mints and burns $TSY through MultiliquidSwap, and records each depositor’s credits and yield. For what Multiliquid Treasury is and who it serves, see Multiliquid Treasury.
How deposits and withdrawals map to swaps
Every deposit and withdrawal is aMultiliquidSwap leg settled by TreasuryDelegate, with the $TSY registration’s ID as stablecoinDelegateID.
- Credits stay with the user. A deposit records credits for
userand mints $TSY toreceiver, which can be another wallet. Transferring $TSY does not move credits. - A withdrawal needs both. It burns $TSY from the user and spends the same amount of the user’s credits. It reverts with
InsufficientCredits(requested, available)if the user’s credits are short. - The receiver must be whitelisted. Deposits mint through
Treasury.mint, which only mints to whitelisted addresses. - The delegate’s whitelists apply. A deposited stablecoin must be on the delegate’s stablecoin whitelist, and an RWA on its RWA whitelist.
Treasury token
Functions
- Transfers are open. Any holder can transfer $TSY. The whitelist applies only to
mint. - The blacklist applies everywhere. A blacklisted address cannot send, receive, mint, or burn.
- Pausing stops every transfer, mint, and burn, except
forceBurnandforceTransfer, which also bypass the blacklist.
Roles
TreasuryDelegate needs MINTER_ROLE to mint deposits.
Bridges
Any contract withBRIDGE_ROLE can bridge $TSY by burning it on one chain and calling bridgeMint on another. TreasuryOFTAdapter does this over LayerZero’s OFT standard: it burns with burnFrom, which needs the holder’s approval of the adapter, and mints with bridgeMint, sending a zero-address recipient’s tokens to 0xdead. Bridging moves $TSY, never credits.
Events and errors
TreasuryDelegate
TreasuryDelegate is a stablecoin delegate for $TSY, with every base function, plus yield accounting.
Credits and yield
A user’s main credits are worth
credits × yieldMultiplier / 1e18. Each deposit adds one withheld record of the minted amount:
- Merging. Records merge oldest first, and only once the user’s main credits have earned every posted rate. Each record’s yield since its earning start is added as it merges, and the multiplier becomes the value-weighted blend.
- Withdrawing. A withdrawal spends withheld credits first, newest first, at face value, and then main credits at the multiplier. A deposit withdrawn before it merges earns nothing.
- Fees. The protocol and capital provider fees on a deposit or withdrawal are minted as new $TSY, with their own withheld credits, to the protocol fee vault and to stablecoin custody.
Daily rates
A rate poster publishes one gross APY per finished UTC day, numberedblock.timestamp / 86400.
- In order.
postDailyRate(dayNumber, grossRate)accepts onlylastRatePostingDay() + 1, and only after that day has ended. - Net of the management fee. The delegate stores
grossRate − managementFee()indailyRates(day)and compounds daily at(1 + net)^(1/365) − 1. - Bounded. A gross rate cannot exceed 100%, or
maxDailyRate()when it is set, and cannot be below the management fee. - Accrual stops at a gap. Credits earn up to yesterday, and stop at the first day with no posted rate until the poster fills it.
- Corrections.
correctDailyRate(dayNumber, grossRate)rewrites a posted day betweenfirstRateDay()andlastRatePostingDay(). Users whose credits already earned that day keep their multiplier, unlesssetUserYieldMultiplierrepairs it.
maxFallbackRateSeconds(). While that window is zero, its initial value, there is no partial yield. A withdrawal to an RWA earns whole posted days only.
Accrual
Accrual is permissionless.MultiliquidSwap accrues the user before every $TSY leg, and anyone can accrue a user directly:
Use the bounded form to catch up a user who has not accrued for a long time within your gas limit. Both functions revert while the delegate is paused.
Reads
Administration
TreasuryDelegate defines its own OPERATOR_ROLE and RATE_POSTER_ROLE, separate from the token’s. initialize posts the first rate for the deployment day and can grant RATE_POSTER_ROLE.
Events and errors
The base delegate’s errors also apply, as Stablecoin delegates lists.