Overview
Stablecoin delegate contracts manage the integration between the Multiliquid Protocol and the counterparty to the swap, either stablecoin issuers (mint/burn) or organizations providing already existing liquidity (balance sheet). A stablecoin delegate contract focuses on one specific stablecoin and routes its operations through that lens. This means the delegate will handle any minting/burning or transfers, contain a custody address that holds RWAs and other stablecoin liquidity, as well as provide administrative functions for whitelisting, fee configuration, and pausability. Base Contract:src/v2/StablecoinDelegateBase.sol
Delegate Types
MintBurnStablecoinDelegate
For stablecoins with native mint/burn capability. Location:src/v2/MintBurnStablecoinDelegate.sol
Characteristics:
- Directly mints stablecoins during RWA → Stablecoin swaps
- Directly burns stablecoins during Stablecoin → RWA swaps
- Requires MINTER_ROLE on the stablecoin contract
- No custody management needed
BalanceSheetStablecoinDelegate
For existing stablecoin liquidity balances without mint/burn integration Location:src/v2/BalanceSheetStablecoinDelegate.sol
Characteristics:
- Transfers stablecoins from custody during RWA → Stablecoin swaps
- Receives stablecoins to custody during Stablecoin → RWA swaps
- Manages custody addresses for RWA tokens
- Requires pre-funded stablecoin reserves
Core Interface
All stablecoin delegates implementIStablecoinDelegateV2:
Key Functions
deployStablecoin
Called by MultiliquidSwap during RWA → Stablecoin swaps.DeployStablecoinParams):
vault: Address to receive protocol feevaultAmount: Protocol fee amountuser: Address receiving stablecoinsuserAmount: Stablecoin amount to userrwaAddress: RWA token addressrwaAmount: RWA amount being depositedmetadata: Optional metadata for the swap
- Validates RWA is whitelisted
- Receives RWA tokens from user to custody/issuer
- Mints or transfers stablecoins to user
- Transfers protocol fee to vault
- Returns success status
receiveStablecoin
Called by MultiliquidSwap during Stablecoin → RWA swaps.ReceiveStablecoinParams):
user: Address receiving RWA tokenstotalAmount: Total stablecoin amount (includes fees)vault: Address to receive protocol feevaultAmount: Protocol fee amountredemptionFeeAmt: Redemption fee charged by issuerrwaAddress: RWA token addressrwaAmount: RWA amount to transfer to usermetadata: Optional metadata for the swap
- Validates RWA is whitelisted
- Burns or receives stablecoins from user
- Transfers RWA tokens from custody to user
- Handles protocol and redemption fees
- Returns success status
exchangeRWAs
Called by MultiliquidSwap for RWA-to-RWA swaps (using this stablecoin for pricing).- Receives
rwaInAmountofrwaInAddressfrom user - Transfers
rwaOutAmountofrwaOutAddressto user - Collects protocol and redemption fees
- Returns success status
exchangeStablecoins
Called by MultiliquidSwap for stablecoin-to-stablecoin swaps.- Receives
stablecoinInAmountfrom user - Transfers or mints
stablecoinOutAmountto user - Collects acceptance and redemption fees
- Returns success status
Whitelist Management
whitelistRWA
Add or remove an RWA from this stablecoin’s whitelist.rwa: Address of the RWA tokenaccepted:trueto whitelist,falseto remove
whitelistStablecoin
Add or remove another stablecoin for cross-stablecoin swaps.stablecoin: Address of the other stablecoinaccepted:trueto whitelist,falseto remove
Fee Configuration
setRWADiscountRate
Set discount rate for a specific RWA.rate: Discount in WAD format (1e18 = 100%)- Example: 5% discount = 5e16
setRWARedemptionFee
Set redemption fee for a specific RWA.rate: Fee in WAD format (1e18 = 100%)- Example: 0.5% fee = 5e15
Custody Management
Both custody addresses must be set before swap operations can execute (enforced bycustodyAddressesSet modifier).
setRWACustodyAddress
Set the custody address for RWA tokens.setStablecoinCustodyAddress
Set the custody address for stablecoin reserves and fees.Access Control
DEFAULT_ADMIN_ROLE: Can upgrade delegate, manage all roles ISSUER_ADMIN_ROLE: Stablecoin issuer’s administrative role- Manage RWA and stablecoin whitelists
- Set discount rates and redemption fees
- Configure custody addresses
- Pause/unpause delegate
- Execute swaps
- Trigger minting/burning
- Can call
pauseMultiliquid()/unpauseMultiliquid()(separate from issuer admin pause)
Events
Next: RWA Delegate Contracts
Explore optional risk management contracts for Real World Asset tokens