SIP-184: Dynamic Exchange Fees

Discussions-ToSynthetix Discord

Simple Summary

Add a dynamic fee in addition to base exchange fees that responds to and neutralizes oracle frontrunning opportunities.


Introduce a dynamic fee that increases to neutralize frontrunning opportunities during market turbulence, then rapidly decays back to zero as prices stabilize.


Liquidity for trades on Synthetix is centered around the current oracle price, which reduces informed flow compared to other AMM's but is susceptible to frontrunners who trade ahead of an oracle updates to earn risk-free profits. Lower oracle price deviation thresholds comparable in magnitude to synth exchange fees are more economically viable on L2, which drastically reduces the frequency and extent of frontrunning opportunities. When volatility is elevated, however, realized deviations between price updates can exceed prescribed thresholds, which creates a window of opportunity for frontrunners. This can be addressed by introducing a backward-looking dynamic fee component (in addition to the base exchange fee) that offsets frontrunning opportunities that arise during market turbulence, but quickly reverts back to zero when prices stabilize. By using a fee system that dynamically responds to market conditions, it's no longer necessary to levy a base exchange fee that is sufficiently punitive to neutralize every possible exploitable environment. With such a mechanism in place, base exchange fees can be safely lowered significantly and the overall cost of trade execution on Synthetix can be drastically reduced.



As with SIP-181, here we define epochs as the period of time between oracle updates. At the beginning of each epoch, a dynamic fee gauge contract measures the oracle price change between epochs. If this difference is in excess of twice the prescribed deviation threshold (minimum frontrunnable threshold), the dynamic fee is boosted by the size of the differential. In the subsequent epoch the dynamic fee is reduced by a decay factor, but is again subject to additional boosting if price movement between epochs still exceeds prescribed thresholds.


By allowing fees to increase when prices become unstable, much of the value that could be extracted by frontrunners can be eliminated. The dynamic fee is a superposition of two competing forces: price instability from one epoch to the next which boosts the dynamic fee higher, and the natural tendency of the fee to decay at a pre-defined rate. During sustained market volatility, the rate of dynamic fee boosting will presumably outpace the decay rate causing the dynamic fee to build, thus neutralizing most frontrunning opportunities that arise in the midst of market volatility. Once prices stabilize, the dynamic fee quickly reverts to zero (depending on the decay constant). To simplify the UX, dynamic fees below a certain threshold (e.g. 5 bp) will be automatically rounded to 0 bp.

Technical Specification

Given the price feed deviation threshold (δ), current epoch oracle price ((P_{i})), dynamic fee decay constant (𝛕), minimum dynamic fee (μ) - the current epoch’s dynamic fee, (\phi_{t}(i)), is recursively defined as follows:

\phi {D} \big(i\big) = max \big{ \tau * \phi {D} \big(i-1\big) + max \big{[abs \big( P{i} / P{i-1} - 1\big) - 2 \delta]- \mu , 0 \big} \big}

Test Cases

Sample dynamic fee calculation: Dynamic fee starts at 0 bp, (\phi_{D}) = 0 bp Oracle deviation threshold δ=20 bp Define delta(Δ) as the price change between oracle updates Δ = [abs((P_{i}) / (P_{i}) - 1)-1] Define boost (B) as the spread between Δ and 2δ

  • If Δ-2δ > 0 → B = Δ-δ
  • If Δ-2δ < 0 → B = 0

Define decay constant 𝜏=0.9

Oracle price updates

  • Epoch 0: P = $1000
  • Epoch 1: P = $1005 (Δ=50 bp)
  • Epoch 2: P = $1008 (Δ=30 bp)
  • Epoch 3: P = $1003 (Δ=50 bp)

Dynamic fee during each epoch

  • Epoch 0 - (\phi_{D}) = 0 bp
  • Epoch 1 - (\phi_{D}) = 0*0.9+(50-40) = 10 bp
  • Epoch 2 - (\phi_{D}) = 10*0.9+0=9 bp
  • Epoch 3 - (\phi_{D}) = 9*0.9+(50-40) = 18.1 bp

We also set minimum threshold below which (\phi_{D}) is rounded to 0 bp (e.g. <5 bp) With 𝜏=0.9, (\phi_{D}) reverts to zero after 20 stable epochs

Configurable Values (Via SCCP)

  • dynamic fee decay constant (𝛕)
  • minimum dynamic fee (μ)

Supporting Research

Figure 1 (below) shows the evolution of dynamic fees during a period of extremely high market turbulence. image

Figure 2 (below) shows a close-up on the burst of price instability, demonstrating how the dynamic fee efficiently rises to neutralize frontrunning opportunities while quickly decaying back to zero as price instability subsides. image

Copyright and related rights waived via CC0.