Pool
This section contains api reference of the pool contract
Last updated
This section contains api reference of the pool contract
Last updated
get_pool_data
Returns the current state of the Pool
None
Returns PoolData
structure containing current state of the pool. Typed pools may return additional arguments if present
PoolData
structure
Key | Type | Index | Description |
---|---|---|---|
Notes:
fee ratio is the value of fee divided by params::fee_divider
(10000); so a fee of 1% has a value of 100
get_lp_account_address
Get the lp account address of a user
Function getLpAccountAddress
returns the lp account address of a user
get_jetton_data
Standard jetton 'get' methods from TonWeb JettonMinter.
None
Returns a structure with Jetton data
JettonData
structure
get_wallet_address
Get lp wallet address of a user.
Function getJettonWalletAddress
returns a calculated lp wallet address of a user
On-chain counterparts of getter methods.
getter_pool_data
(0x26df39fc)Sends a message with the current state of the pool. On-chain equivalent of get_pool_data
.
None
Sends a message with current pool data to the sender_address
additional_data
bodygetter_lp_account_address
(0x15fbca95)Sends a message with the lp account address of a user. On-chain equivalent of get_lp_account_address
.
Sends a message with the lp account address of a user to sender_address
provide_wallet_address
(0x2c76b973)Sends a message with the lp wallet address of a user. On-chain equivalent of get_wallet_address
.
Sends a message back to sender with the calculated lp wallet address of a user
additional_data
bodyHandles operations sent from a Jetton wallet.
burn_notification_ext
(0x297437cf)Sent by LpWallet
after burning LP jettons to release liquidity.
Sends a message with op excesses
(0xd53276db) to response_address
Sends a message with a released amount of both tokens to be received by a user as a result of the burn operation to the router, which initiates pay_to
operation to from_address
Handles messages from the router.
swap
(0x6664de2a)Swap tokens. This message is received from the router when the user initiates a token swap.
payload
bodyadditional_data
bodyNotes:
swap will fail if a user should receive less than min_out
of tokens as a result
max allowed value of ref_fee
is 100 (1%)
Sends a message with an amount of the other tokens to be received by a user as a result of the swap to the router, which initiates pay_to
operation
Additionally may send a message with referral fees to the router, which initiates pay_vault
operation to Vault
of referral_address
provide_lp
(0x37c096df)Provide liquidity for the pool. A user must submit an amount of both tokens to receive lp tokens and add new liquidity to a pool. This message is routed to liquidity pool account with add_liquidity
operation code.
payload
bodyadditional_data
bodySends a message to liquidity pool account with add_liquidity
operation code.
reset_gas
(0x29d22935)Updates the amount of TON (in nanoTons) on the pool to storage_fee::pool
(10000000) of the pool. The remaining amount of TON will be sent to excesses_address
.
Sends a message to excesses_address
with the remaining TON
internal_set_fees
(0x75930d63)Set new fee values including liquidity pool fees, protocol fees and referral fees as well as an address for receiving collected protocol fees.
Notes:
fee ratio is the value of fee divided by params::fee_divider
(10000); so to set a fee to 1% the value must be 100
fees must be between params::min_fee
(0) and params::max_fee
(100)
Sends a message to excesses_address
with the remaining TON
Handles messages from the protocol_fee_address
.
collect_fees
(0x1ee4911e)Collect protocol fees. The amount of fees in both tokens will be sent to protocol_fee_address
address.
Sends a message with collected fees in both tokens to the router, which initiates pay_to
operation to protocol_fee_address
.
Handles messages from an lp account.
cb_add_liquidity
(0x06ecd527)Add new liquidity to the pool. Sent by user's lp account after both or one amounts tokens is sent by a user. The resulting added liquidity must be greater than min_lp_out
for the operation to be successful.
Notes:
addition of liquidity will fail if a user should receive less than min_lp_out
of lp tokens as a result
cannot add liquidity if a supply of either tokens becomes greater than MAX_COINS
(2^120 - 1)
Sends a message with internal_transfer
(0x178d4519) op code to the lp wallet of to_address
with minted liquidity tokens
cb_refund_me
(0x0f98e2b8)Sent by user's lp account after a user initiates refund_me
operation to cancel addition of new liquidity. The amount of previously stored tokens will be sent back to the user.
Sends a message with amount0
of the first token and amount1
of the second token to the router, which initiates pay_to
operation
Key | Type | Description |
---|---|---|
Key | Type | Index | Description |
---|---|---|---|
Name | Type | Description |
---|---|---|
Name | Value | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Value | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Value | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Value | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Value | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Type | Description |
---|---|---|
Name | Value | Description |
---|---|---|