R
R
Ref Finance
English
Search
⌃K

Ref v2 Pools

Pooling with Ref v2's Discretized Concentrated Liquidity AMM

Introduction

Ref v2's Discretized Concentrated Liquidity (DCL) pools are based on iZUMi Finance’s Discretized Liquidity AMM. Each DCL Pool is divided into many separate bins, each of which represents a slightly different swap rate between the two tokens in the pool. When a Liquidity Provider (LP) deposits their assets in a DCL Pool, they select a range of swap rates for which their assets can be used for swapping. In other words, their liquidity is “concentrated” within a specific range of swap rates, which is then distributed among separate, or “discrete”, bins along that range. This differs from the pools in Ref v1, where liquidity is evenly distributed throughout the curve of the constant product formula (x * y = k).
Liquidity Distribution in a DCL Pool
To determine the swap rate, the exchange uses a virtual constant product curve, derived from the total liquidity in the pool and how it is distributed. When a swap takes place, the exchange identifies which bins to use for the transaction. It treats each bin as if it were a pool, and manages each one separately using a method based on the constant sum formula (x + y = z).
Virtual vs Real Reserves in DL Pools
When a swap takes place against a DCL pool, only the LPs with assets placed within bins utilised for the swap will receive a share of the swap fees, in proportion to their share of the liquidity within those bins. This differs from the pools in Ref v1, where fees are shared among all LPs in proportion to their share of the liquidity within the entire pool. Another way Ref v2 differs is that a LP’s share of the fees is immediately allocated to them, and are not part of the pool’s liquidity.

Risks with DCL Pools

The more concentrated a LP’s liquidity is (i.e. the smaller the range of swap rates they choose when they deposit), the higher their share of the fees will be when their liquidity is used for a swap, compared to how much they would have received had they spread their liquidity over a wider range. However, there is also increased risk. If the overall swap rate goes outside the bounds they have chosen, their entire position will be converted to the token that is decreasing in value relative to the other.
For example, if a LP deposits USDC.e and NEAR within the range of 2.23572 - 2.730688 USDC.e/NEAR, and the value of NEAR drops below 2.23572 USDC.e, then their entire position will be converted to NEAR. If the value of NEAR goes above 2.730688 USDC.e, then their entire position will be converted to USDC.e.
Price points at which a position is converted into one token. The more concentrated a LP’s liquidity is, the higher the risk that their entire position will be converted to the token whose value is decreasing relative to the other.

Depositing Liquidity

To deposit liquidity in a DCL pool, first go to the "V2 Pools" tab on the Pools Page, click on a pool, and then click "Add liquidity".
DCL Pools are found in the "V2 Pools" tab of the Pools Page.
The "Add Liquidity" button is on each pool's detail page.
Choose a minimum and maximum rate that your assets can be used for swaps, and the amounts to deposit. There may be pools with multiple "Fee Tiers" to choose from. The higher the fee, the more you make from swaps that utilize your pool, but your pool is less likely to be selected for swaps than pools with lower fees.
The Add Liquidity form for a DCL pool.

Claiming Swap Fees

With Ref v2's DCL Pools, your share of the swap fees are immediately allocated to your account, and are not part of the pool’s liquidity. You can “claim” your share of the fees at any time, without removing any liquidity from the pool. However, adding or removing liquidity will automatically transfer any unclaimed tokens to your wallet.
Clicking the "Claim" button will transfer your share of the swap fees to your wallet.

Adding More Liquidity

If you want to add more liquidity to a pool, you will be given two choices. You can add more liquidity to your existing position, or you can create a new position and select a different range to deposit your liquidity in.
You are presented with this form when adding liquidity to a pool that you already have a position in.

Removing Liquidity

After clicking the "Remove" button on the pool page, you will have the option of removing all your liquidity, or only a portion of it. Removing any liquidity will automatically transfer any unclaimed tokens from swap fees to your wallet.
You can remove some or all of your liquidity.