Unstake
This section describes how to unstake.
Last updated
This section describes how to unstake.
Last updated
Overview
To unstake user needs to send message with OP::BURN
to its Jetton Wallet and specify amount of bmTON to burn. The TL-B scheme of burn request is following:
Then message with OP::BURN_NOTIFICATION
comes from Jetton Wallet to Financial contract. Financial checks that sender is valid and message has enough TON for burn notification and if everything is correct it deploys Unstake Request contract with user address (owner_address
) and withdraw_ton_amount
(int withdraw_ton_amount = muldiv(ton_total_supply, withdraw_jetton_amount, jetton_total_supply)
). To retrieve ton_total_supply
and jetton_total_supply
(if needed) you have to invoke get_full_data
method in Financial contract:
The TL-B scheme of burn notification is following:
After Unstake Request is deployed, anyone can send message to it. Contract checks that unlock timestamp has passed and if everything is correct it sends message to Financial with OP::UNSTAKE
, ton amount, jetton amount (currently unused) and user address. The TL-B scheme of this message is following:
Then Financial contract checks that its balance is enough (balance >= withdraw_ton_amount + msg_value
) and if this condition is correct it sends message with OP::UNSTAKE_NOTIFICATION
and value equal to unstake_amount - storage_fee
to user. The TL-B scheme of this message is following:
Otherwise, it sends message back to Unstake Request. The TL-B scheme of this message is following: