Starting the pool

Last modified:

Starting the pool

Suppose a liquidity provider initializes an empty CenturionDEX v2 pool by depositing x>0x > 0 units of token XX and y>0y > 0 units of token YY. Since the pool has no pre-existing reserves, there is no reserve ratio that the initial deposit must satisfy. Therefore, any positive pair (x,y)(x, y) can be used to create the pool, and these deposited amounts become the initial reserves of the AMM.

Following the Centurion v2-style initialization rule, the amount of LP tokens minted at pool creation is determined by the geometric mean of the initial reserves. More precisely, if MINIMUM_LIQUIDITY=1000\mathrm{MINIMUM\_LIQUIDITY} = 1000, then on-chain the first liquidity provider receives

ΔS=xy1000,\Delta S = \lfloor\sqrt{xy}\rfloor - 1000,

provided that

xy>1000,\lfloor\sqrt{xy}\rfloor > 1000,

since the on-chain Math.sqrt returns the integer floor of the square root. Equivalently, the smallest xyxy that allows a successful first deposit is xy1,002,001xy \ge 1{,}002{,}001.

In addition, 1000 LP tokens are permanently locked by minting them to an unrecoverable address. Hence, the total LP token supply after initialization is

S=ΔS+1000=xy.S = \Delta S + 1000 = \lfloor\sqrt{xy}\rfloor.

It follows that, once the pool has been created, the total LP token supply is always bounded below by 1000. In practice, this permanently locked amount is negligible for a normally sized pool, but it ensures that a minimum quantity of LP tokens can never be redeemed.