@keep-network/tbtc-v2 1.6.0-dev.17 → 1.6.0-dev.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/artifacts/BLS.json +1 -1
  2. package/artifacts/Bank.json +3 -3
  3. package/artifacts/BeaconAuthorization.json +1 -1
  4. package/artifacts/BeaconDkg.json +1 -1
  5. package/artifacts/BeaconDkgValidator.json +1 -1
  6. package/artifacts/BeaconInactivity.json +1 -1
  7. package/artifacts/BeaconSortitionPool.json +3 -3
  8. package/artifacts/Bridge.json +5 -5
  9. package/artifacts/BridgeGovernance.json +2 -2
  10. package/artifacts/BridgeGovernanceParameters.json +2 -2
  11. package/artifacts/Deposit.json +2 -2
  12. package/artifacts/DepositSweep.json +2 -2
  13. package/artifacts/DonationVault.json +3 -3
  14. package/artifacts/EcdsaDkgValidator.json +1 -1
  15. package/artifacts/EcdsaInactivity.json +1 -1
  16. package/artifacts/EcdsaSortitionPool.json +3 -3
  17. package/artifacts/Fraud.json +2 -2
  18. package/artifacts/LightRelay.json +18 -18
  19. package/artifacts/LightRelayMaintainerProxy.json +8 -8
  20. package/artifacts/MaintainerProxy.json +19 -19
  21. package/artifacts/MovingFunds.json +2 -2
  22. package/artifacts/NuCypherToken.json +2 -2
  23. package/artifacts/RandomBeacon.json +2 -2
  24. package/artifacts/RandomBeaconChaosnet.json +2 -2
  25. package/artifacts/RandomBeaconGovernance.json +2 -2
  26. package/artifacts/Redemption.json +2 -2
  27. package/artifacts/ReimbursementPool.json +2 -2
  28. package/artifacts/T.json +2 -2
  29. package/artifacts/TBTC.json +3 -3
  30. package/artifacts/TBTCToken.json +3 -3
  31. package/artifacts/TBTCVault.json +23 -23
  32. package/artifacts/TokenStaking.json +1 -1
  33. package/artifacts/TokenholderGovernor.json +9 -9
  34. package/artifacts/TokenholderTimelock.json +8 -8
  35. package/artifacts/VendingMachine.json +3 -3
  36. package/artifacts/VendingMachineNuCypher.json +1 -1
  37. package/artifacts/VendingMachineV2.json +3 -3
  38. package/artifacts/VendingMachineV3.json +3 -3
  39. package/artifacts/WalletProposalValidator.json +2 -2
  40. package/artifacts/WalletRegistry.json +5 -5
  41. package/artifacts/WalletRegistryGovernance.json +2 -2
  42. package/artifacts/Wallets.json +2 -2
  43. package/artifacts/solcInputs/{d86f3b9c8cafe2e77604a4fc30b88b09.json → 19f15a13262ffc15233697ce606a19a1.json} +1 -1
  44. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
  45. package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
  46. package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.dbg.json +1 -1
  47. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
  48. package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  49. package/build/contracts/bridge/BridgeGovernanceParameters.sol/BridgeGovernanceParameters.dbg.json +1 -1
  50. package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
  51. package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
  52. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +1 -1
  53. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
  54. package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
  55. package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +1 -1
  56. package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
  57. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
  58. package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
  59. package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
  60. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
  61. package/build/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.dbg.json +1 -1
  62. package/build/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.dbg.json +1 -1
  63. package/build/contracts/bridge/WalletProposalValidator.sol/WalletProposalValidator.dbg.json +1 -1
  64. package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
  65. package/build/contracts/integrator/AbstractTBTCDepositor.sol/AbstractTBTCDepositor.dbg.json +1 -1
  66. package/build/contracts/integrator/AbstractTBTCDepositor.sol/AbstractTBTCDepositor.json +0 -19
  67. package/build/contracts/integrator/IBridge.sol/IBridge.dbg.json +1 -1
  68. package/build/contracts/integrator/IBridge.sol/IBridgeTypes.dbg.json +1 -1
  69. package/build/contracts/integrator/ITBTCVault.sol/ITBTCVault.dbg.json +1 -1
  70. package/build/contracts/l2/L2TBTC.sol/L2TBTC.dbg.json +1 -1
  71. package/build/contracts/l2/L2WormholeGateway.sol/IWormholeTokenBridge.dbg.json +1 -1
  72. package/build/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.dbg.json +1 -1
  73. package/build/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.dbg.json +1 -1
  74. package/build/contracts/relay/LightRelay.sol/ILightRelay.dbg.json +1 -1
  75. package/build/contracts/relay/LightRelay.sol/LightRelay.dbg.json +1 -1
  76. package/build/contracts/relay/LightRelay.sol/RelayUtils.dbg.json +1 -1
  77. package/build/contracts/relay/LightRelayMaintainerProxy.sol/LightRelayMaintainerProxy.dbg.json +1 -1
  78. package/build/contracts/test/BankStub.sol/BankStub.dbg.json +4 -0
  79. package/build/contracts/test/BankStub.sol/BankStub.json +555 -0
  80. package/build/contracts/test/BridgeStub.sol/BridgeStub.dbg.json +4 -0
  81. package/build/contracts/test/BridgeStub.sol/BridgeStub.json +3318 -0
  82. package/build/contracts/test/HeartbeatStub.sol/HeartbeatStub.dbg.json +4 -0
  83. package/build/contracts/test/HeartbeatStub.sol/HeartbeatStub.json +30 -0
  84. package/build/contracts/test/LightRelayStub.sol/LightRelayStub.dbg.json +4 -0
  85. package/build/contracts/test/LightRelayStub.sol/LightRelayStub.json +467 -0
  86. package/build/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.dbg.json +4 -0
  87. package/build/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.json +96 -0
  88. package/build/contracts/test/SepoliaLightRelay.sol/SepoliaLightRelay.dbg.json +4 -0
  89. package/build/contracts/test/SepoliaLightRelay.sol/SepoliaLightRelay.json +456 -0
  90. package/build/contracts/test/SystemTestRelay.sol/SystemTestRelay.dbg.json +4 -0
  91. package/build/contracts/test/SystemTestRelay.sol/SystemTestRelay.json +89 -0
  92. package/build/contracts/test/TestBitcoinTx.sol/TestBitcoinTx.dbg.json +4 -0
  93. package/build/contracts/test/TestBitcoinTx.sol/TestBitcoinTx.json +102 -0
  94. package/build/contracts/test/TestERC20.sol/TestERC20.dbg.json +4 -0
  95. package/build/contracts/test/TestERC20.sol/TestERC20.json +508 -0
  96. package/build/contracts/test/TestERC721.sol/TestERC721.dbg.json +4 -0
  97. package/build/contracts/test/TestERC721.sol/TestERC721.json +390 -0
  98. package/build/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.dbg.json +4 -0
  99. package/build/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.json +35 -0
  100. package/build/contracts/test/TestTBTCDepositor.sol/MockBridge.dbg.json +4 -0
  101. package/build/contracts/test/TestTBTCDepositor.sol/MockBridge.json +224 -0
  102. package/build/contracts/test/TestTBTCDepositor.sol/MockTBTCVault.dbg.json +4 -0
  103. package/build/contracts/test/TestTBTCDepositor.sol/MockTBTCVault.json +87 -0
  104. package/build/contracts/test/TestTBTCDepositor.sol/TestTBTCDepositor.dbg.json +4 -0
  105. package/build/contracts/test/TestTBTCDepositor.sol/TestTBTCDepositor.json +264 -0
  106. package/build/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.dbg.json +4 -0
  107. package/build/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.json +372 -0
  108. package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
  109. package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +1 -1
  110. package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
  111. package/build/contracts/vault/TBTCOptimisticMinting.sol/TBTCOptimisticMinting.dbg.json +1 -1
  112. package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
  113. package/contracts/integrator/AbstractTBTCDepositor.sol +10 -17
  114. package/contracts/test/BankStub.sol +11 -0
  115. package/contracts/test/BridgeStub.sol +174 -0
  116. package/contracts/test/HeartbeatStub.sol +16 -0
  117. package/contracts/test/LightRelayStub.sol +15 -0
  118. package/contracts/test/ReceiveApprovalStub.sol +33 -0
  119. package/contracts/test/SepoliaLightRelay.sol +48 -0
  120. package/contracts/test/SystemTestRelay.sol +57 -0
  121. package/contracts/test/TestBitcoinTx.sol +24 -0
  122. package/contracts/test/TestERC20.sol +12 -0
  123. package/contracts/test/TestERC721.sol +16 -0
  124. package/contracts/test/TestEcdsaLib.sol +17 -0
  125. package/contracts/test/TestTBTCDepositor.sol +196 -0
  126. package/contracts/test/WormholeBridgeStub.sol +125 -0
  127. package/export/artifacts/contracts/bridge/VendingMachine.sol/VendingMachine.json +6 -6
  128. package/export/artifacts/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.json +6 -6
  129. package/export/artifacts/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.json +6 -6
  130. package/export/artifacts/contracts/l2/L2TBTC.sol/L2TBTC.json +40 -40
  131. package/export/artifacts/contracts/l2/L2WormholeGateway.sol/L2WormholeGateway.json +47 -47
  132. package/export/artifacts/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.json +88 -88
  133. package/export/artifacts/contracts/relay/LightRelay.sol/LightRelay.json +57 -57
  134. package/export/artifacts/contracts/relay/LightRelayMaintainerProxy.sol/LightRelayMaintainerProxy.json +31 -31
  135. package/export/artifacts/contracts/test/BankStub.sol/BankStub.json +2 -2
  136. package/export/artifacts/contracts/test/BridgeStub.sol/BridgeStub.json +30 -30
  137. package/export/artifacts/contracts/test/HeartbeatStub.sol/HeartbeatStub.json +2 -2
  138. package/export/artifacts/contracts/test/LightRelayStub.sol/LightRelayStub.json +59 -59
  139. package/export/artifacts/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.json +7 -7
  140. package/export/artifacts/contracts/test/SepoliaLightRelay.sol/SepoliaLightRelay.json +59 -59
  141. package/export/artifacts/contracts/test/SystemTestRelay.sol/SystemTestRelay.json +14 -14
  142. package/export/artifacts/contracts/test/TestBitcoinTx.sol/TestBitcoinTx.json +5 -5
  143. package/export/artifacts/contracts/test/TestERC20.sol/TestERC20.json +6 -6
  144. package/export/artifacts/contracts/test/TestERC721.sol/TestERC721.json +8 -8
  145. package/export/artifacts/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.json +2 -2
  146. package/export/artifacts/contracts/test/TestTBTCDepositor.sol/MockBridge.json +36 -36
  147. package/export/artifacts/contracts/test/TestTBTCDepositor.sol/MockTBTCVault.json +23 -23
  148. package/export/artifacts/contracts/test/TestTBTCDepositor.sol/TestTBTCDepositor.json +1846 -2016
  149. package/export/artifacts/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.json +37 -37
  150. package/export/artifacts/contracts/token/TBTC.sol/TBTC.json +2 -2
  151. package/export/artifacts/contracts/vault/DonationVault.sol/DonationVault.json +11 -11
  152. package/export/artifacts/contracts/vault/TBTCVault.sol/TBTCVault.json +135 -135
  153. package/export/typechain/factories/AbstractTBTCDepositor__factory.js +0 -19
  154. package/export/typechain/factories/MockBridge__factory.js +1 -1
  155. package/export/typechain/factories/MockTBTCVault__factory.js +1 -1
  156. package/export/typechain/factories/TestTBTCDepositor__factory.js +1 -20
  157. package/package.json +1 -2
@@ -0,0 +1,372 @@
1
+ {
2
+ "_format": "hh-sol-artifact-1",
3
+ "contractName": "WormholeBridgeStub",
4
+ "sourceName": "contracts/test/WormholeBridgeStub.sol",
5
+ "abi": [
6
+ {
7
+ "inputs": [
8
+ {
9
+ "internalType": "contract TestERC20",
10
+ "name": "_wormholeToken",
11
+ "type": "address"
12
+ }
13
+ ],
14
+ "stateMutability": "nonpayable",
15
+ "type": "constructor"
16
+ },
17
+ {
18
+ "anonymous": false,
19
+ "inputs": [
20
+ {
21
+ "indexed": false,
22
+ "internalType": "bytes",
23
+ "name": "encodedVm",
24
+ "type": "bytes"
25
+ }
26
+ ],
27
+ "name": "WormholeBridgeStub_completeTransferWithPayload",
28
+ "type": "event"
29
+ },
30
+ {
31
+ "anonymous": false,
32
+ "inputs": [
33
+ {
34
+ "indexed": false,
35
+ "internalType": "address",
36
+ "name": "token",
37
+ "type": "address"
38
+ },
39
+ {
40
+ "indexed": false,
41
+ "internalType": "uint256",
42
+ "name": "amount",
43
+ "type": "uint256"
44
+ },
45
+ {
46
+ "indexed": false,
47
+ "internalType": "uint16",
48
+ "name": "recipientChain",
49
+ "type": "uint16"
50
+ },
51
+ {
52
+ "indexed": false,
53
+ "internalType": "bytes32",
54
+ "name": "recipient",
55
+ "type": "bytes32"
56
+ },
57
+ {
58
+ "indexed": false,
59
+ "internalType": "uint256",
60
+ "name": "arbiterFee",
61
+ "type": "uint256"
62
+ },
63
+ {
64
+ "indexed": false,
65
+ "internalType": "uint32",
66
+ "name": "nonce",
67
+ "type": "uint32"
68
+ }
69
+ ],
70
+ "name": "WormholeBridgeStub_transferTokens",
71
+ "type": "event"
72
+ },
73
+ {
74
+ "anonymous": false,
75
+ "inputs": [
76
+ {
77
+ "indexed": false,
78
+ "internalType": "address",
79
+ "name": "token",
80
+ "type": "address"
81
+ },
82
+ {
83
+ "indexed": false,
84
+ "internalType": "uint256",
85
+ "name": "amount",
86
+ "type": "uint256"
87
+ },
88
+ {
89
+ "indexed": false,
90
+ "internalType": "uint16",
91
+ "name": "recipientChain",
92
+ "type": "uint16"
93
+ },
94
+ {
95
+ "indexed": false,
96
+ "internalType": "bytes32",
97
+ "name": "recipient",
98
+ "type": "bytes32"
99
+ },
100
+ {
101
+ "indexed": false,
102
+ "internalType": "uint32",
103
+ "name": "nonce",
104
+ "type": "uint32"
105
+ },
106
+ {
107
+ "indexed": false,
108
+ "internalType": "bytes",
109
+ "name": "payload",
110
+ "type": "bytes"
111
+ }
112
+ ],
113
+ "name": "WormholeBridgeStub_transferTokensWithPayload",
114
+ "type": "event"
115
+ },
116
+ {
117
+ "inputs": [
118
+ {
119
+ "internalType": "bytes",
120
+ "name": "encodedVm",
121
+ "type": "bytes"
122
+ }
123
+ ],
124
+ "name": "completeTransferWithPayload",
125
+ "outputs": [
126
+ {
127
+ "internalType": "bytes",
128
+ "name": "",
129
+ "type": "bytes"
130
+ }
131
+ ],
132
+ "stateMutability": "nonpayable",
133
+ "type": "function"
134
+ },
135
+ {
136
+ "inputs": [
137
+ {
138
+ "internalType": "address",
139
+ "name": "to",
140
+ "type": "address"
141
+ },
142
+ {
143
+ "internalType": "uint256",
144
+ "name": "amount",
145
+ "type": "uint256"
146
+ }
147
+ ],
148
+ "name": "mintWormholeToken",
149
+ "outputs": [],
150
+ "stateMutability": "nonpayable",
151
+ "type": "function"
152
+ },
153
+ {
154
+ "inputs": [
155
+ {
156
+ "internalType": "bytes",
157
+ "name": "encoded",
158
+ "type": "bytes"
159
+ }
160
+ ],
161
+ "name": "parseTransferWithPayload",
162
+ "outputs": [
163
+ {
164
+ "components": [
165
+ {
166
+ "internalType": "uint8",
167
+ "name": "payloadID",
168
+ "type": "uint8"
169
+ },
170
+ {
171
+ "internalType": "uint256",
172
+ "name": "amount",
173
+ "type": "uint256"
174
+ },
175
+ {
176
+ "internalType": "bytes32",
177
+ "name": "tokenAddress",
178
+ "type": "bytes32"
179
+ },
180
+ {
181
+ "internalType": "uint16",
182
+ "name": "tokenChain",
183
+ "type": "uint16"
184
+ },
185
+ {
186
+ "internalType": "bytes32",
187
+ "name": "to",
188
+ "type": "bytes32"
189
+ },
190
+ {
191
+ "internalType": "uint16",
192
+ "name": "toChain",
193
+ "type": "uint16"
194
+ },
195
+ {
196
+ "internalType": "bytes32",
197
+ "name": "fromAddress",
198
+ "type": "bytes32"
199
+ },
200
+ {
201
+ "internalType": "bytes",
202
+ "name": "payload",
203
+ "type": "bytes"
204
+ }
205
+ ],
206
+ "internalType": "struct IWormholeTokenBridge.TransferWithPayload",
207
+ "name": "transfer",
208
+ "type": "tuple"
209
+ }
210
+ ],
211
+ "stateMutability": "pure",
212
+ "type": "function"
213
+ },
214
+ {
215
+ "inputs": [],
216
+ "name": "receiverAddress",
217
+ "outputs": [
218
+ {
219
+ "internalType": "bytes32",
220
+ "name": "",
221
+ "type": "bytes32"
222
+ }
223
+ ],
224
+ "stateMutability": "view",
225
+ "type": "function"
226
+ },
227
+ {
228
+ "inputs": [
229
+ {
230
+ "internalType": "bytes32",
231
+ "name": "_receiverAddress",
232
+ "type": "bytes32"
233
+ }
234
+ ],
235
+ "name": "setReceiverAddress",
236
+ "outputs": [],
237
+ "stateMutability": "nonpayable",
238
+ "type": "function"
239
+ },
240
+ {
241
+ "inputs": [
242
+ {
243
+ "internalType": "uint256",
244
+ "name": "_transferAmount",
245
+ "type": "uint256"
246
+ }
247
+ ],
248
+ "name": "setTransferAmount",
249
+ "outputs": [],
250
+ "stateMutability": "nonpayable",
251
+ "type": "function"
252
+ },
253
+ {
254
+ "inputs": [],
255
+ "name": "transferAmount",
256
+ "outputs": [
257
+ {
258
+ "internalType": "uint256",
259
+ "name": "",
260
+ "type": "uint256"
261
+ }
262
+ ],
263
+ "stateMutability": "view",
264
+ "type": "function"
265
+ },
266
+ {
267
+ "inputs": [
268
+ {
269
+ "internalType": "address",
270
+ "name": "token",
271
+ "type": "address"
272
+ },
273
+ {
274
+ "internalType": "uint256",
275
+ "name": "amount",
276
+ "type": "uint256"
277
+ },
278
+ {
279
+ "internalType": "uint16",
280
+ "name": "recipientChain",
281
+ "type": "uint16"
282
+ },
283
+ {
284
+ "internalType": "bytes32",
285
+ "name": "recipient",
286
+ "type": "bytes32"
287
+ },
288
+ {
289
+ "internalType": "uint256",
290
+ "name": "arbiterFee",
291
+ "type": "uint256"
292
+ },
293
+ {
294
+ "internalType": "uint32",
295
+ "name": "nonce",
296
+ "type": "uint32"
297
+ }
298
+ ],
299
+ "name": "transferTokens",
300
+ "outputs": [
301
+ {
302
+ "internalType": "uint64",
303
+ "name": "sequence",
304
+ "type": "uint64"
305
+ }
306
+ ],
307
+ "stateMutability": "payable",
308
+ "type": "function"
309
+ },
310
+ {
311
+ "inputs": [
312
+ {
313
+ "internalType": "address",
314
+ "name": "token",
315
+ "type": "address"
316
+ },
317
+ {
318
+ "internalType": "uint256",
319
+ "name": "amount",
320
+ "type": "uint256"
321
+ },
322
+ {
323
+ "internalType": "uint16",
324
+ "name": "recipientChain",
325
+ "type": "uint16"
326
+ },
327
+ {
328
+ "internalType": "bytes32",
329
+ "name": "recipient",
330
+ "type": "bytes32"
331
+ },
332
+ {
333
+ "internalType": "uint32",
334
+ "name": "nonce",
335
+ "type": "uint32"
336
+ },
337
+ {
338
+ "internalType": "bytes",
339
+ "name": "payload",
340
+ "type": "bytes"
341
+ }
342
+ ],
343
+ "name": "transferTokensWithPayload",
344
+ "outputs": [
345
+ {
346
+ "internalType": "uint64",
347
+ "name": "sequence",
348
+ "type": "uint64"
349
+ }
350
+ ],
351
+ "stateMutability": "payable",
352
+ "type": "function"
353
+ },
354
+ {
355
+ "inputs": [],
356
+ "name": "wormholeToken",
357
+ "outputs": [
358
+ {
359
+ "internalType": "contract TestERC20",
360
+ "name": "",
361
+ "type": "address"
362
+ }
363
+ ],
364
+ "stateMutability": "view",
365
+ "type": "function"
366
+ }
367
+ ],
368
+ "bytecode": "0x608060405234801561001057600080fd5b50604051610b08380380610b0883398101604081905261002f91610054565b600080546001600160a01b0319166001600160a01b0392909216919091179055610084565b60006020828403121561006657600080fd5b81516001600160a01b038116811461007d57600080fd5b9392505050565b610a75806100936000396000f3fe6080604052600436106100b15760003560e01c8063c3f511c111610069578063e566df311161004e578063e566df31146101bb578063ea63738d146101db578063efcb70c01461020857600080fd5b8063c3f511c11461017b578063c5a5ebda146101a857600080fd5b8063504d27fd1161009a578063504d27fd1461010b57806381c82233146101215780639542c9f11461014357600080fd5b80630f5287b0146100b657806316fed3e2146100e7575b600080fd5b6100c96100c4366004610577565b610228565b60405167ffffffffffffffff90911681526020015b60405180910390f35b3480156100f357600080fd5b506100fd60025481565b6040519081526020016100de565b34801561011757600080fd5b506100fd60015481565b34801561012d57600080fd5b5061014161013c3660046105d8565b600155565b005b34801561014f57600080fd5b50600054610163906001600160a01b031681565b6040516001600160a01b0390911681526020016100de565b34801561018757600080fd5b5061019b6101963660046106f9565b6102a0565b6040516100de9190610786565b6100c96101b63660046107a0565b61041e565b3480156101c757600080fd5b506101416101d63660046105d8565b600255565b3480156101e757600080fd5b506101fb6101f63660046106f9565b61046f565b6040516100de9190610823565b34801561021457600080fd5b5061014161022336600461089b565b6104ca565b604080516001600160a01b03881681526020810187905261ffff861681830152606081018590526080810184905263ffffffff831660a082015290516000917f4d24ef3f381c3d7e8696045268f69c41ec3dee2c5bd1aaa48daf8ec2ec7fe436919081900360c00190a1506103099695505050505050565b60607f6efaccd86b6ce8325db6ad038d68e09f9b1af9a0fc1ed121ebe9d870aafc2086826040516102d19190610786565b60405180910390a16000546001546040516340c10f1960e01b815233600482015260248101919091526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561032957600080fd5b505af115801561033d573d6000803e3d6000fd5b5050604080516101008101825260018152600260208083018290527f300000000000000000000000000000000000000000000000000000000000000083850152600460608401527f50000000000000000000000000000000000000000000000000000000000000006080840152600660a08401527f700000000000000000000000000000000000000000000000000000000000000060c08401529054835180830191909152835180820383018152908401845260e083015291519093506104079250839101610823565b604051602081830303815290604052915050919050565b60007f8f36aa28e4f86a5b6d397422d004b60e74eda866a331d074749b789d70ca3144878787878787604051610459969594939291906108c5565b60405180910390a1506103789695505050505050565b60408051610100810182526000808252602080830182905292820181905260608083018290526080830182905260a0830182905260c083019190915260e0820152825190916104c49184018101908401610976565b92915050565b6000546040516340c10f1960e01b81526001600160a01b03848116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b15801561051857600080fd5b505af115801561052c573d6000803e3d6000fd5b505050505050565b80356001600160a01b038116811461054b57600080fd5b919050565b61ffff8116811461056057600080fd5b50565b803563ffffffff8116811461054b57600080fd5b60008060008060008060c0878903121561059057600080fd5b61059987610534565b95506020870135945060408701356105b081610550565b935060608701359250608087013591506105cc60a08801610563565b90509295509295509295565b6000602082840312156105ea57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715610644576106446105f1565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610673576106736105f1565b604052919050565b600067ffffffffffffffff821115610695576106956105f1565b50601f01601f191660200190565b600082601f8301126106b457600080fd5b81356106c76106c28261067b565b61064a565b8181528460208386010111156106dc57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561070b57600080fd5b813567ffffffffffffffff81111561072257600080fd5b61072e848285016106a3565b949350505050565b60005b83811015610751578181015183820152602001610739565b50506000910152565b60008151808452610772816020860160208601610736565b601f01601f19169290920160200192915050565b602081526000610799602083018461075a565b9392505050565b60008060008060008060c087890312156107b957600080fd5b6107c287610534565b95506020870135945060408701356107d981610550565b9350606087013592506107ee60808801610563565b915060a087013567ffffffffffffffff81111561080a57600080fd5b61081689828a016106a3565b9150509295509295509295565b6020815260ff8251166020820152602082015160408201526040820151606082015261ffff6060830151166080820152608082015160a0820152600060a083015161087460c084018261ffff169052565b5060c083015160e083015260e083015161010080818501525061072e61012084018261075a565b600080604083850312156108ae57600080fd5b6108b783610534565b946020939093013593505050565b6001600160a01b038716815285602082015261ffff8516604082015283606082015263ffffffff8316608082015260c060a0820152600061090960c083018461075a565b98975050505050505050565b805160ff8116811461054b57600080fd5b805161054b81610550565b600082601f83011261094257600080fd5b81516109506106c28261067b565b81815284602083860101111561096557600080fd5b61072e826020830160208701610736565b60006020828403121561098857600080fd5b815167ffffffffffffffff808211156109a057600080fd5b9083019061010082860312156109b557600080fd5b6109bd610620565b6109c683610915565b815260208301516020820152604083015160408201526109e860608401610926565b606082015260808301516080820152610a0360a08401610926565b60a082015260c083015160c082015260e083015182811115610a2457600080fd5b610a3087828601610931565b60e0830152509594505050505056fea2646970667358221220913de8d1db6fa583b976d45f865e25f5fd92a6626c1bddca76ad1d23088eee1764736f6c63430008110033",
369
+ "deployedBytecode": "0x6080604052600436106100b15760003560e01c8063c3f511c111610069578063e566df311161004e578063e566df31146101bb578063ea63738d146101db578063efcb70c01461020857600080fd5b8063c3f511c11461017b578063c5a5ebda146101a857600080fd5b8063504d27fd1161009a578063504d27fd1461010b57806381c82233146101215780639542c9f11461014357600080fd5b80630f5287b0146100b657806316fed3e2146100e7575b600080fd5b6100c96100c4366004610577565b610228565b60405167ffffffffffffffff90911681526020015b60405180910390f35b3480156100f357600080fd5b506100fd60025481565b6040519081526020016100de565b34801561011757600080fd5b506100fd60015481565b34801561012d57600080fd5b5061014161013c3660046105d8565b600155565b005b34801561014f57600080fd5b50600054610163906001600160a01b031681565b6040516001600160a01b0390911681526020016100de565b34801561018757600080fd5b5061019b6101963660046106f9565b6102a0565b6040516100de9190610786565b6100c96101b63660046107a0565b61041e565b3480156101c757600080fd5b506101416101d63660046105d8565b600255565b3480156101e757600080fd5b506101fb6101f63660046106f9565b61046f565b6040516100de9190610823565b34801561021457600080fd5b5061014161022336600461089b565b6104ca565b604080516001600160a01b03881681526020810187905261ffff861681830152606081018590526080810184905263ffffffff831660a082015290516000917f4d24ef3f381c3d7e8696045268f69c41ec3dee2c5bd1aaa48daf8ec2ec7fe436919081900360c00190a1506103099695505050505050565b60607f6efaccd86b6ce8325db6ad038d68e09f9b1af9a0fc1ed121ebe9d870aafc2086826040516102d19190610786565b60405180910390a16000546001546040516340c10f1960e01b815233600482015260248101919091526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561032957600080fd5b505af115801561033d573d6000803e3d6000fd5b5050604080516101008101825260018152600260208083018290527f300000000000000000000000000000000000000000000000000000000000000083850152600460608401527f50000000000000000000000000000000000000000000000000000000000000006080840152600660a08401527f700000000000000000000000000000000000000000000000000000000000000060c08401529054835180830191909152835180820383018152908401845260e083015291519093506104079250839101610823565b604051602081830303815290604052915050919050565b60007f8f36aa28e4f86a5b6d397422d004b60e74eda866a331d074749b789d70ca3144878787878787604051610459969594939291906108c5565b60405180910390a1506103789695505050505050565b60408051610100810182526000808252602080830182905292820181905260608083018290526080830182905260a0830182905260c083019190915260e0820152825190916104c49184018101908401610976565b92915050565b6000546040516340c10f1960e01b81526001600160a01b03848116600483015260248201849052909116906340c10f1990604401600060405180830381600087803b15801561051857600080fd5b505af115801561052c573d6000803e3d6000fd5b505050505050565b80356001600160a01b038116811461054b57600080fd5b919050565b61ffff8116811461056057600080fd5b50565b803563ffffffff8116811461054b57600080fd5b60008060008060008060c0878903121561059057600080fd5b61059987610534565b95506020870135945060408701356105b081610550565b935060608701359250608087013591506105cc60a08801610563565b90509295509295509295565b6000602082840312156105ea57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610100810167ffffffffffffffff81118282101715610644576106446105f1565b60405290565b604051601f8201601f1916810167ffffffffffffffff81118282101715610673576106736105f1565b604052919050565b600067ffffffffffffffff821115610695576106956105f1565b50601f01601f191660200190565b600082601f8301126106b457600080fd5b81356106c76106c28261067b565b61064a565b8181528460208386010111156106dc57600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121561070b57600080fd5b813567ffffffffffffffff81111561072257600080fd5b61072e848285016106a3565b949350505050565b60005b83811015610751578181015183820152602001610739565b50506000910152565b60008151808452610772816020860160208601610736565b601f01601f19169290920160200192915050565b602081526000610799602083018461075a565b9392505050565b60008060008060008060c087890312156107b957600080fd5b6107c287610534565b95506020870135945060408701356107d981610550565b9350606087013592506107ee60808801610563565b915060a087013567ffffffffffffffff81111561080a57600080fd5b61081689828a016106a3565b9150509295509295509295565b6020815260ff8251166020820152602082015160408201526040820151606082015261ffff6060830151166080820152608082015160a0820152600060a083015161087460c084018261ffff169052565b5060c083015160e083015260e083015161010080818501525061072e61012084018261075a565b600080604083850312156108ae57600080fd5b6108b783610534565b946020939093013593505050565b6001600160a01b038716815285602082015261ffff8516604082015283606082015263ffffffff8316608082015260c060a0820152600061090960c083018461075a565b98975050505050505050565b805160ff8116811461054b57600080fd5b805161054b81610550565b600082601f83011261094257600080fd5b81516109506106c28261067b565b81815284602083860101111561096557600080fd5b61072e826020830160208701610736565b60006020828403121561098857600080fd5b815167ffffffffffffffff808211156109a057600080fd5b9083019061010082860312156109b557600080fd5b6109bd610620565b6109c683610915565b815260208301516020820152604083015160408201526109e860608401610926565b606082015260808301516080820152610a0360a08401610926565b60a082015260c083015160c082015260e083015182811115610a2457600080fd5b610a3087828601610931565b60e0830152509594505050505056fea2646970667358221220913de8d1db6fa583b976d45f865e25f5fd92a6626c1bddca76ad1d23088eee1764736f6c63430008110033",
370
+ "linkReferences": {},
371
+ "deployedLinkReferences": {}
372
+ }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/fd90cfb34a89b5cd7ef101e64705ab37.json"
3
+ "buildInfo": "../../../build-info/8b16fc152b88a0a691ccc6c859790c3d.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/fd90cfb34a89b5cd7ef101e64705ab37.json"
3
+ "buildInfo": "../../../build-info/8b16fc152b88a0a691ccc6c859790c3d.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/fd90cfb34a89b5cd7ef101e64705ab37.json"
3
+ "buildInfo": "../../../build-info/8b16fc152b88a0a691ccc6c859790c3d.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/fd90cfb34a89b5cd7ef101e64705ab37.json"
3
+ "buildInfo": "../../../build-info/8b16fc152b88a0a691ccc6c859790c3d.json"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "_format": "hh-sol-dbg-1",
3
- "buildInfo": "../../../build-info/fd90cfb34a89b5cd7ef101e64705ab37.json"
3
+ "buildInfo": "../../../build-info/8b16fc152b88a0a691ccc6c859790c3d.json"
4
4
  }
@@ -64,6 +64,9 @@ import "./ITBTCVault.sol";
64
64
  /// }
65
65
  ///
66
66
  /// function finalizeProcess(uint256 depositKey) external {
67
+ /// // Ensure the function cannot be called for the same deposit
68
+ /// // twice.
69
+ ///
67
70
  /// (
68
71
  /// uint256 initialDepositAmount,
69
72
  /// uint256 tbtcAmount,
@@ -84,11 +87,6 @@ abstract contract AbstractTBTCDepositor {
84
87
  IBridge public bridge;
85
88
  /// @notice TBTCVault contract address.
86
89
  ITBTCVault public tbtcVault;
87
- /// @notice Mapping holding information about pending deposits that have
88
- /// been initialized but not finalized yet. If the deposit is not
89
- /// in this mapping it means it has already been finalized or it
90
- /// has not been initialized yet.
91
- mapping(uint256 => bool) public pendingDeposits;
92
90
 
93
91
  // Reserved storage space that allows adding more variables without affecting
94
92
  // the storage layout of the child contracts. The convention from OpenZeppelin
@@ -137,6 +135,8 @@ abstract contract AbstractTBTCDepositor {
137
135
  /// - The revealed vault address must match the TBTCVault address,
138
136
  /// - All requirements from {Bridge#revealDepositWithExtraData}
139
137
  /// function must be met.
138
+ /// @dev This function doesn't validate if a deposit has been initialized before,
139
+ /// as the Bridge won't allow the same deposit to be revealed twice.
140
140
  // slither-disable-next-line dead-code
141
141
  function _initializeDeposit(
142
142
  IBridgeTypes.BitcoinTxInfo calldata fundingTx,
@@ -150,8 +150,6 @@ abstract contract AbstractTBTCDepositor {
150
150
  reveal.fundingOutputIndex
151
151
  );
152
152
 
153
- pendingDeposits[depositKey] = true;
154
-
155
153
  emit DepositInitialized(
156
154
  depositKey,
157
155
  /* solhint-disable-next-line not-rely-on-time */
@@ -180,6 +178,9 @@ abstract contract AbstractTBTCDepositor {
180
178
  /// (in the context of this contract) yet.
181
179
  /// - The deposit must be finalized on the Bridge side. That means the
182
180
  /// deposit must be either swept or optimistically minted.
181
+ /// @dev This function doesn't validate if a deposit has been finalized before,
182
+ /// it is a responsibility of the implementing contract to ensure this
183
+ /// function won't be called twice for the same deposit.
183
184
  /// @dev IMPORTANT NOTE: The tbtcAmount returned by this function is an
184
185
  /// approximation. See documentation of the `calculateTbtcAmount`
185
186
  /// responsible for calculating this value for more details.
@@ -192,11 +193,11 @@ abstract contract AbstractTBTCDepositor {
192
193
  bytes32 extraData
193
194
  )
194
195
  {
195
- require(pendingDeposits[depositKey], "Deposit not initialized");
196
-
197
196
  IBridgeTypes.DepositRequest memory deposit = bridge.deposits(
198
197
  depositKey
199
198
  );
199
+ require(deposit.revealedAt != 0, "Deposit not initialized");
200
+
200
201
  (, uint64 finalizedAt) = tbtcVault.optimisticMintingRequests(
201
202
  depositKey
202
203
  );
@@ -206,14 +207,6 @@ abstract contract AbstractTBTCDepositor {
206
207
  "Deposit not finalized by the bridge"
207
208
  );
208
209
 
209
- // We can safely delete the deposit from the pending deposits mapping.
210
- // This deposit cannot be initialized again because the bridge does not
211
- // allow to reveal the same deposit twice. Deleting the deposit from
212
- // the mapping will also prevent the finalizeDeposit function from
213
- // being called again for the same deposit.
214
- // slither-disable-next-line reentrancy-no-eth
215
- delete pendingDeposits[depositKey];
216
-
217
210
  initialDepositAmount = deposit.amount * SATOSHI_MULTIPLIER;
218
211
 
219
212
  tbtcAmount = _calculateTbtcAmount(deposit.amount, deposit.treasuryFee);
@@ -0,0 +1,11 @@
1
+ // SPDX-License-Identifier: GPL-3.0-only
2
+
3
+ pragma solidity 0.8.17;
4
+
5
+ import "../bank/Bank.sol";
6
+
7
+ contract BankStub is Bank {
8
+ function setBalance(address addr, uint256 amount) external {
9
+ balanceOf[addr] = amount;
10
+ }
11
+ }
@@ -0,0 +1,174 @@
1
+ // SPDX-License-Identifier: GPL-3.0-only
2
+
3
+ pragma solidity 0.8.17;
4
+
5
+ import "../bridge/BitcoinTx.sol";
6
+ import "../bridge/Bridge.sol";
7
+ import "../bridge/MovingFunds.sol";
8
+ import "../bridge/Wallets.sol";
9
+
10
+ contract BridgeStub is Bridge {
11
+ function setSweptDeposits(BitcoinTx.UTXO[] calldata utxos) external {
12
+ for (uint256 i = 0; i < utxos.length; i++) {
13
+ uint256 utxoKey = uint256(
14
+ keccak256(
15
+ abi.encodePacked(utxos[i].txHash, utxos[i].txOutputIndex)
16
+ )
17
+ );
18
+ self.deposits[utxoKey].sweptAt = 1641650400;
19
+ }
20
+ }
21
+
22
+ function setSpentMainUtxos(BitcoinTx.UTXO[] calldata utxos) external {
23
+ for (uint256 i = 0; i < utxos.length; i++) {
24
+ uint256 utxoKey = uint256(
25
+ keccak256(
26
+ abi.encodePacked(utxos[i].txHash, utxos[i].txOutputIndex)
27
+ )
28
+ );
29
+ self.spentMainUTXOs[utxoKey] = true;
30
+ }
31
+ }
32
+
33
+ function setProcessedMovedFundsSweepRequests(
34
+ BitcoinTx.UTXO[] calldata utxos
35
+ ) external {
36
+ for (uint256 i = 0; i < utxos.length; i++) {
37
+ uint256 utxoKey = uint256(
38
+ keccak256(
39
+ abi.encodePacked(utxos[i].txHash, utxos[i].txOutputIndex)
40
+ )
41
+ );
42
+ self.movedFundsSweepRequests[utxoKey].state = MovingFunds
43
+ .MovedFundsSweepRequestState
44
+ .Processed;
45
+ }
46
+ }
47
+
48
+ function setActiveWallet(bytes20 activeWalletPubKeyHash) external {
49
+ self.activeWalletPubKeyHash = activeWalletPubKeyHash;
50
+ }
51
+
52
+ function setWalletMainUtxo(
53
+ bytes20 walletPubKeyHash,
54
+ BitcoinTx.UTXO calldata utxo
55
+ ) external {
56
+ self.registeredWallets[walletPubKeyHash].mainUtxoHash = keccak256(
57
+ abi.encodePacked(
58
+ utxo.txHash,
59
+ utxo.txOutputIndex,
60
+ utxo.txOutputValue
61
+ )
62
+ );
63
+ }
64
+
65
+ function setWallet(bytes20 walletPubKeyHash, Wallets.Wallet calldata wallet)
66
+ external
67
+ {
68
+ self.registeredWallets[walletPubKeyHash] = wallet;
69
+
70
+ if (wallet.state == Wallets.WalletState.Live) {
71
+ self.liveWalletsCount++;
72
+ }
73
+ }
74
+
75
+ function setDepositDustThreshold(uint64 _depositDustThreshold) external {
76
+ self.depositDustThreshold = _depositDustThreshold;
77
+ }
78
+
79
+ function setDepositTxMaxFee(uint64 _depositTxMaxFee) external {
80
+ self.depositTxMaxFee = _depositTxMaxFee;
81
+ }
82
+
83
+ function setRedemptionDustThreshold(uint64 _redemptionDustThreshold)
84
+ external
85
+ {
86
+ self.redemptionDustThreshold = _redemptionDustThreshold;
87
+ }
88
+
89
+ function setRedemptionTreasuryFeeDivisor(
90
+ uint64 _redemptionTreasuryFeeDivisor
91
+ ) external {
92
+ self.redemptionTreasuryFeeDivisor = _redemptionTreasuryFeeDivisor;
93
+ }
94
+
95
+ function setPendingMovedFundsSweepRequest(
96
+ bytes20 walletPubKeyHash,
97
+ BitcoinTx.UTXO calldata utxo
98
+ ) external {
99
+ uint256 requestKey = uint256(
100
+ keccak256(abi.encodePacked(utxo.txHash, utxo.txOutputIndex))
101
+ );
102
+
103
+ self.movedFundsSweepRequests[requestKey] = MovingFunds
104
+ .MovedFundsSweepRequest(
105
+ walletPubKeyHash,
106
+ utxo.txOutputValue,
107
+ /* solhint-disable-next-line not-rely-on-time */
108
+ uint32(block.timestamp),
109
+ MovingFunds.MovedFundsSweepRequestState.Pending
110
+ );
111
+
112
+ self
113
+ .registeredWallets[walletPubKeyHash]
114
+ .pendingMovedFundsSweepRequestsCount++;
115
+ }
116
+
117
+ function processPendingMovedFundsSweepRequest(
118
+ bytes20 walletPubKeyHash,
119
+ BitcoinTx.UTXO calldata utxo
120
+ ) external {
121
+ uint256 requestKey = uint256(
122
+ keccak256(abi.encodePacked(utxo.txHash, utxo.txOutputIndex))
123
+ );
124
+
125
+ MovingFunds.MovedFundsSweepRequest storage request = self
126
+ .movedFundsSweepRequests[requestKey];
127
+
128
+ require(
129
+ request.state == MovingFunds.MovedFundsSweepRequestState.Pending,
130
+ "Stub sweep request must be in Pending state"
131
+ );
132
+
133
+ request.state = MovingFunds.MovedFundsSweepRequestState.Processed;
134
+
135
+ self
136
+ .registeredWallets[walletPubKeyHash]
137
+ .pendingMovedFundsSweepRequestsCount--;
138
+ }
139
+
140
+ function timeoutPendingMovedFundsSweepRequest(
141
+ bytes20 walletPubKeyHash,
142
+ BitcoinTx.UTXO calldata utxo
143
+ ) external {
144
+ uint256 requestKey = uint256(
145
+ keccak256(abi.encodePacked(utxo.txHash, utxo.txOutputIndex))
146
+ );
147
+
148
+ MovingFunds.MovedFundsSweepRequest storage request = self
149
+ .movedFundsSweepRequests[requestKey];
150
+
151
+ require(
152
+ request.state == MovingFunds.MovedFundsSweepRequestState.Pending,
153
+ "Stub sweep request must be in Pending state"
154
+ );
155
+
156
+ request.state = MovingFunds.MovedFundsSweepRequestState.TimedOut;
157
+
158
+ self
159
+ .registeredWallets[walletPubKeyHash]
160
+ .pendingMovedFundsSweepRequestsCount--;
161
+ }
162
+
163
+ function setMovedFundsSweepTxMaxTotalFee(
164
+ uint64 _movedFundsSweepTxMaxTotalFee
165
+ ) external {
166
+ self.movedFundsSweepTxMaxTotalFee = _movedFundsSweepTxMaxTotalFee;
167
+ }
168
+
169
+ function setDepositRevealAheadPeriod(uint32 _depositRevealAheadPeriod)
170
+ external
171
+ {
172
+ self.depositRevealAheadPeriod = _depositRevealAheadPeriod;
173
+ }
174
+ }