Volatility Mitigation Mechanism

Mitigation mechanism represents a process that reduces/eliminates long-term risks to people and property from some dangers, like extreme price changes that could happen due to the principles of how token prices are estimated conform to the next formula:

And with the enhanced version of this formula set in the core of the AMM:

Where k is presenting a constant balance of assets. This structure leads to the problem of price regulation when big swaps of the tokens are able to cause extreme changes in the token prices and therefore decline pool price distributions from following the external markets and lead to the total elimination of the pool activity due to broken pool parameters.

AMM problem or why is mitigation required?

A transaction size can lead to a negative impact on the price distribution and cause great deviation depends on the size of pool reserves. Considering that there can be some external factors causing extreme changes in token prices it is required to set an algorithm that will be able to “smooth” price distribution and be adaptive to the market changes. For example, in the case below there is the same transaction performed on the same pool with different reserves sizes:

A regulation algorithm must adapt in such a manner that the first case could be blocked because of a big price impact and in the second case transaction would not be blocked considering price distribution before the reviewed one.

Mitigation mechanism working principle

What is required to be done before a mitigation check?

Here is a detailed overview of the verification of the transaction to check if it matches mitigation requirements, or if it should be declined. This overview will be based on the mechanisms that were applied for simulations of the trades and the comparison of distributions with and without mitigation mechanisms.

Before mitigation verification, it is required to perform verification of whether the reserves do pool contain enough reserves of both tokens to execute the transaction, or not and then verify slippage of the transaction if one was applied check if the price of token exchange is not too far from the expected by trader value. If both checks are passed, then a mitigation check is performed.

How is the mitigation check performed?

The mitigation mechanism takes transaction for verification if it successfully passed previous verifications and mitigation mechanism work is enabled. Verification of the transaction is based on finding the slice factor of the transaction, which requires a calculation of tokens out values with applied system fees to see how reserves after performing the transaction will look like.

The mitigation mechanism takes transaction for verification if it successfully passed previous verifications and mitigation mechanism work is enabled. Verification of the transaction is based on finding the slice factor of the transaction, which requires a calculation of tokens out values with applied system fees to see how reserves after performing the transaction will look like.

and then calculates a slice factor curve using the formula:

This slice factor curve will estimate margins (limits) of price distribution (or forms a “tunnel” where transaction should be placed to pass the check, the principle is shown above), but in case if curve sets too high margins it is possible to reduce them to smaller window manually (estimated acceptable deviation for pool). After preparing “margins” to perform transaction verification it is required to find how the transaction deviates from the expected distribution. The algorithm calculates out a value that should have been placed in case the tokens would have been exchanged conform TWAP value:

After calculating TWAP-estimated out value, is calculated difference between the transaction-estimated out the value of the token and TWAP-estimated out value of the token:

The final check is in comparison of the found out value difference with the slice factor curve, conform the next principle:

After all, those verifications can be estimated if a transaction can pass and can be executed or should be declined.

Last updated