Notes
- Amounts are in the token’s smallest units (USDC has 6 decimals).
1=0.000001USDC.- Use the correct vault address for your asset.
- You need a bit of ETH on Base for gas and some USDC for the deposit.
- Full source code is available in our public GitHub repository: CompassLabs/api_usecases – deposit_on_morpho.
Prerequisites
Implementation
Set a USDC allowance and deposit into a Morpho vault.Full Code
Troubleshooting (quick)
- Revert or underflow: Check amount units and token decimals.
- Allowance errors: Ensure the vault address matches the USDC vault.
- Insufficient funds: Top up ETH on Base for gas.
- Wrong network: Confirm your RPC URL is Base mainnet.