Identifying the best path, price, and price Impact
Best path, price, and price impact are three of the most important pieces of information before the user makes a decision for the transaction. If the price is not good or the price impact is too high, the user may not proceed with the transaction. The price and price impact are calculated based on the path the DeFi app selected. So, it is important to select a swapping path to make the deal. Compared to other paths that can make the swap, the best swapping path can do one of the following:
- Receive more tokens when an amount of spending tokens is specified
- Spend fewer tokens when an amount of receiving tokens is specified
Based on these principles, selecting the best path is determined by the following two types of factors:
- The amounts of tokens in the reserves of the liquidity pools for every token pair along the path
- The spending token amount or the receiving token amount specified by the user