| Constant Factor AMM
Last updated
Last updated
Each pool on Hyperswap holds reserves of two tokens, and the price of the tokens is determined by the ratio of these reserves. This system is designed to maintain a balance between the two tokens. Whenever a trade is made, the price of the tokens is updated based on the new ratio of reserves in the pool, following the constant product formula:
Where: x = quantity of Token A in the pool y = quantity of Token B in the pool k = constant product This formula ensures that large trades significantly impact the token price, leading to slippage.
Anyone can become a liquidity provider (LP) on Hyperswap by depositing an equivalent value of both tokens in a pool. For example, if you wish to provide liquidity to the ETH/USDC pool, you would deposit both ETH and USDC in equal value. In return, you receive liquidity provider (LP) tokens, which represent your share of the pool. LPs earn trading fees on every swap made in the pool, typically 0.3% per trade. These fees are added to the pool, increasing its total value and the value of the LP tokens. To withdraw liquidity, LPs can redeem their LP tokens for the underlying assets, along with their proportional share of the accrued fees.
A swap on Hyperswap V1 is the process of exchanging one ERC-20 token for another. Users can initiate swaps directly from their wallet by interacting with the Hyperswap Router.
When a swap is made, the price of the tokens in the liquidity pool adjusts based on the constant product formula mentioned earlier. A 0.3% fee is applied to each swap.
Prices are algorithmically determined by the ratio of tokens in a given liquidity pool. When a swap occurs, the relative quantities of the two tokens change, which updates the price. The larger the trade, the greater the price impact (slippage) due to the constant product formula.
For example:
A large trade on a small liquidity pool will result in a larger price movement. A small trade on a large liquidity pool will result in a minimal price movement.