Skip to main content
Scaffold this example locally and test it with the CLI:

circuit.toml

circuit.toml

Example

Sample Output

How It Works

  1. Check holdings: Reads agent.allocation and finds USDC in balances
  2. Approve (once): On first run, approves Aave V3 Pool to spend USDC with max uint256 and stores a flag in memory. The server automatically waits for onchain confirmation before returning. Subsequent runs skip this step.
  3. Supply: Deposits USDC into Aave V3 using the Pool’s supply function
  4. Unwind: Withdraws all USDC from Aave V3 using withdraw with max uint256

Notes

  • This agent uses signAndSend to build custom transactions with ABI-encoded calldata. See Custom Transactions and Signing for details.
  • TypeScript uses viem for ABI encoding - add it with bun add viem.
  • Python uses eth-abi - add it with uv add eth-abi.
  • Aave V3 Pool address and USDC address shown are for Base. Adjust for other networks.
  • The approve + supply pattern is standard for any ERC-20 DeFi deposit. The server automatically confirms each transaction before returning, so the approval is guaranteed to be confirmed before the subsequent supply call.