> ## Documentation Index
> Fetch the complete documentation index at: https://docs.meteora.ag/llms.txt
> Use this file to discover all available pages before exploring further.

# DAMM v2 Dynamic Fees

> Learn how DAMM v2 dynamic fees add a volatility-responsive fee layer on top of the selected base fee mode.

DAMM v2 dynamic fees are an optional fee layer that responds to market volatility. When price movement is higher, the dynamic fee can increase. When the market calms down, the dynamic fee decays.

This gives pools a way to charge more during turbulent periods without permanently raising the base fee.

## How It Fits With Base Fees

Every DAMM v2 pool has one base fee mode. Dynamic fees sit on top of that base fee:

```math theme={"system"}
\text{Total Trading Fee} = \text{Base Fee} + \text{Dynamic Fee}
```

If dynamic fees are disabled, the dynamic fee is zero.

## How It Works

DAMM v2 tracks recent price movement through a volatility accumulator. The accumulator rises when price changes and can decay or reset over time.

Key settings include:

| Setting                    | Product Meaning                                                                |
| -------------------------- | ------------------------------------------------------------------------------ |
| Bin step                   | Price sensitivity used by the volatility calculation; currently fixed to 1 bps |
| Filter period              | Very short-term window that helps smooth noisy updates                         |
| Decay period               | Time window after which volatility can decay or reset                          |
| Reduction factor           | How much of the previous accumulator becomes the next volatility reference     |
| Max volatility accumulator | Cap that prevents the volatility measure from growing without bound            |
| Variable fee control       | How strongly volatility affects the final dynamic fee numerator                |

The dynamic fee numerator is:

```math theme={"system"}
\left\lceil
\frac{(\text{Volatility Accumulator} \times \text{Bin Step})^2 \times \text{Variable Fee Control}}{100{,}000{,}000{,}000}
\right\rceil
```

## Validation Limits

The current implementation enforces:

| Parameter                          | Constraint                                         |
| ---------------------------------- | -------------------------------------------------- |
| `bin_step`                         | Must equal `1`                                     |
| `bin_step_u128`                    | Must equal the default fixed-point value for 1 bps |
| `filter_period` and `decay_period` | `filter_period < decay_period`                     |
| `reduction_factor`                 | At most `10000`                                    |
| `variable_fee_control`             | At most `0xffffff`                                 |
| `max_volatility_accumulator`       | At most `0xffffff`                                 |

Operators can enable or update dynamic fees with non-default dynamic fee parameters. Passing default dynamic fee parameters disables dynamic fees, but only if dynamic fees are already enabled.

## Why Use Dynamic Fees

<CardGroup cols={2}>
  <Card title="Volatility Response" icon="wave-pulse" iconType="solid">
    Fees can increase when market movement becomes more intense.
  </Card>

  <Card title="LP Compensation" icon="hand-holding-dollar" iconType="solid">
    LPs can earn higher fees during periods where price risk may be higher.
  </Card>

  <Card title="Temporary Protection" icon="shield" iconType="solid">
    The fee can decay as volatility settles instead of staying elevated forever.
  </Card>

  <Card title="Works With Base Modes" icon="layer-group" iconType="solid">
    Dynamic fees can be paired with DAMM v2 base fee modes for more adaptive fee design.
  </Card>
</CardGroup>

## Product Examples

<AccordionGroup>
  <Accordion title="Launch With Extra Volatility Protection">
    A launch pool can use a time scheduler or market cap scheduler as the base fee, then add dynamic fees to react to sudden price movement.
  </Accordion>

  <Accordion title="Mature Pool With Adaptive LP Fees">
    A long-term pool can keep a moderate base fee and let dynamic fees increase only when trading becomes volatile.
  </Accordion>

  <Accordion title="Integrator-Controlled Risk Settings">
    Launchpads can create fee presets with different dynamic fee sensitivity for different token categories.
  </Accordion>
</AccordionGroup>

## Important Takeaway

Dynamic fees are not a replacement for the base fee. They are an adaptive layer. The base fee defines the pool's default fee behavior, while the dynamic fee responds to recent market movement.
