Component: cetus_clmm/factory.move
Description
The factory module is responsible for the creation of new liquidity pools for given coin pairs. The pool manager can create pools with any specifications using the create_pool function as well as register permissioned pairs and manage allowed coins. Other users can create pools via the create_pool_v2_ function — but only with a coin pair that is not in the denylist. Coin creators who have a CreationCap can register a base coin with allowed quote coins to prevent pool creation.
Invariants
Each pool key (combination of base coin, quote coin, and
tick_spacing) must remain unique.The initial price of a pool must be within the valid range.
When registering a token pair, the quote coin must be included in the allowed pair configuration.
The
CreationCapcan only register pools for their associated coin types.Tick spacing must exist within the designated fee-tier configuration.
When creating a pool with the
create_pool_v2_function, the initial liquidity added must be nonzero.The token pair must not be in the denylist.
Test coverage
Cases covered
Coin allowlist and denylist management
Correct coin-type--ordering validation
Pool creation with
CreationCapFee-tier validation during pool creation
Init-price validation for pool creation