Unstake
This section describes how to unstake.
Last updated
This section describes how to unstake.
Last updated
To unstake user needs to send message with OP::BURN
to its Jetton Wallet and specify amount of jettons 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 tons 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 and user address. The TL-B scheme of this message is following:
Then Financial contract checks that its balance is enough (balance - MIN_TON_FOR_STORAGE >= withdraw_ton_amount
) and if this condition is correct it empty message with value equal to unstake_amount
(withdraw_ton_amount + msg_value - (storage_fee + LOCKUP_GAS_CONSUMPTION + UNSTAKE_GAS_CONSUMPTION
) to user.
Otherwise, it sends message back to Unstake Request. The TL-B scheme of this message is following: