Requirements
- Target platform
- OpenClaw
- Install method
- Manual import
- Extraction
- Extract archive
- Prerequisites
- OpenClaw
- Primary doc
- SKILL.md
Borrow from Aave via credit delegation. Agent self-funds by borrowing against delegator collateral. Supports borrow, repay, health checks. Works on Aave V2/V3.
Borrow from Aave via credit delegation. Agent self-funds by borrowing against delegator collateral. Supports borrow, repay, health checks. Works on Aave V2/V3.
Hand the extracted package to your coding agent with a concrete install brief instead of figuring it out manually.
I downloaded a skill package from Yavira. Read SKILL.md from the extracted folder and install it by following the included instructions. Then review README.md for any prerequisites, environment setup, or post-install checks. Tell me what you changed and call out any manual steps you could not complete.
I downloaded an updated skill package from Yavira. Read SKILL.md from the extracted folder, compare it with my current installation, and upgrade it while preserving any custom configuration unless the package docs explicitly say otherwise. Then review README.md for any prerequisites, environment setup, or post-install checks. Summarize what changed and any follow-up checks I should run.
Borrow funds from Aave using delegated credit. Your main wallet supplies collateral and delegates borrowing power to the agent's wallet. The agent can then autonomously borrow tokens when needed β the debt accrues against the delegator's position. Protocol: Works on Aave V3 and Aave V2 β the function signatures for credit delegation (borrow, repay, approveDelegation, borrowAllowance) are identical across both versions. Just swap in the V2 LendingPool and ProtocolDataProvider addresses. The only cosmetic difference: V3 returns collateral/debt in USD (8 decimals), V2 in ETH (18 decimals). The health factor safety check works correctly on both.
OpenClaw β Install as a skill, the agent borrows autonomously Claude Code β Run scripts directly from a Claude Code session Any agent framework β Plain bash + Foundry's cast, works anywhere with a shell Combines with Bankr skills for borrow-then-swap flows: borrow USDC via delegation, then use Bankr to swap, bridge, or deploy it.
Credit delegation in Aave V3 separates two things: borrowing power and delegation approval. Borrowing power is holistic. It comes from your entire collateral position across all assets. 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 asset. Delegation approval is isolated per debt token. You control which assets the agent can borrow and how much of each by calling approveDelegation() on individual VariableDebtTokens. Each asset has its own debt token contract, and each approval is independent. This means you can, for example: Deposit ETH as collateral (gives you broad borrowing power) Approve the agent to borrow up to 500 USDC (via the USDC VariableDebtToken) Approve the agent to borrow up to 0.1 WETH (via the WETH VariableDebtToken) Leave cbETH unapproved (agent cannot borrow it at all) The agent can only borrow assets you've explicitly approved, up to the amounts you've set β but the capacity to borrow comes from your total collateral, not from any single deposit. Your Collateral (holistic) Delegation Approvals (isolated) βββββββββββββββββββββββββββ ββββββββββββββββββββββββββββββββ β $5k ETH β β USDC DebtToken β agent: 500 β β $3k USDC β βββLTVββββΆ β WETH DebtToken β agent: 0.1 β β $2k cbETH β = $8k β cbETH DebtToken β agent: 0 β β Total: $10k @ 80% LTV β capacity ββββββββββββββββββββββββββββββββ βββββββββββββββββββββββββββ
Delegator (your wallet) Agent Wallet (delegatee) β β β 1. supply collateral to Aave β β 2. approveDelegation(agent, amount) β β on the VariableDebtToken β β β β ββββ 3. borrow(asset, β β β amount, onBehalfOf β β β = delegator) β β β β β [debt on YOUR position] [tokens in agent wallet] β β β β ββββ 4. repay(asset, β β amount, onBehalfOf β β = delegator) β
Foundry must be installed (cast CLI): curl -L https://foundry.paradigm.xyz | bash && foundryup Delegator setup (done ONCE by the user, NOT the agent): Supply collateral to Aave V3 (via app.aave.com or contract) Call approveDelegation(agentAddress, maxAmount) on the VariableDebtToken of the asset you want the agent to borrow The VariableDebtToken address can be found via: cast call $DATA_PROVIDER "getReserveTokensAddresses(address)(address,address,address)" $ASSET --rpc-url $RPC Configure the skill: mkdir -p ~/.openclaw/skills/aave-delegation cat > ~/.openclaw/skills/aave-delegation/config.json << 'EOF' { "chain": "base", "rpcUrl": "https://mainnet.base.org", "agentPrivateKey": "0xYOUR_AGENT_PRIVATE_KEY", "delegatorAddress": "0xYOUR_MAIN_WALLET", "poolAddress": "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5", "dataProviderAddress": "0x2d8A3C5677189723C4cB8873CfC9C8976FDF38Ac", "assets": { "USDC": { "address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "decimals": 6 }, "WETH": { "address": "0x4200000000000000000000000000000000000006", "decimals": 18 } }, "safety": { "minHealthFactor": "1.5", "maxBorrowPerTx": "1000", "maxBorrowPerTxUnit": "USDC" } } EOF Verify setup: scripts/aave-setup.sh
# Full status report scripts/aave-status.sh # Check specific asset delegation scripts/aave-status.sh USDC # Just health factor scripts/aave-status.sh --health-only
# Borrow 100 USDC scripts/aave-borrow.sh USDC 100 # Borrow 0.5 WETH scripts/aave-borrow.sh WETH 0.5 The borrow script automatically: Checks delegation allowance (sufficient?) Checks delegator health factor (safe to borrow?) Executes the borrow Reports the result
# Repay 100 USDC scripts/aave-repay.sh USDC 100 # Repay all USDC debt scripts/aave-repay.sh USDC max The repay script automatically: Approves the Pool to spend the token (if needed) Executes the repay Reports remaining debt
Every borrow operation runs these checks BEFORE executing: Delegation allowance β Is the remaining allowance >= requested amount? Health factor β Is the delegator's health factor > minHealthFactor (default 1.5) AFTER this borrow? Per-tx cap β Is the amount <= maxBorrowPerTx? Confirmation β Logs the full operation details before sending If ANY check fails, the borrow is aborted with a clear error message. β οΈ The agent must NEVER bypass safety checks. If the user asks the agent to borrow and the health factor is too low, the agent should refuse and explain why.
Check delegation allowance β How much can the agent still borrow? Check health factor β Is the delegator's position safe? Check outstanding debt β How much does the delegator owe on each asset? Check available liquidity β Is there enough in the Aave pool to borrow? Resolve debt token addresses β Look up VariableDebtToken for any asset
Borrow β Draw funds from Aave against delegated credit Repay β Return borrowed funds to reduce delegator's debt Approve β Approve Pool to spend tokens for repayment
ChainPool AddressGas CostBase0xA238Dd80C259a72e81d7e4664a9801593F98d1c5Very LowEthereum0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2HighPolygon0x794a61358D6845594F94dc1DB02A252b5b4814aDVery LowArbitrum0x794a61358D6845594F94dc1DB02A252b5b4814aDLow See deployments.md for full address list including debt tokens.
# Check if we have enough gas BALANCE=$(cast balance $AGENT_ADDRESS --rpc-url $RPC) if [ "$BALANCE" -lt "1000000000000000" ]; then # < 0.001 ETH # Borrow a small amount of WETH for gas aave-borrow.sh WETH 0.005 fi
# Borrow USDC from delegated credit aave-borrow.sh USDC 100 # Swap to ETH using Bankr bankr.sh "Swap 100 USDC for ETH on Base"
# Agent borrows USDC weekly and swaps to ETH aave-borrow.sh USDC 100 bankr.sh "Swap 100 USDC for ETH on Base"
# Always check health first aave-status.sh # Only borrow if healthy aave-borrow.sh USDC 500
FieldRequiredDescriptionchainYesChain name (base, ethereum, polygon, arbitrum)rpcUrlYesJSON-RPC endpoint URLagentPrivateKeyYesAgent wallet private key (0x-prefixed)delegatorAddressYesUser's main wallet that delegated creditpoolAddressYesAave V3 Pool contract addressdataProviderAddressYesAave V3 PoolDataProvider addressassetsYesMap of symbol β {address, decimals}safety.minHealthFactorNoMin HF after borrow (default: 1.5)safety.maxBorrowPerTxNoMax borrow per transaction (default: 1000)safety.maxBorrowPerTxUnitNoUnit for maxBorrowPerTx (default: USDC)
VariableOverridesAAVE_RPC_URLrpcUrlAAVE_AGENT_PRIVATE_KEYagentPrivateKeyAAVE_DELEGATOR_ADDRESSdelegatorAddressAAVE_POOL_ADDRESSpoolAddressAAVE_MIN_HEALTH_FACTORsafety.minHealthFactor
ErrorCauseFixINSUFFICIENT_ALLOWANCEDelegation amount exceededDelegator must call approveDelegation() againHEALTH_FACTOR_TOO_LOWBorrow would risk liquidationReduce amount or add collateralAMOUNT_EXCEEDS_CAPPer-tx safety cap hitReduce amount or update configINSUFFICIENT_LIQUIDITYNot enough in Aave poolTry smaller amount or different assetINSUFFICIENT_GASAgent wallet has no native tokenSend gas to agent walletEMODE_MISMATCHAsset incompatible with delegator's eModeBorrow an asset in the same eMode category
See safety.md for the full threat model and emergency procedures. Critical rules: The delegator's private key must NEVER be in this repo, config, or scripts β this is the agent's workspace. The delegator manages their side via the Aave UI or a block explorer. Never commit config.json to version control β it contains the agent's private key Never set minHealthFactor below 1.2 β liquidation happens at 1.0 Always cap delegation amounts β never approve type(uint256).max Monitor delegator health β set up alerts if HF drops below 2.0 Agent must refuse to borrow if safety checks fail, even if instructed to
Aave V3 Docs: https://docs.aave.com/developers Credit Delegation Guide: https://docs.aave.com/developers/guides/credit-delegation Aave Address Book: https://github.com/bgd-labs/aave-address-book Foundry Book: https://book.getfoundry.sh/ DebtToken Reference: https://docs.aave.com/developers/tokens/debttoken
Agent frameworks, memory systems, reasoning layers, and model-native orchestration.
Largest current source with strong distribution and engagement signals.