Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Account

account

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

IndexTypeSize (b/r)CellNameDescription
1addr267 / 01account::user_addressAddress of the user ton wallet of the user that owns this two jetton account
2addr267 / 01account::pool_addressAddress of the pool that created this two jetton account
3coins124 / 011account::amount0Amount of jetton0 (in pool terms) currently stored in the account
4coins124 / 011account::amount1Amount of jetton1 (in pool terms) currently stored in the account
5coins124 / 011account::enough0Amount of jetton0 (in pool terms) that is enough to make a mint operation. When reached for both tokens, mint is triggered
6coins124 / 011account::enough1Amount of jetton1 (in pool terms) that is enough to make a mint operation.

Cells

NameSizeFree
1534489
11496527

Interface

get_account_data

(slice, slice, int, int, int, int) get_account_data ()

This function provides current state of the user account

Return Values

#TypeDescription
0sliceaccount::user_address Address of the owner of the account
1sliceaccount::pool_address Address of the pool that this account is attached to
2intaccount::amount0 Amount of jetton0 that was deposited for mint
3intaccount::amount1 Amount of jetton1 that was deposited for mint
4intaccount::enough0 Amount of jetton0 that is enough to send message to the pool and actually do the mint
5intaccount::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\

PathMnemonicTypeDescription
opUint(32),op
query_idUint(64)queryid as of the TON documentation
new_amount0Coins(124)Amount of jetton0 that is funded for the mint
new_amount1Coins(124)Amount of jetton1 that is funded for the mint
new_enough0Coins(124)Minimum amount of jetton0 totally collected on the account that is required to start the mint
new_enough1Coins(124)Minimum amount of jetton1 totally collected on the account that is required to start the mint
liquidityUint(128)Amount of liquidity to mint
tickLowerInt(24)lower bound of the range in which to mint
tickUpperInt(24)upper bound of the range in which to mint
TL-B Description (TBD)

This is a preliminary tl-b - subject to change

Tlb for ACCOUNTV3_ADD_LIQUIDITY

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;

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\

PathMnemonicTypeDescription
opUint(32),op
query_idUint(64)queryid as of the TON documentation
TL-B Description (TBD)

This is a preliminary tl-b - subject to change

Tlb for ACCOUNTV3_RESET_GAS

ACCOUNTV3_RESET_GAS#42a0fb43 
    query_id:uint64
= ContractMessages;

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\

PathMnemonicTypeDescription
opUint(32),op
query_idUint(64)queryid as of the TON documentation
TL-B Description (TBD)

This is a preliminary tl-b - subject to change

Tlb for ACCOUNTV3_REFUND_ME

ACCOUNTV3_REFUND_ME#bf3f447 
    query_id:uint64
= ContractMessages;