aave ยท diff
v1.0.1 to v1.0.1
46 added, 77 removed. Audit A to A.
---
name: aave
version: 1.0.1
description: Supply and withdraw tokens on Aave V3 lending pools
delivery: script
- tools:
- - aave_supply
- - aave_withdraw
- - aave_positions
metadata:
starchild:
emoji: "๐ฆ"
skillKey: aave
requires:
env: [WALLET_SERVICE_URL]
user-invocable: true
disable-model-invocation: false
---
# Aave V3 Yield Farming
Supply tokens into Aave V3 lending pools to earn yield, withdraw at any time, and view positions across multiple chains.
- **Supported Networks:** Ethereum, Arbitrum, Base, Optimism, Polygon, Avalanche.
+ Supported Networks: Ethereum, Arbitrum, Base, Optimism, Polygon, Avalanche.
- **IMPORTANT:** All tools require a `chain` parameter. Always ask the user which network they want to use before proceeding. Do not assume a default chain.
+ ## Runtime Mode
- ## Prerequisites โ Wallet Policy
+ This skill is script-only. It does not register `aave_*` tools.
- Before executing supply or withdraw transactions, the wallet policy must be active. Load the **wallet-policy** skill and propose the standard wildcard policy (deny key export + allow `*`). This covers all Aave operations โ token approvals, supply, and withdraw โ across all chains.
+ Call via Python exports:
+ - `aave_positions(chain)`
+ - `aave_supply(chain, token, amount)`
+ - `aave_withdraw(chain, token, amount=0, max=False)`
- ## Available Tools (3)
+ Imports:
+ `from skills.aave.exports import aave_positions, aave_supply, aave_withdraw`
- | Tool | Type | Description |
- |------|------|-------------|
- | `aave_supply` | Write | Approve + supply tokens to Aave V3 pool. Earns yield immediately. |
- | `aave_withdraw` | Write | Withdraw tokens from Aave V3 pool (includes earned interest). |
- | `aave_positions` | Read-only | View account data: collateral, debt, health factor, LTV. |
+ Wallet dependency is runtime-only via `core.wallet_runtime`.
+ ## Prerequisites
+
+ Before supply/withdraw, wallet policy must allow the transaction path.
+
## Supported Tokens by Chain
| Chain | USDC | USDT | DAI | WETH | WBTC |
|-------|------|------|-----|------|------|
| Ethereum | yes | yes | yes | yes | yes |
| Arbitrum | yes | yes | yes | yes | yes |
| Polygon | yes | yes | yes | yes | yes |
| Optimism | yes | yes | yes | yes | yes |
| Avalanche | yes | yes | yes | yes | yes |
| Base | yes | โ | yes | yes | โ |
- ## Decision Tree
-
- ```
- User wants to earn yield on tokens?
- โ Use aave_supply
-
- User wants to check current positions?
- โ Use aave_positions
-
- User wants to withdraw (partial or full)?
- โ Use aave_withdraw (set max=true for full withdrawal)
- ```
-
- ## Tool Usage Examples
+ ## Script Examples
- ### Supply 100 USDC on Arbitrum
+ Read positions:
- ```
- aave_supply(chain="arbitrum", token="USDC", amount="100")
- ```
+ ```python
+ import asyncio
+ from skills.aave.exports import aave_positions
- ### Withdraw 50 USDC from Arbitrum
+ async def main():
+ result = await aave_positions(chain="arbitrum")
+ print(result)
- ```
- aave_withdraw(chain="arbitrum", token="USDC", amount="50")
+ asyncio.run(main())
```
- ### Withdraw all WETH from Ethereum
+ Supply 100 USDC:
- ```
- aave_withdraw(chain="ethereum", token="WETH", max=true)
- ```
+ ```python
+ import asyncio
+ from skills.aave.exports import aave_supply
- ### Check positions on Arbitrum
+ async def main():
+ result = await aave_supply(chain="arbitrum", token="USDC", amount=100)
+ print(result)
- ```
- aave_positions(chain="arbitrum")
+ asyncio.run(main())
```
- ## Common Workflows
-
- **Step 0 for all workflows:** If the wallet policy is not yet active, load the wallet-policy skill and propose the standard wildcard policy before proceeding.
-
- ### Earn yield on stablecoins
-
- 1. **Check balance:** `wallet_balance` to verify token holdings
- 2. **Supply:** `aave_supply(chain="arbitrum", token="USDC", amount="100")`
- 3. **Verify:** `aave_positions(chain="arbitrum")` โ should show collateral
-
- ### Check and withdraw
-
- 1. **View positions:** `aave_positions(chain="arbitrum")`
- 2. **Withdraw partial:** `aave_withdraw(chain="arbitrum", token="USDC", amount="50")`
- 3. **Or withdraw all:** `aave_withdraw(chain="arbitrum", token="USDC", max=true)`
+ Withdraw partial / all:
- ## Amount Formatting
+ ```python
+ import asyncio
+ from skills.aave.exports import aave_withdraw
- Amounts are in **human-readable units** (not wei):
- - `"100"` = 100 USDC
- - `"0.5"` = 0.5 WETH
- - `"1.5"` = 1.5 WBTC
+ async def main():
+ part = await aave_withdraw(chain="arbitrum", token="USDC", amount=50)
+ print(part)
+ full = await aave_withdraw(chain="arbitrum", token="USDC", max=True)
+ print(full)
- The tool handles decimal conversion internally based on the token's decimals.
+ asyncio.run(main())
+ ```
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| `Unknown chain` | Invalid chain name | Use: ethereum, arbitrum, base, optimism, polygon, avalanche |
- | `Unknown token` | Token not available on that chain | Check supported tokens table above |
- | `Insufficient balance` | Not enough tokens in wallet | Check balance with `wallet_balance` first |
+ | `Unknown token` | Token not available on that chain | Check supported tokens table |
+ | `Insufficient balance` | Not enough tokens in wallet | Check wallet balance before supply |
| `Amount must be positive` | Zero or negative amount | Use a positive number |
- | `Policy violation` | Wallet policy blocks the transaction | Load wallet-policy skill and propose wildcard policy |
- | `Not running on a Fly Machine` | Local dev environment | Supply/withdraw require deployed environment with wallet |
-
- ## Positions Output Explained
-
- `aave_positions` returns:
- - **total_collateral_usd** โ Total value of supplied assets (USD)
- - **total_debt_usd** โ Total borrowed amount (USD). Will be 0 if you only supply.
- - **available_borrows_usd** โ How much more you could borrow (USD)
- - **health_factor** โ Ratio of collateral to debt. Higher = safer. "infinite" if no debt.
- - **ltv** โ Loan-to-value ratio (percentage)
- - **current_liquidation_threshold** โ Collateral ratio at which liquidation occurs (percentage)
+ | `Policy violation` | Wallet policy blocks transaction | Update wallet policy |
+ | `Not running on a Fly Machine` | Local dev environment | Supply/withdraw require deployed env with wallet |