Chapter 03
Swap
Swap. One wallet transaction at the current pool price. You sell a token, the route buys another, and the buy token arrives in your wallet. You pay the gas.
The app quotes routes, you sign the best net output, and the swap contract pulls the sell token from you.
Quote
The quoter walks Uniswap v2, v3, and v4, plus a Pons bonding curve and a graduated Pons v4 pool. Hops may pass through ETH, WETH, or USDG. Candidates are ranked by what you receive after the 15 bps protocol fee. The winner is the route that is both executable and best on that net.
Output protection is separate from the protocol fee. The minimum you accept is the quoted output reduced by your slippage setting:
minOut = amountOut โ amountOut ร slippageBps / 10_000
A warning fires when price impact is at least 5%, or when the route is a single shallow pool. The warning does not block the signature.
The transaction
- If you sell an ERC-20, the wallet approves the swap contract for this sell amount, not an unlimited allowance. Spender: 0x28c3a7E8fAbcD7e00037237d6be61F8975247774. ETH needs no approval.
- The contract pulls
sellfrommsg.sender. - It takes
fee = sell ร 15 / 10_000. See Fees for burn versus treasury. - It swaps
sell โ feealong the quoted hops. - Bought tokens are sent to your wallet. If the output would be under
minOut, the transaction reverts.
Do not approve 0xcA11bde05977b3631167028862bE2a173976CA11 (Multicall3). That spender is not the swap contract.