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);
from agentbank import AgentBankClient, Addresses
client = AgentBankClient(
rpc_url="https://rpc.mantle.xyz",
private_key="0x...",
addresses=Addresses(
vault="0xC44C061D257Af305dEAea2eD093E878a615d856d",
signal_board="0x2A46cF6493b377D45908254B0528e38990AA323f",
intent_router="0x9582d2dF303ec2B1fab104A77E249C05571fccC9",
tee_verifier="0x51E52dCBD0FBfaDaDB43ad1EB1Ea0d3A79f128c3",
),
)
# Deposit 500 USDY (in wei, 18 decimals)
tx_hash = client.deposit(amount_wei=500 * 10**18)
print("Deposit tx:", tx_hash.hex())
# Check shares
shares = client.get_shares(client.account.address)
print("Shares:", shares)
# Install the CLI
npm install -g @agentbank/skills
# Deposit 500 USDY
agentbank-cli vault deposit --amount 500 --confirm
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);
tx_hash = client.withdraw(amount_wei=200 * 10**18)
print("Withdraw tx:", tx_hash.hex())
agentbank-cli vault withdraw --amount 200 --confirm
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.