Router
Last updated
Last updated
This contract implements the router and does the management of the pools. Due to the distributed nature of the TON Blockchain router, it can't do many checks, so it's mostly the proxy for the calls. The router contract so far is used as an owner of all the wallets holding the funds invested by liquidity providers.
The main idea is that if malformed or corrupted data is sent to the router it would create a malformed address of the pool and the message sent to it would fail. So if the message reaches the pool it means some criteria are satisfied.
Index | Type | Size (b/r) | Cell | Name | Description |
---|---|---|---|---|---|
(slice, slice, slice, int, int) getRouterState ()
returns router admin address
@return0 router admin address
(slice) getPoolAddress (slice jetton_wallet0, slice jetton_wallet1)
returns pool address for two given jetton_wallets belonging to the router
@param jetton_wallet0 Address of the jetton 0 wallet belonging to router
@param jetton_wallet1 Address of the jetton 1 wallet belonging to router
@return0 pool address
(cell, cell, cell) getChildContracts ()
returns code of the child contracts deprecated
@return0 code of the pool contract
@return1 code of the account contract
@return2 code of the nft position contract
Opcode : 0x2e3034ef
Operation that deploys and inits new Pool contract for two given jettons identified by their wallets. New pool would reorder the jettons to match the invariant slice_hash(jetton0_address) > slice_hash(jetton1_address).
Opcode : 0xa1daa96d
Opcode : 0x7362d09c
Opcode : 0x42a0fb43
Opcode : 0xd4deb03b
Opcode : 0x98bac405
Name | Size | Free |
---|---|---|
Mnemonic | Type | Description |
---|---|---|
Mnemonic | Type | Description |
---|---|---|
Mnemonic | Type | Description |
---|---|---|
Mnemonic | Type | Description |
---|---|---|
Mnemonic | Type | Description |
---|---|---|
Mnemonic | Type | Description |
---|---|---|
1
addr
267 / 0
1
router::admin_address
Admin address.
2
addr
267 / 0
1
router::pool_admin_address
Admin address.
3
addr
267 / 0
1
router::pool_factory_address
PoolFactory address. Only this address and admin can create new pools
4
uint64
64 / 0
1
router::pool_seqno
Number of pools created. Used by indexer to ensure that none of pools are skipped
5
uint64
64 / 0
1
router::flags
Flags that control some router features
6
code
0 / 1
1
router::poolv3_code
The cell with the code of the pool, that is needed to create a pool contract
7
code
0 / 1
1
router::accountv3_code
The cell with the code of the account, that is needed to create initial data for pool contract
8
code
0 / 1
1
router::position_nftv3_code
The cell with the code of the user NFT position, that is needed to create initial data for pool contract
1
929
94
op
Uint(32) op
query_id
Uint(64)
queryid as of the TON documentation
jetton_wallet0
Address()
Address of the jetton0 wallet. Used to compute pool address
jetton_wallet1
Address()
Address of the jetton1 wallet. Used to compute pool address
tick_spacing
Int(24)
Tick spacing to be used in the pool
initial_priceX96
Uint(160),PriceX96
Initial price for the pool
protocol_fee
Uint(16)
Liquidity provider fee. base in FEE_DENOMINATOR parts. If value is more than 10000 value would be default
lp_fee_base
Uint(16)
Protocol fee in FEE_DENOMINATOR. If value is more than 10000 value would be default
lp_fee_current
Uint(16)
Current value of the pool fee, in case of dynamic adjustment. If value is more than 10000 value would be default
nftv3_content
Cell(),Metadata
nftv3item_content
Cell(),Metadata
jetton0_minter
Address()
Address of the jetton0 minter, used by indexer and frontend
jetton1_minter
Address()
Address of the jetton1 minter, used by indexer and frontend
controller_addr
Address()
Address that is allowed to change the fee. Can always be updated by admin
op
Uint(32) op
query_id
Uint(64)
owner0
Address()
owner1
Address()
exit_code
Uint(32)
seqno
Uint(64), Indexer
hasCoinsInfo
Boolean()
hasIndexerInfo
Boolean()
amount0
Coins()
jetton0_address
Address()
amount1
Coins()
jetton1_address
Address()
op
Uint(32) op
query_id
Uint(64)
jetton_amount
Coins()
from_user
Address()
forward_payload
Cell()
op
Uint(32) op
op
Uint(32) op
new_admin
Address()
op
Uint(32) op