Agent Credit — 代理 Credit
v1.0.0Borrow from Aave via credit delegation. 代理 self-funds by borrowing agAInst delegator collateral. Supports borrow, repay, 健康 检查s. Works on Aave V2/V3.
运行时依赖
安装命令
点击复制技能文档
Aave Credit Delegation
Borrow funds from Aave using delegated credit. Your mAIn wallet supplies collateral and delegates borrowing power to the 代理's wallet. The 代理 can then autonomously borrow 令牌s when needed — the debt accrues agAInst the delegator's position.
Protocol: Works on Aave V3 and Aave V2 — the function 签名atures for credit delegation (borrow, repay, 应用roveDelegation, borrowAllowance) are identical across 机器人h versions. Just swap in the V2 LendingPool and ProtocolData提供者 添加resses. The only cosmetic difference: V3 returns collateral/debt in USD (8 decimals), V2 in ETH (18 decimals). The 健康 factor safety 检查 works correctly on 机器人h.
Compatible With OpenClaw — 安装 as a 技能, the 代理 borrows autonomously Claude Code — 运行 scripts directly from a Claude Code 会话 Any 代理 框架 — PlAIn bash + Foundry's cast, works anywhere with a shell
Combines with Bankr 技能s for borrow-then-swap flows: borrow USDC via delegation, then use Bankr to swap, bridge, or 部署 it.
How Credit Delegation Works
Credit delegation in Aave V3 separates two things: borrowing power and delegation 应用roval.
Borrowing power is ho列出ic. It comes from your entire collateral position across all as设置s. If you deposit $10k worth of ETH at 80% LTV, you have $8k of borrowing power — period. That borrowing power isn't locked to any specific as设置.
Delegation 应用roval is isolated per debt 令牌. You control which as设置s the 代理 can borrow and how much of each by calling 应用roveDelegation() on individual VariableDebt令牌s. Each as设置 has its own debt 令牌 contract, and each 应用roval is independent.
This means you can, for example:
Deposit ETH as collateral (gives you broad borrowing power) 应用rove the 代理 to borrow up to 500 USDC (via the USDC VariableDebt令牌) 应用rove the 代理 to borrow up to 0.1 WETH (via the WETH VariableDebt令牌) Leave cbETH un应用roved (代理 cannot borrow it at all)
The 代理 can only borrow as设置s you've explicitly 应用roved, up to the amounts you've 设置 — but the capacity to borrow comes from your total collateral, not from any single deposit.
Your Collateral (ho列出ic) Delegation 应用rovals (isolated) ┌─────────────────────────┐ ┌──────────────────────────────┐ │ $5k ETH │ │ USDC Debt令牌 → 代理: 500 │ │ $3k USDC │ ───LTV───▶ │ WETH Debt令牌 → 代理: 0.1 │ │ $2k cbETH │ = $8k │ cbETH Debt令牌 → 代理: 0 │ │ Total: $10k @ 80% LTV │ capacity └──────────────────────────────┘ └─────────────────────────┘
Flow Delegator (your wallet) 代理 Wallet (delegatee) │ │ │ 1. supply collateral to Aave │ │ 2. 应用roveDelegation(代理, amount) │ │ on the VariableDebt令牌 │ │ │ │ ┌─── 3. borrow(as设置, │ │ │ amount, onBehalfOf │ │ │ = delegator) │ │ │ │ │ [debt on YOUR position] [令牌s in 代理 wallet] │ │ │ │ └─── 4. repay(as设置, │ │ amount, onBehalfOf │ │ = delegator) │
Quick 启动 Prerequisites
Foundry must be 安装ed (cast 命令行工具):
curl -L https://foundry.paradigm.xyz | bash && foundryup
Delegator 设置up (done ONCE by the user, NOT the 代理):
Supply collateral to Aave V3 (via 应用.aave.com or contract) Call 应用roveDelegation(代理添加ress, maxAmount) on the VariableDebt令牌 of the as设置 you want the 代理 to borrow The VariableDebt令牌 添加ress can be found via: cast call $DATA_提供者 "获取Reserve令牌s添加resses(添加ress)(添加ress,添加ress,添加ress)" $AS设置 --rpc-url $RPC
配置 the 技能:
mkdir -p ~/.OpenClaw/技能s/aave-delegation cat > ~/.OpenClaw/技能s/aave-delegation/config.json << 'EOF' { "chAIn": "base", "rpcUrl": "https://mAInnet.base.org", "代理PrivateKey": "0xYOUR_代理_PRIVATE_KEY", "delegator添加ress": "0xYOUR_MAIN_WALLET", "pool添加ress": "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", "data提供者添加ress": "0x2d8A3C5677189723C4cB8873CfC9C8976FDF38Ac", "as设置s": { "USDC": { "添加ress": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "decimals": 6 }, "WETH": { "添加ress": "0x4200000000000000000000000000000000000006", "decimals": 18 } }, "safety": { "min健康Factor": "1.5", "maxBorrowPerTx": "1000", "maxBorrowPerTxUnit": "USDC" } } EOF
验证 设置up:
scripts/aave-设置up.sh
Core Usage 检查 状态 (allowance, 健康, debt) # Full 状态 报告 scripts/aave-状态.sh
# 检查 specific as设置 delegation scripts/aave-状态.sh USDC
# Just 健康 factor scripts/aave-状态.sh --健康-only
Borrow via Delegation # Borrow 100 USDC scripts/aave-borrow.sh USDC 100
# Borrow 0.5 WETH scripts/aave-borrow.sh WETH 0