Skip to main content
Split one order across two Uniswap V3 pools, weighting each leg by the pool’s live liquidity, swap both legs via SwapRouter02, then require the combined output to clear the floor, all inside one transaction. If the floor is not met the whole transaction reverts and no leg settles. The router is fixed (Base mainnet); the tokens, amount, caller, pools and floor are parameters.

Prerequisites

  • Complete Sauce setup, including access, a Pot and the current Kitchen fee.
  • Use Base mainnet (chain ID 8453) and two Uniswap V3 pools for the same token pair.
  • The caller must hold the input tokens and approve the Pot to spend amountIn.
  • Save these three ABI files beside the program: IERC20, IV3SwapRouter, IUniswapV3Pool.
  • Supply a minimum acceptable output in the output token’s smallest unit. Review the compiler compatibility limitation before execution.

Program

order-split.sauce.ts

What to notice

  • throw aborts the program and reverts every leg. There is no partial fill.
  • The split ratio is computed from liquidity() read in the same block, not from an off-chain estimate.

Run it

Same as the best-pool swap: compile for evm with the three ABI files beside the source, append seven arguments, execute through your Pot.

Troubleshooting

If execution reverts, check the input balance, allowance to the Pot, pool pair, fee tiers and minimum output. Simulate the complete call and estimate gas before submission. A quote or swap failure reverts the transaction.

Next steps

Review SauceScript contract calls or package the program as an intent.