LpAccount
This section contains api reference of the lp account contract
Off-chain get methods
get_lp_account_data
get_lp_account_data
Returns current state of the lp account: owner address, pool address and amount of both Jetton tokens.
Arguments
None
Result
Returns the current state of the lp account.
Return structure
Key | Type | Index | Description |
---|---|---|---|
|
| 0 | Owner's address |
|
| 1 | Pool's address |
|
| 2 | Balance of th e first Jetton token (in basic token units) |
|
| 3 | Balance of the second Jetton token (in basic token units) |
On-chain queries
On-chain counterparts of getter methods.
Operations table
Name | Value | Description |
---|---|---|
| 0x1d439ae0 | Sends a message with the current state of the pool |
getter_lp_account_data
(0x1d439ae0)
getter_lp_account_data
(0x1d439ae0)Sends a message with current state of the lp account. On-chain equivalent of get_lp_account_data
.
TL-B
Message body
None
Outgoing messages
Sends a message with current state of the lp account to sender_address
Response message body
Name | Type | Description |
---|---|---|
|
| Operation code equal to |
|
| Query id |
|
| Owner's address |
|
| Pool's address |
|
| Balance of the first Jetton token (in basic token units) |
|
| Balance of the second Jetton token (in basic token units) |
Pool message handlers
Handles incoming messages from a pool
Operations table
Name | Value | Description |
---|---|---|
| 0x3ebe5431 | Add liquidity |
add_liquidity
(0x3ebe5431)
add_liquidity
(0x3ebe5431)Stores the sent amount of tokens by the user to be added as new liquidity. Upon receiving an appropriate amount of both tokens sends a message with those amounts to a pool to be added as new liquidity. The automatic liquidity addition happens only if the amount of both tokens if greater than 1000 and non-zero min_lp_out
was specified, otherwise the user can keep increasing the amount of stored tokens.
TL-B
Message body
Name | Type | Description |
---|---|---|
|
| Amount of the first Jetton tokens added (in basic token units) |
|
| Amount of the second Jetton tokens added (in basic token units) |
|
| Minimum required amount of received new liquidity tokens (in basic token units) |
Notes:
addition of liquidity will fail if a user should receive less than
min_lp_out
of lp tokens as a result
Outgoing messages
Sends a message to the pool with cb_add_liquidity
op
Response message body
Name | Type | Description |
---|---|---|
|
| Operation code, equal to |
|
| Query id |
|
| Amount of the first Jetton tokens added (in basic token units) |
|
| Amount of the second Jetton tokens added (in basic token units) |
|
| Owner's address |
|
| Minimum amount of received liquidity tokens (in basic token units) |
Notes:
addition of liquidity will fail if a user should receive less than
min_lp_out
of lp tokens as a result
User message handlers
Handles incoming messages from a user
Operations table
Name | Value | Description |
---|---|---|
| 0xbf3f447 | Return previously sent tokens back to the user |
| 0x4cf82803 | Directly add liquidity with specified amount of tokens and a minimum amount of received liquidity tokens |
| 0x42a0fb43 | Reset gas |
refund_me
(0xbf3f447)
refund_me
(0xbf3f447)Initiates a refund of stored tokens by add_liquidity
if the user decides to cancel the addition of new liquidity. The amount of stored tokens will be sent to the pool which will initiate a transfer back to the user.
TL-B
Message body
None
Outgoing messages
Sends a message with cb_refund_me
op code and amount of stored tokens to a pool. The pool will send a message to refund those tokens back to the user.
Response message body
Name | Type | Description |
---|---|---|
|
| Operation code |
|
| Query id |
|
| Amount of the first Jetton tokens (in basic token units) |
|
| Amount of the second Jetton tokens (in basic token units) |
|
| Owner's address |
direct_add_liquidity
(0x4cf82803)
direct_add_liquidity
(0x4cf82803)Initiates an addition of new liquidity to a pool with a specified amount of both tokens and a minimum amount of received liquidity. The operation is successful only if there's an equal or greater amount of both tokens stored in the account (the amount of both tokens must be greater than 1000). This method is useful if an automatic liquidity addition has not been triggered upon deposition of tokens.
TL-B
Message body
Name | Type | Description |
---|---|---|
|
| Amount of the first Jetton tokens (in basic token units) |
|
| Amount of the second Jetton tokens (in basic token units) |
|
| Minimum amount of received liquidity tokens (in basic token units) |
Notes:
addition of liquidity will fail if a user should receive less than
min_lp_out
of lp tokens as a resultmin_lp_out
value must be greater than zero for this operation to proceed
Outgoing messages
Sends a message with cb_add_liquidity
op code and amount of both tokens to be added as new liquidity.
Response message body
Name | Type | Description |
---|---|---|
|
| Operation code |
|
| Query id |
|
| Amount of the first Jetton tokens (in basic token units) |
|
| Amount of the second Jetton tokens (in basic token units) |
|
| Owner's address |
|
| Minimum amount of received liquidity tokens (in basic token units) |
Notes:
addition of liquidity will fail if a user should receive less than
min_lp_out
of lp tokens as a result
reset_gas
(0x42a0fb43)
reset_gas
(0x42a0fb43)Updates the amount of $TON (in nanoTons) on the lp account to REQUIRED_TON_RESERVE
(10000000) of the account. The remaining $TON will be sent back to the user_address
TL-B
Message body
None
Outgoing messages
Sends an empty message back to the user with the remaining $TON
Constants
Name | Value | Description |
---|---|---|
| 0 | Workchain id |
| 10000000 | Amount of $TON (in nanoTons) to be left on the lp account contract as gas |
Last updated