$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
Web3 & BlockchainadvancedNew

DeFi Integration

Share

Integrate DeFi protocols (Uniswap, Aave)

Works with OpenClaude

You are a Web3 developer integrating decentralized finance (DeFi) protocols. The user wants to connect their application to Uniswap and Aave smart contracts for token swaps and lending operations.

What to check first

  • Run npm list ethers web3 to verify ethers.js or web3.js is installed
  • Check that you have contract ABIs for Uniswap V3 Router and Aave LendingPool saved locally
  • Verify your RPC provider URL (Infura, Alchemy, or local node) is accessible with curl https://your-rpc-url with a simple JSON-RPC call

Steps

  1. Install required dependencies: npm install ethers dotenv and npm install @uniswap/sdk-core @uniswap/v3-sdk for Uniswap
  2. Create a .env file with PRIVATE_KEY, RPC_URL, and WALLET_ADDRESS
  3. Initialize ethers.js provider and signer using the RPC URL and private key from environment variables
  4. For Uniswap swaps, import the Uniswap V3 Router contract ABI and instantiate the router contract at address 0xE592427A0AEce92De3Edee1F18E0157C05861564
  5. For Aave, import the LendingPool contract ABI and connect to the pool proxy address (varies by network; Ethereum mainnet is 0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9)
  6. Build swap transactions using Uniswap's exactInputSingle function with encoded path, amountIn, amountOutMinimum, and deadline
  7. For Aave deposits, call deposit(tokenAddress, amount, onBehalfOf, referralCode) on the LendingPool contract
  8. Estimate gas with contract.estimateGas.functionName() and execute transactions with await signer.sendTransaction(tx)

Code

const ethers = require('ethers');
require('dotenv').config();

const UNISWAP_ROUTER = '0xE592427A0AEce92De3Edee1F18E0157C05861564';
const AAVE_LENDING_POOL = '0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9';

const UNISWAP_ABI = [
  'function exactInputSingle((bytes,uint256,uint256,uint256,uint256)) external payable returns (uint256)',
  'function multicall(uint256,bytes[]) payable returns (bytes[])'
];

const AAVE_ABI = [
  'function deposit(address asset, uint256 amount, address onBehalfOf, uint16 referralCode) external',

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

Difficultyadvanced
Version1.0.0
AuthorClaude Skills Hub
web3defiuniswap

Install command:

curl -o ~/.claude/skills/defi-integration.md https://claude-skills-hub.vercel.app/skills/web3/defi-integration.md

Related Web3 & Blockchain Skills

Other Claude Code skills in the same category — free to download.

Want a Web3 & Blockchain skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.