The mathematics of AMMs
AMMs are a type of DEX that rely on mathematical formulas to set the price of a token. The trading process and determination of the price are done automatically without depending on other traders.
As we discussed previously, the concept of liquidity pool plays the most important role for AMMs. An liquidity pool typically consists of two or more types of crypto assets. Here, we want to introduce the term relation function of a liquidity pool. We will walk through the concept to understand how liquidity pools work.
Relation functions
A liquidity pool usually has a formula to define the relations and constraints of assets (there could be two or more assets in the liquidity pool). Here, we relation functions come into scope.
A relation function of the types of assets in liquidity pools defines how the specific AMM works. A relation function defines the conditions the reserves of all types of assets in a liquidity pool must satisfy. The market makers...