> For the complete documentation index, see [llms.txt](https://docs.tonco.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tonco.io/contracts-v1.6-forthcoming/router.md).

# Router

### router

* [Description](#description)
* [Data Storage](#data-storage)
* [Interface](#interface)
* [Messages](#messages)

## Description

The **Router** is the system's central dispatcher and the custodian of all LP jetton wallets. Users reach the protocol by transferring jettons to the router with a payload (see [router payloads](/contracts-v1.6-forthcoming/router_payloads.md)); the router parses it and routes the funds to the right [Pool](/contracts-v1.6-forthcoming/pool.md) for a swap or for funding a mint. It also deploys new pools (from the Pool Factory or the admin), pays funds back out through its own jetton wallets (PAY\_TO), and supports a multihop shortcut. The router cannot cryptographically verify that a transfer notification came from a real jetton wallet, so it derives the target pool from the sender — a fake sender simply maps to a pool that does not exist. Critical parameters (admin, proxyTON wallet, flags, router/pool code) change only through a two-phase timelock; the admin is expected to be a multisig.

## Interface

### getRouterState

(address, address, address, address?, int, int, int) getRouterState ()

returns the router state and configuration

#### Return Values

| # | Type     | Description                                                                  |
| - | -------- | ---------------------------------------------------------------------------- |
| 0 | address  | router admin address                                                         |
| 1 | address  | pool admin address (passed to pools on creation; has privileged pool rights) |
| 2 | address  | pool factory address (allowed to request pool creation)                      |
| 3 | address? | proxy TON wallet address (critial to multihop shortcut)                      |
| 4 | int      | router flags                                                                 |
| 5 | int      | router seqno (monotonic counter for indexing)                                |
| 6 | int      | router version (e.g. 16000 = v1.6.000)                                       |

### getPoolAddress

(address) getPoolAddress (jettonWallet0: address, jettonWallet1: address)

returns pool address for two given jetton\_wallets belonging to the router

#### Parameters

| # | Type    | Name          | Description                                        |
| - | ------- | ------------- | -------------------------------------------------- |
| 0 | address | jettonWallet0 | Address of the jetton 0 wallet belonging to router |
| 1 | address | jettonWallet1 | Address of the jetton 1 wallet belonging to router |

#### Return Values

| # | Type    | Description  |
| - | ------- | ------------ |
| 0 | address | pool address |

### getChildContracts

(cell, cell, cell, cell) getChildContracts ()

returns code of the child contracts *deprecated*

#### Return Values

| # | Type | Description                         |
| - | ---- | ----------------------------------- |
| 0 | cell | code of the pool contract           |
| 1 | cell | code of the account contract        |
| 2 | cell | code of the nft position contract   |
| 3 | cell | code of the pool prototype contract |

### get\_pending\_timelocks

( int, int, address?, int, address?, int, int, int, cell?, int, cell?,) get\_pending\_timelocks ()

returns active router timelocks to monitor system state. Timestamp 0xFFFFFFFFFFFFFFFF means - never/timelock not active

#### Return Values

| #  | Type     | Description                                           |
| -- | -------- | ----------------------------------------------------- |
| 0  | int      | Timelock delay                                        |
| 1  | int      | Timestamp when new Admin Address can be committed     |
| 2  | address? | New Admin Address                                     |
| 3  | int      | Timestamp when new Proxy Ton Address can be committed |
| 4  | address? | New Proxy Ton Address                                 |
| 5  | int      | Timestamp when new flags can be committed             |
| 6  | int      | New Flags                                             |
| 7  | int      | Timestamp when new code can be committed              |
| 8  | cell?    | Cell with new code                                    |
| 9  | int      | Timestamp when new pool code can be committed         |
| 10 | cell?    | Cell with new pool code                               |

## Messages

### JETTON\_TRANSFER\_NOTIFICATION

Opcode : **0x7362d09c**

Process router funding, payload determines if it is mint or swap\
Access Rights: Sent by a jetton wallet when a user transfers tokens to the router. The router cannot verify that the notification truly comes from a real jetton wallet, so it does not authorize the sender directly: the target pool is derived from the sender, and if the sender is not a genuine wallet the derived pool simply does not exist. Funds that fail validation are returned to the user.<br>

<table data-full-width="true"><thead><tr><th width="90">Path</th><th width="200">Mnemonic</th><th width="180">Type</th><th>Description</th></tr></thead><tbody><tr><td></td><td>op</td><td>Uint(32),op</td><td></td></tr><tr><td></td><td>query_id</td><td>Uint(64)</td><td>queryid as of the TON documentation</td></tr><tr><td></td><td>jetton_amount</td><td>Coins(124)</td><td>Amount of coins sent to the router</td></tr><tr><td></td><td>from_user</td><td>Address(267)</td><td>User that originated the transfer</td></tr><tr><td></td><td>forward_payload</td><td>Cell(0),Either, Payload</td><td>Payload for processing</td></tr></tbody></table>

<details>

<summary>TL-B Description</summary>

This is a preliminary tl-b - subject to change

{% code title="Tlb for JETTON\_TRANSFER\_NOTIFICATION" overflow="wrap" lineNumbers="true" %}

```javascript
JETTON_TRANSFER_NOTIFICATION#7362d09c 
    query_id:uint64
    jetton_amount:(VarUInteger 16)
    from_user:MsgAddress
    forward_payload:(Either ^Cell Cell)
= ContractMessages;
```

{% endcode %}

</details>

### ROUTER\_CREATE\_POOL

Opcode : **0x2e3034ef**

Operation that deploys and inits new [Pool](/contracts-v1.6-forthcoming/pool.md) 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).`\
Access Rights: Allowed for the Pool Factory and the Router Admin (Superadmin). On a repeated CREATE\_POOL for an existing pool the router forwards an initialization message, which lets the admin change tick spacing, NFT metadata, the initial price (while no positions exist), the Pool Admin and Controller, and the lock state; a request coming through the Pool Factory cannot assign the ALM Vault or Arbiter roles.<br>

<table data-full-width="true"><thead><tr><th width="90">Path</th><th width="200">Mnemonic</th><th width="180">Type</th><th>Description</th></tr></thead><tbody><tr><td></td><td>op</td><td>Uint(32),op</td><td></td></tr><tr><td></td><td>query_id</td><td>Uint(64)</td><td>queryid as of the TON documentation</td></tr><tr><td></td><td>jetton_wallet0</td><td>Address(267)</td><td>Address of the jetton0 wallet. Used to compute pool address</td></tr><tr><td></td><td>jetton_wallet1</td><td>Address(267)</td><td>Address of the jetton1 wallet. Used to compute pool address</td></tr><tr><td></td><td>tick_spacing</td><td>Uint(24)</td><td>Tick spacing to be used in the pool</td></tr><tr><td></td><td>initial_priceX96</td><td>Uint(160),PriceX96</td><td>Initial price for the pool</td></tr><tr><td></td><td>pool_active</td><td>Uint(1)</td><td>Should pool be created as active</td></tr><tr><td></td><td>protocol_fee</td><td>Uint(16),Fee</td><td>Protocol fee in FEE_DENOMINATOR parts. If value is more than 10000 value would be default</td></tr><tr><td></td><td>lp_fee_base</td><td>Uint(16),Fee</td><td>Liquidity provider base fee in FEE_DENOMINATOR. If value is more than 10000 value would be default</td></tr><tr><td></td><td>lp_fee_current</td><td>Uint(16),Fee</td><td>Current value of the pool fee, in case of dynamic adjustment. If value is more than 10000 value would be default</td></tr><tr><td></td><td>0</td><td>Cell(0) roles_cell</td><td>Cell With Role</td></tr><tr><td>0</td><td>has_controller</td><td>Uint(1),Bool</td><td>Flag that shows if this message have a new controller address</td></tr><tr><td>0</td><td>controller_addr</td><td>Address(267)</td><td>Address that is allowed to change the fee. Can always be updated by admin.</td></tr><tr><td>0</td><td>has_creator</td><td>Uint(1),Bool</td><td>Flag that shows if this message have a new creator address</td></tr><tr><td>0</td><td>creator_addr</td><td>Address(267)</td><td>Address that is allowed to change the fee. Can always be updated by admin. If has_controller is false could be 00b</td></tr><tr><td>0</td><td>0</td><td>Cell(0) privilege_roles_cell</td><td>Cell With Privilege Roles</td></tr><tr><td>0->0</td><td>has_arbiter</td><td>Uint(1),Bool</td><td>Flag that shows if this message have a new Arbiter address</td></tr><tr><td>0->0</td><td>arbiter_addr</td><td>Address(267)</td><td>Address that is allowed to make privileged swaps</td></tr><tr><td>0->0</td><td>has_alm</td><td>Uint(1),Bool</td><td>Flag that shows if this message have a new ALM address</td></tr><tr><td>0->0</td><td>alm_addr</td><td>Address(267)</td><td>Address that is used to identify ALM contract</td></tr><tr><td>0</td><td>1</td><td>Cell(0) roles_add</td><td>Cell With Additional Roles</td></tr><tr><td>0->1</td><td>has_oracle</td><td>Uint(1),Bool</td><td>Flag that shows if this message have a new oracle address</td></tr><tr><td>0->1</td><td>oracle_addr</td><td>Address(267)</td><td>Address that is allowed to change the fee. Can always be updated by admin. Could be 00b</td></tr><tr><td></td><td>1</td><td>Cell(0) metadata_cell</td><td>Cell With Metainfo</td></tr><tr><td>1</td><td>nftv3_content</td><td>Cell(0),Metadata</td><td>Metadata for the NFT Collection</td></tr><tr><td>1</td><td>nftv3item_content</td><td>Cell(0),Metadata</td><td>Metadata for the NFT Item</td></tr><tr><td></td><td>2</td><td>Cell(0) minter_cell</td><td>Cell With Minters</td></tr><tr><td>2</td><td>jetton0_minter</td><td>Address(267)</td><td>Address of the jetton0 minter, used by indexer and frontend</td></tr><tr><td>2</td><td>jetton1_minter</td><td>Address(267)</td><td>Address of the jetton1 minter, used by indexer and frontend</td></tr></tbody></table>

<details>

<summary>TL-B Description</summary>

This is a preliminary tl-b - subject to change

{% code title="Tlb for ROUTER\_CREATE\_POOL" overflow="wrap" lineNumbers="true" %}

```javascript
ROUTER_CREATE_POOL#2e3034ef 
    query_id:uint64
    jetton_wallet0:MsgAddress
    jetton_wallet1:MsgAddress
    tick_spacing:uint24
    initial_priceX96:uint160
    pool_active:uint1
    protocol_fee:uint16
    lp_fee_base:uint16
    lp_fee_current:uint16
    roles_cell:^Roles_cellType
    metadata_cell:^Metadata_cellType
    minter_cell:^Minter_cellType
= ContractMessages;
_ 
    has_arbiter:uint1
    arbiter_addr:MsgAddress
    has_alm:uint1
    alm_addr:MsgAddress
= Privilege_roles_cellType;
_ 
    has_oracle:uint1
    oracle_addr:MsgAddress
= Roles_addType;
_ 
    has_controller:uint1
    controller_addr:MsgAddress
    has_creator:uint1
    creator_addr:MsgAddress
    privilege_roles_cell:^Privilege_roles_cellType   // optional ref (present only if a ref is left)
    roles_add:^Roles_addType   // optional ref (present only if a ref is left)
= Roles_cellType;
_ 
    nftv3_content:^Cell
    nftv3item_content:^Cell
= Metadata_cellType;
_ 
    jetton0_minter:MsgAddress
    jetton1_minter:MsgAddress
= Minter_cellType;
```

{% endcode %}

</details>

### ROUTER\_PAY\_TO

Opcode : **0xa1daa96d**

This message is the message that is sent to Router by the pool, an it would be accepted only from the pool:

Possible error codes

| Operation | Error Core                       | Value | Meaning                                                  |
| --------- | -------------------------------- | ----- | -------------------------------------------------------- |
| SWAP      | RESULT\_SWAP\_OK                 | 200   | Swap went fine                                           |
| SWAP      | RESULT\_SWAP\_OUTPUT\_TOO\_SMALL | 230   | minAmount was not reached, swap reverted                 |
| SWAP      | RESULT\_SWAP\_INTERNAL\_ERROR    | 231   | Internal error, generally this should not happen         |
| SWAP      | RESULT\_SWAP\_POOL\_LOCKED       | 232   | Attempt to swap in the locked pool                       |
| SWAP      | RESULT\_SWAP\_POOL\_EMPTY        | 233   | Attempt to swap in the empty pool                        |
| MINT      | RESULT\_MINT\_OK                 | 202   | Mint went fine                                           |
| MINT      | RESULT\_NO\_LIQUIDITY            | 226   | Minting Zero liquidity was asked (not always unintended) |
| MINT      | RESULT\_TICK\_IMPOSSIBLE\_LOW    | 220   | One of the ticks is too low                              |
| MINT      | RESULT\_TICK\_IMPOSSIBLE\_HIGH   | 221   | One of the ticks is too high                             |
| MINT      | RESULT\_WRONG\_TICK\_SPACING     | 222   | One of ticks is not divisible by tick\_spacing           |
| MINT      | RESULT\_TOO\_MANY\_TICKS         | 223   | Pool is full                                             |
| MINT      | RESULT\_TOO\_MUCH\_LIQUIDITY     | 224   | Too much liquidity in one tick                           |
| MINT      | RESULT\_NOT\_ENOUGH\_COINS       | 225   | Not enough coins to mint                                 |
| BURN      | RESULT\_BURN\_OK                 | 201   | Burn went fine                                           |

\
Access Rights: Accepted by the router only from a pool: the sender must match the pool the router itself derives, so no other contract can trigger a payout. The router then sends the funds out through its own jetton wallet. As an exception, when the router's emergency mode is enabled the Router Admin may invoke PAY\_TO directly.<br>

<table data-full-width="true"><thead><tr><th width="90">Path</th><th width="200">Mnemonic</th><th width="180">Type</th><th>Description</th></tr></thead><tbody><tr><td></td><td>op</td><td>Uint(32),op</td><td></td></tr><tr><td></td><td>query_id</td><td>Uint(64)</td><td>queryid as of the TON documentation</td></tr><tr><td></td><td>reciever0</td><td>Address(267)</td><td>Address of the first receiver of the funds</td></tr><tr><td></td><td>reciever1</td><td>Address(267)</td><td>Address of the second receiver of the funds</td></tr><tr><td></td><td>exit_code0</td><td>Uint(8),ErrorCode</td><td>Most significant byte. Reforge: result of the first processed order</td></tr><tr><td></td><td>exit_code1</td><td>Uint(8),ErrorCode</td><td>Reforge: result of the second processed order</td></tr><tr><td></td><td>exit_code2</td><td>Uint(8),ErrorCode</td><td>Reforge: result of the third processed order</td></tr><tr><td></td><td>exit_code3</td><td>Uint(8),ErrorCode</td><td>Least significant byte. Swap/burn/collect result is here; reforge: fourth order</td></tr><tr><td></td><td>seqno</td><td>Uint(64),Indexer</td><td>Internal pool sequence number</td></tr><tr><td></td><td>0</td><td>Maybe Cell(1) coinsinfo_cell</td><td>Cell with info about the coins</td></tr><tr><td>0</td><td>jetton0_address</td><td>Address(267)</td><td>Jetton to be sent to receiver0 identified by the wallet that belongs to router</td></tr><tr><td>0</td><td>jetton1_address</td><td>Address(267)</td><td>Jetton to be sent to receiver1 identified by the wallet that belongs to router</td></tr><tr><td>0</td><td>amount0</td><td>Coins(124)</td><td>Amount of coins to be payed to receiver0</td></tr><tr><td>0</td><td>amount1</td><td>Coins(124)</td><td>Amount of coins to be payed to receiver1</td></tr><tr><td>0</td><td>0</td><td>Cell(0) payload_cell</td><td>Information about the payload</td></tr><tr><td>0->0</td><td>payload_amount0</td><td>Coins(124)</td><td>Amount of GRAM to forward to receiver0 together with payload_0</td></tr><tr><td>0->0</td><td>payload_0</td><td>Cell(1),Maybe, Payload</td><td>Forward payload delivered to receiver0 with the jetton transfer</td></tr><tr><td>0->0</td><td>payload_amount1</td><td>Coins(124)</td><td>Amount of GRAM to forward to receiver1 together with payload_1</td></tr><tr><td>0->0</td><td>payload_1</td><td>Cell(1),Maybe, Payload</td><td>Forward payload delivered to receiver1 with the jetton transfer</td></tr><tr><td>0->0</td><td>excess_address</td><td>Address(267)</td><td>Address to receive the excess gas</td></tr><tr><td></td><td>1</td><td>Maybe Cell(1) indexer_swap_info_cell</td><td>Indexer-only. Post-swap pool state (null for non-swap)</td></tr><tr><td>1</td><td>liquidity</td><td>Uint(128),Indexer</td><td>Post-swap concentrated liquidity at current tick</td></tr><tr><td>1</td><td>price_sqrt</td><td>Uint(160),Indexer,PriceX96</td><td>Post-swap square root of the price stored as fixed point 64.96</td></tr><tr><td>1</td><td>tick</td><td>Int(24),Indexer</td><td>Post-swap current tick</td></tr><tr><td>1</td><td>feeGrowthGlobal0X128</td><td>Int(256),Indexer</td><td>Current range fee per unit of the liquidity for jetton0</td></tr><tr><td>1</td><td>feeGrowthGlobal1X128</td><td>Int(256),Indexer</td><td>Current range fee per unit of the liquidity for jetton1</td></tr><tr><td></td><td>2</td><td>Maybe Cell(1) positions_cell</td><td>Cell with positions (null for swap/collect)</td></tr><tr><td>2</td><td>0</td><td>Maybe Cell(1) burn0</td><td>Cell with burn number 0</td></tr><tr><td>2->0</td><td>index[0]</td><td>Uint(64)</td><td>Index of the burned position NFT</td></tr><tr><td>2->0</td><td>subindex[0]</td><td>Uint(4)</td><td>Subindex</td></tr><tr><td>2->0</td><td>liquidity[0]</td><td>Uint(128)</td><td>Position liquidity before this burn</td></tr><tr><td>2->0</td><td>tickLower[0]</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>2->0</td><td>tickUpper[0]</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>2->0</td><td>feeGrowthInside0LastX128[0]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton0, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->0</td><td>feeGrowthInside1LastX128[0]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton1, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2,0</td><td>0</td><td>Maybe Cell(1) new_fee_cell</td><td>Fee counters to collect to (Used by indexer)</td></tr><tr><td>2->0->0</td><td>feeGrowthInside0CurrentX128[0]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton0, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->0->0</td><td>feeGrowthInside1CurrentX128[0]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton1, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->0</td><td>liquidity2Burn[0]</td><td>Uint(128)</td><td>Amount of liquidity that was burned from this position</td></tr><tr><td>2</td><td>1</td><td>Maybe Cell(1) burn1</td><td>Cell with burn number 1</td></tr><tr><td>2->1</td><td>index[1]</td><td>Uint(64)</td><td>Index of the burned position NFT</td></tr><tr><td>2->1</td><td>subindex[1]</td><td>Uint(4)</td><td>Subindex</td></tr><tr><td>2->1</td><td>liquidity[1]</td><td>Uint(128)</td><td>Position liquidity before this burn</td></tr><tr><td>2->1</td><td>tickLower[1]</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>2->1</td><td>tickUpper[1]</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>2->1</td><td>feeGrowthInside0LastX128[1]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton0, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->1</td><td>feeGrowthInside1LastX128[1]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton1, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2,1</td><td>0</td><td>Maybe Cell(1) new_fee_cell</td><td>Fee counters to collect to (Used by indexer)</td></tr><tr><td>2->1->0</td><td>feeGrowthInside0CurrentX128[1]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton0, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->1->0</td><td>feeGrowthInside1CurrentX128[1]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton1, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->1</td><td>liquidity2Burn[1]</td><td>Uint(128)</td><td>Amount of liquidity that was burned from this position</td></tr><tr><td>2</td><td>2</td><td>Maybe Cell(1) burn2</td><td>Cell with burn number 2</td></tr><tr><td>2->2</td><td>index[2]</td><td>Uint(64)</td><td>Index of the burned position NFT</td></tr><tr><td>2->2</td><td>subindex[2]</td><td>Uint(4)</td><td>Subindex</td></tr><tr><td>2->2</td><td>liquidity[2]</td><td>Uint(128)</td><td>Position liquidity before this burn</td></tr><tr><td>2->2</td><td>tickLower[2]</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>2->2</td><td>tickUpper[2]</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>2->2</td><td>feeGrowthInside0LastX128[2]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton0, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->2</td><td>feeGrowthInside1LastX128[2]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton1, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2,2</td><td>0</td><td>Maybe Cell(1) new_fee_cell</td><td>Fee counters to collect to (Used by indexer)</td></tr><tr><td>2->2->0</td><td>feeGrowthInside0CurrentX128[2]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton0, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->2->0</td><td>feeGrowthInside1CurrentX128[2]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton1, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->2</td><td>liquidity2Burn[2]</td><td>Uint(128)</td><td>Amount of liquidity that was burned from this position</td></tr><tr><td>2</td><td>3</td><td>Maybe Cell(1) burn3</td><td>Cell with burn number 3</td></tr><tr><td>2->3</td><td>index[3]</td><td>Uint(64)</td><td>Index of the burned position NFT</td></tr><tr><td>2->3</td><td>subindex[3]</td><td>Uint(4)</td><td>Subindex</td></tr><tr><td>2->3</td><td>liquidity[3]</td><td>Uint(128)</td><td>Position liquidity before this burn</td></tr><tr><td>2->3</td><td>tickLower[3]</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>2->3</td><td>tickUpper[3]</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>2->3</td><td>feeGrowthInside0LastX128[3]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton0, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->3</td><td>feeGrowthInside1LastX128[3]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton1, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2,3</td><td>0</td><td>Maybe Cell(1) new_fee_cell</td><td>Fee counters to collect to (Used by indexer)</td></tr><tr><td>2->3->0</td><td>feeGrowthInside0CurrentX128[3]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton0, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->3->0</td><td>feeGrowthInside1CurrentX128[3]</td><td>Int(256),x128</td><td>Fee counter inside position range for jetton1, per unit of liquidity, in 128.128 fixed point</td></tr><tr><td>2->3</td><td>liquidity2Burn[3]</td><td>Uint(128)</td><td>Amount of liquidity that was burned from this position</td></tr></tbody></table>

<details>

<summary>TL-B Description</summary>

This is a preliminary tl-b - subject to change

{% code title="Tlb for ROUTER\_PAY\_TO" overflow="wrap" lineNumbers="true" %}

```javascript
ROUTER_PAY_TO#a1daa96d 
    query_id:uint64
    reciever0:MsgAddress
    reciever1:MsgAddress
    exit_code0:uint8
    exit_code1:uint8
    exit_code2:uint8
    exit_code3:uint8
    seqno:uint64
    coinsinfo_cell:(Maybe ^Coinsinfo_cellType)
    indexer_swap_info_cell:(Maybe ^Indexer_swap_info_cellType)
    positions_cell:(Maybe ^Positions_cellType)
= ContractMessages;
_ 
    payload_amount0:(VarUInteger 16)
    payload_0:(Maybe ^Cell)
    payload_amount1:(VarUInteger 16)
    payload_1:(Maybe ^Cell)
    excess_address:MsgAddress
= Payload_cellType;
_ 
    jetton0_address:MsgAddress
    jetton1_address:MsgAddress
    amount0:(VarUInteger 16)
    amount1:(VarUInteger 16)
    payload_cell:^Payload_cellType   // optional ref (present only if a ref is left)
= Coinsinfo_cellType;
_ 
    liquidity:uint128
    price_sqrt:uint160
    tick:int24
    feeGrowthGlobal0X128:int256
    feeGrowthGlobal1X128:int256
= Indexer_swap_info_cellType;
_ 
    feeGrowthInside0CurrentX128_0:int256
    feeGrowthInside1CurrentX128_0:int256
= New_fee_cellType;
_ 
    index_0:uint64
    subindex_0:uint4
    liquidity_0:uint128
    tickLower_0:int24
    tickUpper_0:int24
    feeGrowthInside0LastX128_0:int256
    feeGrowthInside1LastX128_0:int256
    new_fee_cell:(Maybe ^New_fee_cellType)
    liquidity2Burn_0:uint128
= Burn0Type;
_ 
    feeGrowthInside0CurrentX128_1:int256
    feeGrowthInside1CurrentX128_1:int256
= New_fee_cellType1;
_ 
    index_1:uint64
    subindex_1:uint4
    liquidity_1:uint128
    tickLower_1:int24
    tickUpper_1:int24
    feeGrowthInside0LastX128_1:int256
    feeGrowthInside1LastX128_1:int256
    new_fee_cell:(Maybe ^New_fee_cellType1)
    liquidity2Burn_1:uint128
= Burn1Type;
_ 
    feeGrowthInside0CurrentX128_2:int256
    feeGrowthInside1CurrentX128_2:int256
= New_fee_cellType2;
_ 
    index_2:uint64
    subindex_2:uint4
    liquidity_2:uint128
    tickLower_2:int24
    tickUpper_2:int24
    feeGrowthInside0LastX128_2:int256
    feeGrowthInside1LastX128_2:int256
    new_fee_cell:(Maybe ^New_fee_cellType2)
    liquidity2Burn_2:uint128
= Burn2Type;
_ 
    feeGrowthInside0CurrentX128_3:int256
    feeGrowthInside1CurrentX128_3:int256
= New_fee_cellType3;
_ 
    index_3:uint64
    subindex_3:uint4
    liquidity_3:uint128
    tickLower_3:int24
    tickUpper_3:int24
    feeGrowthInside0LastX128_3:int256
    feeGrowthInside1LastX128_3:int256
    new_fee_cell:(Maybe ^New_fee_cellType3)
    liquidity2Burn_3:uint128
= Burn3Type;
_ 
    burn0:(Maybe ^Burn0Type)
    burn1:(Maybe ^Burn1Type)
    burn2:(Maybe ^Burn2Type)
    burn3:(Maybe ^Burn3Type)
= Positions_cellType;
```

{% endcode %}

</details>

### ROUTERV3\_RESET\_GAS

Opcode : **0x42a0fb43**

This operation allows router owners the gas if too much accumulated on the contract\
Access Rights: Allowed only for the Router Admin. Withdraws excess TON that accumulated on the router, leaving enough to keep it funded.<br>

<table data-full-width="true"><thead><tr><th width="90">Path</th><th width="200">Mnemonic</th><th width="180">Type</th><th>Description</th></tr></thead><tbody><tr><td></td><td>op</td><td>Uint(32),op</td><td></td></tr><tr><td></td><td>query_id</td><td>Uint(64)</td><td>queryid as of the TON documentation</td></tr></tbody></table>

<details>

<summary>TL-B Description</summary>

This is a preliminary tl-b - subject to change

{% code title="Tlb for ROUTERV3\_RESET\_GAS" overflow="wrap" lineNumbers="true" %}

```javascript
ROUTERV3_RESET_GAS#42a0fb43 
    query_id:uint64
= ContractMessages;
```

{% endcode %}

</details>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.tonco.io/contracts-v1.6-forthcoming/router.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
