Integrate DeFi protocols (Uniswap, Aave)
✓Works with OpenClaudeYou 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 web3to 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-urlwith a simple JSON-RPC call
Steps
- Install required dependencies:
npm install ethers dotenvandnpm install @uniswap/sdk-core @uniswap/v3-sdkfor Uniswap - Create a
.envfile withPRIVATE_KEY,RPC_URL, andWALLET_ADDRESS - Initialize ethers.js provider and signer using the RPC URL and private key from environment variables
- For Uniswap swaps, import the Uniswap V3 Router contract ABI and instantiate the router contract at address
0xE592427A0AEce92De3Edee1F18E0157C05861564 - For Aave, import the LendingPool contract ABI and connect to the pool proxy address (varies by network; Ethereum mainnet is
0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9) - Build swap transactions using Uniswap's
exactInputSinglefunction with encoded path, amountIn, amountOutMinimum, and deadline - For Aave deposits, call
deposit(tokenAddress, amount, onBehalfOf, referralCode)on the LendingPool contract - Estimate gas with
contract.estimateGas.functionName()and execute transactions withawait 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
Related Web3 & Blockchain Skills
Other Claude Code skills in the same category — free to download.
Smart Contract
Scaffold Solidity smart contract with tests
Web3 Frontend
Build Web3 frontend with wagmi and viem
Hardhat Setup
Set up Hardhat development environment for Solidity
Wallet Connect
Integrate wallet connection (MetaMask, WalletConnect)
NFT Contract
Create ERC-721/1155 NFT smart contract
Smart Contract Security Audit
Audit a Solidity smart contract for the most common vulnerabilities
Solidity Gas Optimization
Reduce gas costs in Solidity contracts using storage packing, bitmaps, and efficient patterns
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.