Manager (V3)

The Manager V3 contract is the core protocol contract for deposits and withdrawals in YieldFi v3.

Connecting to Manager V3

Using Wagmi

import { connectManagerV3, getContractAddresses, Chain } from "yieldfi-sdk";
import { ethers } from "ethers";
import { useAccount, useWalletClient } from "wagmi";
import ManagerV3ABI from "yieldfi-sdk/abis/v3/Manager.json";

function ManagerV3Example() {
  const { address } = useAccount();
  const { data: walletClient } = useWalletClient();

  const connectManager = async () => {
    if (!walletClient || !address) {
      throw new Error("Wallet not connected");
    }

    const provider = new ethers.BrowserProvider(walletClient);
    const signer = await provider.getSigner();

    const contracts = getContractAddresses(Chain.ETHEREUM);
    const managerV3 = connectManagerV3(
      contracts.manager,
      ManagerV3ABI,
      signer
    );

    return managerV3;
  };
}

Using Browser Provider

Common Operations

Deposit Assets

Deposit assets to a vault and receive vault shares.

Parameters:

  • vault - Vault contract address

  • asset - Asset token address to deposit

  • amount - Amount of asset to deposit

  • receiver - Address that will receive vault shares

  • minShares - Minimum shares to receive (slippage protection)

  • referralCode - Referral code (bytes32)

Request Redemption

Request redemption from a vault. Shares are locked (not burned) until processed.

Parameters:

  • vault - Vault contract address

  • shares - Amount of shares to redeem

  • owner - Owner of the shares

  • receiver - Address that will receive redemption assets

Cancel Redemption

Cancel a pending redemption request and unlock shares.

Process Redemption (Operator Only)

Process a redemption from the queue. Typically called by vault operators.

View Functions

Get Redemption Queue Length

Get Redemption Queue Entry

Get Standard Debt

Get total locked shares (standard debt) for a vault.

Get NAV

Get current Net Asset Value (NAV) for a vault.

Check Whitelisting

Get Vault Asset

Get the base asset address for a vault.

Type Safety

The SDK provides TypeScript types for type-safe contract interactions:

Complete Example

Using Wagmi

Using Browser Provider

Last updated