Meteora Documentation home page
Search...
⌘K
GitHub
Faucet
Support
Developer Updates
Integration
Overview
DLMM
DAMM v1
DAMM v2
Introduction
Pool Fee Configs
DAMM v2 Formulas
Typescript SDK
Rust SDK
API
DBC
Alpha Vault
Stake2Earn
Dynamic Vault
Meteora Lock
Dynamic Fee Sharing
Launch Pools
DLMM Launch Pool
Alpha Vault Launch Pool
DAMM v1 Launch Pool
DAMM v2 Launch Pool
Meteora
Blog
Support
Meteora Documentation home page
Search...
⌘K
Ask AI
Meteora
Blog
Support
Search...
Navigation
DAMM v2
DAMM v2 Formulas
Overview
Anti Sniper Suite
Developer Guide
Resources
Legal
Overview
Anti Sniper Suite
Developer Guide
Resources
Legal
DAMM v2
DAMM v2 Formulas
Copy page
Copy page
DAMM v2 is a constant product AMM that operates between a
sqrt_min_price
and a
sqrt_max_price
.
Liquidity Addition / Removal
When adding or removing liquidity, for a given liquidity delta
ΔL
, the required token amounts are calculated as:
Δ
a
=
Δ
L
×
(
1
P
−
1
P
max
)
\Delta a = \Delta L \times \left(\frac{1}{\sqrt{P}} - \frac{1}{\sqrt{P_{\text{max}}}}\right)
Δ
a
=
Δ
L
×
(
P
1
−
P
max
1
)
Δ
b
=
Δ
L
×
(
P
−
P
min
)
\Delta b = \Delta L \times (\sqrt{P} - \sqrt{P_{\text{min}}})
Δ
b
=
Δ
L
×
(
P
−
P
min
)
LP Token Amount
Example from token B:
Token B Amount
=
LP Token
×
(
currentSqrtPrice
−
minSqrtPrice
)
2
128
\text{Token B Amount} = \frac{\text{LP Token} × (\text{currentSqrtPrice} - \text{minSqrtPrice})}{2^{128}}
Token B Amount
=
2
128
LP Token
×
(
currentSqrtPrice
−
minSqrtPrice
)
so you can reverse:
LP Token
=
Token B Amount
×
2
128
currentSqrtPrice
−
minSqrtPrice
\text{LP Token} = \frac{\text{Token B Amount} × 2^{128}}{\text{currentSqrtPrice} - \text{minSqrtPrice}}
LP Token
=
currentSqrtPrice
−
minSqrtPrice
Token B Amount
×
2
128
Farming Rewards
The farming rewards are calculated as:
Reward per token
=
Elapsed Time
×
Reward Rate
×
2
64
Total Liquidity
\text{Reward per token} = \frac{\text{Elapsed Time} \times \text{Reward Rate} \times 2^{64}}{\text{Total Liquidity}}
Reward per token
=
Total Liquidity
Elapsed Time
×
Reward Rate
×
2
64
User reward
=
Position Liquidity
×
(
Current Reward per Token
−
User Last Reward per Token
)
≫
64
\text{User reward} = \text{Position Liquidity} \times (\text{Current Reward per Token} - \text{User Last Reward per Token}) \gg 64
User reward
=
Position Liquidity
×
(
Current Reward per Token
−
User Last Reward per Token
)
≫
64
Price Impact
The price impact for a swap can be calculated as:
Price Impact
=
∣
New Sqrt Price
−
Old Sqrt Price
∣
Old Sqrt Price
\text{Price Impact} = \frac{|\text{New Sqrt Price} - \text{Old Sqrt Price}|}{\text{Old Sqrt Price}}
Price Impact
=
Old Sqrt Price
∣
New Sqrt Price
−
Old Sqrt Price
∣
Was this page helpful?
Yes
No
Previous
Getting Started
DAMM v2
Next
On this page
Liquidity Addition / Removal
LP Token Amount
Farming Rewards
Price Impact
Assistant
Responses are generated using AI and may contain mistakes.