Skip to main content

Pool

Stores liquidity assets, routes messages for adding liquidity and swaps to the appropriate range contracts, ensures payouts to users.

Interfaces​

swap​

This message and it's query_id should be sent as forward_payload and query_id of jetton-transfer.

Route jetton swap operation to range contract.

PathMnemonicTypeDescription
opuint320xf9cd3bf5
to_addressaddressreceiver address.
partial_executionintflag of further parsing (see below)
partial_execution=0normal_slippagecoinsmin token out.
partial_execution=1slippageuint256last sqrt price of swap.
exact_outcoinsexact out of tokens to recieve from swap. 0 if no exact_out present.
ref_addraddressif null address then no referral fee applied.
additional_datamaybe_celladditional data for swap. Now it is address of swap origin.
reject_payloadmaybe_cellreject payload for swap. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for swap. Sender recieves it with swapped tokens.

swap​

Route swap operation in native to range contract. works only on native pools.

PathMnemonicTypeDescription
opuint320xf9cd3bf5
query_iduint64query id
native_amountcoinsamount of tons is being sent for swap.
to_addressaddressreceiver address.
partial_executionintflag of further parsing (see below)
partial_execution=0normal_slippagecoinsmin token out.
partial_execution=1slippageuint256last sqrt price of swap.
exact_outcoinsexact out of tokens to recieve from swap. 0 if no exact_out present.
ref_addraddressif null address then no referral fee applied.
additional_datamaybe_celladditional data for swap. Now it is address of swap origin.
reject_payloadmaybe_cellreject payload for swap. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for swap. Sender recieves it with swapped tokens.

swap_v2​

This message and it's query_id should be sent as forward_payload and query_id of jetton-transfer.

Route jetton swap operation to range contract.

PathMnemonicTypeDescription
opuint320x437bdf98
to_addressaddressreceiver address.
partial_executionintflag of further parsing (see below)
partial_execution=0normal_slippagecoinsmin token out.
partial_execution=1slippageuint256last sqrt price of swap.
exact_outcoinsexact out of tokens to recieve from swap. 0 if no exact_out present.
additional_datamaybe_celladditional data for swap. Now it is address of swap origin.
reject_payloadmaybe_cellreject payload for swap. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for swap. Sender recieves it with swapped tokens.

swap_v2​

Route swap operation in native to range contract. works only on native pools.

PathMnemonicTypeDescription
opuint320x437bdf98
query_iduint64query id
native_amountcoinsamount of tons is being sent for swap.
to_addressaddressreceiver address.
partial_executionintflag of further parsing (see below)
partial_execution=0normal_slippagecoinsmin token out.
partial_execution=1slippageuint256last sqrt price of swap.
exact_outcoinsexact out of tokens to recieve from swap. 0 if no exact_out present.
additional_datamaybe_celladditional data for swap. Now it is address of swap origin.
reject_payloadmaybe_cellreject payload for swap. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for swap. Sender recieves it with swapped tokens.

provide​

This message and it's query_id should be sent as forward_payload and query_id of jetton-transfer.

Route add liquidity operation in jetton to range contract.

PathMnemonicTypeDescription
opuint320x151898ad
deposit_typeuint3one of deploy
liquidity_typeuint1one of custom
liquidity_dictdictdictionary of tokens for each bin of provision.
reject_payloadmaybe_cellreject payload for liquidity provision. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for liquidity provision. Sender recieves it with notify from lp multitoken contract.

provide_both​

This message and it's query_id should be sent as forward_payload and query_id of jetton-transfer.

Route add liquidity operation in jetton and native assets to range contract. works only on native pools.

PathMnemonicTypeDescription
opuint320x733ccfba
native_amountcoinsamount of nanoton for liquidity provision.
deposit_typeuint3one of deploy
liquidity_typeuint1one of custom
liquidity_dictdictdictionary of tokens for each bin of provision.
reject_payloadmaybe_cellreject payload for liquidity provision. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for liquidity provision. Sender recieves it with notify from lp multitoken contract.

provide​

Route add liquidity operation in native to range contract. works only on native pools.

PathMnemonicTypeDescription
opuint320x151898ad
query_iduint64query id
native_amountcoinsamount of nanoton for liquidity provision.
deposit_typeuint3one of deploy
liquidity_typeuint1one of custom
liquidity_dictdictdictionary of tokens for each bin of provision.
reject_payloadmaybe_cellreject payload for liquidity provision. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for liquidity provision. Sender recieves it with notify from lp multitoken contract.

deposit_on_account​

This message and it's query_id should be sent as forward_payload and query_id of jetton-transfer.

Deposit incoming asset on trade account.

PathMnemonicTypeDescription
opuint320xbf078db7
user_addressaddressaddress of trade account contract owner.
public_keyuint256public key of trade account. In most cases should be the public key of owner's wallet.
seedcellRandom data cell. Used for creating trade account in required shard.

deposit_on_account​

Deposit native asset on trade account. works only on native pools.

PathMnemonicTypeDescription
opuint320xbf078db7
query_iduint64query id
user_addressaddressaddress of trade account contract owner.
public_keyuint256public key of trade account. In most cases should be the public key of owner's wallet.
seedcellRandom data cell. Used for creating trade account in required shard.
native_amountcoinsnanotons amount to deposit on the trade account.

swap_from_account​

Route swap from trade account to range contract.

PathMnemonicTypeDescription
opuint320x455d690c
query_iduint64query id
user_addressaddressreceiver address.
public_keyuint256public key of trade account. In most cases should be the public key of owner's wallet.
seedcellRandom data cell. Used for creating trade account in required shard.
swap_bodyreceiver_addressaddressreceiver address.
swap_bodyaccount?boolis receiver same trade account contract.
swap_bodyamountcoinsamount of nanoton trade account will be sending with the message to the pool.
swap_bodymodeuint16mode of message trade account will be sedning to the pool.
swap_bodyasset_amountcoinsamount of asset is being send for swap to the pool.
swap_bodyis_xboolfirst or second asset will be sent to the pool.
swap_bodypartial_executionintflag of further parsing (see below)
partial_execution=0normal_slippagecoinsmin token out.
partial_execution=1slippageuint256last sqrt price of swap.
swap_bodyexact_outcoinsexact out of tokens to recieve from swap.

trade_account_provide​

Route provide from trade account to range contract.

PathMnemonicTypeDescription
opuint320x5673856b
query_iduint64query id
user_addressaddress
seedcell
deposit_typeuint3one of deploy
liquidity_dictdictdictionary of tokens for each bin of provision.
amount_xcoinsamount of first asset to deposit on lp account.
amount_ycoinsamount of second asset to deposit on lp account.
reject_payloadmaybe_cellreject payload for liquidity provision. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for liquidity provision. Sender recieves it with notify from lp multitoken contract.

withdraw_from_account​

Pay user assets from his trade account.

PathMnemonicTypeDescription
opuint320x8a747c91
query_iduint64query id
user_addressaddressreceiver address.
public_keyuint256public key of trade account. In most cases should be the public key of owner's wallet.
seedcellRandom data cell. Used for creating trade account in required shard.
swap_bodyreceiver_addressaddressreceiver address.
swap_bodyamount_xcoinsamount of first asset to withdraw.
swap_bodyamount_ycoinsamount of second asset to withdraw.

lp_account_provide​

| Path | Mnemonic | Type | Description | | ---- | --------------- | ---------- | ---------------------------------------------------------------------------------------------------- | ---------------- | ------- | | | op | uint32 | 0xc8d6147e | | | query_id | uint64 | query id | | | user_address | address | lp account's user owner. | | | amount_x | coins | amount of first asset to deposit on lp account. | | | amount_y | coins | amount of second asset to deposit on lp account. | | | deposit_type | uint3 | one of deploy | not_deploy | update. | | | liquidity_type | uint1 | one of custom | custom_one_side. | | | liquidity_dict | dict | dictionary of tokens for each bin of provision. | | | reject_payload | maybe_cell | reject payload for liquidity provision. Sender recieves it with tokens refund. | | | forward_payload | maybe_cell | forward payload for liquidity provision. Sender recieves it with notify from lp multitoken contract. |

swap_success_callback​

Pay user result of swap operation.

PathMnemonicTypeDescription
opuint320x8098a8b2
query_iduint64query id
new_current_bin_numberint32new current bin number, that was set after swap on the range contract.
new_sqrt_pint256new sqrt price, that was set after swap on the range contract.
from_accountboolis swap from trade account.
amount_xcoinsamount of first asset to send.
amount_ycoinsamount of second asset to send.
is_xboolis swap was from asset_x to asset_y or otherwise.
receiver_addressaddressaddress that should receive swapped tokens.
ref_cell -- maybe -- cell with referral address if present.ref_addraddressreferral address
additional_datamaybe_cell
reject_payloadmaybe_cellreject payload for swap. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for swap. Sender recieves it with swapped tokens.

swap_success_callback_v2​

Pay user result of swap operation.

PathMnemonicTypeDescription
opuint320x77c33806
query_iduint64query id
new_current_bin_numberint32new current bin number, that was set after swap on the range contract.
new_sqrt_pint256new sqrt price, that was set after swap on the range contract.
from_accountboolis swap from trade account.
amount_xcoinsamount of first asset to send.
amount_ycoinsamount of second asset to send.
is_xboolis swap was from asset_x to asset_y or otherwise.
receiver_addressaddressaddress that should receive swapped tokens.
lp_feeuint16
additional_datamaybe_cell
reject_payloadmaybe_cellreject payload for swap. Sender recieves it with tokens refund.
forward_payloadmaybe_cellforward payload for swap. Sender recieves it with swapped tokens.

success_provide_callback​

Pay user refund from add liquidity operation.

PathMnemonicTypeDescription
opuint320xa6234c28
query_iduint64query id
first_binint32first bin of sender range contract. Used for validating sender address.
amount_xcoinsamount of first asset to send.
amount_ycoinsamount of second asset to send.
user_addressaddressaddress that should receive swapped tokens.
forward_payloadmaybe_cellforward payload for swap. Sender recieves it with swapped tokens.

success_burn_callback​

Pay user result of remove liquidity operation.

PathMnemonicTypeDescription
opuint320x9090cde1
query_iduint64query id
first_binint32first bin of sender range contract. Used for validating sender address.
amount_xcoinsamount of first asset to send.
amount_ycoinsamount of second asset to send.
user_addressaddressaddress that should receive swapped tokens.
forward_payloadmaybe_cellforward payload for swap. Sender recieves it with swapped tokens.

lp_account_refund​

PathMnemonicTypeDescription
opuint320xa12803fc
query_iduint64query id
amount_xcoinsamount of first asset to withdraw from user's lp account.
amount_ycoinsamount of second asset to withdraw from user's lp account.
user_addressaddressaddress for calculating lp account's address.
forward_payloadmaybe_cellforward payload.

swap_fallback​

Refund user assets after slippage trigger on swap.

PathMnemonicTypeDescription
opuint320x84484046
query_iduint64query id
first_binint32first bin of sender range contract. Used for validating sender address.
from_accountboolis swap from trade account.
user_addressaddressuser address.
is_xboolis swap was from asset_x to asset_y or otherwise.
amountcoinsamount of first or second asset.
additional_datamaybe_celladditional data for swap. Now it is address of swap origin.
reject_payloadmaybe_cellreject payload for swap. Sender recieves it with tokens refund.

Get-methods​

get_protocol_fees​

Collected protocol fees on pool.

Return​

PathMnemonicTypeDescription
collected_token_x_protocol_feenumber
collected_token_y_protocol_feenumber

get_pool_info​

Return​

PathMnemonicTypeDescription
token_x_addressaddresstoken x jetton wallet
token_y_addressaddresstoken y jetton wallet
bin_stepnumberbin step of pool
lp_feenumberlp fee in pool

get_active_range​

Current active range address.

Return​

PathMnemonicTypeDescription
range_addressaddress

get_range_address​

Range address, calculated from first bin number of this range.

Input​

PathMnemonicTypeDescription
first_binnumber

Return​

PathMnemonicTypeDescription
range_addressaddress

get_lp_account_address​

Input​

PathMnemonicTypeDescription
user_addressaddress

Return​

PathMnemonicTypeDescription
lp_account_addressaddress

get_trade_account_address​

Input​

PathMnemonicTypeDescription
user_addressaddress
public_keynumber
seedslice

Return​

PathMnemonicTypeDescription
trade_account_addressaddress

get_pool_tokens​

Addresses of pool's jetton wallets.

Return​

PathMnemonicTypeDescription
pool_token_x_addressaddresstoken x jetton wallet
pool_token_y_addressaddresstoken y jetton wallet

get_admin_address​

Return​

PathMnemonicTypeDescription
admin_addressaddressadmin of pool

get_current_bin​

Return​

PathMnemonicTypeDescription
current_binnumbercurrent active bin in pool

get_sqrt_p​

Return​

PathMnemonicTypeDescription
sqrt_pnumbercurrent sqrt_p in pool

get_is_inited​

Return​

PathMnemonicTypeDescription
initnumberinit status of pool

get_tvl​

Return​

PathMnemonicTypeDescription
token_x_amountnumberamount of token x in pool
token_y_amountnumberamount of token y in pool

get_farming_info​

Return​

PathMnemonicTypeDescription
distributed_x_amountnumberamount of rewards distributed.
distributed_y_amountnumberamount of rewards distributed.
farming_x_per_secondnumberreward rate of token x
farming_y_per_secondnumberreward rate of token y
previous_callnumbertimestamp of last farming tick
end_of_farmingnumbertimestamp when farming ends

get_dynamic_fees_info​

Dynamic fees data.

Return​

PathMnemonicTypeDescription
base_feenumber
dynamic_fee_factornumber
time_filternumber
time_decaynumber

get_whoami​

Return​

PathMnemonicTypeDescription
pool_typeslicealways returns string "DLMM"

get_storage​

Return​

PathMnemonicTypeDescription
storagecellfull current storage of the contract.