-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Estimate staking fees #281
Merged
Merged
Conversation
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
To match the contract API from #91.
Add function that estimates the staking fees. Returns the following fees for staking operation: - treasuryFee - the tBTC treasury fee taken from each deposit and transferred to the treasury upon sweep proof submission. Is calculated based on the initial funding transaction amount, - optimisticMintingFee - the tBTC optimistic minting fee, Is calculated AFTER the treasury fee is cut, - depositTxMaxFee - maximum amount of BTC transaction fee that can be incurred by each swept deposit being part of the given sweep transaction, - depositorFee - the Acre network depositor fee taken from each deposit and transferred to the treasury upon stake request finalization.
Expose fee breakdown for staking opeartion in staking `module`.
nkuba
reviewed
Mar 6, 2024
We want to group the staking fees by tBTC and Acre networks.
This function returns the staking fees estimated based on the provided amount grouped by tBTC and Acre network fees. Fees are in 1e8 satoshi precision.
Update the `estimateStakingFees` function in Ethereum implementation of the `BitcoinDepositor` contract handle - we want to check if the `depositTreasuryFeeDivisor` value is greater than zero before we do division operation.
✅ Deploy Preview for acre-dapp-testnet ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
Move all the contract parameters getters to the beginning of the `estimateStakingFees` function to improve readability.
Sum up all network fees and add total field - we decided to add a total field because the SDK should be responsible for summing up all fees. If we add a new fee in the future the consumers will have to update their code as well which is not a developer-friendly approach.
nkuba
reviewed
Mar 18, 2024
`depositorFee` -> `bitcoinDepositorFee`
Add `fromSatoshi` fn that converts an amount from `1e8` to `1e18` token precision. Also here we remove optional `fromPrecision` param in `toSatoshi` fn - we assume we always convert from `1e18` to `1e8` and in `fromSatoshi` we always convert from `1e8` to `1e18`.
We should consider exposing the tBTC Bridge minting parameters from tTBC SDK.
This parameter will not change frequently, so we can cache this value per instance.
1 task
nkuba
reviewed
Apr 16, 2024
We transition from stake to deposit naming. Here we only update places related to the estimating fees feature. We are going to update the term in a separate PR.
Take into account stBTC deposit fee taken from each tBTC deposit to the stBTC pool which is then transferred to the treasury.
Use a consistent precision for both, input parameters and the values the function returns.
nkuba
reviewed
Apr 16, 2024
Make `BitcoinDepositor#estimateDepositFees` and `StBTC#depositFee` function names consistent. It was a little confusing to have `estimate` prefix in one but not in the other. Rename to `calculateDepositFee` in both.
This value doesn't change often that's why we want to cache it per `StBTC` contract handle instance.
nkuba
approved these changes
Apr 18, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #150
Add function that estimates the deposit fees for a given amount and expose it
in staking module.
Returns the following fees for deposit operation:
tbtc
- total tBTC network minting fees including:treasuryFee
- the tBTC treasury fee taken from each deposit andtransferred to the treasury upon sweep proof submission. Is calculated
based on the initial funding transaction amount,
optimisticMintingFee
- the tBTC optimistic minting fee, Is calculatedAFTER the treasury fee is cut,
depositTxMaxFee
- maximum amount of BTC transaction fee that can beincurred by each swept deposit being part of the given sweep
transaction.
acre
- total Acre network staking fees including:depositorFee
- the Acre network depositor fee taken from each depositand transferred to the treasury upon stake request finalization,
depositFee
- the stBTC deposit fee taken for each tBTC deposit into thestBTC pool.
total
- summed up all staking fees. We decided to add a total field becausethe SDK should be responsible for summing up all fees. If we add a new fee in
the future the consumers will have to update their code as well which is not a
developer-friendly approach.