swap
Exchange native ETH for $CPU or sell $CPU for ETH on the Uniswap v4 pool. Enter amount and slippage; the transaction is executed on-chain.
Instructions
Swap between native ETH and $CPU on the game token pool (Uniswap v4), in either direction: sell: "ETH" buys $CPU, sell: "CPU" sells it for ETH. amount is how much of the sold token to spend. Preview the result first with quote_swap. The swap is exact-input: you spend amount and receive at least the quoted output minus slippage (a percent, e.g. 0.5 = 0.5%). Selling $CPU auto-approves it (via Permit2) once before the first swap; the trade is submitted on-chain and this waits for confirmation. A 1% pool fee applies.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sell | Yes | Token to spend: ETH (to buy $CPU) or CPU (to sell for ETH). | |
| amount | Yes | Amount of the `sell` token to spend, as a decimal string (e.g. "0.5"). 18 decimals. | |
| slippage | No | Max slippage as a percent (e.g. 0.5 = 0.5%); the floor on what you receive. Default 0.5. |