# Account

### account

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

## Interface

### get\_account\_data

(address, address, int, int, int, cell?) get\_account\_data ()

This function provides current state of the user account

#### Return Values

| # | Type    | Description                                                                 |
| - | ------- | --------------------------------------------------------------------------- |
| 0 | address | account::user\_address Address of the owner of the account                  |
| 1 | address | 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::posCount                                                           |
| 5 | cell?   | account::order                                                              |

## Messages

### ACCOUNT\_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<br>

<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>enough0</td><td>Coins(124)</td><td>When temporary storage (user account) satisfy both enough0/1 amounts - mint would trigger</td></tr><tr><td></td><td>enough1</td><td>Coins(124)</td><td>When temporary storage (user account) satisfy both enough0/1 amounts - mint would trigger</td></tr><tr><td></td><td>needPos</td><td>Uint(64)</td><td>Amount of positions that are enough for the order to be executed</td></tr><tr><td></td><td>passthrough</td><td>Uint(4)</td><td>Amount of positions that will be untouched</td></tr><tr><td></td><td>target_action</td><td>Uint(32)</td><td>target_action</td></tr><tr><td></td><td>0</td><td>Maybe Cell(1) MintOrder0</td><td>Cell with mint order</td></tr><tr><td>0</td><td>op0</td><td>Uint(32)</td><td></td></tr><tr><td>0</td><td>liquidity0</td><td>Uint(128)</td><td>Amount of liquidity to mint</td></tr><tr><td>0</td><td>tickLower0</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>0</td><td>tickUpper0</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>0</td><td>receiver0</td><td>Address(267)</td><td>Address of receiver of the NFT</td></tr><tr><td></td><td>1</td><td>Maybe Cell(1) MintOrder1</td><td>Cell with mint order</td></tr><tr><td>1</td><td>op1</td><td>Uint(32)</td><td></td></tr><tr><td>1</td><td>liquidity1</td><td>Uint(128)</td><td>Amount of liquidity to mint</td></tr><tr><td>1</td><td>tickLower1</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>1</td><td>tickUpper1</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>1</td><td>receiver1</td><td>Address(267)</td><td>Address of receiver of the NFT</td></tr><tr><td></td><td>2</td><td>Maybe Cell(1) MintOrder2</td><td>Cell with mint order</td></tr><tr><td>2</td><td>op2</td><td>Uint(32)</td><td></td></tr><tr><td>2</td><td>liquidity2</td><td>Uint(128)</td><td>Amount of liquidity to mint</td></tr><tr><td>2</td><td>tickLower2</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>2</td><td>tickUpper2</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>2</td><td>receiver2</td><td>Address(267)</td><td>Address of receiver of the NFT</td></tr><tr><td></td><td>3</td><td>Maybe Cell(1) MintOrder3</td><td>Cell with mint order</td></tr><tr><td>3</td><td>op3</td><td>Uint(32)</td><td></td></tr><tr><td>3</td><td>liquidity3</td><td>Uint(128)</td><td>Amount of liquidity to mint</td></tr><tr><td>3</td><td>tickLower3</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>3</td><td>tickUpper3</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>3</td><td>receiver3</td><td>Address(267)</td><td>Address of receiver of the NFT</td></tr></tbody></table>

<details>

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

This is a preliminary tl-b - subject to change

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

```javascript
ACCOUNT_ADD_LIQUIDITY#3ebe5431 
    query_id:uint64
    new_amount0:(VarUInteger 16)
    new_amount1:(VarUInteger 16)
    enough0:(VarUInteger 16)
    enough1:(VarUInteger 16)
    needPos:uint64
    passthrough:uint4
    target_action:uint32
    MintOrder0:(Maybe ^[
        op0:uint32
        liquidity0:uint128
        tickLower0:int24
        tickUpper0:int24
        receiver0:MsgAddress
    ] ) 
    MintOrder1:(Maybe ^[
        op1:uint32
        liquidity1:uint128
        tickLower1:int24
        tickUpper1:int24
        receiver1:MsgAddress
    ] ) 
    MintOrder2:(Maybe ^[
        op2:uint32
        liquidity2:uint128
        tickLower2:int24
        tickUpper2:int24
        receiver2:MsgAddress
    ] ) 
    MintOrder3:(Maybe ^[
        op3:uint32
        liquidity3:uint128
        tickLower3:int24
        tickUpper3:int24
        receiver3:MsgAddress
    ] ) 
= ContractMessages;
```

{% endcode %}

</details>

### ACCOUNT\_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<br>

<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 ACCOUNT\_RESET\_GAS" overflow="wrap" lineNumbers="true" %}

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

{% endcode %}

</details>

### ACCOUNT\_SET\_ORDER

Opcode : **0x61d86ffe**

This operation allows user to set an order (usually for minting or refunding) that will be executed if the preconditions are satisfied\
Access Rights: This operation is allowed for account::user\_address<br>

<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>enough0</td><td>Coins(124)</td><td>When temporary storage (user account) satisfy both enough0/1 amounts - mint would trigger</td></tr><tr><td></td><td>enough1</td><td>Coins(124)</td><td>When temporary storage (user account) satisfy both enough0/1 amounts - mint would trigger</td></tr><tr><td></td><td>needPos</td><td>Uint(64)</td><td>Amount of positions that are enough for the order to be executed</td></tr><tr><td></td><td>passthrough</td><td>Uint(4)</td><td>Amount of positions that will be untouched</td></tr><tr><td></td><td>target_action</td><td>Uint(32)</td><td>target_action</td></tr><tr><td></td><td>0</td><td>Maybe Cell(1) mint0</td><td>Cell with burn number 0</td></tr><tr><td>0</td><td>mintOp[0]</td><td>Uint(32)</td><td></td></tr><tr><td>0</td><td>liquidity[0]</td><td>Uint(128)</td><td></td></tr><tr><td>0</td><td>tickLower[0]</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>0</td><td>tickUpper[0]</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>0</td><td>nftReceiver[0]</td><td>Address(267)</td><td>Address that would receive the minted NFT, excesses and refunds</td></tr><tr><td></td><td>1</td><td>Maybe Cell(1) mint1</td><td>Cell with burn number 1</td></tr><tr><td>1</td><td>mintOp[1]</td><td>Uint(32)</td><td></td></tr><tr><td>1</td><td>liquidity[1]</td><td>Uint(128)</td><td></td></tr><tr><td>1</td><td>tickLower[1]</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>1</td><td>tickUpper[1]</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>1</td><td>nftReceiver[1]</td><td>Address(267)</td><td>Address that would receive the minted NFT, excesses and refunds</td></tr><tr><td></td><td>2</td><td>Maybe Cell(1) mint2</td><td>Cell with burn number 2</td></tr><tr><td>2</td><td>mintOp[2]</td><td>Uint(32)</td><td></td></tr><tr><td>2</td><td>liquidity[2]</td><td>Uint(128)</td><td></td></tr><tr><td>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</td><td>tickUpper[2]</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>2</td><td>nftReceiver[2]</td><td>Address(267)</td><td>Address that would receive the minted NFT, excesses and refunds</td></tr><tr><td></td><td>3</td><td>Maybe Cell(1) mint3</td><td>Cell with burn number 3</td></tr><tr><td>3</td><td>mintOp[3]</td><td>Uint(32)</td><td></td></tr><tr><td>3</td><td>liquidity[3]</td><td>Uint(128)</td><td></td></tr><tr><td>3</td><td>tickLower[3]</td><td>Int(24)</td><td>lower bound of the range in which to mint</td></tr><tr><td>3</td><td>tickUpper[3]</td><td>Int(24)</td><td>upper bound of the range in which to mint</td></tr><tr><td>3</td><td>nftReceiver[3]</td><td>Address(267)</td><td>Address that would receive the minted NFT, excesses and refunds</td></tr></tbody></table>

<details>

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

This is a preliminary tl-b - subject to change

{% code title="Tlb for ACCOUNT\_SET\_ORDER" overflow="wrap" lineNumbers="true" %}

```javascript
ACCOUNT_SET_ORDER#61d86ffe 
    query_id:uint64
    enough0:(VarUInteger 16)
    enough1:(VarUInteger 16)
    needPos:uint64
    passthrough:uint4
    target_action:uint32
    mint0:(Maybe ^[
        mintOp[0]:uint32
        liquidity[0]:uint128
        tickLower[0]:int24
        tickUpper[0]:int24
        nftReceiver[0]:MsgAddress
    ] ) 
    mint1:(Maybe ^[
        mintOp[1]:uint32
        liquidity[1]:uint128
        tickLower[1]:int24
        tickUpper[1]:int24
        nftReceiver[1]:MsgAddress
    ] ) 
    mint2:(Maybe ^[
        mintOp[2]:uint32
        liquidity[2]:uint128
        tickLower[2]:int24
        tickUpper[2]:int24
        nftReceiver[2]:MsgAddress
    ] ) 
    mint3:(Maybe ^[
        mintOp[3]:uint32
        liquidity[3]:uint128
        tickLower[3]:int24
        tickUpper[3]:int24
        nftReceiver[3]:MsgAddress
    ] ) 
= ContractMessages;
```

{% endcode %}

</details>
