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
| Index | Type | Size (b/r) | Cell | Name | Description |
|---|---|---|---|---|---|
| 1 | addr | 267 / 0 | 1 | pool_factory::admin_address | Admin address. Only this address can change pool creation parameters |
| 2 | addr | 267 / 0 | 1 | pool_factory::router_address | Router address. Address of the pool to witch pool creation request will be forwarded |
| 3 | coins | 124 / 0 | 1 | pool_factory::ton_price | Ton price that is taken form the pool creator to discourage pool creation spam |
| 4 | cell | 0 / 1 | 1 | pool_factory::order_code | Code of pool factory order subcontract. It is used internally and have no user callable methods |
| 5 | cell | 0 / 1 | 1 | pool_factory::nftv3_content | packed metadata that would be given to nft that corresponds to nft collection |
| 6 | cell | 0 / 1 | 1 | pool_factory::nftv3item_content | packed metadata that would be given to nft that corresponds to the position |
Cells
| Name | Size | Free |
|---|---|---|
| 1 | 658 | 365 |
Interface
getPoolFactoryData
(slice, slice, int, cell, cell) getPoolFactoryData ()
Returns current settings of the pool factory
Return Values
| # | Type | Description |
|---|---|---|
| 0 | slice | address containing the pool_factory::admin_address |
| 1 | slice | address containing the pool_factory::router_address |
| 2 | int | int containing the pool_factory::ton_price |
| 3 | cell | int containing the pool_factory::nftv3_content |
| 4 | cell | int containing the pool_factory::nftv3item_content |
getOrderAddress
(slice) getOrderAddress (slice jetton0MinterAddr, slice jetton1MinterAddr)
Returns future order address
Return Values
| # | Type | Description |
|---|---|---|
| 0 | slice | address 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
| NO | fee | tick_spacing |
|---|---|---|
| 1 | 0.01% | 10 |
| 2 | 0.3% | 60 |
| 3 | 1% | 200 |
| Path | Mnemonic | Type | Description |
|---|---|---|---|
| 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;