Overview
Stablecoin delegates connectMultiliquidSwap to a specific Liquidity Provider (LP). Each delegate defines how assets move, which collateral it accepts, where reserves are held, how LP fees are configured, and which administrative controls apply.
The selected stablecoinDelegateID gives every route a clear LP domain. That domain owns the settlement policy even when the route exchanges two RWAs or two stablecoins.
LP-Owned Configuration
LP admins manage accepted assets, fee schedules, custody, liquidity, and
delegate-level controls.
Atomic Settlement
Delegates move or mint assets only when called by the registered
MultiliquidSwap contract.Transparent Reserves
Hot custody and informational cold-storage addresses are directly readable
on-chain.
Composable Liquidity
Delegates can designate an auto-liquidity stablecoin for prefund and sweep
workflows.
src/prod/StablecoinDelegateBase.sol
Delegate Architecture
MultiliquidSwap calculates resolved amounts and calls one of four settlement methods. The delegate then performs the token-specific transfer, mint, or burn operations.
Production Delegate Families
All families inherit the same custody, LP-admin, whitelist, fee, blacklist, pause, and upgrade framework.
Settlement Interface
Each method is callable only by the role assigned to
MultiliquidSwap, is non-reentrant, and respects delegate pause and blacklist state.
User and Receiver
user is the source of the input asset and receiver is the destination for the output asset. Delegates validate both identities and send output directly to the requested receiver.
Protocol and LP Fees
protocolFeeAmt contains the protocol amounts resolved by MultiliquidSwap. lpFeeAmt contains the explicit LP fee for the route. The concrete delegate determines whether those amounts are transferred from custody, taken from input, or minted according to the stablecoin’s settlement model.
Balance-Sheet Settlement
BalanceSheetStablecoinDelegate uses pre-existing liquidity:
- RWA inputs move from the user to
balanceSheetCustodyAddress. - RWA outputs move from RWA custody to the receiver.
- Stablecoin inputs move into
stablecoinCustodyAddress. - Stablecoin outputs and applicable protocol fees move out of stablecoin custody.
- RWA and stablecoin custody accounts approve the delegate as ERC-20 spender.
Mint-and-Burn Settlement
MintBurnStablecoinDelegate represents integrations that expose controlled mint and burn authority:
- RWA → stablecoin routes mint stablecoin output to the receiver.
- Stablecoin → RWA routes burn the user’s delegated stablecoin.
- RWA → RWA routes can mint protocol and LP fees without moving the delegated stablecoin through the user’s wallet.
- Stablecoin → stablecoin routes mint or burn the delegated stablecoin and custody the counterparty stablecoin.
Treasury Yield Delegate
TreasuryDelegate combines stablecoin settlement with on-chain yield accounting.
Credits and Yield
credits[user]tracks released backing credits.- New deposits enter a 24-hour withheld-credit queue.
totalWithheldCredits[user]provides the aggregate pending amount.yieldMultiplier[user]converts released credits into effective redeemable value.lastAccrualDay[user]records the user’s synchronized rate day.
Daily Rates
Rate posters submit sequential gross APY values. The delegate subtracts the portfolio management fee and stores the resulting net APY and derived daily compounding rate.Interest Accrual
maxDays bounds posted-rate processing and maxRecords bounds withheld-credit merging. Both values must be nonzero. batchAccrueInterest synchronizes multiple users without explicit per-user limits.
Swap settlement synchronizes the relevant user’s Treasury state before final pricing. Read-only quoteSwap uses stored state without changing it.
LP Administration
LP admins are stored independently from OpenZeppelin role membership and can add or remove other LP admins.Asset Eligibility
Fee Configuration
LP admins configure WAD-scaled rates through the delegate:MultiliquidSwap. Rates must remain below 1e18.
Auto-Liquidity
MultiliquidSwap for eligible prefund and sweep legs. Passing bytes32(0) disables automatic liquidity for the delegate.
Custody
Delegate Controls
LP admins can:- Apply an additional delegate-level blacklist
- Pause and unpause LP settlement
- Withdraw stablecoin held directly by the delegate
- Update hot custody accounts
- Manage LP-admin membership
PAUSE_ROLE has a separate pauseMultiliquid and unpauseMultiliquid path for protocol operations.
Token Allowances
Stablecoin delegates execute ERC-20transferFrom calls and are the token spender for user and custody transfers.
Typical integrations configure:
- User allowance to the selected delegate for each input token
- RWA custody allowance to the delegate for RWA output inventory
- Stablecoin custody allowance to the delegate for stablecoin output and fee inventory
Access Control
Core Events
The base delegate emits events for:- RWA and stablecoin whitelist updates
- RWA discounts and redemption fees
- Stablecoin acceptance and redemption fees
- Auto-liquidity configuration
- Hot custody changes
- Cold-storage additions and removals
- Delegate blacklist changes
- LP-admin membership
- Pause, unpause, and upgrades
TreasuryDelegate additionally emits daily-rate, interest-accrual, credit, management-fee, and yield-multiplier events.
Next: RWA Delegate Contracts
Explore asset-specific stateful risk controls