Skip to content

Implement tBTC Bridge fees reimbursement #942

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

nkuba
Copy link
Member

@nkuba nkuba commented Apr 23, 2025

For deposits below a certain threshold, the fees will be reimbursed from the fees reimbursement pool, funded by the Acre protocol.

The tBTC Bridge fees reimbursement threshold can be updated by the Acre protocol owner.

TODO:

  • tests

For deposits below a certain threshold, the fees will be reimbursed
from the fees reimbursement pool, funded by the Acre protocol.

The tBTC Bridge fees reimbursement threshold can be updated by the
Acre protocol owner.
@nkuba nkuba requested a review from pdyraga April 23, 2025 09:10
Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for acre-dapp-testnet canceled.

Name Link
🔨 Latest commit 72b5571
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp-testnet/deploys/6808ae7fae97750008ed478f

Copy link

netlify bot commented Apr 23, 2025

Deploy Preview for acre-dapp canceled.

Name Link
🔨 Latest commit 72b5571
🔍 Latest deploy log https://app.netlify.com/sites/acre-dapp/deploys/6808ae7feb0bcd0008683d5a

Copy link
Member

@pdyraga pdyraga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good so far!

address _tbtcToken,
address _bitcoinDepositor
) external initializer {
__Ownable2Step_init();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should be good not calling it at all, given it does nothing, but if you want to make it more future-proof, this could make sense.

@@ -177,6 +195,9 @@ contract BitcoinDepositor is AbstractTBTCDepositor, Ownable2StepUpgradeable {

minDepositAmount = 0.015 * 1e18; // 0.015 BTC
depositorFeeDivisor = 1000; // 1/1000 == 10bps == 0.1% == 0.001

// Disable fees reimbursement by default.
bridgeFeesReimbursementThreshold = 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we deploying a new BitcoinDepositor contract or upgrading the existing one? For this line it does not make a lot of difference as the default value is 0 but I want to understand the flow.

Comment on lines +49 to +57
uint256 availableBalance = IERC20(tbtcToken).balanceOf(address(this));

if (availableBalance < reimbursedAmount) {
reimbursedAmount = availableBalance;
}

if (reimbursedAmount > 0) {
IERC20(tbtcToken).safeTransfer(msg.sender, reimbursedAmount);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because there is some logic to calculate the reimbursed amount (I mean, in some cases the full amount cannot be covered), maybe we can create a view function so we can call it in SDK and use it in this function?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants