Skip to main content
As a capital provider, you own your pairs on Solana. You set each pair’s fees, hold its inventory in vaults that only the program can move, and pay the protocol fee on every swap from a separate fee account. This recipe takes a stablecoin and RWA pair from opening to closing.

Before you start

  • Both tokens registered. The Multiliquid admin registers a token, with its price sources, before anyone can pair it. Contact the Multiliquid team to register one.
  • Issuer approval for permissioned tokens. The issuer must admit two addresses: your wallet, which owns the token accounts you fund from, and your vault authority, the PDA that owns your vaults. Step 1 derives it. Admitting one does not admit the other, and the issuer must also thaw both token accounts if it freezes new ones.
  • The fee token. Protocol fees are paid in the token that client.fetchGlobalConfig() returns as feeTokenMint.
  • SOL for network fees and rent. Your wallet pays for the pair, its vaults, and the records the program keeps.
  • The SDK client and a wallet, set up as in Swap on-chain. Here the wallet is the capital provider’s.
Every step below builds an unsigned transaction that your wallet signs and pays for. This helper signs, sends, and waits until each one is final:
send.ts

1. Get your vault authority admitted

Your vaults are token accounts owned by a PDA derived from your wallet. Derive it, and send both addresses to the issuer of each permissioned token:
The program cannot grant issuer approval or thaw an account. Until the issuer acts, adding liquidity and swaps that touch the vault fail.

2. Open the pair

Pass the two mints in any order, and a fee for each direction in basis points:
The pair stores the mint with the lower address bytes as its quote mint, and the SDK sorts them for you. redemptionFeeBps applies to swaps from the quote mint to the base mint, and discountRateBps to swaps from base to quote. The quote mint is not always the stablecoin, so read accounts.quoteTokenMintAddress and set each fee for the direction you mean. Each fee is at most 9,900 basis points, and the two together must be less than 10,000. Opening the pair also creates a vault for each mint, if you have none yet, and your fee account. A pair opens unpaused.

3. Fund your fee account

Every swap debits its protocol fee from your fee account, in the fee token. Swaps on all your pairs fail while it cannot pay, so keep it funded:
Any wallet can fund it. Only you can take the balance back, by closing it.

4. Add inventory

Fund the vault each swap pays out of: the RWA vault for users who buy, and the stablecoin vault for users who sell.
One vault serves every pair you own with that mint.

5. Change fees or pause

update_pair sets both fees and the pause flag together, so pass all three:
New fees apply to the next swap. To pause every pair you own with a given stablecoin in one call, set your stablecoin setting instead:

6. Withdraw inventory

Withdraw any amount the vault holds:
Withdrawals work while a token or your stablecoin setting is paused, so you can always exit. Only a program-wide pause stops them.

7. Close the pair

Closing a pair reclaims its rent. When no other pair of yours uses a vault, the program also returns the vault’s balance to you and closes it:
After your last pair, close your fee account to recover its balance and rent, with swapProgramClient.getCloseLpFeeAccountInstructionAsync. Close it no earlier: swaps on any pair you still own fail without it.

When something goes wrong

Errors lists every program error.

Next steps

Pairs and liquidity

Every pair and liquidity instruction, including Treasury routing.

Ladder pricing

Change fees with rolling volume, from an off-chain worker.

Security

What you control, and what the admin controls.