In a Sauce program, swap withConcentrated-liquidity AMM on Arc, forked from Uniswap V3 with native USDC in place of WETH9.@sauce/router’s function for the venue (uniswapV2,uniswapV3,uniswapV4,curve,balancerV2, …; Slipstream, PancakeSwap V3 and Algebra pools throughuniswapV3), with a minimum output and, where the pool takes one, a price limit (the@sauce/routerreference; several pools under one limit, the distributed swap).
Notes
- Pools call back
unitFlowV3SwapCallback, notuniswapV3SwapCallback, so a contract that swaps against a pool directly must implement the renamed callback - The GitHub README lists testnet addresses; these mainnet addresses are the defaults in UnitFlow’s own app build
- From a Pot program,
@sauce/router’suniswapV3uses the paired execution Router’sswapV3andunitFlowV3SwapCallback.potRouterUpdate(client, pot)returns an owner-signed update when the Pot differs from its Kitchen’s current Router. Compare addresses withv12RouterAddress(); Router releases are content-addressed, not generation-numbered. uniswapV3is exact input: the Router caps what the callback may take atamountIn
Its names in a program
On Arc,UnitflowV3 is a namespace: its contracts need no import.
Deployments
ABI
Where a line says what an address it returns is, a program that calls the function through its namespace calls that contract’s methods on the result directly:<Namespace>.<Contract>.<function>(...).<method>(...). A token’s methods are the ERC-20
functions, and its writes are SafeERC20.
UnitFlowV3FactoryABI
import UnitFlowV3FactoryABI from "./protocols/unitflow-v3/UnitFlowV3FactoryABI.json"; Speaks for: factory.
getPool(address tokenA, address tokenB, uint24 fee) view returns (address pool): the address is aUnitflowV3.PoolfeeAmountTickSpacing(uint24 fee) view returns (int24)
UnitFlowV3PoolABI
import UnitFlowV3PoolABI from "./protocols/unitflow-v3/UnitFlowV3PoolABI.json";
slot0() view returns (uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked)liquidity() view returns (uint128)fee() view returns (uint24)tickSpacing() view returns (int24)token0() view returns (address): the address is a tokentoken1() view returns (address): the address is a token
UnitFlowV3QuoterABI
import UnitFlowV3QuoterABI from "./protocols/unitflow-v3/UnitFlowV3QuoterABI.json"; Speaks for: quoter.
quoteExactInputSingle(address tokenIn, address tokenOut, uint24 fee, uint256 amountIn, uint160 sqrtPriceLimitX96) returns (uint256 amountOut)
UnitFlowV3RouterABI
import UnitFlowV3RouterABI from "./protocols/unitflow-v3/UnitFlowV3RouterABI.json"; Speaks for: router.
exactInputSingle((address tokenIn, address tokenOut, uint24 fee, address recipient, uint256 deadline, uint256 amountIn, uint256 amountOutMinimum, uint160 sqrtPriceLimitX96) params) payable returns (uint256 amountOut)factory() view returns (address): the address is aUnitflowV3.Factory
Next steps
- Protocols: the other protocols, by what they do.
- Protocols and tokens: calling a contract by its namespace, or through its ABI.
- Glossary: the words these pages use, in plain terms.
