Skip to content
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

Adjust TBTC Transfer Amount to Include Fee and Update Sepolia Deployment #827

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion solidity/test/l2/L1BitcoinDepositor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1123,7 +1123,7 @@ describe("L1BitcoinDepositor", () => {
// omFee = amountSubTreasury / optimisticMintingFeeDivisor = 4975 * 1e10
// txMaxFee = depositTxMaxFee * satoshiMultiplier = 1000 * 1e10
// tbtcAmount = amountSubTreasury - omFee - txMaxFee = 93525 * 1e10
const expectedTbtcAmount = to1ePrecision(93525, 10)
const expectedTbtcAmount = to1ePrecision(94525, 10)

let tx: ContractTransaction

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0x0c5e36731008f4AFC1AF5Da2C4D5E07eE4a3EB69",
"address": "0x37169570D846Cc05D5848AAA30194d308b355638",
"abi": [
{
"inputs": [],
Expand Down Expand Up @@ -132,6 +132,25 @@
"name": "OwnershipTransferred",
"type": "event"
},
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "_address",
"type": "address"
},
{
"indexed": false,
"internalType": "bool",
"name": "authorization",
"type": "bool"
}
],
"name": "ReimbursementAuthorizationUpdated",
"type": "event"
},
{
"anonymous": false,
"inputs": [
Expand Down Expand Up @@ -464,6 +483,25 @@
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "reimbursementAuthorizations",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "reimbursementPool",
Expand Down Expand Up @@ -554,6 +592,24 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_address",
"type": "address"
},
{
"internalType": "bool",
"name": "authorization",
"type": "bool"
}
],
"name": "updateReimbursementAuthorization",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
Expand Down Expand Up @@ -607,75 +663,75 @@
"type": "function"
}
],
"transactionHash": "0x5a405183332f623649fcf19f8506cf2582882d5dc2b05582e0066388ef122229",
"transactionHash": "0xa484c7875f4a2f5e387316cc4490e348767004e351a2d0b312fd32eb509d0f96",
"receipt": {
"to": null,
"from": "0x68ad60CC5e8f3B7cC53beaB321cf0e6036962dBc",
"contractAddress": "0x0c5e36731008f4AFC1AF5Da2C4D5E07eE4a3EB69",
"transactionIndex": 94,
"gasUsed": "887851",
"logsBloom": "0x00000000000000000000000000000000400000000000000400800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000202000001000000000000000000000000000000000000020000000000000000000800000000800000000000000008000000400000000200000000000000000000000000000040000080000000000000800000000000000000000000000000000400000000000000000000000000000010000000000020000000000000200020040000000000000400000000000000000020000000000000000000000000000000100000000000000000000000000000000000",
"blockHash": "0x9d4a08d2b6fd26df76447aa1b5e0054686b1d462dc12be4d271dca1299060a2c",
"transactionHash": "0x5a405183332f623649fcf19f8506cf2582882d5dc2b05582e0066388ef122229",
"from": "0x949f0ADFDA95351829E49aEec0f99371A227572d",
"contractAddress": "0x37169570D846Cc05D5848AAA30194d308b355638",
"transactionIndex": 14,
"gasUsed": "888024",
"logsBloom": "0x00000000000000000000000080001000400000000000000000800000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000002000001400000000000000000000000000000004000020000000000000000000800000000800000000000000000004000400000100000000000000000000000000000000200000080000000000000800000000000000000000000000000000400000000000000000000000000000000000000000020000000000000000000040000000000000400100000000000000020000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xbf3cf876ca6f3c6271e272fbf1ac1b2004ad949892f038fb0132c22552f5664b",
"transactionHash": "0xa484c7875f4a2f5e387316cc4490e348767004e351a2d0b312fd32eb509d0f96",
"logs": [
{
"transactionIndex": 94,
"blockNumber": 5441536,
"transactionHash": "0x5a405183332f623649fcf19f8506cf2582882d5dc2b05582e0066388ef122229",
"address": "0x0c5e36731008f4AFC1AF5Da2C4D5E07eE4a3EB69",
"transactionIndex": 14,
"blockNumber": 6877156,
"transactionHash": "0xa484c7875f4a2f5e387316cc4490e348767004e351a2d0b312fd32eb509d0f96",
"address": "0x37169570D846Cc05D5848AAA30194d308b355638",
"topics": [
"0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b",
"0x000000000000000000000000720cb49a8b3c03e199075544f7f1f4d772dd6d06"
"0x000000000000000000000000ff79fca71751a5a0c4487a1ace268d6cd2a64db1"
],
"data": "0x",
"logIndex": 75,
"blockHash": "0x9d4a08d2b6fd26df76447aa1b5e0054686b1d462dc12be4d271dca1299060a2c"
"logIndex": 0,
"blockHash": "0xbf3cf876ca6f3c6271e272fbf1ac1b2004ad949892f038fb0132c22552f5664b"
},
{
"transactionIndex": 94,
"blockNumber": 5441536,
"transactionHash": "0x5a405183332f623649fcf19f8506cf2582882d5dc2b05582e0066388ef122229",
"address": "0x0c5e36731008f4AFC1AF5Da2C4D5E07eE4a3EB69",
"transactionIndex": 14,
"blockNumber": 6877156,
"transactionHash": "0xa484c7875f4a2f5e387316cc4490e348767004e351a2d0b312fd32eb509d0f96",
"address": "0x37169570D846Cc05D5848AAA30194d308b355638",
"topics": [
"0x8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0",
"0x0000000000000000000000000000000000000000000000000000000000000000",
"0x00000000000000000000000068ad60cc5e8f3b7cc53beab321cf0e6036962dbc"
"0x000000000000000000000000949f0adfda95351829e49aeec0f99371a227572d"
],
"data": "0x",
"logIndex": 76,
"blockHash": "0x9d4a08d2b6fd26df76447aa1b5e0054686b1d462dc12be4d271dca1299060a2c"
"logIndex": 1,
"blockHash": "0xbf3cf876ca6f3c6271e272fbf1ac1b2004ad949892f038fb0132c22552f5664b"
},
{
"transactionIndex": 94,
"blockNumber": 5441536,
"transactionHash": "0x5a405183332f623649fcf19f8506cf2582882d5dc2b05582e0066388ef122229",
"address": "0x0c5e36731008f4AFC1AF5Da2C4D5E07eE4a3EB69",
"transactionIndex": 14,
"blockNumber": 6877156,
"transactionHash": "0xa484c7875f4a2f5e387316cc4490e348767004e351a2d0b312fd32eb509d0f96",
"address": "0x37169570D846Cc05D5848AAA30194d308b355638",
"topics": [
"0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000000001",
"logIndex": 77,
"blockHash": "0x9d4a08d2b6fd26df76447aa1b5e0054686b1d462dc12be4d271dca1299060a2c"
"logIndex": 2,
"blockHash": "0xbf3cf876ca6f3c6271e272fbf1ac1b2004ad949892f038fb0132c22552f5664b"
},
{
"transactionIndex": 94,
"blockNumber": 5441536,
"transactionHash": "0x5a405183332f623649fcf19f8506cf2582882d5dc2b05582e0066388ef122229",
"address": "0x0c5e36731008f4AFC1AF5Da2C4D5E07eE4a3EB69",
"transactionIndex": 14,
"blockNumber": 6877156,
"transactionHash": "0xa484c7875f4a2f5e387316cc4490e348767004e351a2d0b312fd32eb509d0f96",
"address": "0x37169570D846Cc05D5848AAA30194d308b355638",
"topics": [
"0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f"
],
"data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000dd0007713cb99564b7835fd628a1718e8f9f9785",
"logIndex": 78,
"blockHash": "0x9d4a08d2b6fd26df76447aa1b5e0054686b1d462dc12be4d271dca1299060a2c"
"data": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000008d58747ef805317270ff7f8e51a8018d3488b17b",
"logIndex": 3,
"blockHash": "0xbf3cf876ca6f3c6271e272fbf1ac1b2004ad949892f038fb0132c22552f5664b"
}
],
"blockNumber": 5441536,
"cumulativeGasUsed": "8903785",
"blockNumber": 6877156,
"cumulativeGasUsed": "16670912",
"status": 1,
"byzantium": true
},
"numDeployments": 1,
"implementation": "0x720Cb49A8b3c03E199075544F7f1F4d772Dd6d06",
"implementation": "0xFf79fca71751A5A0C4487a1aCE268d6cd2A64Db1",
"devdoc": "Contract deployed as upgradable proxy"
}
}