skills/blockchain/defi-protocols/SKILL.md
Specialized knowledge of DeFi protocols including smart contracts, tokens, and decentralized lending on blockchains.
npx skillsauth add alphaonedev/openclaw-graph defi-protocolsInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill equips the AI with specialized knowledge of DeFi protocols, enabling precise interactions with smart contracts, tokens, and decentralized lending on blockchains like Ethereum and Binance Smart Chain.
Use this skill for tasks involving DeFi app development, smart contract auditing, token management, or lending protocol integrations. Apply it when handling blockchain transactions, yield farming, or protocol vulnerabilities in real-time coding scenarios.
/api?module=account&action=balance).To use this skill, initialize a Web3 provider in your code and set environment variables for API keys. For example, in a Node.js script, import Web3 and connect to a network:
const Web3 = require('web3');
const web3 = new Web3(process.env.RPC_URL || 'http://localhost:8545');
For DeFi-specific tasks, wrap contract interactions in try-catch blocks and use ABI files for decoding. When querying Aave, fetch pool data by specifying the contract address and function signature.
npx hardhat run scripts/deploy.js --network sepolia --api-key $ETHEREUM_API_KEY.eth_call for contract calls: curl -X POST --data '{"jsonrpc":"2.0","method":"eth_call","params":[{...}],"id":1}' $RPC_URL.GET https://api.thegraph.com/subgraphs/name/aave/protocol-v2 using GraphQL queries.{ "abi": [{ "name": "balanceOf", "inputs": [...] }] }, and load via fs.readFileSync('abi.json').contract.methods.transfer(address, amount).send({ from: walletAddress }).Integrate this skill with wallets like MetaMask by using Web3 providers that handle signer objects. For authentication, set env vars like $ETHEREUM_API_KEY for services such as Infura or Alchemy. When combining with other skills, ensure compatibility by standardizing blockchain networks (e.g., use Web3.js for both DeFi and general blockchain tasks). For oracles like Chainlink, import their contracts and call functions like getPrice before executing DeFi logic.
Handle common errors like transaction reverts by checking for TransactionError in Ethers.js: try { await contract.methods.borrow().send(); } catch (error) { if (error.reason.includes('insufficient collateral')) console.log('Add more collateral'); }. For API failures, verify status codes (e.g., 429 for rate limits) and retry with exponential backoff. Use event listeners for blockchain errors, e.g., contract.events.ErrorOccurred().on('data', handleError). Always validate inputs to prevent exploits like reentrancy in lending protocols.
const pool = await ethers.getContractAt('ILendingPool', '0x...'); const liquidity = await pool.getReserveData(tokenAddress); console.log(liquidity.availableLiquidity.toString());. Set $AAVE_SUBGRAPH_KEY for any required API access.npx hardhat compile then npx hardhat deploy --network mumbai, with config in hardhat.config.js like module.exports = { networks: { mumbai: { url: process.env.RPC_URL, accounts: [process.env.PRIVATE_KEY] } } };. This deploys an ERC-20 token for DeFi use.tools
Root web development: project structure, tooling selection, deployment decisions
development
WebAssembly: Rust/Go/C to WASM, wasm-bindgen, Emscripten, WASM Component Model
development
Vue 3: Composition API script setup, Pinia, Vue Router 4, SFCs, Vite, Nuxt 3
tools
Tailwind CSS 4: utility classes, config, JIT, arbitrary values, darkMode, plugins, shadcn/ui