Skip to content

Commit

Permalink
add-txMaxFee-to-tbtcAmount
Browse files Browse the repository at this point in the history
The Threshold DAO has decided to set the deposit transaction maximum fee to zero. Instead of modifying the deposit parameters, we adjust the amount of TBTC transferred to the L2 deposit owner by adding back the fee amount.

This change is implemented in the contracts that inherit from AbstractTBTCDepositor, not in the abstract contract itself. Specifically, the implementation adds depositTxMaxFee to the tbtcAmount value returned by _finalizeDeposit.
  • Loading branch information
lrsaturnino committed Oct 15, 2024
1 parent 96bab76 commit 3284910
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions solidity/contracts/l2/L1BitcoinDepositor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,16 @@ contract L1BitcoinDepositor is
bytes32 l2DepositOwner
) = _finalizeDeposit(depositKey);

// The deposit transaction max fee is in the 1e8 satoshi precision.
// We need to convert them to the 1e18 TBTC precision.
(, , uint64 depositTxMaxFee, ) = bridge.depositParameters();
uint256 txMaxFee = depositTxMaxFee * SATOSHI_MULTIPLIER;

// The Threshold DAO decided the deposit transaction max fee to be 0.
// Instead of changing the deposit parameters, we add the fee to the
// amount of TBTC that is transferred to the L2 deposit owner.
tbtcAmount += txMaxFee;

// slither-disable-next-line reentrancy-events
emit DepositFinalized(
depositKey,
Expand Down

0 comments on commit 3284910

Please sign in to comment.