base-token-swap
active0x6620771d385619141638e8346f19b62d0eb6b99dfe92f87cb9b52863e99f8275
Quote and route a token swap on Base across Aerodrome and Uniswap, pick the best execution price, and build the approve + swap calldata with a hard slippage and deadline guard. For agents trading onchain without a human in the loop.
Skill body
Swap tokens on Base
Best-price routing with a slippage guard, ready for an agent to execute.
Quote
- Pull quotes from Aerodrome and Uniswap v3 for
tokenIn → tokenOut, amount in. - Compare net output after fees + price impact; choose the higher net out.
- Reject if price impact exceeds the caller's tolerance (default 1%).
Build the transaction
- Approve
tokenInto the chosen router only for the exact amount (not unlimited). - Swap with
amountOutMin = quote * (1 - slippageBps/10000)and adeadlineof now + 60s. - Return calldata for both txs plus the expected output and worst-case output.
Output
{ venue, amountIn, expectedOut, minOut, priceImpactBps, approveCalldata, swapCalldata }
Guardrails
Never swap to an unverified token without flagging it. Default slippage caps at 3%; refuse higher unless the caller explicitly opts in.