Skip to main content
Archived documentation for @eco-incorp/sauce@1.0.0. Install this release with npm install --save-exact @eco-incorp/sauce@1.0.0. Links to guides outside this tab open current documentation.
DEX aggregator that routes swaps across multiple liquidity sources. Supports limit orders and Fusion mode for gasless swaps.

When to use it

  • An aggregator: its router fills a swap across many venues along a route its off-chain API quotes. Use it for a route the program does not want to choose itself.

Pitfalls for a program

  • The calldata is quoted for one sender, amount and moment: quote it for the Pot (the swap’s sender) and send it soon.
  • Approve the router for exactly amountIn, and clear the allowance after.
  • The calldata’s own minimum is not yours: check the output as a balance delta against your minOut.

In a Sauce program

Forward a 1inch quote for the Pot, checked by the WETH received:

What it offers

  • unoswap: Single-source optimized swap via AggregationRouter
  • swap: Multi-source aggregated swap with custom routing

Notes

  • Same contract address across all 7 chains
  • V6 router is the latest version
  • unoswap is gas-efficient for single-pool swaps; swap handles complex multi-hop routes
  • dex in unoswap packs the pool address with its protocol and swap-direction flags in the high bits
  • Fusion mode enables gasless swaps via order matching (off-chain, not in ABI)
  • Approve srcToken to aggregationRouterV6 before swapping

Its names in a program

On Ethereum, Oneinch is a namespace: its contracts need no import.

Deployments

ABI

AggregationRouterV6ABI

import AggregationRouterV6ABI from "./protocols/oneinch/AggregationRouterV6ABI.json"; Speaks for: aggregationRouterV6.
  • swap(address executor, (address srcToken, address dstToken, address srcReceiver, address dstReceiver, uint256 amount, uint256 minReturnAmount, uint256 flags) desc, bytes data) payable returns (uint256 returnAmount, uint256 spentAmount)
  • unoswap(uint256 token, uint256 amount, uint256 minReturn, uint256 dex) returns (uint256 returnAmount)

Next steps