Individual Contract Integration Guide
This guide explains how to interact with the yoVaults smart contracts (yoETH, yoUSD, yoBTC, yoEUR) on the Base blockchain. These contracts implement the ERC-4626 Tokenized Vault Standard, enabling users and integrators to deposit ERC-20 tokens ("assets") and receive yield-bearing yoTokens in return.
The guide outlines how to:
Connect to the vaults with Ethers.js
Use read functions (
previewDeposit,previewMint,previewRedeem) to estimate outcomesExecute deposit and redemption transactions
Understand how yoTokens ↔ assets conversion works
All vaults follow the same contract interface and live on Base chain (chain ID 8453).
⚙️ Setup
Install Ethers
npm install ethersConnect to Base & Instantiate the Contract
import { ethers } from "ethers";
import abi from "./yoAbi.json"; // Use the ABI attached below
const provider = new ethers.JsonRpcProvider("https://mainnet.base.org");
const signer = new ethers.Wallet(PRIVATE_KEY, provider);
const YO_VAULTS = {
yoETH: "0x3a43aec53490cb9fa922847385d82fe25d0e9de7",
yoUSD: "0x0000000f2eb9f69274678c76222b35eec7588a65",
yoBTC: "0xbcbc8cb4d1e8ed048a6276a5e94a3e952660bcbc",
};
const vault = new ethers.Contract(YO_VAULTS.yoETH, abi, signer); // Swap as needed🔍 Simulate with preview* and convertTo Functions
preview* and convertTo FunctionsThese functions estimate how many shares or assets you'll receive/spend before making a transaction or to price your position.
Pricing your positions:
maxWithdraw(owner)
maxWithdraw(owner)Returns the maximum amount of assets that can currently be withdrawn by the given address.
const maxAssets = await vault.maxWithdraw(await signer.getAddress());convertToAssets(shares)
convertToAssets(shares)Estimate how many yoTokens you get for a given asset amount (excludes fees):
const yoTokens = await vault.convertToShares(ethers.parseUnits("1.0", 18));Quoting before building a transaction
previewDeposit(assets)
previewDeposit(assets)Estimate how many yoTokens you get for a given asset amount net of deposit fees:
const yoTokens = await vault.previewDeposit(ethers.parseUnits("1.0", 18));previewRedeem(shares)
previewRedeem(shares)Estimate how many assets you'd get back when redeeming yoTokens net of withdrawal fees:
const assetsOut = await vault.previewRedeem(ethers.parseUnits("1.0", 18));✍️ Execute Transactions
deposit(assets, receiver)
deposit(assets, receiver)Deposit a specific amount of assets and receive yoTokens in return:
const tx = await vault.deposit(
ethers.parseUnits("1.0", 18), // Assets to deposit
await signer.getAddress() // Receiver of yoTokens
);
await tx.wait();redeem(yoTokens, receiver, owner)
redeem(yoTokens, receiver, owner)Burn yoTokens and receive assets in return. You cannot request an exact asset amount. See our Notes below.
const tx = await vault.redeem(
ethers.parseUnits("1.0", 18), // yoTokens to redeem
await signer.getAddress(), // Receiver of assets
await signer.getAddress() // Owner of shares
);
await tx.wait(); Recap: Share-to-Asset Logic
Deposit assets for yoTokens
deposit()
previewDeposit()
Mint exact amount of yoTokens
mint()
previewMint()
Redeem yoTokens for assets
redeem()
previewRedeem()
Notes
All values must be parsed using correct decimals (e.g.
ethers.parseUnits("1.0", 18)).ETH / yoETH decimals: 18
cbBTC / yoBTC decimals: 8
USDC / yoUSD decimals: 6
EURC / yoEUR: 6
Only
redeemis supported for withdrawals because depending on the withdrawal amount, the yoVault may not have enough available liquidity to fill the redeem order. In those cases, the withdrawal will remain pending for up to 24 hours. The protocol will fill the redeem order and send the assets directly to thereceiverspecified in therequestRedeemtransactionAll the yoVaults follow the same ABI and differ only by address.
Last updated