Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

web3-defi-protocols

БесплатноЗапускает вложенные скриптыНе проверен

Integrate DeFi protocols into SpoonOS agents. Use when building lending integrations (Aave, Compound), DEX aggregators (1inch, CoW Protocol), or yield…

jiayaoqijiaот jiayaoqijia★ 81 звезда на GitHub

Об этом скилле

DeFi Protocol Integration

Connect SpoonOS agents to major DeFi protocols.

Supported Protocols

Protocol Type Chains
Aave V3 Lending ETH, Polygon, Arbitrum, Optimism, Base
Compound V3 Lending ETH, Polygon, Arbitrum, Base
1inch DEX Aggregator All major EVM
CoW Protocol MEV-protected swaps ETH, Gnosis
Uniswap V3 DEX All major EVM

Aave V3 Integration

Contract Addresses

AAVE_V3_ADDRESSES = {
    "ethereum": {
        "pool": "0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2",
        "pool_data_provider": "0x7B4EB56E7CD4b454BA8ff71E4518426369a138a3",
        "oracle": "0x54586bE62E3c3580375aE3723C145253060Ca0C2"
    },
    "polygon": {
        "pool": "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
        "pool_data_provider": "0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654",
        "oracle": "0xb023e699F5a33916Ea823A16485e259257cA8Bd1"
    },
    "arbitrum": {
        "pool": "0x794a61358D6845594F94dc1DB02A252b5b4814aD",
        "pool_data_provider": "0x69FA688f1Dc47d4B5d8029D5a35FB7a548310654",
        "oracle": "0xb56c2F0B653B2e0b10C9b928C8580Ac5Df02C7C7"
    },
    "base": {
        "pool": "0xA238Dd80C259a72e81d7e4664a9801593F98d1c5",
        "pool_data_provider": "0x2d8A3C5677189723C4cB8873CfC9C8976FDF38Ac",
        "oracle": "0x2Cc0Fc26eD4563A5ce5e8bdcfe1A2878676Ae156"
    }
}

Aave Tool Implementation

# scripts/aave_lending.py
from spoon_ai.tools.base import BaseTool
from pydantic import Field
from web3 import Web3
import json

AAVE_POOL_ABI = [...]  # See references/aave-abi.md

class AaveLendingTool(BaseTool):
    name: str = "aave_lending"
    description: str = "Supply, borrow, repay on Aave V3"
    parameters: dict = Field(default={
        "type": "object",
        "properties": {
            "action": {
                "type": "string",
                "enum": ["supply", "borrow", "repay", "withdraw", "positions"],
                "description": "Lending action to perform"
            },
            "asset": {"type": "string", "description": "Token symbol (USDC, WETH, etc.)"},
            "amount": {"type": "string", "description": "Amount in token units"},
            "chain": {"type": "string", "default": "ethereum"}
        },
        "required": ["action"]
    })

    async def execute(self, action: str, asset: str = None,
                      amount: str = None, chain: str = "ethereum") -> str:
        if action == "positions":
            return await self._get_positions(chain)
        elif action == "supply":
            return await self._supply(asset, amount, chain)
        elif action == "borrow":
            return await self._borrow(asset, amount, chain)
        elif action == "repay":
            return await self._repay(asset, amount, chain)
        elif action == "withdraw":
            return await self._withdraw(asset, amount, chain)

    async def _get_positions(self, chain: str) -> str:
        """Get user's Aave positions."""
        addresses = AAVE_V3_ADDRESSES[chain]
        w3 = Web3(Web3.HTTPProvider(RPC_URLS[chain]))

        pool_data = w3.eth.contract(
            address=addresses["pool_data_provider"],
            abi=POOL_DATA_PROVIDER_ABI
        )

        user_address = os.getenv("WALLET_ADDRESS")
        reserves = pool_data.functions.getUserReservesData(
            addresses["pool"],
            user_address
        ).call()

        positions = []
        for reserve in reserves:
            if reserve[1] > 0 or reserve[2] > 0:  # supplied or borrowed
                positions.append({
                    "asset": reserve[0],
                    "supplied": reserve[1] / 1e18,
                    "borrowed": reserve[2] / 1e18
                })

        return json.dumps({"positions": positions}, indent=2)

1inch Integration

API Configuration

ONEINCH_API = {
    "base_url": "https://api.1inch.dev",
    "swap_endpoint": "/swap/v6.0/{chain_id}/swap",
    "quote_endpoint": "/swap/v6.0/{chain_id}/quote",
    "tokens_endpoint": "/swap/v6.0/{chain_id}/tokens"
}

CHAIN_IDS = {
    "ethereum": 1,
    "polygon": 137,
    "arbitrum": 42161,
    "optimism": 10,
    "base": 8453
}

1inch Swap Tool

# scripts/oneinch_swap.py
import aiohttp
import os
from spoon_ai.tools.base import BaseTool
from pydantic import Field

class OneInchSwapTool(BaseTool):
    name: str = "oneinch_swap"
    description: str = "Get swap quotes and execute via 1inch aggregator"
    parameters: dict = Field(default={
        "type": "object",
        "properties": {
            "action": {"type": "string", "enum": ["quote", "swap"]},
            "from_token": {"type": "string", "description": "Source token address"},
            "to_token": {"type": "string", "description": "Destination token address"},
            "amount": {"type": "string", "description": "Amount in wei"},
            "chain": {"type": "string", "default": "ethereum"},
Полный SKILL.md на GitHub

Установить web3-defi-protocols в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

SOURCE.mdTRUST.auto.yamlscripts/aave_lending.pyscripts/cow_swap.pyscripts/oneinch_swap.pyscripts/yield_finder.py

FAQ

Что делает скилл web3-defi-protocols?

Integrate DeFi protocols into SpoonOS agents. Use when building lending integrations (Aave, Compound), DEX aggregators (1inch, CoW Protocol), or yield strategies.

Как установить скилл web3-defi-protocols?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл web3-defi-protocols запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить web3-defi-protocols с