*2.2. Constant Product Market*

Constant product AMM (CPAMM) cost function for *n* assets is defined as follows:

$$\mathcal{C}(\mathbf{x}) = \prod\_{i=1}^{n} \mathbf{x}\_i \tag{6}$$

where *C*(*x*) set as a constant.

Constant product AMM has many advantages that makes it suitable to be used in DEXs—it is simple to code into the smart contract, it is a convex function which meets the principles of supply and demand and it is also liquidity sensitive. Although it has been shown in [27] that prices in such a DEX can be inaccurate during volatile markets, this cost function still remains the most popular and being utilized by large DEXs, such as Uniswap [28,29].

Decentralized exchange pools consist of two tokens and Equation (6) becomes the following:

$$
\alpha \times y = k \tag{7}
$$

where *k* is the constant, *x* is the amount of the first token and *y* is the amount of the second token.

The price for each token in a pool can be calculated by simply dividing the number of tokens in one reserve to the number of tokens in another. A more detailed review of constant product markets is given in [30,31].
