Skip to main content

Documentation Index

Fetch the complete documentation index at: https://0xcaptain.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

AgentBank vaults follow the ERC-4626 standard. You deposit an underlying asset (USDY) and receive vault shares. To exit, you either withdraw a specific asset amount (the vault burns the required shares) or redeem a specific number of shares for the equivalent assets. This page shows how to perform these operations using the TypeScript SDK, Python SDK, and Byreal Skills CLI.
Withdrawals are subject to a 24-hour cooldown after your deposit. You cannot withdraw within 24 hours of depositing.

Deposit

import { AgentBankClient } from "@agentbank/sdk";
import { createPublicClient, createWalletClient, http } from "viem";
import { mantle } from "viem/chains";
import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`);
const publicClient = createPublicClient({ chain: mantle, transport: http("https://rpc.mantle.xyz") });
const walletClient = createWalletClient({ chain: mantle, transport: http("https://rpc.mantle.xyz"), account });

const client = new AgentBankClient({
  publicClient,
  walletClient,
  addresses: {
    vault: "0xC44C061D257Af305dEAea2eD093E878a615d856d",
    signalBoard: "0x2A46cF6493b377D45908254B0528e38990AA323f",
    intentRouter: "0x9582d2dF303ec2B1fab104A77E249C05571fccC9",
    teeVerifier: "0x51E52dCBD0FBfaDaDB43ad1EB1Ea0d3A79f128c3",
  },
});

// Deposit 500 USDY
const txHash = await client.vault.deposit({ amount: "500" });
console.log("Deposit tx:", txHash);

// Check your shares
const shares = await client.vault.getShares(account.address);
console.log("ABV2 shares:", shares);

Withdraw by asset amount

Specify the exact amount of USDY you want to receive. The vault calculates and burns the corresponding shares.
// Withdraw 200 USDY worth of value
const txHash = await client.vault.withdraw({ amount: "200" });
console.log("Withdraw tx:", txHash);

Redeem by share amount

Specify the exact number of shares to burn and receive the proportional asset value.
// Redeem 100 shares
const txHash = await client.vault.redeem({ shares: "100" });
console.log("Redeem tx:", txHash);

Read vault stats

// Total value locked
const tvl = await client.vault.getTVL();
console.log("TVL:", tvl, "USDY");

// Estimated APY (simplified share price model)
const apy = await client.vault.getAPY();
console.log("Estimated APY:", apy, "%");

// Underlying asset address
const asset = await client.vault.getUnderlyingAsset();
console.log("Underlying asset:", asset);
Via CLI:
agentbank-cli vault stats -o json
Example output:
{
  "tvl": "4250000.00",
  "apy": "8.42",
  "totalOps": 1243,
  "totalBlocked": 87
}

Deposit into a specific tier

If you want to deposit into a specific risk tier rather than the default vault:
# List available tiers
agentbank-cli tier list

# Deposit 1000 USDY into the Balanced tier
agentbank-cli tier deposit --tier balanced --amount 1000 --confirm
See Vault Tiers for a full comparison of each tier’s parameters.