Liquidity Pools

Native Public Liquidity Pools

Native offers a diverse selection of liquidity pool frameworks to drive community-centric liquidity solutions for various project teams. We're also continuing to develop other models.

They enable users to deploy liquidity into these liquidity pools, whereby the liquidity pool will give allowance to the NativePool, functioning as the treasury. Swap fees accumulate directly within the liquidity pool contract. Users have the capacity to withdraw their liquidity along with any accrued fees.

Moreover, Native allows project teams to distribute additional rewards, encouraging users to stake their LP tokens and harvest further rewards made available by the project team.

NativeUniswapV2LiquidityPool

The NativeUniswapV2LiquidityPool contract mimics the Uniswap V2 operations.

Upon initialization, two token types, representing the trading pair for the liquidity pool, are defined. It also issues an LP token signifying ownership in the liquidity pool, which is minted or burned when liquidity is added or removed.

Users can add or remove liquidity through functions, specifying desired amounts, minimum thresholds, recipients of LP tokens, and a deadline for transactions. The contract ensures fairness when removing liquidity, determining the proportion of the pool owned by the LP tokens, and ensuring the user receives their share.

The contract also maintains the "k" constant product, crucial for accurate token swap pricing. Project teams can integrate this contract for a community-focused liquidity solution, promoting a more efficient DeFi ecosystem.

NativePMMLiquidityPool

The NativePMMLiquidityPool contract creates a liquidity pool with built-in mechanisms to support professional market makers (PMMs). A PMM is a type of market participant that provides liquidity in a marketplace by being willing to buy and sell securities for their own account.

In this setup, the contract maintains a list of tokens with detailed parameters including a cap (maximum amount that can be held), withdrawal limit percentage (maximum percentage of tokens that can be withdrawn within a given time frame), and a withdrawal limit period (the timeframe for the withdrawal limit).

With these features, the NativePMMLiquidityPool contract ensures a smooth operation of the liquidity pool. When tokens are added to the pool, the contract verifies that the token balances don't exceed the set cap. This helps prevent any single token from dominating the liquidity pool.

Moreover, the contract manages withdrawal limits to ensure the stability of the pool. When a user attempts to remove tokens from the pool, the contract checks whether the requested amount exceeds the allowed limit. If it does, the transaction is halted. This helps keep the liquidity pool healthy by preventing sudden large-scale withdrawals.

The contract also offers functions for updating token information, including their cap, withdrawal limit percentage, and withdrawal limit period. This allows the PMM to adapt the liquidity pool parameters based on market conditions and strategy.

One of the unique features of this contract is that it allows for a designated PMM to rebalance the pool by transferring tokens. This can be essential in volatile markets where quick adjustments may be needed.

NativeFixedPriceLiquidityPool

The NativeFixedPriceLiquidityPool contract establishes a fixed-price liquidity pool for two distinct tokens (X and Y) with a predetermined ratio. This type of pool enables users to deposit or withdraw either token and receive Liquidity Provider (LP) tokens proportional to their deposit.

The key point of this liquidity pool is that the price between token X and token Y is always fixed, ensuring that the pool has sufficient balances for both tokens.

When users deposit tokens, the contract calculates the LP token price to determine how many LP tokens the depositor receives. This calculation is based on the total value of the tokens in the pool.

When withdrawing tokens, the contract determines the amount of tokens users can withdraw by calculating the value of their LP token balance in relation to the total supply. The options for withdrawal can be one or both tokens, depending on the pool's balance.

The contract also manages swap transactions between token X and Y, accruing a fee with each transaction. This fee leads to LP token price appreciation, meaning withdrawing users will receive more underlying tokens, while new depositors will receive fewer LP tokens for the same amount of deposit.

Built on top of several OpenZeppelin contracts, NativeFixedPriceLiquidityPool is non-reentrant for security purposes and makes use of the TransferHelper library for safe transfers. It's a valuable tool for projects looking to establish a fixed-price liquidity pool between two tokens.

Last updated