-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Track pending stake requests balance
Acre contract has a max deposit limit as a cap for new deposits. tBTC Depositor contract is a contract that performs stakes asynchronously, requiring tBTC Bridge to mint tBTC for deposited Bitcoin. We cannot rely solely on the `Acre.maxDeposit` function for the maximum amount of stake users can make, as the limit may be reached while initiating the stake request and finalizing tBTC minting. In the tBTC Depositor contract, we define a `maxStake` function that will consider the `Acre.maxDeposit` and the balance of pending stakes requested by the tBTC Depositor contract. The dApp should use this function to check the maximum allowed stake limit. Deposit details revealed in the stake request may be invalid, and a Bitcoin funding transaction was not made. In such a case, we don't want the amount for this request to be included in the pending stakes balance forever. We introduce a timeout, after which the requested amount will be deducted from the balance of the pending stake. When the stake request is finalized, it will be released from the pending stakes balance, as it will be deposited and included in the `Acre.maxDeposit` amount. When the stake request is recalled and tBTC is withdrawn by the staker, the pending stakes balance will also be reduced.
- Loading branch information
Showing
1 changed file
with
141 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters