-
Notifications
You must be signed in to change notification settings - Fork 5
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
base: main
Are you sure you want to change the base?
Conversation
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.
✅ Deploy Preview for acre-dapp-testnet canceled.
|
✅ Deploy Preview for acre-dapp canceled.
|
There was a problem hiding this 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(); |
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
uint256 availableBalance = IERC20(tbtcToken).balanceOf(address(this)); | ||
|
||
if (availableBalance < reimbursedAmount) { | ||
reimbursedAmount = availableBalance; | ||
} | ||
|
||
if (reimbursedAmount > 0) { | ||
IERC20(tbtcToken).safeTransfer(msg.sender, reimbursedAmount); | ||
} |
There was a problem hiding this comment.
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?
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: