bemo liquid staking
  • 👋Welcome to bemo
    • Introduction
    • What is liquid staking?
      • TON staking
      • Staking limitations
      • Liquid staking
      • bemo benefits
    • How bemo works
      • Staking
      • Validation
      • Unstaking
    • bmTON
      • bmTON explained
      • bmTON pricing
    • stTON
      • stTON explained
      • stTON pricing
  • 💻DEVELOPERS
    • bemo v1 (deprecated)
      • Stake
      • Unstake
      • Tracking unstake requests
      • How to get TON-stTON rate
    • bemo v2
      • Stake
      • Unstake
      • Tracking unstake requests
      • How to get TON-bmTON rate
  • 🚀Get Started
    • How to stake TON
    • FAQ
    • Ambassador Program
  • 🏦Tokenomics
    • Incentive Rewards Program
    • stXP
      • stXP FAQ
    • BMO Token
  • Legal
    • Disclaimer
    • Terms of Use
    • Privacy policy
  • 🆘Support
Powered by GitBook
On this page
  1. DEVELOPERS
  2. bemo v2

Unstake

This section describes how to unstake.

PreviousStakeNextTracking unstake requests

Last updated 14 days ago

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:

burn#595f07bc query_id:uint64 jetton_amount:Coins forward_payload:(Maybe ^Cell) = InternalMsgBody;

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:

// TL-B:
get_full_data#_ = (
    jetton_total_supply:Coins 
    ton_total_supply:Coins 
    commission_total_supply:Coins
    commission_factor:uint16
    commission_address:MsgAddressInt
    admin_address:MsgAddressInt
    transaction_address:MsgAddressInt
    content:^Cell
    jetton_wallet_code:^Cell
    unstake_request_code:^Cell
    last_lockup_epoch:uint32
    lockup_supply:Coins
    next_lockup_supply:Coins
    later_lockup_supply:Coins
    next_unstake_request_index:uint64
)

The TL-B scheme of burn notification is following:

burn_notification#7bdd97de query_id:uint64 withdraw_jetton_amount:Coins owner_address:MsgAddressInt receiver_address:MsgAddressInt forward_payload:(Maybe ^Cell) = InternalMsgBody;

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:

unstake#492ab1b3 index:uint64 owner:MsgAddressInt ton_amount:Coins jetton_amount:Coins forward_payload:(Maybe ^Cell) = InternalMsgBody;

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:

unstake_notification#90c80a07 query_id:uint64 forward_payload:(Maybe ^Cell) = InternalMsgBody;

Otherwise, it sends message back to Unstake Request. The TL-B scheme of this message is following:

return_unstake_request#38633538 unlock_timestamp:uint32 = InternalMsgBody;
💻