MultiliquidSwap coordinates settlement conversions at execution time.
The feature has two complementary operations:
- Prefund runs before a user-requested stablecoin-output swap. It redeems the capital provider’s Multiliquid Treasury token (
$TSY) into the stablecoin required for settlement. - Sweep runs after an eligible stablecoin-input swap. It deposits the stablecoin balance received by the capital provider vault during that swap into Multiliquid Treasury.
MultiliquidSwap derives any capital provider prefund or sweep leg from current execution state using the capital provider vault’s separate permissions.
How It Works
Prefund
Prefund is explicit in the user-requested route. It is not a separate route submitted by the capital provider:- The user-facing integrator selects route
8,9,10, or11, and the execution operator submits it for the user. MultiliquidSwapquotes that user-requested leg at execution time.- The contract derives a stablecoin-to-stablecoin exact-out leg owned by the capital provider from Multiliquid Treasury into the stablecoin needed by the user-requested leg.
- The capital provider vault is the user and receiver of the derived leg;
MultiliquidSwapis its operator. - The derived capital provider prefund and user-requested leg settle atomically.
$TSY balance, Multiliquid Treasury credits, token approval, protocol allowance, and Treasury Delegate settlement capacity.
Sweep
Sweep is automatic on eligible user-requested routes once the capital provider vault has opted in for the user’s input asset:- Before the user-requested leg, the contract reads the capital provider vault’s input-stablecoin balance.
- The user-requested leg settles into the capital provider vault.
- The contract reads the balance again and uses only the positive delta as the sweep input.
- A zero standing protocol allowance from the capital provider vault skips the sweep.
- A positive allowance causes the contract to derive an exact-in deposit owned by the capital provider into Multiliquid Treasury.
$TSY output is quoted internally at execution time, and the derived capital provider leg settles atomically with the user-requested swap.
Multiliquid Treasury deposits create $TSY tokens and Treasury Delegate credits for the capital provider vault. The Multiliquid Treasury application page describes token and credit accounting.
Route Behavior
This table starts with the route requested and authorized by the user. The last two columns show whetherMultiliquidSwap can add a separate Multiliquid Treasury leg owned by the capital provider.
“Eligible” does not mean the user controls the capital provider sweep. A sweep executes only when the capital provider has configured Multiliquid Treasury and the capital provider vault has granted a sufficient standing allowance for the user-requested input asset. Prefund may be skipped when the derived conversion would be an identity operation.
The contract reads Auto-Sweep configuration from the user-requested leg’s
stablecoinDelegateID. For stablecoin-to-stablecoin routes, the integrator’s input-side or output-side delegate selection therefore determines which capital provider domain, configuration, and custody account apply. The capital provider provides integration partners with the stablecoin delegate ID that identifies the capital provider domain.
Who Controls Each Part
Multiliquid Treasury Auto-Sweep is controlled at three levels:
This separation supports several operating modes:
Standing allowances can be bounded and replenished as they are spent, or set to
type(uint256).max. A maximum allowance is treated as unlimited and is not decremented by successful swaps.
Capital Provider Enablement Steps
This section assumes the capital provider stablecoin delegate is initialized, its custody address is configured, and it accepts Multiliquid Treasury. The examples assume an initializedml client from the EVM Integration Guide. Narrative references use capital provider terminology; ml.issuerAdmin remains the exact SDK module name for the delegate’s on-chain admin interface.
1
Capital provider admin: Select Multiliquid Treasury
The capital provider admin sets
TSY_YIELD as the autoLiquidityStablecoinID for the
existing capital provider stablecoin delegate.2
Capital provider vault: Approve the Treasury Delegate
The capital provider vault approves the Treasury Delegate to pull USDC for Multiliquid Treasury
sweeps. Approval for
$TSY is required only when the capital provider also uses prefunded
JIT redemption.3
Capital provider vault: Grant standing protocol allowances
The capital provider vault authorizes
MultiliquidSwap to spend USDC for derived Liquid
Treasury sweeps. A separate $TSY allowance enables optional prefund.4
Capital provider + operator: Verify enablement
The capital provider operations team confirms the configured Multiliquid Treasury ID and
previews an eligible sweep. The execution operator simulates the final
user-requested transaction.
Configuration Values
lpStablecoinID when the capital provider domain is not the Uniform Labs USDC registration.
1. Capital Provider Admin: Select Multiliquid Treasury
The capital provider admin sets Multiliquid Treasury as the destination for the existing capital provider stablecoin delegate:MultiliquidSwap. The transaction emits AutoLiquidityStablecoinIDSet.
The setting applies only to user-requested routes whose stablecoinDelegateID selects this capital provider domain.
2. Capital Provider Vault: Approve the Treasury Delegate
ERC-20 approval authorizes the Treasury Delegate to pull tokens from the capital provider vault during settlement. The wallet client below must sign as the capital provider vault. USDC approval enables the Multiliquid Treasury sweep:$TSY approval:
3. Capital Provider Vault: Grant Standing Protocol Allowances
swapInputAllowance is separate from ERC-20 approval. It authorizes MultiliquidSwap to insert and operate a derived capital provider leg.
The capital provider creates an SDK client whose wallet signs as the capital provider vault:
0leaves Multiliquid Treasury sweep disabled for USDC; the user-requested leg can continue without the sweep.- A sufficient positive allowance enables USDC sweep into Multiliquid Treasury.
- A positive but insufficient allowance causes the complete user transaction to revert atomically.
type(uint256).max is treated as unlimited and is not decremented by successful swaps. A bounded allowance is decremented as it is spent and must include enough headroom for execution-time amounts.
4. Capital Provider + Operator: Verify Enablement
The capital provider operations team first confirms that the capital provider domain points to Multiliquid Treasury:MultiliquidSwap measures the capital provider vault balance delta around the user-requested leg.
The execution operator should simulate the final bounded transaction with the actual user, operator, receiver, and permit:
Change or Disable Auto-Sweep
Disable One Sweep Input
The capital provider vault sets that input asset’s standing protocol allowance to zero using thesetAutoLegAllowance helper. This disables Multiliquid Treasury sweep for that asset without affecting other sweep inputs or user-requested swaps.
Revoking the protocol allowance does not revoke the token’s ERC-20 approval. The capital provider vault revokes both controls if the Treasury Delegate should no longer be able to pull that asset from custody.
Stop Using Prefund but Keep Sweep
The capital provider cannot rewrite the user’s route during execution. The capital provider coordinates with user-facing integrators to use base route IDs2, 3, 6, or 7 instead of prefunded routes 8–11. This stops Multiliquid Treasury prefund requests while leaving Multiliquid Treasury sweep available on otherwise eligible stablecoin-input routes.
Disable All Automatic Legs
Re-Enable Multiliquid Treasury
The capital provider admin can restoreliquidTreasuryID after confirming the Treasury Delegate whitelist, per-asset terms, custody inventory, token approvals, and protocol allowances. The restored configuration applies immediately to subsequent user-requested swaps that select the capital provider delegate.
Monitoring
For capital provider reconciliation, every user-requested and derived capital provider leg emits its own unifiedSwap event:
- Derived Multiliquid Treasury prefund events use stablecoin-to-stablecoin exact-out route
7. - Derived Multiliquid Treasury sweep events use stablecoin-to-stablecoin exact-in route
6. - For derived capital provider events, the event’s user and receiver are the capital provider vault, and its operator is
MultiliquidSwap. - For the user-requested event, the user, receiver, operator, and requested route remain the user transaction’s values.
6 or 7 alone is not sufficient because users can also request those routes directly.
Multiliquid Treasury
Multiliquid Treasury token, credit, and yield mechanics
MultiliquidSwap
Automatic-leg execution mechanics