Comment on page
In DerpDEX, a swap refers to the process of exchanging one ERC20 token for another ERC20 token. The tokens are swapped based on the current liquidity (the value of tokens) in a specific token pool. If the token pool is present in the DEX, the tokens will be swapped directly from the pool. Swap executes based on the current liquidity of the token pair in the pool.
Below is an example of USER swapping ETH for USDT.
If the token pool is not present, the DEX will automatically select the best route for swapping the tokens required by the user. Below is an example of how a user gets USDT out of their ETH if the ETH-USDT pool is not available.
This routing from one token pool to another is known as Smart Routing. It is a mechanism used to optimise the trade execution by finding the most efficient route for the swap across different liquidity sources. Click below to learn more on how DerpDEX utilises Smart Routing to simplify user experience and find best path to swap their tokens.
DerpDEX works based on Automated Market Maker and the price is not decided by any single entity. Price of any pair depends on the amount of liquidity present and the pool price is updated every time a Swap is done. As Liquidity varies at different price point, the price can vary. Simply put, more liquidity will results in less price impact.
Other than Price Impact, which provides the price of the asset based on pool, Slippage is the change of price that can occur while making a transaction on chain. When a transaction is executed from the UI, it takes some time on the chain for the Swap. The time taken depends on the gas provided by the user and the trades placed for the same liquidity pool .
Swapping a token requires some fee from the protocol, and the fee is proportionately distributed among liquidity providers. By participating in the liquidity provision, the user can earn incentives by providing liquidity to the pool.