Exchange Proxy
This contract includes swap forwarding proxy logic and on-chain smart order routing functionality.
viewSplit
functions query the On Chain Registry to provide best swap information using on-chain data.smartSwap
functions combine view and batch functionality to provide complete optimized on-chain swaps.multihopBatchSwapExactIn(Swap[][] memory swapSequences, TokenInterface tokenIn, TokenInterface tokenOut, uint totalAmountIn, uint minTotalAmountOut) public payable
Execute multi-hop swaps returned from off-chain SOR for swapExactIn trade type.
multihopBatchSwapExactOut(Swap[][] memory swapSequences, TokenInterface tokenIn, TokenInterface tokenOut, uint maxTotalAmountIn) public payable
Execute multi-hop swaps returned from off-chain SOR for swapExactOut trade type.
batchSwapExactIn(Swap[] memory swaps, TokenInterface tokenIn, TokenInterface tokenOut, uint totalAmountIn, uint minTotalAmountOut) public payable
Execute single-hop swaps for swapExactIn trade type. Used for swaps returned from viewSplit function and legacy off-chain SOR.
batchSwapExactOut(Swap[] memory swaps, TokenInterface tokenIn, TokenInterface tokenOut, uint maxTotalAmountIn) public payable
Execute single-hop swaps for swapExactOut trade type. Used for swaps returned from viewSplit function and legacy off-chain SOR.
viewSplitExactIn(address tokenIn, address tokenOut, uint swapAmount, uint nPools)
View function that calculates most optimal swaps (exactIn swap type) across a max of nPools. Returns an array of Swaps and the total amount out for swap.
viewSplitExactOut(address tokenIn, address tokenOut, uint swapAmount, uint nPools)
View function that calculates most optimal swaps (exactOut swap type) across a max of nPools. Returns an array of Swaps and the total amount in for swap.
(! Please be aware the return parameter "totalOutput" in the contract is a misnomer and actually represents totalInput !)
smartSwapExactIn
smartSwapExactIn(TokenInterface tokenIn, TokenInterface tokenOut, uint totalAmountIn, uint minTotalAmountOut, uint nPools) public payable
Calculates and executes most optimal swaps across a max of nPools for tokenIn > tokenOut swap with an input token amount = totalAmountIn.
smartSwapExactOut(TokenInterface tokenIn, TokenInterface tokenOut, uint totalAmountOut, uint maxTotalAmountIn, uint nPools) public payable
Calculates and executes most optimal swaps across a max of nPools for tokenIn > tokenOut swap with a desired output token amount = totalAmountOut.
Last modified 2yr ago