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.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0xf9cd3bf5 |
| to_address | address | receiver address. |
| partial_execution | int | flag of further parsing (see below) |
| partial_execution=0 | normal_slippage | coins | min token out. |
| partial_execution=1 | slippage | uint256 | last sqrt price of swap. |
| exact_out | coins | exact out of tokens to recieve from swap. 0 if no exact_out present. |
| ref_addr | address | if null address then no referral fee applied. |
| additional_data | maybe_cell | additional data for swap. Now it is address of swap origin. |
| reject_payload | maybe_cell | reject payload for swap. Sender recieves it with tokens refund. |
| forward_payload | maybe_cell | forward payload for swap. Sender recieves it with swapped tokens. |
swap
Route swap operation in native to range contract. works only on native pools.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0xf9cd3bf5 |
| query_id | uint64 | query id |
| native_amount | coins | amount of tons is being sent for swap. |
| to_address | address | receiver address. |
| partial_execution | int | flag of further parsing (see below) |
| partial_execution=0 | normal_slippage | coins | min token out. |
| partial_execution=1 | slippage | uint256 | last sqrt price of swap. |
| exact_out | coins | exact out of tokens to recieve from swap. 0 if no exact_out present. |
| ref_addr | address | if null address then no referral fee applied. |
| additional_data | maybe_cell | additional data for swap. Now it is address of swap origin. |
| reject_payload | maybe_cell | reject payload for swap. Sender recieves it with tokens refund. |
| forward_payload | maybe_cell | forward 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.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x437bdf98 |
| to_address | address | receiver address. |
| partial_execution | int | flag of further parsing (see below) |
| partial_execution=0 | normal_slippage | coins | min token out. |
| partial_execution=1 | slippage | uint256 | last sqrt price of swap. |
| exact_out | coins | exact out of tokens to recieve from swap. 0 if no exact_out present. |
| additional_data | maybe_cell | additional data for swap. Now it is address of swap origin. |
| reject_payload | maybe_cell | reject payload for swap. Sender recieves it with tokens refund. |
| forward_payload | maybe_cell | forward payload for swap. Sender recieves it with swapped tokens. |
swap_v2
Route swap operation in native to range contract. works only on native pools.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x437bdf98 |
| query_id | uint64 | query id |
| native_amount | coins | amount of tons is being sent for swap. |
| to_address | address | receiver address. |
| partial_execution | int | flag of further parsing (see below) |
| partial_execution=0 | normal_slippage | coins | min token out. |
| partial_execution=1 | slippage | uint256 | last sqrt price of swap. |
| exact_out | coins | exact out of tokens to recieve from swap. 0 if no exact_out present. |
| additional_data | maybe_cell | additional data for swap. Now it is address of swap origin. |
| reject_payload | maybe_cell | reject payload for swap. Sender recieves it with tokens refund. |
| forward_payload | maybe_cell | forward 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.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x151898ad |
| deposit_type | uint3 | one of deploy |
| liquidity_type | uint1 | one of custom |
| 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. |
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.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x733ccfba |
| native_amount | coins | amount of nanoton for liquidity provision. |
| deposit_type | uint3 | one of deploy |
| liquidity_type | uint1 | one of custom |
| 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. |
provide
Route add liquidity operation in native to range contract. works only on native pools.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x151898ad |
| query_id | uint64 | query id |
| native_amount | coins | amount of nanoton for liquidity provision. |
| deposit_type | uint3 | one of deploy |
| liquidity_type | uint1 | one of custom |
| 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. |
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.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0xbf078db7 |
| user_address | address | address of trade account contract owner. |
| public_key | uint256 | public key of trade account. In most cases should be the public key of owner's wallet. |
| seed | cell | Random data cell. Used for creating trade account in required shard. |
deposit_on_account
Deposit native asset on trade account. works only on native pools.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0xbf078db7 |
| query_id | uint64 | query id |
| user_address | address | address of trade account contract owner. |
| public_key | uint256 | public key of trade account. In most cases should be the public key of owner's wallet. |
| seed | cell | Random data cell. Used for creating trade account in required shard. |
| native_amount | coins | nanotons amount to deposit on the trade account. |
swap_from_account
Route swap from trade account to range contract.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x455d690c |
| query_id | uint64 | query id |
| user_address | address | receiver address. |
| public_key | uint256 | public key of trade account. In most cases should be the public key of owner's wallet. |
| seed | cell | Random data cell. Used for creating trade account in required shard. |
| swap_body | receiver_address | address | receiver address. |
| swap_body | account? | bool | is receiver same trade account contract. |
| swap_body | amount | coins | amount of nanoton trade account will be sending with the message to the pool. |
| swap_body | mode | uint16 | mode of message trade account will be sedning to the pool. |
| swap_body | asset_amount | coins | amount of asset is being send for swap to the pool. |
| swap_body | is_x | bool | first or second asset will be sent to the pool. |
| swap_body | partial_execution | int | flag of further parsing (see below) |
| partial_execution=0 | normal_slippage | coins | min token out. |
| partial_execution=1 | slippage | uint256 | last sqrt price of swap. |
| swap_body | exact_out | coins | exact out of tokens to recieve from swap. |
trade_account_provide
Route provide from trade account to range contract.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x5673856b |
| query_id | uint64 | query id |
| user_address | address | |
| seed | cell | |
| deposit_type | uint3 | one of deploy |
| liquidity_dict | dict | dictionary of tokens for each bin of provision. |
| amount_x | coins | amount of first asset to deposit on lp account. |
| amount_y | coins | amount of second asset to deposit on lp account. |
| 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. |
withdraw_from_account
Pay user assets from his trade account.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x8a747c91 |
| query_id | uint64 | query id |
| user_address | address | receiver address. |
| public_key | uint256 | public key of trade account. In most cases should be the public key of owner's wallet. |
| seed | cell | Random data cell. Used for creating trade account in required shard. |
| swap_body | receiver_address | address | receiver address. |
| swap_body | amount_x | coins | amount of first asset to withdraw. |
| swap_body | amount_y | coins | amount 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.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x8098a8b2 |
| query_id | uint64 | query id |
| new_current_bin_number | int32 | new current bin number, that was set after swap on the range contract. |
| new_sqrt_p | int256 | new sqrt price, that was set after swap on the range contract. |
| from_account | bool | is swap from trade account. |
| amount_x | coins | amount of first asset to send. |
| amount_y | coins | amount of second asset to send. |
| is_x | bool | is swap was from asset_x to asset_y or otherwise. |
| receiver_address | address | address that should receive swapped tokens. |
| ref_cell -- maybe -- cell with referral address if present. | ref_addr | address | referral address |
| additional_data | maybe_cell | |
| reject_payload | maybe_cell | reject payload for swap. Sender recieves it with tokens refund. |
| forward_payload | maybe_cell | forward payload for swap. Sender recieves it with swapped tokens. |
swap_success_callback_v2
Pay user result of swap operation.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x77c33806 |
| query_id | uint64 | query id |
| new_current_bin_number | int32 | new current bin number, that was set after swap on the range contract. |
| new_sqrt_p | int256 | new sqrt price, that was set after swap on the range contract. |
| from_account | bool | is swap from trade account. |
| amount_x | coins | amount of first asset to send. |
| amount_y | coins | amount of second asset to send. |
| is_x | bool | is swap was from asset_x to asset_y or otherwise. |
| receiver_address | address | address that should receive swapped tokens. |
| lp_fee | uint16 | |
| additional_data | maybe_cell | |
| reject_payload | maybe_cell | reject payload for swap. Sender recieves it with tokens refund. |
| forward_payload | maybe_cell | forward payload for swap. Sender recieves it with swapped tokens. |
success_provide_callback
Pay user refund from add liquidity operation.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0xa6234c28 |
| query_id | uint64 | query id |
| first_bin | int32 | first bin of sender range contract. Used for validating sender address. |
| amount_x | coins | amount of first asset to send. |
| amount_y | coins | amount of second asset to send. |
| user_address | address | address that should receive swapped tokens. |
| forward_payload | maybe_cell | forward payload for swap. Sender recieves it with swapped tokens. |
success_burn_callback
Pay user result of remove liquidity operation.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x9090cde1 |
| query_id | uint64 | query id |
| first_bin | int32 | first bin of sender range contract. Used for validating sender address. |
| amount_x | coins | amount of first asset to send. |
| amount_y | coins | amount of second asset to send. |
| user_address | address | address that should receive swapped tokens. |
| forward_payload | maybe_cell | forward payload for swap. Sender recieves it with swapped tokens. |
lp_account_refund
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0xa12803fc |
| query_id | uint64 | query id |
| amount_x | coins | amount of first asset to withdraw from user's lp account. |
| amount_y | coins | amount of second asset to withdraw from user's lp account. |
| user_address | address | address for calculating lp account's address. |
| forward_payload | maybe_cell | forward payload. |
swap_fallback
Refund user assets after slippage trigger on swap.
| Path | Mnemonic | Type | Description |
|---|
| op | uint32 | 0x84484046 |
| query_id | uint64 | query id |
| first_bin | int32 | first bin of sender range contract. Used for validating sender address. |
| from_account | bool | is swap from trade account. |
| user_address | address | user address. |
| is_x | bool | is swap was from asset_x to asset_y or otherwise. |
| amount | coins | amount of first or second asset. |
| additional_data | maybe_cell | additional data for swap. Now it is address of swap origin. |
| reject_payload | maybe_cell | reject payload for swap. Sender recieves it with tokens refund. |
Get-methods
get_protocol_fees
Collected protocol fees on pool.
Return
| Path | Mnemonic | Type | Description |
|---|
| collected_token_x_protocol_fee | number | |
| collected_token_y_protocol_fee | number | |
get_pool_info
Return
| Path | Mnemonic | Type | Description |
|---|
| token_x_address | address | token x jetton wallet |
| token_y_address | address | token y jetton wallet |
| bin_step | number | bin step of pool |
| lp_fee | number | lp fee in pool |
get_active_range
Current active range address.
Return
| Path | Mnemonic | Type | Description |
|---|
| range_address | address | |
get_range_address
Range address, calculated from first bin number of this range.
| Path | Mnemonic | Type | Description |
|---|
| first_bin | number | |
Return
| Path | Mnemonic | Type | Description |
|---|
| range_address | address | |
get_lp_account_address
| Path | Mnemonic | Type | Description |
|---|
| user_address | address | |
Return
| Path | Mnemonic | Type | Description |
|---|
| lp_account_address | address | |
get_trade_account_address
| Path | Mnemonic | Type | Description |
|---|
| user_address | address | |
| public_key | number | |
| seed | slice | |
Return
| Path | Mnemonic | Type | Description |
|---|
| trade_account_address | address | |
get_pool_tokens
Addresses of pool's jetton wallets.
Return
| Path | Mnemonic | Type | Description |
|---|
| pool_token_x_address | address | token x jetton wallet |
| pool_token_y_address | address | token y jetton wallet |
get_admin_address
Return
| Path | Mnemonic | Type | Description |
|---|
| admin_address | address | admin of pool |
get_current_bin
Return
| Path | Mnemonic | Type | Description |
|---|
| current_bin | number | current active bin in pool |
get_sqrt_p
Return
| Path | Mnemonic | Type | Description |
|---|
| sqrt_p | number | current sqrt_p in pool |
get_is_inited
Return
| Path | Mnemonic | Type | Description |
|---|
| init | number | init status of pool |
get_tvl
Return
| Path | Mnemonic | Type | Description |
|---|
| token_x_amount | number | amount of token x in pool |
| token_y_amount | number | amount of token y in pool |
get_farming_info
Return
| Path | Mnemonic | Type | Description |
|---|
| distributed_x_amount | number | amount of rewards distributed. |
| distributed_y_amount | number | amount of rewards distributed. |
| farming_x_per_second | number | reward rate of token x |
| farming_y_per_second | number | reward rate of token y |
| previous_call | number | timestamp of last farming tick |
| end_of_farming | number | timestamp when farming ends |
get_dynamic_fees_info
Dynamic fees data.
Return
| Path | Mnemonic | Type | Description |
|---|
| base_fee | number | |
| dynamic_fee_factor | number | |
| time_filter | number | |
| time_decay | number | |
get_whoami
Return
| Path | Mnemonic | Type | Description |
|---|
| pool_type | slice | always returns string "DLMM" |
get_storage
Return
| Path | Mnemonic | Type | Description |
|---|
| storage | cell | full current storage of the contract. |