ethereum-wingmanEthereum development tutor and builder for Scaffold-ETH 2 projects. Triggers on "build", "create", "dApp", "smart contract", "Solidity", "DeFi", "Ethereum", "web3", or any blockchain development task. ALWAYS uses fork mode to test against real protocol state.
Install via ClawdBot CLI:
clawdbot install jp4g/ethereum-wingmanComprehensive Ethereum development guide for AI agents. Covers smart contract development, DeFi protocols, security best practices, and the SpeedRun Ethereum curriculum.
When a user wants to BUILD any Ethereum project, follow these steps:
Step 1: Create Project
npx create-eth@latest
# Select: foundry (recommended), target chain, project name
Step 2: Fix Polling Interval
Edit packages/nextjs/scaffold.config.ts and change:
pollingInterval: 30000, // Default: 30 seconds (way too slow!)
to:
pollingInterval: 3000, // 3 seconds (much better for development)
Step 3: Install & Fork a Live Network
cd <project-name>
yarn install
yarn fork --network base # or mainnet, arbitrum, optimism, polygon
Step 4: Enable Auto Block Mining (REQUIRED!)
# In a new terminal, enable interval mining (1 block/second)
cast rpc anvil_setIntervalMining 1
Without this, block.timestamp stays FROZEN and time-dependent logic breaks!
Optional: Make it permanent by editing packages/foundry/package.json to add --block-time 1 to the fork script.
Step 5: Deploy to Local Fork (FREE!)
yarn deploy
Step 6: Start Frontend
yarn start
Step 7: Test the Frontend
After the frontend is running, open a browser and test the app:
http://localhost:3000Use the cursor-browser-extension MCP tools for browser automation.
See tools/testing/frontend-testing.md for detailed workflows.
yarn chain (use yarn fork --network instead!)forge init or set up Foundry from scratchyarn chain (WRONG) yarn fork --network base (CORRECT)
āā Empty local chain āā Fork of real Base mainnet
āā No protocols āā Uniswap, Aave, etc. available
āā No tokens āā Real USDC, WETH exist
āā Testing in isolation āā Test against REAL state
Token, protocol, and whale addresses are in data/addresses/:
tokens.json - WETH, USDC, DAI, etc. per chainprotocols.json - Uniswap, Aave, Chainlink per chain whales.json - Large token holders for test fundingNOTHING IS AUTOMATIC ON ETHEREUM.
Smart contracts cannot execute themselves. There is no cron job, no scheduler, no background process. For EVERY function that "needs to happen":
Always ask: "Who calls this function? Why would they pay gas?"
If you can't answer this, your function won't get called.
// LIQUIDATIONS: Caller gets bonus collateral
function liquidate(address user) external {
require(getHealthFactor(user) < 1e18, "Healthy");
uint256 bonus = collateral * 5 / 100; // 5% bonus
collateralToken.transfer(msg.sender, collateral + bonus);
}
// YIELD HARVESTING: Caller gets % of harvest
function harvest() external {
uint256 yield = protocol.claimRewards();
uint256 callerReward = yield / 100; // 1%
token.transfer(msg.sender, callerReward);
}
// CLAIMS: User wants their own tokens
function claimRewards() external {
uint256 reward = pendingRewards[msg.sender];
pendingRewards[msg.sender] = 0;
token.transfer(msg.sender, reward);
}
USDC = 6 decimals, not 18!
// BAD: Assumes 18 decimals - transfers 1 TRILLION USDC!
uint256 oneToken = 1e18;
// GOOD: Check decimals
uint256 oneToken = 10 ** token.decimals();
Common decimals:
Contracts cannot pull tokens directly. Two-step process:
// Step 1: User approves
token.approve(spenderContract, amount);
// Step 2: Contract pulls tokens
token.transferFrom(user, address(this), amount);
Never use infinite approvals:
// DANGEROUS
token.approve(spender, type(uint256).max);
// SAFE
token.approve(spender, exactAmount);
Use basis points (1 bp = 0.01%):
// BAD: This equals 0
uint256 fivePercent = 5 / 100;
// GOOD: Basis points
uint256 FEE_BPS = 500; // 5% = 500 basis points
uint256 fee = (amount * FEE_BPS) / 10000;
External calls can call back into your contract:
// SAFE: Checks-Effects-Interactions pattern
function withdraw() external nonReentrant {
uint256 bal = balances[msg.sender];
balances[msg.sender] = 0; // Effect BEFORE interaction
(bool success,) = msg.sender.call{value: bal}("");
require(success);
}
Always use OpenZeppelin's ReentrancyGuard.
Flash loans can manipulate spot prices instantly:
// SAFE: Use Chainlink
function getPrice() internal view returns (uint256) {
(, int256 price,, uint256 updatedAt,) = priceFeed.latestRoundData();
require(block.timestamp - updatedAt < 3600, "Stale");
require(price > 0, "Invalid");
return uint256(price);
}
First depositor can steal funds via share manipulation:
// Mitigation: Virtual offset
function convertToShares(uint256 assets) public view returns (uint256) {
return assets.mulDiv(totalSupply() + 1e3, totalAssets() + 1);
}
Some tokens (USDT) don't return bool on transfer:
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
using SafeERC20 for IERC20;
token.safeTransfer(to, amount); // Handles non-standard tokens
packages/
āāā foundry/ # Smart contracts
ā āāā contracts/ # Your Solidity files
ā āāā script/ # Deploy scripts
āāā nextjs/
āāā app/ # React pages
āāā contracts/ # Generated ABIs + externalContracts.ts
// Read contract data
const { data } = useScaffoldReadContract({
contractName: "YourContract",
functionName: "greeting",
});
// Write to contract
const { writeContractAsync } = useScaffoldWriteContract("YourContract");
// Watch events
useScaffoldEventHistory({
contractName: "YourContract",
eventName: "Transfer",
fromBlock: 0n,
});
Reference these for hands-on learning:
| Challenge | Concept | Key Lesson |
|-----------|---------|------------|
| 0: Simple NFT | ERC-721 | Minting, metadata, tokenURI |
| 1: Staking | Coordination | Deadlines, escrow, thresholds |
| 2: Token Vendor | ERC-20 | Approve pattern, buy/sell |
| 3: Dice Game | Randomness | On-chain randomness is insecure |
| 4: DEX | AMM | x*y=k formula, slippage |
| 5: Oracles | Price Feeds | Chainlink, manipulation resistance |
| 6: Lending | Collateral | Health factor, liquidation incentives |
| 7: Stablecoins | Pegging | CDP, over-collateralization |
| 8: Prediction Markets | Resolution | Outcome determination |
| 9: ZK Voting | Privacy | Zero-knowledge proofs |
| 10: Multisig | Signatures | Threshold approval |
| 11: SVG NFT | On-chain Art | Generative, base64 encoding |
Before deployment, verify:
When helping developers:
yarn fork, never yarn chainGenerated Mar 1, 2026
A developer wants to build a lending platform similar to Aave or Compound. Using Ethereum Wingman, they can fork Base mainnet to test against real Aave pools and token prices. The skill guides them through creating incentive mechanisms for liquidations and ensuring proper decimal handling for USDC (6 decimals) and WETH (18 decimals).
A team is creating an NFT marketplace that automatically distributes royalties to creators on secondary sales. The skill helps them set up a Scaffold-ETH 2 project with fork mode to test against existing NFT contracts, implement secure payment splitting using basis points (no floating point), and ensure frontend integration with RainbowKit works properly.
A security auditor needs to test a bridge contract that moves assets between Ethereum and Layer 2 networks. Ethereum Wingman enables forking mainnet to simulate real token transfers, test reentrancy protection with OpenZeppelin guards, and verify that incentive structures properly reward relayers for submitting proofs.
A DAO wants to build a dashboard for managing their multi-signature treasury across DeFi protocols. The skill guides development using fork mode to interact with real Uniswap pools and Aave positions, implement safe ERC-20 approval patterns, and create frontend components that display real-time portfolio values.
Developers are creating a blockchain game where players earn tokens through gameplay. Ethereum Wingman helps them test time-dependent logic (like daily rewards) by enabling auto block mining, implement proper token distribution schedules using basis points, and ensure frontend wallet connection works seamlessly for in-game purchases.
Offer custom smart contract development services for clients wanting DeFi protocols, NFT projects, or DAOs. Use Ethereum Wingman to rapidly prototype and test against real networks, reducing development time from weeks to days while ensuring security best practices are followed.
Provide smart contract security audits using the fork testing methodology to identify vulnerabilities in real protocol states. Offer remediation consulting to fix critical issues like reentrancy, decimal errors, and incentive misalignment before mainnet deployment.
Create courses and workshops teaching Ethereum development using the SpeedRun Ethereum curriculum integrated with Scaffold-ETH 2. Offer hands-on labs where students fork mainnet to build real DeFi applications, with certification upon completion.
š¬ Integration Tip
Always use fork mode instead of local chains to test against real protocol states, and remember to enable auto block mining to prevent time-dependent logic from breaking.
Connect Claude to Clawdbot instantly and keep it connected 24/7. Run after setup to link your subscription, then auto-refreshes tokens forever.
ERC-8004 Trustless Agents - Register, discover, and build reputation for AI agents on Ethereum. Use when registering agents on-chain, querying agent registries, giving/receiving reputation feedback, or interacting with the AI agent trust layer.
Autonomous crypto trading on Base via Bankr. Use for trading tokens, monitoring launches, executing strategies, or managing a trading portfolio. Triggers on "trade", "buy", "sell", "launch", "snipe", "profit", "PnL", "portfolio balance", or any crypto trading task on Base.
Deploy ERC20 tokens on Base using Clanker SDK. Create tokens with built-in Uniswap V4 liquidity pools. Supports Base mainnet and Sepolia testnet. Requires PRIVATE_KEY in config.
Query DeFi portfolio data across 50+ chains via Zapper's GraphQL API. Use when the user wants to check wallet balances, DeFi positions, NFT holdings, token prices, or transaction history. Supports Base, Ethereum, Polygon, Arbitrum, Optimism, and more. Requires ZAPPER_API_KEY.
Interact with Solana blockchain via Helius APIs. Create/manage wallets, check balances (SOL + tokens), send transactions, swap tokens via Jupiter, and monitor addresses. Use for any Solana blockchain operation, crypto wallet management, token transfers, DeFi swaps, or portfolio tracking.