Meteora Documentation home page
Search...
⌘K
Ask AI
Meteora
Blog
Support
Search...
Navigation
DAMM v2
DAMM v2 Formulas
Overview
Anti Sniper Suite
Developer Guide
API Reference
Resources
Legal
GitHub
Faucet
Support
Developer Updates
API Status
Introduction
Meteora Stack Overview
Quick Launch
DLMM Launch Pool
DAMM v2 Launch Pool
DAMM v1 Launch Pool
DBC Token Launch Pool
Invent with Metsumi
Metsumi Actions 💕
Metsumi Scaffolds 💗
Guides
DLMM
DAMM v1
DAMM v2
Introduction
Pool Fee Configs
DAMM v2 Formulas
Typescript SDK
Rust SDK
DBC
Alpha Vault
Stake2Earn
Dynamic Vault
Meteora Lock
Dynamic Fee Sharing
On this page
Liquidity Addition / Removal
LP Token Amount
Farming Rewards
Price Impact
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
Pool Fee Configs
Getting Started
Assistant
Responses are generated using AI and may contain mistakes.