Communitygithub.com

Aave Credit Delegation (Aave クレジット委任)

Aaveのクレジット委任機能を使ってエージェントが自己資金調達を行います。デリゲーターの担保を基に借用し、返済、健全性チェックをサポート。Aave V2/V3に対応。

Aave Credit Delegation (Aave クレジット委任) とは?

このスキルは、Aaveプロトコルのクレジット委任(Credit Delegation)を活用し、AIエージェントが自律的に資金を借り入れ・返済できるようにします。ユーザー(デリゲーター)が自身のウォレットでAaveに担保を預け、エージェントウォレットに対して特定の資産の借入権限を委任します。エージェントは、委任された上限額の範囲内で自動的に借入を実行し、負債はデリゲーターのポジションに計上されます。健全性チェック(ヘルスファクター)や1取引あたりの最大借入額などの安全機構が組み込まれており、リスクを制御しながら動作します。対応プラットフォームはOpenClaw、Claude Code、またはFoundryの`cast`コマンドを利用できる任意のエージェントフレームワークです。Aave V3とV2の両方に対応しており、関数シグネチャが同一であるため、アドレスを差し替えるだけで簡単に切り替えられます。Bankrなどのスキルと組み合わせることで、借入→スワップ→運用といった複雑なフローも実現できます。

対応✓Claude Code~Codex CLI~Cursor
npx skills add https://github.com/modbender/skill-library-mcp/tree/HEAD/data/agent-credit

お気に入りのAIに質問する

このエージェントスキルを事前に読み込んだ状態で新しいチャットを開きます。

ドキュメント

Aave Credit Delegation (Aave クレジット委任) は何をしますか?

Aaveのクレジット委任機能を使って資金を借り入れます。メインウォレットが担保を預け、エージェントウォレットに借入権限を委任します。エージェントは必要に応じて自律的にトークンを借り入れることができ、負債はデリゲーターのポジションに計上されます。

プロトコル: Aave V3 および Aave V2 で動作します。クレジット委任に関する関数シグネチャ(borrow、repay、approveDelegation、borrowAllowance)は両バージョンで同一です。V2のLendingPoolおよびProtocolDataProviderのアドレスに差し替えるだけで利用可能です。唯一の違いは、V3が担保/負債をUSD(8桁精度)で返すのに対し、V2はETH(18桁精度)で返す点です。ヘルスファクターの安全チェックは両方で正しく動作します。

互換性

  • OpenClaw — スキルとしてインストールすると、エージェントが自律的に借入を実行します
  • Claude Code — Claude Codeセッションから直接スクリプトを実行
  • 任意のエージェントフレームワーク — プレーンなbash + Foundryのcastで、シェルが使える環境ならどこでも動作

Bankr スキルと組み合わせると、借入→スワップのフローが実現できます。USDCをクレジット委任で借り入れ、Bankrを使ってスワップ、ブリッジ、展開などを行えます。

クレジット委任の仕組み

Aave V3のクレジット委任は、借入能力(Borrowing Power) と 委任承認(Delegation Approval) の2つを分離します。

借入能力は全体として扱われます。 これは全資産にわたる担保ポジション全体から生じます。たとえば、ETHを10,000ドル相当、LTV 80%で預ければ、借入能力は8,000ドルです。この借入能力は特定の資産に固定されません。

委任承認は負債トークンごとに独立しています。 各変動負債トークン(VariableDebtToken)に対してapproveDelegation()を呼び出すことで、エージェントが借り入れ可能な資産とその量を個別に制御します。各資産には独自の負債トークンコントラクトがあり、各承認は独立しています。

つまり、以下のようなことが可能です:

  • ETHを担保として預ける(広範な借入能力を得る)
  • エージェントに対して最大500 USDCの借入を承認(USDC VariableDebtToken経由)
  • エージェントに対して最大0.1 WETHの借入を承認(WETH VariableDebtToken経由)
  • cbETHは未承認のまま(エージェントは一切借りられない)

エージェントは、あなたが明示的に承認した資産のみを、設定された上限額まで借り入れることができます。ただし、借入の容量は単一の預入からではなく、総担保から生じます。

あなたの担保(全体)                  委任承認(個別)
┌─────────────────────────────┐      ┌──────────────────────────────┐
│  $5k ETH                    │      │  USDC DebtToken → エージェント: 500 │
│  $3k USDC                   │  ───LTV───▶ │  WETH DebtToken → エージェント: 0.1 │
│  $2k cbETH                  │   = $8k     │  cbETH DebtToken → エージェント: 0  │
│  合計: $10k @ 80% LTV       │  容量      └──────────────────────────────┘
└─────────────────────────────┘

フロー

デリゲーター(あなたのウォレット)       エージェントウォレット(委任先)
    │                                        │
    │  1. Aaveに担保を預ける                 │
    │  2. approveDelegation(エージェント, 量)   │
    │       をVariableDebtToken上で実行        │
    │                                        │
    │            ┌─── 3. borrow(資産,         │
    │            │       量, onBehalfOf       │
    │            │       = デリゲーター)       │
    │            │                            │
    │     [あなたのポジションに負債]  [エージェントウォレットにトークン]
    │            │                            │
    │            └─── 4. repay(資産,          │
    │                    量, onBehalfOf       │
    │                    = デリゲーター)       │

クイックスタート

前提条件

  1. Foundry がインストールされていること(cast CLI):

    curl -L https://foundry.paradigm.xyz | bash && foundryup
    
  2. デリゲーターのセットアップ(ユーザーが1回だけ実行。エージェントは実行しません):

    • Aave V3に担保を預ける(app.aave.comまたはコントラクト経由)
    • エージェントに借り入れさせたい資産の VariableDebtToken 上で approveDelegation(agentAddress, maxAmount) を呼び出す
    • VariableDebtTokenのアドレスは以下で確認可能: cast call $DATA_PROVIDER "getReserveTokensAddresses(address)(address,address,address)" $ASSET --rpc-url $RPC
  3. スキルの設定:

    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
    
  4. セットアップの確認:

    scripts/aave-setup.sh
    

コア機能

ステータス確認(承認量、ヘルス、負債)

# 完全なステータスレポート
scripts/aave-status.sh

# 特定の資産の委任を確認
scripts/aave-status.sh USDC

# ヘルスファクターのみ表示
scripts/aave-status.sh --health-only

委任による借入

# 100 USDCを借り入れ
scripts/aave-borrow.sh USDC 100

# 0.5 WETHを借り入れ
scripts/aave-borrow.sh WETH 0.5

借入スクリプトは自動的に:

  1. 委任承認量を確認(十分か?)
  2. デリゲーターのヘルスファクターを確認(借入しても安全か?)
  3. 借入を実行
  4. 結果を報告

負債の返済

# 100 USDCを返済
scripts/aave-repay.sh USDC 100

# USDCの負債を全額返済
scripts/aave-repay.sh USDC max

返済スクリプトは自動的に:

  1. Poolがトークンを使用することを承認(必要な場合)
  2. 返済を実行
  3. 残りの負債を報告

安全システム

すべての借入操作は、実行前に以下のチェックを実行します:

  1. 委任承認量 — 残りの承認量が要求量以上か?
  2. ヘルスファクター — この借入後もデリゲーターのヘルスファクターが minHealthFactor(デフォルト1.5)を超えているか?
  3. 1取引あたりの上限 — 量が maxBorrowPerTx 以下か?
  4. 確認 — 送信前に操作の詳細をすべてログ出力

いずれかのチェックが失敗した場合、借入は明確なエラーメッセージとともに中止されます。

⚠️ エージェントは絶対に安全チェックをバイパスしてはいけません。 ユーザーが借入を依頼してもヘルスファクターが低すぎる場合、エージェントは拒否し、その理由を説明しなければなりません。

機能一覧

読み取り操作(ガス不要)

  • 委任承認量の確認 — エージェントがまだいくら借り入れ可能か?
  • ヘルスファクターの確認 — デリゲーターのポジションは安全か?
  • 未返済負債の確認 — 各資産でデリゲーターがいくら負債を抱えているか?
  • 利用可能流動性の確認 — Aaveプールに借り入れ可能な十分な量があるか?
  • 負債トークンアドレスの解決 — 任意の資産のVariableDebtTokenを検索

書き込み操作(エージェントウォレットにガスが必要)

  • 借入 — 委任されたクレジットに対してAaveから資金を引き出す
  • 返済 — 借り入れた資金を返却し、デリゲーターの負債を減らす
  • 承認 — Poolが返済用トークンを使用することを承認

サポートチェーン

チェーンPoolアドレスガスコスト
Base0xA238Dd80C259a72e81d7e4664a9801593F98d1c5非常に低い
Ethereum0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2高い
Polygon0x794a61358D6845594F94dc1DB02A252b5b4814aD非常に低い
Arbitrum0x794a61358D6845594F94dc1DB02A252b5b4814aD低い

完全なアドレス一覧(負債トークン含む)は deployments.md を参照してください。

よくあるパターン

エージェントの自己ガス調達

# 十分なガスがあるか確認
BALANCE=$(cast balance $AGENT_ADDRESS --rpc-url $RPC)
if [ "$BALANCE" -lt "1000000000000000" ]; then  # < 0.001 ETH
  # ガス代として少量のWETHを借り入れ
  aave-borrow.sh WETH 0.005
fi

Bankrを使った借入+スワップ

# 委任クレジットからUSDCを借り入れ
aave-borrow.sh USDC 100
# Bankrを使ってETHにスワップ
bankr.sh "Swap 100 USDC for ETH on Base"

定期的DCA

# エージェントが毎週USDCを借り入れ、ETHにスワップ
aave-borrow.sh USDC 100
bankr.sh "Swap 100 USDC for ETH on Base"

安全第一のポートフォリオリバランス

# まず常にヘルスを確認
aave-status.sh
# 健全な場合のみ借り入れ
aave-borrow.sh USDC 500

設定リファレンス

config.json フィールド

フィールド必須説明
chainはいチェーン名(base, ethereum, polygon, arbitrum)
rpcUrlはいJSON-RPCエンドポイントURL
agentPrivateKeyはいエージェントウォレットの秘密鍵(0xプレフィックス)
delegatorAddressはいクレジットを委任したユーザーのメインウォレット
poolAddressはいAave V3 Poolコントラクトアドレス
dataProviderAddressはいAave V3 PoolDataProviderアドレス
assetsはいシンボル→{address, decimals}のマップ
safety.minHealthFactorいいえ借入後の最小HF(デフォルト: 1.5)
safety.maxBorrowPerTxいいえ1取引あたりの最大借入額(デフォルト: 1000)
safety.maxBorrowPerTxUnitいいえmaxBorrowPerTxの単位(デフォルト: USDC)

環境変数(configを上書き)

変数上書き対象
AAVE_RPC_URLrpcUrl
AAVE_AGENT_PRIVATE_KEYagentPrivateKey
AAVE_DELEGATOR_ADDRESSdelegatorAddress
AAVE_POOL_ADDRESSpoolAddress
AAVE_MIN_HEALTH_FACTORsafety.minHealthFactor

エラーハンドリング

エラー原因修正方法
INSUFFICIENT_ALLOWANCE委任量を超過デリゲーターが再度approveDelegation()を呼び出す
HEALTH_FACTOR_TOO_LOW借入により清算リスクが発生量を減らすか、担保を追加する
AMOUNT_EXCEEDS_CAP1取引あたりの安全上限に到達量を減らすか、設定を更新する
INSUFFICIENT_LIQUIDITYAaveプールに十分な流動性がないより少ない量か、別の資産を試す
INSUFFICIENT_GASエージェントウォレットにネイティブトークンがないエージェントウォレットにガス代を送金する
EMODE_MISMATCH資産がデリゲーターのeModeと互換性がない同じeModeカテゴリの資産を借り入れる

セキュリティ

完全な脅威モデルと緊急手順については safety.md を参照してください。

重要なルール:

  1. デリゲーターの秘密鍵は絶対にこのリポジトリ、設定、スクリプトに含めてはいけません — これはエージェントの作業領域です。デリゲーターはAave UIまたはブロックエクスプローラ経由で自身の操作を行います。
  2. config.jsonをバージョン管理にコミットしてはいけません — エージェントの秘密鍵が含まれています
  3. minHealthFactorを1.2未満に設定してはいけません — 清算は1.0で発生します
  4. 常に委任量に上限を設けてください — type(uint256).max を承認しないでください
  5. デリゲーターのヘルスを監視してください — HFが2.0を下回った場合にアラートを設定してください
  6. 安全チェックに失敗した場合、エージェントは指示されても借入を拒否しなければなりません

リソース

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

modbender/skill-library-mcp

Paid acquisition strategy, budget allocation, and avoiding common advertising mistakes across platforms

modbender/skill-library-mcp

Complete investment portfolio risk management system. Analyze positions, calculate risk metrics, stress test scenarios, optimize allocations, and generate institutional-grade risk reports — all wit...

modbender/skill-library-mcp

Discover and register autonomous AI agents. Use when: browsing the agent registry, submitting an agent for verification, or embedding agent badges. NOT for: general web search or agent capability analysis.

modbender/skill-library-mcp

Create AI avatar and talking head videos with OmniHuman, Fabric, PixVerse via inference.sh CLI. Models: OmniHuman 1.5, OmniHuman 1.0, Fabric 1.0, PixVerse Lipsync. Capabilities: audio-driven avatars, lipsync videos, talking head generation, virtual presenters. Use for: AI presenters, explainer videos, virtual influencers, dubbing, marketing videos. Triggers: ai avatar, talking head, lipsync, avatar video, virtual presenter, ai spokesperson, audio driven video, heygen alternative, synthesia alternative, talking avatar, lip sync, video avatar, ai presenter, digital human

modbender/skill-library-mcp

AI代码编辑器规则模板集合 - 为Cursor、Windsurf、Claude Code、Cline等AI编辑器提供项目规则配置。适用于需要配置AI编码助手规则的开发者,包含全栈Web、移动端、Vue3+SpringBoot等技术栈模板。

modbender/skill-library-mcp

Generate landing page code from product descriptions

modbender/skill-library-mcp

Create AI marketing videos for ads, promos, product launches, and brand content. Models: Veo, Seedance, Wan, FLUX for visuals, Kokoro for voiceover. Types: product demos, testimonials, explainers, social ads, brand videos. Use for: Facebook ads, YouTube ads, product launches, brand awareness. Triggers: marketing video, ad video, promo video, commercial, brand video, product video, explainer video, ad creative, video ad, facebook ad video, youtube ad, instagram ad, tiktok ad, promotional video, launch video

modbender/skill-library-mcp

Generate AI music videos end-to-end. Creates music with Suno (sunoapi.org), generates visuals with OpenAI/Seedream/Google/Seedance, and assembles into music video with ffmpeg. Supports timestamped lyrics (auto SRT), Suno native music video generation, slideshow/video/hybrid modes. Token-based cost tracking per generation.

modbender/skill-library-mcp

Generate AI-powered notes from videos (document, outline, or graphic-text formats)

modbender/skill-library-mcp

The video AI notes tool is provided by Baidu. Based on the video download address provided by the user, it downloads and parses the video, and finally generates AI notes corresponding to the video (a total of three types of notes can be generated: document notes, outline notes, and image-text notes).

modbender/skill-library-mcp

Automated appointment management for beauty salons, clinics, studios, and photo booths. Handles booking requests, calendar sync, conflict detection, reminders, no-show tracking, and waitlist management.

modbender/skill-library-mcp

Bird identification, life list tracking, and trading card generation. Use this skill when the user: sends a bird photo to identify, says "set up my Birdfolio" or "set my region", asks "how's my checklist", asks "Birdfolio progress", asks "how many birds have I found", asks "show my Birdfolio" or "show my life list", asks "what's my rarest bird", or asks "tell me about [bird species]". Handles everything from first-time setup through ongoing life list tracking and visual trading card generation.

modbender/skill-library-mcp

Multi-project task and research management (JSON-first CLI)

modbender/skill-library-mcp

Track stock and crypto portfolios with CLI - real-time prices, P&L, dividend tracking, multiple portfolios

modbender/skill-library-mcp

Track cryptocurrency portfolios with real-time prices, P&L calculations, and allocation analysis. Query Bitcoin, Ethereum, Solana and 10,000+ token holdings.

modbender/skill-library-mcp

加密貨幣Portfolio追蹤 - 支援TRON/ETH/BSC,分析持倉、收益、Gas費用

modbender/skill-library-mcp

Lead strategy with competitive analysis, strategic planning, growth roadmaps, and business portfolio management.

modbender/skill-library-mcp

Create ATS-optimized resumes and CVs with proper structure, metrics, and industry targeting.

modbender/skill-library-mcp

Use this skill when the user asks to build, create, design, develop, or improve ANY frontend interface, web page, UI component, or visual element. This includes: - Building landing pages, websites, web apps, dashboards, portfolios, or any web interface - Creating UI components (buttons, forms, cards, navbars, modals, etc.) - Designing pages with React, Vue, Next.js, Svelte, or any frontend framework - Adding styling or improving visual design of existing components - Implementing specific design aesthetics (modern, dark, minimalist, brutalist, etc.) - User mentions "frontend", "UI", "UX", "design", "interface", "web design", or "styling" - User asks for "beautiful", "modern", "professional", "clean", or any aesthetic adjective - User requests help with CSS, Tailwind, styled-components, or any styling approach This skill automatically retrieves the appropriate design system prompt (Neo-brutalism, Modern Dark, Bauhaus, Cyberpunk, Material, etc.) to help create visually distinctive, production-grade frontend...

modbender/skill-library-mcp

Native video analysis using Google Gemini API. Upload and analyze video files — describe scenes, extract text/UI, answer questions about content, transcribe speech, identify objects and actions. Use when: (1) User sends a video file and wants it analyzed, (2) Video summarization or description needed, (3) Extracting text, UI elements, or information from screen recordings, (4) Answering questions about video content, (5) Comparing multiple videos, (6) Analyzing tutorials, demos, or walkthroughs.

関連スキル