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

This contract implements the creation of the pools. And works as a proxy to CREATE_POOL message of the router

Data Storage

IndexTypeSize (b/r)CellNameDescription
1addr 267 / 01pool_factory::admin_addressAdmin address. Only this address can change pool creation parameters
2addr 267 / 01pool_factory::router_addressRouter address. Address of the pool to witch pool creation request will be forwarded
3coins 124 / 01pool_factory::ton_priceTon price that is taken form the pool creator to discourage pool creation spam
4cell 0 / 11pool_factory::order_codeCode of pool factory order subcontract. It is used internally and have no user callable methods
5cell 0 / 11pool_factory::nftv3_contentpacked metadata that would be given to nft that corresponds to nft collection
6cell 0 / 11pool_factory::nftv3item_contentpacked metadata that would be given to nft that corresponds to the position

Cells

NameSizeFree
1658365

Interface

getPoolFactoryData

(slice, slice, int, cell, cell) getPoolFactoryData ()

Returns current settings of the pool factory

Return Values

#TypeDescription
0sliceaddress containing the pool_factory::admin_address
1sliceaddress containing the pool_factory::router_address
2intint containing the pool_factory::ton_price
3cellint containing the pool_factory::nftv3_content
4cellint containing the pool_factory::nftv3item_content

getOrderAddress

(slice) getOrderAddress (slice jetton0MinterAddr, slice jetton1MinterAddr)

Returns future order address

Return Values

#TypeDescription
0sliceaddress where pool creation order is/will be deployed

Messages

POOL_FACTORY_CREATE_POOL

Opcode : 0x9e9a8f7f

Message that initiates pool creation

You need to pass jetton 0/1 masters(minters) of the coins for which to create the pool You also need to provide two wallet address for the jettons, these need to be the wallets belonging to the Router. Also price need to be provided in sqrt Q64.96 format Sqrt Q64.96 Format

Please note that price should be presented in pool internal format. This means that if you have two jettons - jetton0 and jetton1 and price 1 jetton0 = X jetton1, you need to check if the jettons are in pool natural order - slice_hash(jetton0_wallet_address) > slice_hash(jetton1_wallet_address). If it's not true you would need to invert your price. 1 jetton1 = (1/X) jetton0

Please note that pool factory checks for strict master/minter and wallet correspondence. This is done by onchain call to minter with PROVIDE_WALLET_ADDRESS message. If the minter is lacking this method pool creation is impossible

There are 3 settings presets

NOfeetick_spacing
10.01%10
20.3%60
31%200


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. Currently content is ignored
0 jetton0Wallet Address(267) Address of the jetton0 wallet of the Router
0 jetton1Wallet Address(267) Address of the jetton1 wallet of the Router
TL-B Description (TBD) 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:^[
        jetton0Wallet:MsgAddress
        jetton1Wallet:MsgAddress
    ]  
= ContractMessages;