Prerequisites
You need:- Tokens to deposit (e.g., USDC, MirrorTokens)
- The token addresses
- The vault addresses (look up via
BookManager.getVault(currency)) - The Controller and BookManager addresses
Step 1: Approve tokens for deposits
The Controller needs permission to transfer your tokens to deposit them into vaults.TypeScript (viem)
Solidity
Step 2: Deposit into vaults
Once approved, deposit your tokens into their respective vaults via the Controller.TypeScript (viem)
Solidity
Step 3: Approve vaults for trading
The BookManager needs permission to manage your vault shares during trading operations (locking, settling, etc.).Get vault addresses
First, retrieve the vault addresses:Approve vaults
Solidity
Step 4: Check your vault balance
You can check your vault balance at any time:Step 5: Withdraw from vaults
To withdraw tokens back to your wallet:TypeScript (viem)
Solidity
maxWithdraw(user). Cancel your open orders first to unlock collateral.
Summary
To start trading:- Approve Controller on tokens (for deposits)
- Deposit tokens into vaults via Controller
- Approve BookManager on vaults (for trading)
- You’re ready to place orders!
- Cancel all open orders (to unlock collateral)
- Withdraw funds via
Controller.withdrawFromVault
Troubleshooting
“Insufficient balance” when depositing:- Check your token balance with
token.balanceOf(user) - Ensure you’ve approved enough tokens
- Check
vault.maxWithdraw(user)—you may have locked collateral - Cancel orders to unlock funds
- Ensure you’ve approved the BookManager on the vault (not the token)
See also
- Vaults & deposits concept - detailed explanation
- Place & cancel orders - trading operations
- Controller reference - Controller API