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 should be sent as forward_payload of jetton-transfer.

Route jetton swap operation to range contract.

PathMnemonicTypeDescription
opuint320xf2ef6c1b
query_iduint64query id
to_addressaddressreciever 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
opuint320xf2ef6c1b
query_iduint64query id
native_amountcoinsamount of tons is being sent for swap.
to_addressaddressreciever 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.

provide

This message should be sent as forward_payload of jetton-transfer.

Route add liquidity operation in jetton to range contract.

PathMnemonicTypeDescription
opuint320x96feef7b
query_iduint64query id
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 should be sent as forward_payload of jetton-transfer.

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

PathMnemonicTypeDescription
opuint320x3ea0bafc
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.

provide

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

PathMnemonicTypeDescription
opuint320x96feef7b
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.

lp_account_provide

PathMnemonicTypeDescription
opuint320xaf31d23f
query_iduint64query id
user_addressaddresslp account's user owner.
amount_xcoinsamount of first asset to deposit on lp account.
amount_ycoinsamount of second asset to deposit on lp account.
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.

swap_success_callback

Pay user result of swap operation.

PathMnemonicTypeDescription
opuint320x520e4831
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_accountboolalways false
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_cellmaybe_cellcell with referral address if present.
from_addressmaybe_cellcell with address that should receive refunded tokens.
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
opuint320x2422cbe
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
opuint320x42062d62
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
opuint320x9ba48e67
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
opuint320x1bba3896
query_iduint64query id
first_binint32first bin of sender range contract. Used for validating sender address.
from_accountboolalways false
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_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_fees_info

Fees data, multiplicated by 10000.

Return

PathMnemonicTypeDescription
ref_feenumber
protocol_feenumber
protocol_fee_addressaddress

get_storage

Return

PathMnemonicTypeDescription
storagecellfull current storage of the contract.