Swap

Swaps are one of the most common interactions with a DEX. The mechanism of token swap is easy to understand, which is to sell the tokens that are currently owned by the swapper for the proportional amount of the destination tokens. In this process, a small percentage of swap fee will be deducted, which is the incentives to those liquidity providers.

The execution of swaps in Cetus protocol (or in most DEX platforms actually) is different from order book markets. An order book market usually follows a first-in-first-out policy and the time of your order matters, while our swaps execute against a passive liquidity pool and liquidity providers on Cetus will earn transaction fees proportional to their active liquidity that they contribute.

Price Impact

In an order book market or a CEX, the price impact of an order depends on the size and array of the opening limit buy or sell orders. The final execution price of an order is usually the weighted average price of multiple limit orders.

The price impact in an AMM or in a concentrated liquidity protocol is sort of different. During the swap, the relative value of one token to the other changes dynamically and continuously so the final execution price of a swap lies somewhere between the start price and end price. The price impact for a swap order will be affected by the real-time available liquidity in corresponding price space. The price impact will be much smaller for a given swap size if the liquidity depth at the particular price is higher.

Slippage

A swap user should have seen the term ‘slippage’ or ‘price slippage’ on a DEX before. That is the term that we use to describe the possible price change that may occur during a transaction is pending.

To respond to the possible price change, we adopt the concept of slippage tolerance. Slippage tolerance can be set by a user, which is to determine the largest price impact that the user is willing to accept. If the final execution price is outside of the acceptable slippage range, the transaction will get failed to protect the user’s interests.

A trade that uses assets and tokens that are purchased before paying for them. A trade that uses the tokens purchased before paying for them.

Last updated