Overview
The Chat Agent provides a conversational interface for users to interact with the MetaVault. It handles deposits, withdrawals, balance checks, and provides public vault information while maintaining strict security boundaries.Security Model
Allowed Operations
- Check user’s own balance and shares
- Get wallet LINK balance
- View public vault information (TVL, APY, prices)
- Prepare unsigned deposit/withdrawal transactions
- Check and approve token allowances
Restricted Operations
- Admin functions (rebalance, harvest, parameter updates)
- Strategy internals (leverage ratios, debt positions)
- Other users’ private data
- Risk calculations and liquidation data
Agent Tools
The Chat Agent has access to the following tools, which are invoked automatically based on user requests:User Account Tools
get_my_balance
Gets the current user’s vault share balance and withdrawable LINK amount.The user’s wallet address
Raw share balance (18 decimals)
Raw withdrawable LINK amount (18 decimals)
Human-readable share balance
Human-readable withdrawable LINK amount
get_link_balance
Returns the user’s LINK balance in their wallet.The user’s wallet address
Wallet address queried
Raw LINK balance (18 decimals)
Human-readable LINK balance
Token symbol (“LINK”)
Formatted message with balance
user_deposit
Prepares an unsigned LINK deposit transaction for the user to sign.Amount of LINK to deposit (human-readable format)
Always true if transaction is prepared successfully
Unsigned transaction object
User-friendly message about the transaction
user_withdraw
Prepares an unsigned withdrawal transaction for the user to sign.Number of shares to withdraw (human-readable format)
Always true if transaction is prepared successfully
Unsigned transaction object (same structure as deposit)
User-friendly message about the transaction
Approval Tools
check_allowance
Checks if user’s LINK token allowance is sufficient for a deposit.User’s wallet address
Desired deposit amount (human-readable)
Current allowance (raw 18 decimal format)
Whether allowance is sufficient
Required allowance (raw 18 decimal format)
Wallet address checked
approve_link
Prepares an unsigned approval transaction so the vault can spend LINK.Amount of LINK to approve (human-readable)
Unsigned approval transaction
User-friendly approval message
Public Information Tools
get_public_vault_info
Gets public vault information including total managed assets and total supply.Total managed assets (raw 18 decimals)
Total share supply (raw 18 decimals)
Human-readable total managed LINK
Human-readable total shares
get_token_prices
Fetches real-time LINK price from CoinGecko API.LINK price in USD (scaled by 1e18)
Human-readable LINK price
24-hour price change percentage
Data source (“CoinGecko API”)
get_vault_apy
Gets the current vault APY based on TVL growth.APY as a decimal (e.g., 0.12 = 12%)
Human-readable APY percentage
Status message
Current total value locked
Conversion Tools
convert_to_shares
Converts LINK amount to Vault Share Tokens (VST).Amount of LINK (human-readable format)
Equivalent number of shares
convert_to_assets
Converts Vault Share Tokens (VST) to LINK.Amount of shares/VST (human-readable format)
Equivalent amount of LINK
Deposit Flow
The Chat Agent automatically handles the two-step deposit process:Step 1: Check Allowance
When a user requests a deposit, the agent first checks if the vault has sufficient allowance to spend the user’s LINK tokens.Approval required
If allowance is insufficient, agent calls
approve_link("10") and returns approval transactionDeposit transaction
After approval is confirmed, agent calls
user_deposit("10") and returns deposit transactionExample Chat Interaction
Withdrawal Flow
Withdrawals are simpler and only require one transaction:Response Format
All Chat Agent responses follow a structured JSON format when tools are used:reply: Text response for the userunsignedTx: Transaction to sign (if applicable)needsApproval: Whether an approval is needed before proceedingstep: Current stage in the transaction flow
Error Handling
The Chat Agent returns user-friendly error messages:- Insufficient LINK balance
- Insufficient share balance for withdrawal
- Invalid wallet address
- Network errors (CoinGecko API failures)
- Contract call failures