Individual Contract Integration Guide

This guide explains how to interact with the yoVaults smart contracts (yoETH, yoUSD, yoBTC, yoEUR, yoGOLD). These contracts implement the ERC-4626arrow-up-right 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 outcomes

  • Execute 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) and on Ethereum mainnet (chain ID 1).

NOTE: yoGOLD is only available on Ethereum.


⚙️ Setup

Install Ethers

npm install ethers

Connect to an RPC & 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"); // or use any RPC for Ethereum chain
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
file-download
42KB

🔍 Simulate with preview* and convertTo Functions

These 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)

Returns the maximum amount of assets that can currently be withdrawn by the given address.

convertToAssets(shares)

Estimate how many yoTokens you get for a given asset amount (excludes fees):

Quoting before building a transaction

previewDeposit(assets)

Estimate how many yoTokens you get for a given asset amount net of deposit fees:

previewRedeem(shares)

Estimate how many assets you'd get back when redeeming yoTokens net of withdrawal fees:


✍️ Execute Transactions

deposit(assets, receiver)

Deposit a specific amount of assets and receive yoTokens in return:


redeem(yoTokens, receiver, owner)

Burn yoTokens and receive assets in return. You cannot request an exact asset amount. See our Notes below.


Recap: Share-to-Asset Logic

You Want To...
Use This Function
Simulation Tool

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)).

    • WETH / yoETH decimals: 18

    • cbBTC / yoBTC decimals: 8

    • USDC / yoUSD decimals: 6

    • USDT / yoUSDT decimals: 6

    • EURC / yoEUR: 6

    • XAUT / yoGOLD: 6

  • Only redeem is 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 automatically to the receiver specified in the requestRedeem transaction.

  • All the yoVaults follow the same ABI and differ only by address.

Last updated