Swaps and Range Orders

Swaps

Swaps on Pearl are completely permissionless and a fairly simple process.

  1. User chooses an ERC-20 token they have and the token you want to exchange it for

  2. A swap is processed, trading the current token for a proportional amount of the desired tokens, account for the relative price of one token vs the other, slippage and price impact. A swap fee is deducted and sent to liquidity providers.

Swapping via the Pearl website may result in a different execution behavior compared to interacting directly with the protocol smart contracts.

Most swaps will use the concentrated liquidity pools on Pearl. See here for more technical details on the swap transactions.

Supported Tokens

The concentrated liquidity pools in Pearl's v2 deployment were developed by the team to support rebasing tokens, making them some of the most advanced AMM products in the DEX space.

Our concentrated liquidity pools do not support fee on transfer i.e. tax tokens. Any token with these features will default back to a constant product pool on Pearl. These pools are simple forks from Uniswap v2 and do not have an associated gauge.

Price Impact

In automated market makers like Pearl, price impact occurs when an asset's relative value shifts during the swap transaction, resulting a final execution price between the start and end points of the swap. This is inherent to AMM design.

Price impact varies with liquidity levels at different prices. More liquidity at a price point means lower price impact for a swap, and vice versa.

Pearl's interface estimates price impact in real-time, alerting users to potential high impacts during swaps, allowing for informed decision-making.

Slippage

When using Pearl for swaps, it's crucial to consider slippage. Slippage refers to potential price changes while a transaction is pending.

Transaction execution order on re.al depends on the gas fee paid. Higher fees mean quicker execution, while lower fees lead to uncertain wait times. During this wait, ongoing swaps can alter the price environment.

Slippage tolerance sets an acceptable price change limit beyond the initial impact. The transaction proceeds if the final price is within this range, like %1. If it falls outside, the transaction fails, preventing the swap.

Safety Checks

Price impact and slippage can vary during a transaction's pending status, leading Pearl to implement several safeguards to shield users from significant execution environment shifts. Key safety checks include:

Expired: This error occurs if a swap exceeds a set deadline. To prevent risks from extended pending times and associated price fluctuations, swaps are automatically canceled past this deadline.

INSUFFICIENT_OUTPUT_AMOUNT: Pearl provides an estimated output for the token being purchased. If the actual swap output significantly deviates from this estimate, beyond the slippage tolerance, the swap is canceled. This measure is designed to protect users from substantial, unfavorable price shifts while their transaction is in limbo.

Range Orders

Customizable liquidity positions and single-sided asset provisioning open the door to range orders as a novel swapping approach with automated market makers.

Using Pearl, users can mimic a limit order by supplying a single asset as liquidity within a chosen range. Similar to traditional limit orders, range orders are placed anticipating future execution, with the target asset withdrawable once the spot price traverses the entire order range.

Unlike traditional markets, range order makers on Pearl earn fees during order fulfillment, as these orders are essentially a type of liquidity provision, not standard swaps.

To completely exit in the chosen asset, it's important to monitor the order and withdraw your liquidity once it's filled. Unlike traditional limit orders, range orders will be unfilled if the spot price moves beyond the set range and then reverses, crossing back before you withdraw the target asset.

Last updated