# Account

### account

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

## Description

Account contract. This a contract that stores the funds that the user would use for minting. The account also proxies the minting message and collects proof that both jettons were actually funded correctly

## Data Storage

<table data-full-width="true"><thead><tr><th width="70">Index</th><th width="100">Type</th><th width="100">Size (b/r)</th><th width="58">Cell</th><th width="280">Name</th><th>Description</th></tr></thead><tbody><tr><td>1</td><td>addr</td><td>267 / 0</td><td>1</td><td>account::user_address</td><td>Address of the user ton wallet of the user that owns this two jetton account</td></tr><tr><td>2</td><td>addr</td><td>267 / 0</td><td>1</td><td>account::pool_address</td><td>Address of the pool that created this two jetton account</td></tr><tr><td>3</td><td>coins</td><td>124 / 0</td><td>11</td><td>account::amount0</td><td>Amount of jetton0 (in pool terms) currently stored in the account</td></tr><tr><td>4</td><td>coins</td><td>124 / 0</td><td>11</td><td>account::amount1</td><td>Amount of jetton1 (in pool terms) currently stored in the account</td></tr><tr><td>5</td><td>coins</td><td>124 / 0</td><td>11</td><td>account::enough0</td><td>Amount of jetton0 (in pool terms) that is enough to make a mint operation. When reached for both tokens, mint is triggered</td></tr><tr><td>6</td><td>coins</td><td>124 / 0</td><td>11</td><td>account::enough1</td><td>Amount of jetton1 (in pool terms) that is enough to make a mint operation.</td></tr></tbody></table>

## Cells

| Name | Size | Free |
| ---- | ---- | ---- |
| 1    | 534  | 489  |
| 11   | 496  | 527  |

## Interface

### get\_account\_data

(slice, slice, int, int, int, int) get\_account\_data ()

This function provides current state of the user account

#### Return Values

| # | Type  | Description                                                                                            |
| - | ----- | ------------------------------------------------------------------------------------------------------ |
| 0 | slice | account::user\_address Address of the owner of the account                                             |
| 1 | slice | account::pool\_address Address of the pool that this account is attached to                            |
| 2 | int   | account::amount0 Amount of jetton0 that was deposited for mint                                         |
| 3 | int   | account::amount1 Amount of jetton1 that was deposited for mint                                         |
| 4 | int   | account::enough0 Amount of jetton0 that is enough to send message to the pool and actually do the mint |
| 5 | int   | account::enough1 Amount of jetton1 that is enough to send message to the pool and actually do the mint |

## Messages

### ACCOUNTV3\_ADD\_LIQUIDITY

Opcode : **0x3ebe5431**

This operation adds liquidity and a minting request to the account. This contract is used as a barrier to collect together data about the proofs of funding two tokens and the request to mint some liquidity. Common usage is as follows - send one jetton with the mint instructions and the second jetton with the mint instructions. And as soon as they will both arrive AccountV3 would trigger the minting request in the pool. This makes minting independent of the order in which jettons arrive. Account refers to jettons in the pool (account::pool\_address) order\
Access Rights: This operation is allowed for account::pool\_address\\

<table data-full-width="true"><thead><tr><th width="50">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>new_amount0</td><td>Coins(124)</td><td>Amount of jetton0 that is funded for the mint</td></tr><tr><td></td><td>new_amount1</td><td>Coins(124)</td><td>Amount of jetton1 that is funded for the mint</td></tr><tr><td></td><td>new_enough0</td><td>Coins(124)</td><td>Minimum amount of jetton0 totally collected on the account that is required to start the mint</td></tr><tr><td></td><td>new_enough1</td><td>Coins(124)</td><td>Minimum amount of jetton1 totally collected on the account that is required to start the mint</td></tr><tr><td></td><td>liquidity</td><td>Uint(128)</td><td>Amount of liquidity to mint</td></tr><tr><td></td><td>tickLower</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td></td><td>tickUpper</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr></tbody></table>

<details>

<summary>TL-B Description (TBD)</summary>

This is a preliminary tl-b - subject to change

{% code title="Tlb for ACCOUNTV3\_ADD\_LIQUIDITY" overflow="wrap" lineNumbers="true" %}

```javascript
ACCOUNTV3_ADD_LIQUIDITY#3ebe5431 
    query_id:uint64
    new_amount0:(VarUInteger 16)
    new_amount1:(VarUInteger 16)
    new_enough0:(VarUInteger 16)
    new_enough1:(VarUInteger 16)
    liquidity:uint128
    tickLower:int24
    tickUpper:int24
= ContractMessages;
```

{% endcode %}

</details>

### ACCOUNTV3\_RESET\_GAS

Opcode : **0x42a0fb43**

This operation allows user to get back the gas it too much was sent\
Access Rights: This operation is allowed for account::user\_address\\

<table data-full-width="true"><thead><tr><th width="50">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 (TBD)</summary>

This is a preliminary tl-b - subject to change

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

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

{% endcode %}

</details>

### ACCOUNTV3\_REFUND\_ME

Opcode : **0xbf3f447**

This operation allows user to get back the coins if sending of the second coin in the mint failed. This method allows to trigger mint of 0 liquidity that Would allow to return funds.\
Access Rights: This operation is allowed for account::user\_address\\

<table data-full-width="true"><thead><tr><th width="50">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 (TBD)</summary>

This is a preliminary tl-b - subject to change

{% code title="Tlb for ACCOUNTV3\_REFUND\_ME" overflow="wrap" lineNumbers="true" %}

```javascript
ACCOUNTV3_REFUND_ME#bf3f447 
    query_id:uint64
= ContractMessages;
```

{% endcode %}

</details>


---

# 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.tonco.io/technical-reference/contracts/account.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.
