OrdiAMM
Last updated
Last updated
OrdiFi's AMM model innovates on the Automated Market Maker (AMM) concept by integrating Bitcoin's secure and decentralized nature with the flexibility of RGB smart contracts. It allows for the creation of liquidity pools for BRC-20 assets, maintaining equilibrium through a constant product formula. Users can provide liquidity by locking in assets and receive liquidity tokens in return, which represent their share of the pool and entitle them to a portion of the trading fees. OrdiFi's model is designed to be fast, secure, and efficient, leveraging the speed of the Lightning Network for rapid settlements and ensuring asset security with robust commitment schemes. This approach offers a Bitcoin-native DeFi solution with the potential for broad and diverse liquidity provision and trading.
The AMM model depicted in the OrdiFi is based on the "x * y = k" pricing formula, where x and y represent the reserves of two different tokens in a liquidity pool, and k is a constant. This ensures that the product of the token reserves remains constant after each trade. When a trade occurs, a trader adds Δx of token X to the pool and removes Δy of token Y from the pool. The fee for each trade (ρ) adjusts the effective reserves, impacting the price and the tokens received.
α = Δx / x represents the proportion of token X added relative to the current reserve.
β = Δy / y represents the proportion of token Y removed relative to the current reserve.
γ = 1 - ρ, where ρ is the fee percentage (default 0.003%), adjusts the reserves to account for the trading fee.
The new reserves, x' and y', are calculated considering these ratios and the fee. The fee (ρ) slightly increases the product of reserves, meaning that x' * y' is greater than x * y post-trade when ρ > 0, which is the fee's impact on the liquidity pool.
Adding liquidity to an AMM is the process by which investors provide capital to a liquidity pool, which is used to facilitate trades between different assets.
Liquidity providers (LPs) deposit pairs of assets in a ratio that maintains the pool's current price. This action increases the pool's depth and ensures there is enough capital to execute trades without significant price slippage.
The mathematical representation of adding liquidity is as follows:
For BTC: e' = (1 + α)e
For Token: t' = (1 + α)t
For Liquidity Tokens: l' = l + Δl
Where α = Δe / e
, representing the proportional increase in reserves.
LPs earn fees from trades happening in the pool. These fees are:
Proportional to their share of the pool
A critical reason for investors to become LPs
Vital for the sustainability and growth of DeFi on Bitcoin
Removing liquidity is the process where liquidity providers withdraw their funds from a liquidity pool.
When removing liquidity, LPs redeem their liquidity tokens to reclaim their share of the pool's reserves, often receiving a proportional amount of both assets in the pool.
The removal of liquidity is calculated by:
For BTC: e' = e - Δe
For Token: t' = t - Δt
For Liquidity Tokens: l' = l - Δl
Here, Δe
and Δt
are the amounts of BTC and tokens being withdrawn, respectively.
By removing liquidity, LPs can realize their accrued fees and any potential gains from asset price fluctuations. This process is integral to the AMM ecosystem, allowing LPs to exit the market and freeing up their capital.