Lowest slippage swap
Our protocol implements an algorithm that can reach the lowest slippage during token swap in Uniswap V2 like DEX. Just like 1inch, our algorithm supports all major protocols in Polygon, including QuickSwap, SushiSwap, Dfyn, Kyber DMM, WaultSwap, JetSwap, and more.
Swap Exact Tokens for Tokens in lowest slippage
Suppose that you want to swap exact USDC to WETH through several Uniswap V2 like DEX using only USDC-WETH LP. In 1inch, they will split the swap across all supported DEX. Our algorithm does a similar thing.
For Uniswap V2 like DEX, the swap can be described as the following function
where
is the input USDC amount to the -th DEX
is the swap fee for the -th DEX
is the WETH reserve in the -th DEX
is the USDC reserve in the -th DEX
is the output WETH amount
We need to optimize the following function
Using the method of Lagrange multipliers, we can find the optimal solution for
Swap Tokens for Exact Tokens in lowest slippage
Suppose that you want to swap some USDC to get exact WETH through several Uniswap V2 like DEX using only USDC-WETH LP.
For Uniswap V2 like DEX, the swap can be described as the following function
where
is the output WETH amount to get from the -th DEX
is the swap fee for the -th DEX
is the WETH reserve in the -th DEX
is the USDC reserve in the -th DEX
is the minimum input USDC amount needed
We need to optimize the following function
Again, using the method of Lagrange multipliers, we can find the optimal solution for
Last updated
Was this helpful?