uniswap-swap-simulationSimulate and analyze Uniswap swaps including price impact, slippage, optimal routing, and gas estimation. Use when the user asks about swap execution, routing, price impact, or MEV considerations.
Install via ClawdBot CLI:
clawdbot install wpank/uniswap-swap-simulationThis skill covers simulating Uniswap swaps, calculating price impact, and analyzing routing decisions.
Use the Quoter contract to simulate swaps without executing:
import { createPublicClient, http, encodeFunctionData } from "viem";
// QuoterV2 for v3 pools
const quote = await client.readContract({
address: quoterV2Address,
abi: quoterV2Abi,
functionName: "quoteExactInputSingle",
args: [
{
tokenIn,
tokenOut,
amountIn,
fee,
sqrtPriceLimitX96: 0n,
},
],
});
// Returns: [amountOut, sqrtPriceX96After, initializedTicksCrossed, gasEstimate]
function calculatePriceImpact(
amountIn: bigint,
amountOut: bigint,
marketPrice: number, // token1/token0
decimals0: number,
decimals1: number,
): number {
const executionPrice =
Number(amountOut) / 10 ** decimals1 / (Number(amountIn) / 10 ** decimals0);
return Math.abs(1 - executionPrice / marketPrice);
}
Calculate minimum amount out:
const minAmountOut = (amountOut * (10000n - BigInt(slippageBps))) / 10000n;
For tokens without direct pools, route through intermediary tokens:
// ETH -> USDC -> DAI (two hops)
const path = encodePacked(
["address", "uint24", "address", "uint24", "address"],
[WETH, 3000, USDC, 100, DAI],
);
const quote = await client.readContract({
address: quoterV2Address,
abi: quoterV2Abi,
functionName: "quoteExactInput",
args: [path, amountIn],
});
Typical gas costs by swap complexity:
Always add a 15-20% buffer to gas estimates.
When building swap tools:
AI Usage Analysis
Analysis is being generated⦠refresh in a few seconds.
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.