Factory is the implementation of DEX-as-a-service way to use DEX pool. Factory is used for deploying new DEX pools as separate contracts for some fee in QUIPU tokens. Also factory contract store and manage developer config from Developer module. Also
developerrepresents admin of factory contract.
Factory storage contains init lambda, DEX contract lambdas, configuration of deploy price and burn rate, whitelist, and mapping of deployed pools.
Factory should store many methods, so some of that stored in lambdas inside storage. These lambdas should be set before usage of the contract.
This section called only by
Initialization of new DEX separated into 2 stages because of gas transaction limits.
The first stage deploys the contract and all lambdas except
dex_lambdas(the heaviest lambdas by size) and charges QUIPU tokens but the contract has not started yet (frozen).
The second stage should be called by caller address of the first stage and performs set of DEX lambdas to deployed DEX, unfreezes the contract, and call invest (as initial invest) of underlying tokens.
The link below describes the usage of deployed DEX contract and its storage.
As a developer, you could manage the dev fee rate, set the deploy price, and its burn percent. Also, the developer could add and remove addresses to the whitelist (for deploying new pools without charging QUIPU).