Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Pool Factory

Description

The Pool Factory is the public entry point for creating pools. It holds a whitelist of privileged creators and the default settings presets, and on a create request it supplements the message with router data (such as the Default Pool Admin) and asks the Router to deploy the pool. Anyone may request a pool: a whitelisted creator can pick its own preset and take the Controller/Creator roles, while a non-whitelisted caller gets the default preset. A pool born through the factory can never be granted the privileged ALM Vault or Arbiter roles. The factory admin manages the whitelist and the factory's own parameters.

Interface

getPoolFactoryData

(address, address, int, cell, cell) getPoolFactoryData ()

This function provides current state of the user account

Return Values

#TypeDescription
0addressadmin_address Address of the admin of this Pool Factory
1addressrouter_address Address of the router that this Pool Factory is attached to
2intton_price Amount of ton taken as fee during Pool Creation (so far usually 0)
3cellnftContent Content of Pool that would be presented as Nft Collection
4cellnftItemContent Content of Position NFT that would be presented as NFT

getWhitelist

(dict) getWhitelist ()

This function provides current whitelist of the wallets that are allowed to get more granular control on creation.

Return Values

#TypeDescription
0dictwhitelist Dictionary with whitelist of the Pool Factory

Messages

POOL_FACTORY_CREATE_POOL

Opcode : 0x9e9a8f7f

Message that initiates pool creation
Access Rights: Open to anyone. The factory treats senders differently: a whitelisted address may choose its own pool preset (fee, tick spacing, active flag, NFT content) and become the pool's Controller and Creator, while a non-whitelisted sender gets the default preset with the Default Pool Admin as Controller and Creator. Whoever calls it pays for deployment; the factory then asks the Router to create the pool. A pool created through the factory cannot be granted the ALM Vault or Arbiter roles.

PathMnemonicTypeDescription
op Uint(32),op
query_id Uint(64) queryid as of the TON documentation
jetton0Minter Address(267) Minter address of the first jetton
jetton1Minter Address(267) Minter address of the second jetton
initial_priceX96 Uint(160),PriceX96 Initial price for the pool
settings Uint(16) Value that describes pool configuration preset
0 Cell(0) wallet_cell Cell With Wallets.
0 jetton0Wallet Address(267) Address of the jetton0 wallet of the Router
0 jetton1Wallet Address(267) Address of the jetton1 wallet of the Router
1 Cell(0) settings_cell Cell With Settings for Whitelisted
1 fee Uint(16) Custom LP fee in FEE_DENOMINATOR parts (FEE_DENOMINATOR=10000, so 1 = 0.01%). Applied only if the sender is whitelisted with allow_set_settings
1 tickSpacing Uint(24) Custom tick spacing. Applied only if the sender is whitelisted with allow_set_settings
1 active Uint(1),Boolean Whether the new pool starts active (unlocked). Applied only if the sender is whitelisted with allow_set_active
1 nftContent Cell(1),Maybe Custom NFT collection content for the pool. Applied only if the sender is whitelisted with allow_set_content
TL-B Description This is a preliminary tl-b - subject to change **Tlb for POOL_FACTORY_CREATE_POOL**
POOL_FACTORY_CREATE_POOL#9e9a8f7f 
    query_id:uint64
    jetton0Minter:MsgAddress
    jetton1Minter:MsgAddress
    initial_priceX96:uint160
    settings:uint16
    wallet_cell:^Wallet_cellType
    settings_cell:^Settings_cellType   // optional ref (present only if a ref is left)
= ContractMessages;
_ 
    jetton0Wallet:MsgAddress
    jetton1Wallet:MsgAddress
= Wallet_cellType;
_ 
    fee:uint16
    tickSpacing:uint24
    active:uint1
    nftContent:(Maybe ^Cell)
= Settings_cellType;