# Router/Factory

The Router contract oversees the full functionality of token pair registration and supports all the basic requirements of a front-end offering trading.

## Code

Github Link: (to be updated)

## Address

* Mainnet Router: EQAxC3GzQBgjlvW6CJAwgaHvarTfVxo8p7Be\_6RMSjsPki6s
* Mainnet Factory: EQDp3uMnOuXF2rurDd47BGtGKW88iSNraS8fuP0GElT6G\_39

## Functions

{% tabs %}
{% tab title="Read-Only Functions" %}
**get\_address\_data**

```
(slice, slice, slice, slice, slice, slice) get_address_data() method_id
```

* slice admin\_address
* slice pool\_creator\_address
* slice governance\_jetton\_address
* slice mining\_rate\_admin\_address
* slice lp\_policy\_admin\_address
* slice next\_admin\_address

**get\_mining\_data**

```
(int, int, int, int, int, int) get_mining_data()
```

* int total\_mining\_amount
* int total\_mining\_rate
* int mining\_amount\_per\_sec
* int half\_life
* int total\_reward

**get\_lp\_data**

```
(int, cell, cell) get_lp_data() method_id
```

* int pool\_count
* cell ( dict ) jetton\_pair\_to\_lp
* cell ( dict ) lp\_to\_jetton\_pair

**get\_jetton\_pair\_to\_lp\_address**

```
(slice, int) get_jetton_pair_to_lp_address(slice jettonA_address, slice jettonB_address) method_id
```

* slice lp\_address
* int exist

**get\_code\_data**

```
(cell, cell, cell) get_code_data() method_id
```

* cell lp\_minter\_code
* cell lp\_wallet\_code
* cell mega\_wallet\_code

**get\_lp\_default\_content\_data**

```
(cell) get_lp_default_content_data() method_id
```

* cell lp\_default\_content
  {% endtab %}

{% tab title="State-Changing Functions" %}

#### How to build transaction

* Swap

```typescript
// TL-B schema
// transfer query_id:uint64 amount:VarUInteger 16 destination:MsgAddress response_destination:MsgAddress custom_payload:Maybe ^Cell forward_ton_amount:VarUInteger 16 forward_payload:Either Cell ^Cell = InternalMsgBody

await sendInternalMessageWithWallet({
    walletContract,
    secretKey,
    to: userJettonWalletAddress,
    value: toNano(0.4),
    body: beginCell()
        .storeUint(0xf8a7ea5, 32)
        .storeUint(queryId, 64)
        .storeCoins(fromAmount)
        .storeAddress(routerAddress)
        .storeAddress(responseAddress)
        .storeDict(beginCell().endCell())
        .storeCoins(toNano(0.3))
        .storeDict(beginCell()
            .storeAddress(fromJettonAddress)
            .storeAddress(toJettonAddress)
            .storeCoins(minAmount)
        .endCell())
    .endCell()
});
```

{% endtab %}
{% endtabs %}


---

# Agent Instructions: 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.megaton.fi/developers/contract/router-factory.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.
