@keep-network/tbtc-v2 0.1.1-dev.10 → 0.1.1-dev.102

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 (133) hide show
  1. package/README.adoc +12 -0
  2. package/artifacts/Bank.json +807 -0
  3. package/artifacts/Bridge.json +2300 -0
  4. package/artifacts/BridgeGovernance.json +2931 -0
  5. package/artifacts/BridgeGovernanceParameters.json +1445 -0
  6. package/artifacts/Deposit.json +117 -0
  7. package/artifacts/DepositSweep.json +77 -0
  8. package/artifacts/EcdsaDkgValidator.json +532 -0
  9. package/artifacts/EcdsaInactivity.json +156 -0
  10. package/artifacts/EcdsaSortitionPool.json +1004 -0
  11. package/artifacts/Fraud.json +164 -0
  12. package/artifacts/KeepRegistry.json +99 -0
  13. package/artifacts/KeepStake.json +286 -0
  14. package/artifacts/KeepToken.json +711 -0
  15. package/artifacts/KeepTokenStaking.json +483 -0
  16. package/artifacts/MaintainerProxy.json +1522 -0
  17. package/artifacts/MovingFunds.json +249 -0
  18. package/artifacts/NuCypherStakingEscrow.json +256 -0
  19. package/artifacts/NuCypherToken.json +711 -0
  20. package/artifacts/RandomBeaconStub.json +141 -0
  21. package/artifacts/Redemption.json +174 -0
  22. package/artifacts/ReimbursementPool.json +509 -0
  23. package/artifacts/Relay.json +123 -0
  24. package/artifacts/T.json +1148 -0
  25. package/artifacts/TBTC.json +27 -26
  26. package/artifacts/TBTCToken.json +27 -26
  27. package/artifacts/TBTCVault.json +691 -0
  28. package/artifacts/TokenStaking.json +2288 -0
  29. package/artifacts/TokenholderGovernor.json +1795 -0
  30. package/artifacts/TokenholderTimelock.json +1058 -0
  31. package/artifacts/VendingMachine.json +31 -30
  32. package/artifacts/VendingMachineKeep.json +400 -0
  33. package/artifacts/VendingMachineNuCypher.json +400 -0
  34. package/artifacts/WalletRegistry.json +1843 -0
  35. package/artifacts/WalletRegistryGovernance.json +2754 -0
  36. package/artifacts/Wallets.json +186 -0
  37. package/artifacts/solcInputs/f53bc10568b6d3c32d2989742aa1c456.json +323 -0
  38. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
  39. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.json +2 -2
  40. package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
  41. package/build/contracts/bank/Bank.sol/Bank.json +10 -5
  42. package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.dbg.json +4 -0
  43. package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.json +34 -0
  44. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
  45. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.json +2 -2
  46. package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  47. package/build/contracts/bridge/Bridge.sol/Bridge.json +2549 -198
  48. package/build/contracts/bridge/BridgeGovernance.sol/BridgeGovernance.dbg.json +4 -0
  49. package/build/contracts/bridge/BridgeGovernance.sol/BridgeGovernance.json +2246 -0
  50. package/build/contracts/bridge/BridgeGovernanceParameters.sol/BridgeGovernanceParameters.dbg.json +4 -0
  51. package/build/contracts/bridge/BridgeGovernanceParameters.sol/BridgeGovernanceParameters.json +971 -0
  52. package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +4 -0
  53. package/build/contracts/bridge/BridgeState.sol/BridgeState.json +226 -0
  54. package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +4 -0
  55. package/build/contracts/bridge/Deposit.sol/Deposit.json +72 -0
  56. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +4 -0
  57. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.json +30 -0
  58. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +4 -0
  59. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.json +10 -0
  60. package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +4 -0
  61. package/build/contracts/bridge/Fraud.sol/Fraud.json +86 -0
  62. package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +4 -0
  63. package/build/contracts/bridge/Heartbeat.sol/Heartbeat.json +10 -0
  64. package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +4 -0
  65. package/build/contracts/bridge/IRelay.sol/IRelay.json +37 -0
  66. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +4 -0
  67. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.json +138 -0
  68. package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +4 -0
  69. package/build/contracts/bridge/Redemption.sol/OutboundTx.json +10 -0
  70. package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +4 -0
  71. package/build/contracts/bridge/Redemption.sol/Redemption.json +92 -0
  72. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
  73. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.json +2 -2
  74. package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +4 -0
  75. package/build/contracts/bridge/Wallets.sol/Wallets.json +112 -0
  76. package/build/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.dbg.json +4 -0
  77. package/build/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.json +1111 -0
  78. package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
  79. package/build/contracts/token/TBTC.sol/TBTC.json +2 -2
  80. package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +4 -0
  81. package/build/contracts/vault/DonationVault.sol/DonationVault.json +108 -0
  82. package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
  83. package/build/contracts/vault/IVault.sol/IVault.json +5 -0
  84. package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
  85. package/build/contracts/vault/TBTCVault.sol/TBTCVault.json +273 -5
  86. package/contracts/GovernanceUtils.sol +4 -4
  87. package/contracts/bank/Bank.sol +113 -66
  88. package/contracts/bank/IReceiveBalanceApproval.sol +45 -0
  89. package/contracts/bridge/BitcoinTx.sol +267 -10
  90. package/contracts/bridge/Bridge.sol +1698 -245
  91. package/contracts/bridge/BridgeGovernance.sol +1533 -0
  92. package/contracts/bridge/BridgeGovernanceParameters.sol +1695 -0
  93. package/contracts/bridge/BridgeState.sol +768 -0
  94. package/contracts/bridge/Deposit.sol +269 -0
  95. package/contracts/bridge/DepositSweep.sol +574 -0
  96. package/contracts/bridge/EcdsaLib.sol +45 -0
  97. package/contracts/bridge/Fraud.sol +579 -0
  98. package/contracts/bridge/Heartbeat.sol +112 -0
  99. package/contracts/bridge/IRelay.sol +28 -0
  100. package/contracts/bridge/MovingFunds.sol +1077 -0
  101. package/contracts/bridge/Redemption.sol +1058 -0
  102. package/contracts/bridge/VendingMachine.sol +2 -2
  103. package/contracts/bridge/Wallets.sol +719 -0
  104. package/contracts/hardhat-dependency-compiler/.hardhat-dependency-compiler +1 -0
  105. package/contracts/hardhat-dependency-compiler/@keep-network/ecdsa/contracts/WalletRegistry.sol +3 -0
  106. package/contracts/hardhat-dependency-compiler/@openzeppelin/contracts/proxy/transparent/ProxyAdmin.sol +3 -0
  107. package/contracts/hardhat-dependency-compiler/@openzeppelin/contracts/proxy/transparent/TransparentUpgradeableProxy.sol +3 -0
  108. package/contracts/maintainer/MaintainerProxy.sol +512 -0
  109. package/contracts/token/TBTC.sol +1 -1
  110. package/contracts/vault/DonationVault.sol +125 -0
  111. package/contracts/vault/IVault.sol +6 -22
  112. package/contracts/vault/TBTCVault.sol +188 -29
  113. package/deploy/00_resolve_relay.ts +28 -0
  114. package/deploy/{03_transfer_roles.ts → 03_transfer_vending_machine_roles.ts} +1 -1
  115. package/deploy/04_deploy_bank.ts +27 -0
  116. package/deploy/05_deploy_bridge.ts +80 -0
  117. package/deploy/06_deploy_tbtc_vault.ts +30 -0
  118. package/deploy/07_deploy_bridge_governance.ts +40 -0
  119. package/deploy/08_deploy_maintainer_proxy.ts +30 -0
  120. package/deploy/09_bank_update_bridge.ts +19 -0
  121. package/deploy/10_transfer_bank_ownership.ts +15 -0
  122. package/deploy/11_transfer_bridge_governance.ts +22 -0
  123. package/deploy/12_transfer_bridge_governance_ownership.ts +19 -0
  124. package/deploy/13_transfer_tbtc_vault_ownership.ts +15 -0
  125. package/deploy/14_transfer_maintainer_proxy_ownership.ts +19 -0
  126. package/deploy/15_initialize_wallet_owner.ts +18 -0
  127. package/deploy/16_transfer_proxy_admin_ownership.ts +30 -0
  128. package/deploy/17_authorize_maintainer_proxy.ts +22 -0
  129. package/deploy/18_transfer_reimbursement_pool_ownership.ts +19 -0
  130. package/deploy/19_deploy_proxy_admin_with_deputy.ts +33 -0
  131. package/export.json +19544 -404
  132. package/package.json +34 -26
  133. package/artifacts/solcInputs/524094faac10a04084fcc411e06dab84.json +0 -128
@@ -0,0 +1,1533 @@
1
+ // SPDX-License-Identifier: MIT
2
+
3
+ // ██████████████ ▐████▌ ██████████████
4
+ // ██████████████ ▐████▌ ██████████████
5
+ // ▐████▌ ▐████▌
6
+ // ▐████▌ ▐████▌
7
+ // ██████████████ ▐████▌ ██████████████
8
+ // ██████████████ ▐████▌ ██████████████
9
+ // ▐████▌ ▐████▌
10
+ // ▐████▌ ▐████▌
11
+ // ▐████▌ ▐████▌
12
+ // ▐████▌ ▐████▌
13
+ // ▐████▌ ▐████▌
14
+ // ▐████▌ ▐████▌
15
+
16
+ pragma solidity ^0.8.9;
17
+
18
+ import "@openzeppelin/contracts/access/Ownable.sol";
19
+ import "./BridgeGovernanceParameters.sol";
20
+
21
+ import "./Bridge.sol";
22
+
23
+ /// @title Bridge Governance
24
+ /// @notice Owns the `Bridge` contract and is responsible for updating
25
+ /// its governable parameters in respect to governance delay individual
26
+ /// for each parameter. The other responsibility is marking a vault
27
+ /// address as trusted or no longer trusted.
28
+ contract BridgeGovernance is Ownable {
29
+ using BridgeGovernanceParameters for BridgeGovernanceParameters.DepositData;
30
+ using BridgeGovernanceParameters for BridgeGovernanceParameters.RedemptionData;
31
+ using BridgeGovernanceParameters for BridgeGovernanceParameters.MovingFundsData;
32
+ using BridgeGovernanceParameters for BridgeGovernanceParameters.WalletData;
33
+ using BridgeGovernanceParameters for BridgeGovernanceParameters.FraudData;
34
+
35
+ BridgeGovernanceParameters.DepositData internal depositData;
36
+ BridgeGovernanceParameters.RedemptionData internal redemptionData;
37
+ BridgeGovernanceParameters.MovingFundsData internal movingFundsData;
38
+ BridgeGovernanceParameters.WalletData internal walletData;
39
+ BridgeGovernanceParameters.FraudData internal fraudData;
40
+
41
+ Bridge internal bridge;
42
+
43
+ // Array is used to mitigate the problem with the contract size limit.
44
+ // governanceDelays[0] -> governanceDelay
45
+ // governanceDelays[1] -> newGovernanceDelay
46
+ // governanceDelays[2] -> governanceDelayChangeInitiated
47
+ uint256[3] public governanceDelays;
48
+
49
+ uint256 public bridgeGovernanceTransferChangeInitiated;
50
+ address internal newBridgeGovernance;
51
+
52
+ // We skip emitting event on *Update to go down with the contract size
53
+ // limit. The reason why we leave *Started but not including *Updated is
54
+ // because Bridge governance transferred event can also be read from the
55
+ // Governable bridge contract 'GovernanceTransferred(old, new)'.
56
+ event BridgeGovernanceTransferStarted(
57
+ address newBridgeGovernance,
58
+ uint256 timestamp
59
+ );
60
+
61
+ event DepositDustThresholdUpdateStarted(
62
+ uint64 newDepositDustThreshold,
63
+ uint256 timestamp
64
+ );
65
+ event DepositDustThresholdUpdated(uint64 depositDustThreshold);
66
+
67
+ event DepositTreasuryFeeDivisorUpdateStarted(
68
+ uint64 depositTreasuryFeeDivisor,
69
+ uint256 timestamp
70
+ );
71
+ event DepositTreasuryFeeDivisorUpdated(uint64 depositTreasuryFeeDivisor);
72
+
73
+ event DepositTxMaxFeeUpdateStarted(
74
+ uint64 newDepositTxMaxFee,
75
+ uint256 timestamp
76
+ );
77
+ event DepositTxMaxFeeUpdated(uint64 depositTxMaxFee);
78
+
79
+ event RedemptionDustThresholdUpdateStarted(
80
+ uint64 newRedemptionDustThreshold,
81
+ uint256 timestamp
82
+ );
83
+ event RedemptionDustThresholdUpdated(uint64 redemptionDustThreshold);
84
+
85
+ event RedemptionTreasuryFeeDivisorUpdateStarted(
86
+ uint64 newRedemptionTreasuryFeeDivisor,
87
+ uint256 timestamp
88
+ );
89
+ event RedemptionTreasuryFeeDivisorUpdated(
90
+ uint64 redemptionTreasuryFeeDivisor
91
+ );
92
+
93
+ event RedemptionTxMaxFeeUpdateStarted(
94
+ uint64 newRedemptionTxMaxFee,
95
+ uint256 timestamp
96
+ );
97
+ event RedemptionTxMaxFeeUpdated(uint64 redemptionTxMaxFee);
98
+
99
+ event RedemptionTimeoutUpdateStarted(
100
+ uint32 newRedemptionTimeout,
101
+ uint256 timestamp
102
+ );
103
+ event RedemptionTimeoutUpdated(uint32 redemptionTimeout);
104
+
105
+ event RedemptionTimeoutSlashingAmountUpdateStarted(
106
+ uint96 newRedemptionTimeoutSlashingAmount,
107
+ uint256 timestamp
108
+ );
109
+ event RedemptionTimeoutSlashingAmountUpdated(
110
+ uint96 redemptionTimeoutSlashingAmount
111
+ );
112
+
113
+ event RedemptionTimeoutNotifierRewardMultiplierUpdateStarted(
114
+ uint32 newRedemptionTimeoutNotifierRewardMultiplier,
115
+ uint256 timestamp
116
+ );
117
+ event RedemptionTimeoutNotifierRewardMultiplierUpdated(
118
+ uint32 redemptionTimeoutNotifierRewardMultiplier
119
+ );
120
+
121
+ event MovingFundsTxMaxTotalFeeUpdateStarted(
122
+ uint64 newMovingFundsTxMaxTotalFee,
123
+ uint256 timestamp
124
+ );
125
+ event MovingFundsTxMaxTotalFeeUpdated(uint64 movingFundsTxMaxTotalFee);
126
+
127
+ event MovingFundsDustThresholdUpdateStarted(
128
+ uint64 newMovingFundsDustThreshold,
129
+ uint256 timestamp
130
+ );
131
+ event MovingFundsDustThresholdUpdated(uint64 movingFundsDustThreshold);
132
+
133
+ event MovingFundsTimeoutResetDelayUpdateStarted(
134
+ uint32 newMovingFundsTimeoutResetDelay,
135
+ uint256 timestamp
136
+ );
137
+ event MovingFundsTimeoutResetDelayUpdated(
138
+ uint32 movingFundsTimeoutResetDelay
139
+ );
140
+
141
+ event MovingFundsTimeoutUpdateStarted(
142
+ uint32 newMovingFundsTimeout,
143
+ uint256 timestamp
144
+ );
145
+ event MovingFundsTimeoutUpdated(uint32 movingFundsTimeout);
146
+
147
+ event MovingFundsTimeoutSlashingAmountUpdateStarted(
148
+ uint96 newMovingFundsTimeoutSlashingAmount,
149
+ uint256 timestamp
150
+ );
151
+ event MovingFundsTimeoutSlashingAmountUpdated(
152
+ uint96 movingFundsTimeoutSlashingAmount
153
+ );
154
+
155
+ event MovingFundsTimeoutNotifierRewardMultiplierUpdateStarted(
156
+ uint32 newMovingFundsTimeoutNotifierRewardMultiplier,
157
+ uint256 timestamp
158
+ );
159
+ event MovingFundsTimeoutNotifierRewardMultiplierUpdated(
160
+ uint32 movingFundsTimeoutNotifierRewardMultiplier
161
+ );
162
+
163
+ event MovedFundsSweepTxMaxTotalFeeUpdateStarted(
164
+ uint64 newMovedFundsSweepTxMaxTotalFee,
165
+ uint256 timestamp
166
+ );
167
+ event MovedFundsSweepTxMaxTotalFeeUpdated(
168
+ uint64 movedFundsSweepTxMaxTotalFee
169
+ );
170
+
171
+ event MovedFundsSweepTimeoutUpdateStarted(
172
+ uint32 newMovedFundsSweepTimeout,
173
+ uint256 timestamp
174
+ );
175
+ event MovedFundsSweepTimeoutUpdated(uint32 movedFundsSweepTimeout);
176
+
177
+ event MovedFundsSweepTimeoutSlashingAmountUpdateStarted(
178
+ uint96 newMovedFundsSweepTimeoutSlashingAmount,
179
+ uint256 timestamp
180
+ );
181
+ event MovedFundsSweepTimeoutSlashingAmountUpdated(
182
+ uint96 movedFundsSweepTimeoutSlashingAmount
183
+ );
184
+
185
+ event MovedFundsSweepTimeoutNotifierRewardMultiplierUpdateStarted(
186
+ uint32 newMovedFundsSweepTimeoutNotifierRewardMultiplier,
187
+ uint256 timestamp
188
+ );
189
+ event MovedFundsSweepTimeoutNotifierRewardMultiplierUpdated(
190
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
191
+ );
192
+
193
+ event WalletCreationPeriodUpdateStarted(
194
+ uint32 newWalletCreationPeriod,
195
+ uint256 timestamp
196
+ );
197
+ event WalletCreationPeriodUpdated(uint32 walletCreationPeriod);
198
+
199
+ event WalletCreationMinBtcBalanceUpdateStarted(
200
+ uint64 newWalletCreationMinBtcBalance,
201
+ uint256 timestamp
202
+ );
203
+ event WalletCreationMinBtcBalanceUpdated(
204
+ uint64 walletCreationMinBtcBalance
205
+ );
206
+
207
+ event WalletCreationMaxBtcBalanceUpdateStarted(
208
+ uint64 newWalletCreationMaxBtcBalance,
209
+ uint256 timestamp
210
+ );
211
+ event WalletCreationMaxBtcBalanceUpdated(
212
+ uint64 walletCreationMaxBtcBalance
213
+ );
214
+
215
+ event WalletClosureMinBtcBalanceUpdateStarted(
216
+ uint64 newWalletClosureMinBtcBalance,
217
+ uint256 timestamp
218
+ );
219
+ event WalletClosureMinBtcBalanceUpdated(uint64 walletClosureMinBtcBalance);
220
+
221
+ event WalletMaxAgeUpdateStarted(uint32 newWalletMaxAge, uint256 timestamp);
222
+ event WalletMaxAgeUpdated(uint32 walletMaxAge);
223
+
224
+ event WalletMaxBtcTransferUpdateStarted(
225
+ uint64 newWalletMaxBtcTransfer,
226
+ uint256 timestamp
227
+ );
228
+ event WalletMaxBtcTransferUpdated(uint64 walletMaxBtcTransfer);
229
+
230
+ event WalletClosingPeriodUpdateStarted(
231
+ uint32 newWalletClosingPeriod,
232
+ uint256 timestamp
233
+ );
234
+ event WalletClosingPeriodUpdated(uint32 walletClosingPeriod);
235
+
236
+ event FraudChallengeDepositAmountUpdateStarted(
237
+ uint96 newFraudChallengeDepositAmount,
238
+ uint256 timestamp
239
+ );
240
+ event FraudChallengeDepositAmountUpdated(
241
+ uint96 fraudChallengeDepositAmount
242
+ );
243
+
244
+ event FraudChallengeDefeatTimeoutUpdateStarted(
245
+ uint32 newFraudChallengeDefeatTimeout,
246
+ uint256 timestamp
247
+ );
248
+ event FraudChallengeDefeatTimeoutUpdated(
249
+ uint32 fraudChallengeDefeatTimeout
250
+ );
251
+
252
+ event FraudSlashingAmountUpdateStarted(
253
+ uint96 newFraudSlashingAmount,
254
+ uint256 timestamp
255
+ );
256
+ event FraudSlashingAmountUpdated(uint96 fraudSlashingAmount);
257
+
258
+ event FraudNotifierRewardMultiplierUpdateStarted(
259
+ uint32 newFraudNotifierRewardMultiplier,
260
+ uint256 timestamp
261
+ );
262
+ event FraudNotifierRewardMultiplierUpdated(
263
+ uint32 fraudNotifierRewardMultiplier
264
+ );
265
+
266
+ constructor(Bridge _bridge, uint256 _governanceDelay) {
267
+ bridge = _bridge;
268
+ governanceDelays[0] = _governanceDelay;
269
+ }
270
+
271
+ /// @notice Allows the Governance to mark the given vault address as trusted
272
+ /// or no longer trusted. Vaults are not trusted by default.
273
+ /// Trusted vault must meet the following criteria:
274
+ /// - `IVault.receiveBalanceIncrease` must have a known, low gas
275
+ /// cost,
276
+ /// - `IVault.receiveBalanceIncrease` must never revert.
277
+ /// @param vault The address of the vault.
278
+ /// @param isTrusted flag indicating whether the vault is trusted or not.
279
+ function setVaultStatus(address vault, bool isTrusted) external onlyOwner {
280
+ bridge.setVaultStatus(vault, isTrusted);
281
+ }
282
+
283
+ /// @notice Begins the governance delay update process.
284
+ /// @dev Can be called only by the contract owner. The event that informs about
285
+ /// the start of the governance delay was skipped on purpose to trim
286
+ /// the contract size. All the params inside of the `governanceDelays`
287
+ /// array are public and can be easily fetched.
288
+ /// @param _newGovernanceDelay New governance delay
289
+ function beginGovernanceDelayUpdate(uint256 _newGovernanceDelay)
290
+ external
291
+ onlyOwner
292
+ {
293
+ governanceDelays[1] = _newGovernanceDelay;
294
+ /* solhint-disable not-rely-on-time */
295
+ governanceDelays[2] = block.timestamp;
296
+ /* solhint-enable not-rely-on-time */
297
+ }
298
+
299
+ /// @notice Finalizes the governance delay update process.
300
+ /// @dev Can be called only by the contract owner, after the governance
301
+ /// delay elapses. Updated event was skipped on purpose to trim the
302
+ /// contract size. All the params inside of the `governanceDelays`
303
+ /// array are public and can be easily fetched.
304
+ function finalizeGovernanceDelayUpdate() external onlyOwner {
305
+ require(governanceDelays[2] > 0, "Change not initiated");
306
+ /* solhint-disable not-rely-on-time */
307
+ require(
308
+ block.timestamp - governanceDelays[2] > governanceDelay(),
309
+ "Governance delay has not elapsed"
310
+ );
311
+ /* solhint-enable not-rely-on-time */
312
+ governanceDelays[0] = governanceDelays[1];
313
+ governanceDelays[1] = 0;
314
+ governanceDelays[2] = 0;
315
+ }
316
+
317
+ /// @notice Begins the Bridge governance transfer process.
318
+ /// @dev Can be called only by the contract owner. It is the governance
319
+ /// responsibility to validate the correctness of the new Bridge
320
+ /// Governance contract. The other reason for not adding this check is
321
+ /// to go down with the contract size and leaving only the essential code.
322
+ function beginBridgeGovernanceTransfer(address _newBridgeGovernance)
323
+ external
324
+ onlyOwner
325
+ {
326
+ // slither-disable-next-line missing-zero-check
327
+ newBridgeGovernance = _newBridgeGovernance;
328
+ /* solhint-disable not-rely-on-time */
329
+ bridgeGovernanceTransferChangeInitiated = block.timestamp;
330
+ emit BridgeGovernanceTransferStarted(
331
+ _newBridgeGovernance,
332
+ bridgeGovernanceTransferChangeInitiated
333
+ );
334
+ /* solhint-enable not-rely-on-time */
335
+ }
336
+
337
+ /// @notice Finalizes the bridge governance transfer process.
338
+ /// @dev Can be called only by the contract owner, after the governance
339
+ /// delay elapses. Bridge governance trannsferred event can be read
340
+ /// from the Governable bridge contract 'GovernanceTransferred(old, new)'.
341
+ /// Event that informs about the transfer in this function is skipped on
342
+ /// purpose to go down with the contract size.
343
+ function finalizeBridgeGovernanceTransfer() external onlyOwner {
344
+ require(
345
+ bridgeGovernanceTransferChangeInitiated > 0,
346
+ "Change not initiated"
347
+ );
348
+ /* solhint-disable not-rely-on-time */
349
+ require(
350
+ block.timestamp - bridgeGovernanceTransferChangeInitiated >=
351
+ governanceDelay(),
352
+ "Governance delay has not elapsed"
353
+ );
354
+ /* solhint-enable not-rely-on-time */
355
+ // slither-disable-next-line reentrancy-no-eth
356
+ bridge.transferGovernance(newBridgeGovernance);
357
+ bridgeGovernanceTransferChangeInitiated = 0;
358
+ newBridgeGovernance = address(0);
359
+ }
360
+
361
+ // --- Deposit
362
+
363
+ /// @notice Begins the deposit dust threshold amount update process.
364
+ /// @dev Can be called only by the contract owner.
365
+ /// @param _newDepositDustThreshold New deposit dust threshold amount.
366
+ function beginDepositDustThresholdUpdate(uint64 _newDepositDustThreshold)
367
+ external
368
+ onlyOwner
369
+ {
370
+ depositData.beginDepositDustThresholdUpdate(_newDepositDustThreshold);
371
+ }
372
+
373
+ /// @notice Finalizes the deposit dust threshold amount update process.
374
+ /// @dev Can be called only by the contract owner, after the governance
375
+ /// delay elapses.
376
+ function finalizeDepositDustThresholdUpdate() external onlyOwner {
377
+ (, uint64 depositTreasuryFeeDivisor, uint64 depositTxMaxFee) = bridge
378
+ .depositParameters();
379
+ bridge.updateDepositParameters(
380
+ depositData.getNewDepositDustThreshold(),
381
+ depositTreasuryFeeDivisor,
382
+ depositTxMaxFee
383
+ );
384
+ depositData.finalizeDepositDustThresholdUpdate(governanceDelay());
385
+ }
386
+
387
+ /// @notice Begins the deposit treasury fee divisor amount update process.
388
+ /// @dev Can be called only by the contract owner.
389
+ /// @param _newDepositTreasuryFeeDivisor New deposit treasury fee divisor.
390
+ function beginDepositTreasuryFeeDivisorUpdate(
391
+ uint64 _newDepositTreasuryFeeDivisor
392
+ ) external onlyOwner {
393
+ depositData.beginDepositTreasuryFeeDivisorUpdate(
394
+ _newDepositTreasuryFeeDivisor
395
+ );
396
+ }
397
+
398
+ /// @notice Finalizes the deposit treasury fee divisor amount update process.
399
+ /// @dev Can be called only by the contract owner, after the governance
400
+ /// delay elapses.
401
+ function finalizeDepositTreasuryFeeDivisorUpdate() external onlyOwner {
402
+ (uint64 depositDustThreshold, , uint64 depositTxMaxFee) = bridge
403
+ .depositParameters();
404
+ // slither-disable-next-line reentrancy-no-eth
405
+ bridge.updateDepositParameters(
406
+ depositDustThreshold,
407
+ depositData.getNewDepositTreasuryFeeDivisor(),
408
+ depositTxMaxFee
409
+ );
410
+ depositData.finalizeDepositTreasuryFeeDivisorUpdate(governanceDelay());
411
+ }
412
+
413
+ /// @notice Begins the deposit tx max fee amount update process.
414
+ /// @dev Can be called only by the contract owner.
415
+ /// @param _newDepositTxMaxFee New deposit tx max fee.
416
+ function beginDepositTxMaxFeeUpdate(uint64 _newDepositTxMaxFee)
417
+ external
418
+ onlyOwner
419
+ {
420
+ depositData.beginDepositTxMaxFeeUpdate(_newDepositTxMaxFee);
421
+ }
422
+
423
+ /// @notice Finalizes the deposit tx max fee amount update process.
424
+ /// @dev Can be called only by the contract owner, after the governance
425
+ /// delay elapses.
426
+ function finalizeDepositTxMaxFeeUpdate() external onlyOwner {
427
+ (
428
+ uint64 depositDustThreshold,
429
+ uint64 depositTreasuryFeeDivisor,
430
+
431
+ ) = bridge.depositParameters();
432
+ // slither-disable-next-line reentrancy-no-eth
433
+ bridge.updateDepositParameters(
434
+ depositDustThreshold,
435
+ depositTreasuryFeeDivisor,
436
+ depositData.getNewDepositTxMaxFee()
437
+ );
438
+ depositData.finalizeDepositTxMaxFeeUpdate(governanceDelay());
439
+ }
440
+
441
+ // --- Redemption
442
+
443
+ /// @notice Begins the redemption dust threshold amount update process.
444
+ /// @dev Can be called only by the contract owner.
445
+ /// @param _newRedemptionDustThreshold New redemption dust threshold.
446
+ function beginRedemptionDustThresholdUpdate(
447
+ uint64 _newRedemptionDustThreshold
448
+ ) external onlyOwner {
449
+ redemptionData.beginRedemptionDustThresholdUpdate(
450
+ _newRedemptionDustThreshold
451
+ );
452
+ }
453
+
454
+ /// @notice Finalizes the dust threshold amount update process.
455
+ /// @dev Can be called only by the contract owner, after the governance
456
+ /// delay elapses.
457
+ function finalizeRedemptionDustThresholdUpdate() external onlyOwner {
458
+ (
459
+ ,
460
+ uint64 redemptionTreasuryFeeDivisor,
461
+ uint64 redemptionTxMaxFee,
462
+ uint32 redemptionTimeout,
463
+ uint96 redemptionTimeoutSlashingAmount,
464
+ uint32 redemptionTimeoutNotifierRewardMultiplier
465
+ ) = bridge.redemptionParameters();
466
+ // slither-disable-next-line reentrancy-no-eth
467
+ bridge.updateRedemptionParameters(
468
+ redemptionData.getNewRedemptionDustThreshold(),
469
+ redemptionTreasuryFeeDivisor,
470
+ redemptionTxMaxFee,
471
+ redemptionTimeout,
472
+ redemptionTimeoutSlashingAmount,
473
+ redemptionTimeoutNotifierRewardMultiplier
474
+ );
475
+
476
+ redemptionData.finalizeRedemptionDustThresholdUpdate(governanceDelay());
477
+ }
478
+
479
+ /// @notice Begins the redemption treasury fee divisor amount update process.
480
+ /// @dev Can be called only by the contract owner.
481
+ /// @param _newRedemptionTreasuryFeeDivisor New redemption treasury fee divisor.
482
+ function beginRedemptionTreasuryFeeDivisorUpdate(
483
+ uint64 _newRedemptionTreasuryFeeDivisor
484
+ ) external onlyOwner {
485
+ redemptionData.beginRedemptionTreasuryFeeDivisorUpdate(
486
+ _newRedemptionTreasuryFeeDivisor
487
+ );
488
+ }
489
+
490
+ /// @notice Finalizes the redemption treasury fee divisor amount update process.
491
+ /// @dev Can be called only by the contract owner, after the governance
492
+ /// delay elapses.
493
+ function finalizeRedemptionTreasuryFeeDivisorUpdate() external onlyOwner {
494
+ (
495
+ uint64 redemptionDustThreshold,
496
+ ,
497
+ uint64 redemptionTxMaxFee,
498
+ uint32 redemptionTimeout,
499
+ uint96 redemptionTimeoutSlashingAmount,
500
+ uint32 redemptionTimeoutNotifierRewardMultiplier
501
+ ) = bridge.redemptionParameters();
502
+ // slither-disable-next-line reentrancy-no-eth
503
+ bridge.updateRedemptionParameters(
504
+ redemptionDustThreshold,
505
+ redemptionData.getNewRedemptionTreasuryFeeDivisor(),
506
+ redemptionTxMaxFee,
507
+ redemptionTimeout,
508
+ redemptionTimeoutSlashingAmount,
509
+ redemptionTimeoutNotifierRewardMultiplier
510
+ );
511
+
512
+ redemptionData.finalizeRedemptionTreasuryFeeDivisorUpdate(
513
+ governanceDelay()
514
+ );
515
+ }
516
+
517
+ /// @notice Begins the redemption tx max fee amount update process.
518
+ /// @dev Can be called only by the contract owner.
519
+ /// @param _newRedemptionTxMaxFee New redemption tx max fee.
520
+ function beginRedemptionTxMaxFeeUpdate(uint64 _newRedemptionTxMaxFee)
521
+ external
522
+ onlyOwner
523
+ {
524
+ redemptionData.beginRedemptionTxMaxFeeUpdate(_newRedemptionTxMaxFee);
525
+ }
526
+
527
+ /// @notice Finalizes the redemption tx max fee amount update process.
528
+ /// @dev Can be called only by the contract owner, after the governance
529
+ /// delay elapses.
530
+ function finalizeRedemptionTxMaxFeeUpdate() external onlyOwner {
531
+ (
532
+ uint64 redemptionDustThreshold,
533
+ uint64 redemptionTreasuryFeeDivisor,
534
+ ,
535
+ uint32 redemptionTimeout,
536
+ uint96 redemptionTimeoutSlashingAmount,
537
+ uint32 redemptionTimeoutNotifierRewardMultiplier
538
+ ) = bridge.redemptionParameters();
539
+ // slither-disable-next-line reentrancy-no-eth
540
+ bridge.updateRedemptionParameters(
541
+ redemptionDustThreshold,
542
+ redemptionTreasuryFeeDivisor,
543
+ redemptionData.getNewRedemptionTxMaxFee(),
544
+ redemptionTimeout,
545
+ redemptionTimeoutSlashingAmount,
546
+ redemptionTimeoutNotifierRewardMultiplier
547
+ );
548
+
549
+ redemptionData.finalizeRedemptionTxMaxFeeUpdate(governanceDelay());
550
+ }
551
+
552
+ /// @notice Begins the redemption timeout amount update process.
553
+ /// @dev Can be called only by the contract owner.
554
+ /// @param _newRedemptionTimeout New redemption timeout.
555
+ function beginRedemptionTimeoutUpdate(uint32 _newRedemptionTimeout)
556
+ external
557
+ onlyOwner
558
+ {
559
+ redemptionData.beginRedemptionTimeoutUpdate(_newRedemptionTimeout);
560
+ }
561
+
562
+ /// @notice Finalizes the redemption timeout amount update process.
563
+ /// @dev Can be called only by the contract owner, after the governance
564
+ /// delay elapses.
565
+ function finalizeRedemptionTimeoutUpdate() external onlyOwner {
566
+ (
567
+ uint64 redemptionDustThreshold,
568
+ uint64 redemptionTreasuryFeeDivisor,
569
+ uint64 redemptionTxMaxFee,
570
+ ,
571
+ uint96 redemptionTimeoutSlashingAmount,
572
+ uint32 redemptionTimeoutNotifierRewardMultiplier
573
+ ) = bridge.redemptionParameters();
574
+ // slither-disable-next-line reentrancy-no-eth
575
+ bridge.updateRedemptionParameters(
576
+ redemptionDustThreshold,
577
+ redemptionTreasuryFeeDivisor,
578
+ redemptionTxMaxFee,
579
+ redemptionData.getNewRedemptionTimeout(),
580
+ redemptionTimeoutSlashingAmount,
581
+ redemptionTimeoutNotifierRewardMultiplier
582
+ );
583
+
584
+ redemptionData.finalizeRedemptionTimeoutUpdate(governanceDelay());
585
+ }
586
+
587
+ /// @notice Begins the redemption timeout slashing amount update process.
588
+ /// @dev Can be called only by the contract owner.
589
+ /// @param _newRedemptionTimeoutSlashingAmount New redemption timeout slashing
590
+ /// amount.
591
+ function beginRedemptionTimeoutSlashingAmountUpdate(
592
+ uint96 _newRedemptionTimeoutSlashingAmount
593
+ ) external onlyOwner {
594
+ redemptionData.beginRedemptionTimeoutSlashingAmountUpdate(
595
+ _newRedemptionTimeoutSlashingAmount
596
+ );
597
+ }
598
+
599
+ /// @notice Finalizes the redemption timeout slashing amount update process.
600
+ /// @dev Can be called only by the contract owner, after the governance
601
+ /// delay elapses.
602
+ function finalizeRedemptionTimeoutSlashingAmountUpdate()
603
+ external
604
+ onlyOwner
605
+ {
606
+ (
607
+ uint64 redemptionDustThreshold,
608
+ uint64 redemptionTreasuryFeeDivisor,
609
+ uint64 redemptionTxMaxFee,
610
+ uint32 redemptionTimeout,
611
+ ,
612
+ uint32 redemptionTimeoutNotifierRewardMultiplier
613
+ ) = bridge.redemptionParameters();
614
+ // slither-disable-next-line reentrancy-no-eth
615
+ bridge.updateRedemptionParameters(
616
+ redemptionDustThreshold,
617
+ redemptionTreasuryFeeDivisor,
618
+ redemptionTxMaxFee,
619
+ redemptionTimeout,
620
+ redemptionData.getNewRedemptionTimeoutSlashingAmount(),
621
+ redemptionTimeoutNotifierRewardMultiplier
622
+ );
623
+
624
+ redemptionData.finalizeRedemptionTimeoutSlashingAmountUpdate(
625
+ governanceDelay()
626
+ );
627
+ }
628
+
629
+ /// @notice Begins the redemption timeout notifier reward multiplier amount
630
+ /// update process.
631
+ /// @dev Can be called only by the contract owner.
632
+ /// @param _newRedemptionTimeoutNotifierRewardMultiplier New redemption timeout
633
+ /// notifier reward multiplier.
634
+ function beginRedemptionTimeoutNotifierRewardMultiplierUpdate(
635
+ uint32 _newRedemptionTimeoutNotifierRewardMultiplier
636
+ ) external onlyOwner {
637
+ redemptionData.beginRedemptionTimeoutNotifierRewardMultiplierUpdate(
638
+ _newRedemptionTimeoutNotifierRewardMultiplier
639
+ );
640
+ }
641
+
642
+ /// @notice Finalizes the redemption timeout notifier reward multiplier amount
643
+ /// update process.
644
+ /// @dev Can be called only by the contract owner, after the governance
645
+ /// delay elapses.
646
+ function finalizeRedemptionTimeoutNotifierRewardMultiplierUpdate()
647
+ external
648
+ onlyOwner
649
+ {
650
+ (
651
+ uint64 redemptionDustThreshold,
652
+ uint64 redemptionTreasuryFeeDivisor,
653
+ uint64 redemptionTxMaxFee,
654
+ uint32 redemptionTimeout,
655
+ uint96 redemptionTimeoutSlashingAmount,
656
+
657
+ ) = bridge.redemptionParameters();
658
+ // slither-disable-next-line reentrancy-no-eth
659
+ bridge.updateRedemptionParameters(
660
+ redemptionDustThreshold,
661
+ redemptionTreasuryFeeDivisor,
662
+ redemptionTxMaxFee,
663
+ redemptionTimeout,
664
+ redemptionTimeoutSlashingAmount,
665
+ redemptionData.getNewRedemptionTimeoutNotifierRewardMultiplier()
666
+ );
667
+
668
+ redemptionData.finalizeRedemptionTimeoutNotifierRewardMultiplierUpdate(
669
+ governanceDelay()
670
+ );
671
+ }
672
+
673
+ // --- Moving funds
674
+
675
+ /// @notice Begins the moving funds tx max total fee update process.
676
+ /// @dev Can be called only by the contract owner.
677
+ /// @param _newMovingFundsTxMaxTotalFee New moving funds tx max total fee.
678
+ function beginMovingFundsTxMaxTotalFeeUpdate(
679
+ uint64 _newMovingFundsTxMaxTotalFee
680
+ ) external onlyOwner {
681
+ movingFundsData.beginMovingFundsTxMaxTotalFeeUpdate(
682
+ _newMovingFundsTxMaxTotalFee
683
+ );
684
+ }
685
+
686
+ /// @notice Finalizes the moving funds tx max total fee update process.
687
+ /// @dev Can be called only by the contract owner, after the governance
688
+ /// delay elapses.
689
+ function finalizeMovingFundsTxMaxTotalFeeUpdate() external onlyOwner {
690
+ (
691
+ ,
692
+ uint64 movingFundsDustThreshold,
693
+ uint32 movingFundsTimeoutResetDelay,
694
+ uint32 movingFundsTimeout,
695
+ uint96 movingFundsTimeoutSlashingAmount,
696
+ uint32 movingFundsTimeoutNotifierRewardMultiplier,
697
+ uint64 movedFundsSweepTxMaxTotalFee,
698
+ uint32 movedFundsSweepTimeout,
699
+ uint96 movedFundsSweepTimeoutSlashingAmount,
700
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
701
+ ) = bridge.movingFundsParameters();
702
+ // slither-disable-next-line reentrancy-no-eth
703
+ bridge.updateMovingFundsParameters(
704
+ movingFundsData.getNewMovingFundsTxMaxTotalFee(),
705
+ movingFundsDustThreshold,
706
+ movingFundsTimeoutResetDelay,
707
+ movingFundsTimeout,
708
+ movingFundsTimeoutSlashingAmount,
709
+ movingFundsTimeoutNotifierRewardMultiplier,
710
+ movedFundsSweepTxMaxTotalFee,
711
+ movedFundsSweepTimeout,
712
+ movedFundsSweepTimeoutSlashingAmount,
713
+ movedFundsSweepTimeoutNotifierRewardMultiplier
714
+ );
715
+ movingFundsData.finalizeMovingFundsTxMaxTotalFeeUpdate(
716
+ governanceDelay()
717
+ );
718
+ }
719
+
720
+ /// @notice Begins the moving funds dust threshold update process.
721
+ /// @dev Can be called only by the contract owner.
722
+ /// @param _newMovingFundsDustThreshold New moving funds dust threshold.
723
+ function beginMovingFundsDustThresholdUpdate(
724
+ uint64 _newMovingFundsDustThreshold
725
+ ) external onlyOwner {
726
+ movingFundsData.beginMovingFundsDustThresholdUpdate(
727
+ _newMovingFundsDustThreshold
728
+ );
729
+ }
730
+
731
+ /// @notice Finalizes the moving funds dust threshold update process.
732
+ /// @dev Can be called only by the contract owner, after the governance
733
+ /// delay elapses.
734
+ function finalizeMovingFundsDustThresholdUpdate() external onlyOwner {
735
+ (
736
+ uint64 movingFundsTxMaxTotalFee,
737
+ ,
738
+ uint32 movingFundsTimeoutResetDelay,
739
+ uint32 movingFundsTimeout,
740
+ uint96 movingFundsTimeoutSlashingAmount,
741
+ uint32 movingFundsTimeoutNotifierRewardMultiplier,
742
+ uint64 movedFundsSweepTxMaxTotalFee,
743
+ uint32 movedFundsSweepTimeout,
744
+ uint96 movedFundsSweepTimeoutSlashingAmount,
745
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
746
+ ) = bridge.movingFundsParameters();
747
+ // slither-disable-next-line reentrancy-no-eth
748
+ bridge.updateMovingFundsParameters(
749
+ movingFundsTxMaxTotalFee,
750
+ movingFundsData.getNewMovingFundsDustThreshold(),
751
+ movingFundsTimeoutResetDelay,
752
+ movingFundsTimeout,
753
+ movingFundsTimeoutSlashingAmount,
754
+ movingFundsTimeoutNotifierRewardMultiplier,
755
+ movedFundsSweepTxMaxTotalFee,
756
+ movedFundsSweepTimeout,
757
+ movedFundsSweepTimeoutSlashingAmount,
758
+ movedFundsSweepTimeoutNotifierRewardMultiplier
759
+ );
760
+ movingFundsData.finalizeMovingFundsDustThresholdUpdate(
761
+ governanceDelay()
762
+ );
763
+ }
764
+
765
+ /// @notice Begins the moving funds timeout reset delay update process.
766
+ /// @dev Can be called only by the contract owner.
767
+ /// @param _newMovingFundsTimeoutResetDelay New moving funds timeout reset
768
+ /// delay.
769
+ function beginMovingFundsTimeoutResetDelayUpdate(
770
+ uint32 _newMovingFundsTimeoutResetDelay
771
+ ) external onlyOwner {
772
+ movingFundsData.beginMovingFundsTimeoutResetDelayUpdate(
773
+ _newMovingFundsTimeoutResetDelay
774
+ );
775
+ }
776
+
777
+ /// @notice Finalizes the moving funds timeout reset delay update process.
778
+ /// @dev Can be called only by the contract owner, after the governance
779
+ /// delay elapses.
780
+ function finalizeMovingFundsTimeoutResetDelayUpdate() external onlyOwner {
781
+ (
782
+ uint64 movingFundsTxMaxTotalFee,
783
+ uint64 movingFundsDustThreshold,
784
+ ,
785
+ uint32 movingFundsTimeout,
786
+ uint96 movingFundsTimeoutSlashingAmount,
787
+ uint32 movingFundsTimeoutNotifierRewardMultiplier,
788
+ uint64 movedFundsSweepTxMaxTotalFee,
789
+ uint32 movedFundsSweepTimeout,
790
+ uint96 movedFundsSweepTimeoutSlashingAmount,
791
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
792
+ ) = bridge.movingFundsParameters();
793
+ // slither-disable-next-line reentrancy-no-eth
794
+ bridge.updateMovingFundsParameters(
795
+ movingFundsTxMaxTotalFee,
796
+ movingFundsDustThreshold,
797
+ movingFundsData.getNewMovingFundsTimeoutResetDelay(),
798
+ movingFundsTimeout,
799
+ movingFundsTimeoutSlashingAmount,
800
+ movingFundsTimeoutNotifierRewardMultiplier,
801
+ movedFundsSweepTxMaxTotalFee,
802
+ movedFundsSweepTimeout,
803
+ movedFundsSweepTimeoutSlashingAmount,
804
+ movedFundsSweepTimeoutNotifierRewardMultiplier
805
+ );
806
+ movingFundsData.finalizeMovingFundsTimeoutResetDelayUpdate(
807
+ governanceDelay()
808
+ );
809
+ }
810
+
811
+ /// @notice Begins the moving funds timeout update process.
812
+ /// @dev Can be called only by the contract owner.
813
+ /// @param _newMovingFundsTimeout New moving funds timeout.
814
+ function beginMovingFundsTimeoutUpdate(uint32 _newMovingFundsTimeout)
815
+ external
816
+ onlyOwner
817
+ {
818
+ movingFundsData.beginMovingFundsTimeoutUpdate(_newMovingFundsTimeout);
819
+ }
820
+
821
+ /// @notice Finalizes the moving funds timeout update process.
822
+ /// @dev Can be called only by the contract owner, after the governance
823
+ /// delay elapses.
824
+ function finalizeMovingFundsTimeoutUpdate() external onlyOwner {
825
+ (
826
+ uint64 movingFundsTxMaxTotalFee,
827
+ uint64 movingFundsDustThreshold,
828
+ uint32 movingFundsTimeoutResetDelay,
829
+ ,
830
+ uint96 movingFundsTimeoutSlashingAmount,
831
+ uint32 movingFundsTimeoutNotifierRewardMultiplier,
832
+ uint64 movedFundsSweepTxMaxTotalFee,
833
+ uint32 movedFundsSweepTimeout,
834
+ uint96 movedFundsSweepTimeoutSlashingAmount,
835
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
836
+ ) = bridge.movingFundsParameters();
837
+ // slither-disable-next-line reentrancy-no-eth
838
+ bridge.updateMovingFundsParameters(
839
+ movingFundsTxMaxTotalFee,
840
+ movingFundsDustThreshold,
841
+ movingFundsTimeoutResetDelay,
842
+ movingFundsData.getNewMovingFundsTimeout(),
843
+ movingFundsTimeoutSlashingAmount,
844
+ movingFundsTimeoutNotifierRewardMultiplier,
845
+ movedFundsSweepTxMaxTotalFee,
846
+ movedFundsSweepTimeout,
847
+ movedFundsSweepTimeoutSlashingAmount,
848
+ movedFundsSweepTimeoutNotifierRewardMultiplier
849
+ );
850
+ movingFundsData.finalizeMovingFundsTimeoutUpdate(governanceDelay());
851
+ }
852
+
853
+ /// @notice Begins the moving funds timeout slashing amount update process.
854
+ /// @dev Can be called only by the contract owner.
855
+ /// @param _newMovingFundsTimeoutSlashingAmount New moving funds timeout
856
+ /// slashing amount.
857
+ function beginMovingFundsTimeoutSlashingAmountUpdate(
858
+ uint96 _newMovingFundsTimeoutSlashingAmount
859
+ ) external onlyOwner {
860
+ movingFundsData.beginMovingFundsTimeoutSlashingAmountUpdate(
861
+ _newMovingFundsTimeoutSlashingAmount
862
+ );
863
+ }
864
+
865
+ /// @notice Finalizes the moving funds timeout slashing amount update process.
866
+ /// @dev Can be called only by the contract owner, after the governance
867
+ /// delay elapses.
868
+ function finalizeMovingFundsTimeoutSlashingAmountUpdate()
869
+ external
870
+ onlyOwner
871
+ {
872
+ (
873
+ uint64 movingFundsTxMaxTotalFee,
874
+ uint64 movingFundsDustThreshold,
875
+ uint32 movingFundsTimeoutResetDelay,
876
+ uint32 movingFundsTimeout,
877
+ ,
878
+ uint32 movingFundsTimeoutNotifierRewardMultiplier,
879
+ uint64 movedFundsSweepTxMaxTotalFee,
880
+ uint32 movedFundsSweepTimeout,
881
+ uint96 movedFundsSweepTimeoutSlashingAmount,
882
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
883
+ ) = bridge.movingFundsParameters();
884
+ // slither-disable-next-line reentrancy-no-eth
885
+ bridge.updateMovingFundsParameters(
886
+ movingFundsTxMaxTotalFee,
887
+ movingFundsDustThreshold,
888
+ movingFundsTimeoutResetDelay,
889
+ movingFundsTimeout,
890
+ movingFundsData.getNewMovingFundsTimeoutSlashingAmount(),
891
+ movingFundsTimeoutNotifierRewardMultiplier,
892
+ movedFundsSweepTxMaxTotalFee,
893
+ movedFundsSweepTimeout,
894
+ movedFundsSweepTimeoutSlashingAmount,
895
+ movedFundsSweepTimeoutNotifierRewardMultiplier
896
+ );
897
+ movingFundsData.finalizeMovingFundsTimeoutSlashingAmountUpdate(
898
+ governanceDelay()
899
+ );
900
+ }
901
+
902
+ /// @notice Begins the moving funds timeout notifier reward multiplier update
903
+ /// process.
904
+ /// @dev Can be called only by the contract owner.
905
+ /// @param _newMovingFundsTimeoutNotifierRewardMultiplier New moving funds
906
+ /// timeout notifier reward multiplier.
907
+ function beginMovingFundsTimeoutNotifierRewardMultiplierUpdate(
908
+ uint32 _newMovingFundsTimeoutNotifierRewardMultiplier
909
+ ) external onlyOwner {
910
+ movingFundsData.beginMovingFundsTimeoutNotifierRewardMultiplierUpdate(
911
+ _newMovingFundsTimeoutNotifierRewardMultiplier
912
+ );
913
+ }
914
+
915
+ /// @notice Finalizes the moving funds timeout notifier reward multiplier
916
+ /// update process.
917
+ /// @dev Can be called only by the contract owner, after the governance
918
+ /// delay elapses.
919
+ function finalizeMovingFundsTimeoutNotifierRewardMultiplierUpdate()
920
+ external
921
+ onlyOwner
922
+ {
923
+ (
924
+ uint64 movingFundsTxMaxTotalFee,
925
+ uint64 movingFundsDustThreshold,
926
+ uint32 movingFundsTimeoutResetDelay,
927
+ uint32 movingFundsTimeout,
928
+ uint96 movingFundsTimeoutSlashingAmount,
929
+ ,
930
+ uint64 movedFundsSweepTxMaxTotalFee,
931
+ uint32 movedFundsSweepTimeout,
932
+ uint96 movedFundsSweepTimeoutSlashingAmount,
933
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
934
+ ) = bridge.movingFundsParameters();
935
+ // slither-disable-next-line reentrancy-no-eth
936
+ bridge.updateMovingFundsParameters(
937
+ movingFundsTxMaxTotalFee,
938
+ movingFundsDustThreshold,
939
+ movingFundsTimeoutResetDelay,
940
+ movingFundsTimeout,
941
+ movingFundsTimeoutSlashingAmount,
942
+ movingFundsData.getNewMovingFundsTimeoutNotifierRewardMultiplier(),
943
+ movedFundsSweepTxMaxTotalFee,
944
+ movedFundsSweepTimeout,
945
+ movedFundsSweepTimeoutSlashingAmount,
946
+ movedFundsSweepTimeoutNotifierRewardMultiplier
947
+ );
948
+ movingFundsData
949
+ .finalizeMovingFundsTimeoutNotifierRewardMultiplierUpdate(
950
+ governanceDelay()
951
+ );
952
+ }
953
+
954
+ /// @notice Begins the moved funds sweep tx max total fee update process.
955
+ /// @dev Can be called only by the contract owner.
956
+ /// @param _newMovedFundsSweepTxMaxTotalFee New moved funds sweep tx max total
957
+ /// fee.
958
+ function beginMovedFundsSweepTxMaxTotalFeeUpdate(
959
+ uint64 _newMovedFundsSweepTxMaxTotalFee
960
+ ) external onlyOwner {
961
+ movingFundsData.beginMovedFundsSweepTxMaxTotalFeeUpdate(
962
+ _newMovedFundsSweepTxMaxTotalFee
963
+ );
964
+ }
965
+
966
+ /// @notice Finalizes the moved funds sweep tx max total fee update process.
967
+ /// @dev Can be called only by the contract owner, after the governance
968
+ /// delay elapses.
969
+ function finalizeMovedFundsSweepTxMaxTotalFeeUpdate() external onlyOwner {
970
+ (
971
+ uint64 movingFundsTxMaxTotalFee,
972
+ uint64 movingFundsDustThreshold,
973
+ uint32 movingFundsTimeoutResetDelay,
974
+ uint32 movingFundsTimeout,
975
+ uint96 movingFundsTimeoutSlashingAmount,
976
+ uint32 movingFundsTimeoutNotifierRewardMultiplier,
977
+ ,
978
+ uint32 movedFundsSweepTimeout,
979
+ uint96 movedFundsSweepTimeoutSlashingAmount,
980
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
981
+ ) = bridge.movingFundsParameters();
982
+ // slither-disable-next-line reentrancy-no-eth
983
+ bridge.updateMovingFundsParameters(
984
+ movingFundsTxMaxTotalFee,
985
+ movingFundsDustThreshold,
986
+ movingFundsTimeoutResetDelay,
987
+ movingFundsTimeout,
988
+ movingFundsTimeoutSlashingAmount,
989
+ movingFundsTimeoutNotifierRewardMultiplier,
990
+ movingFundsData.getNewMovedFundsSweepTxMaxTotalFee(),
991
+ movedFundsSweepTimeout,
992
+ movedFundsSweepTimeoutSlashingAmount,
993
+ movedFundsSweepTimeoutNotifierRewardMultiplier
994
+ );
995
+ movingFundsData.finalizeMovedFundsSweepTxMaxTotalFeeUpdate(
996
+ governanceDelay()
997
+ );
998
+ }
999
+
1000
+ /// @notice Begins the moved funds sweep timeout update process.
1001
+ /// @dev Can be called only by the contract owner.
1002
+ /// @param _newMovedFundsSweepTimeout New moved funds sweep timeout.
1003
+ function beginMovedFundsSweepTimeoutUpdate(
1004
+ uint32 _newMovedFundsSweepTimeout
1005
+ ) external onlyOwner {
1006
+ movingFundsData.beginMovedFundsSweepTimeoutUpdate(
1007
+ _newMovedFundsSweepTimeout
1008
+ );
1009
+ }
1010
+
1011
+ /// @notice Finalizes the moved funds sweep timeout update process.
1012
+ /// @dev Can be called only by the contract owner, after the governance
1013
+ /// delay elapses.
1014
+ function finalizeMovedFundsSweepTimeoutUpdate() external onlyOwner {
1015
+ (
1016
+ uint64 movingFundsTxMaxTotalFee,
1017
+ uint64 movingFundsDustThreshold,
1018
+ uint32 movingFundsTimeoutResetDelay,
1019
+ uint32 movingFundsTimeout,
1020
+ uint96 movingFundsTimeoutSlashingAmount,
1021
+ uint32 movingFundsTimeoutNotifierRewardMultiplier,
1022
+ uint64 movedFundsSweepTxMaxTotalFee,
1023
+ ,
1024
+ uint96 movedFundsSweepTimeoutSlashingAmount,
1025
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
1026
+ ) = bridge.movingFundsParameters();
1027
+ // slither-disable-next-line reentrancy-no-eth
1028
+ bridge.updateMovingFundsParameters(
1029
+ movingFundsTxMaxTotalFee,
1030
+ movingFundsDustThreshold,
1031
+ movingFundsTimeoutResetDelay,
1032
+ movingFundsTimeout,
1033
+ movingFundsTimeoutSlashingAmount,
1034
+ movingFundsTimeoutNotifierRewardMultiplier,
1035
+ movedFundsSweepTxMaxTotalFee,
1036
+ movingFundsData.getNewMovedFundsSweepTimeout(),
1037
+ movedFundsSweepTimeoutSlashingAmount,
1038
+ movedFundsSweepTimeoutNotifierRewardMultiplier
1039
+ );
1040
+ movingFundsData.finalizeMovedFundsSweepTimeoutUpdate(governanceDelay());
1041
+ }
1042
+
1043
+ /// @notice Begins the moved funds sweep timeout slashing amount update process.
1044
+ /// @dev Can be called only by the contract owner.
1045
+ /// @param _newMovedFundsSweepTimeoutSlashingAmount New moved funds sweep
1046
+ /// timeout slashing amount.
1047
+ function beginMovedFundsSweepTimeoutSlashingAmountUpdate(
1048
+ uint96 _newMovedFundsSweepTimeoutSlashingAmount
1049
+ ) external onlyOwner {
1050
+ movingFundsData.beginMovedFundsSweepTimeoutSlashingAmountUpdate(
1051
+ _newMovedFundsSweepTimeoutSlashingAmount
1052
+ );
1053
+ }
1054
+
1055
+ /// @notice Finalizes the moved funds sweep timeout slashing amount update
1056
+ /// process.
1057
+ /// @dev Can be called only by the contract owner, after the governance
1058
+ /// delay elapses.
1059
+ function finalizeMovedFundsSweepTimeoutSlashingAmountUpdate()
1060
+ external
1061
+ onlyOwner
1062
+ {
1063
+ (
1064
+ uint64 movingFundsTxMaxTotalFee,
1065
+ uint64 movingFundsDustThreshold,
1066
+ uint32 movingFundsTimeoutResetDelay,
1067
+ uint32 movingFundsTimeout,
1068
+ uint96 movingFundsTimeoutSlashingAmount,
1069
+ uint32 movingFundsTimeoutNotifierRewardMultiplier,
1070
+ uint64 movedFundsSweepTxMaxTotalFee,
1071
+ uint32 movedFundsSweepTimeout,
1072
+ ,
1073
+ uint32 movedFundsSweepTimeoutNotifierRewardMultiplier
1074
+ ) = bridge.movingFundsParameters();
1075
+ // slither-disable-next-line reentrancy-no-eth
1076
+ bridge.updateMovingFundsParameters(
1077
+ movingFundsTxMaxTotalFee,
1078
+ movingFundsDustThreshold,
1079
+ movingFundsTimeoutResetDelay,
1080
+ movingFundsTimeout,
1081
+ movingFundsTimeoutSlashingAmount,
1082
+ movingFundsTimeoutNotifierRewardMultiplier,
1083
+ movedFundsSweepTxMaxTotalFee,
1084
+ movedFundsSweepTimeout,
1085
+ movingFundsData.getNewMovedFundsSweepTimeoutSlashingAmount(),
1086
+ movedFundsSweepTimeoutNotifierRewardMultiplier
1087
+ );
1088
+ movingFundsData.finalizeMovedFundsSweepTimeoutSlashingAmountUpdate(
1089
+ governanceDelay()
1090
+ );
1091
+ }
1092
+
1093
+ /// @notice Begins the moved funds sweep timeout notifier reward multiplier
1094
+ /// update process.
1095
+ /// @dev Can be called only by the contract owner.
1096
+ /// @param _newMovedFundsSweepTimeoutNotifierRewardMultiplier New moved funds
1097
+ /// sweep timeout notifier reward multiplier.
1098
+ function beginMovedFundsSweepTimeoutNotifierRewardMultiplierUpdate(
1099
+ uint32 _newMovedFundsSweepTimeoutNotifierRewardMultiplier
1100
+ ) external onlyOwner {
1101
+ movingFundsData
1102
+ .beginMovedFundsSweepTimeoutNotifierRewardMultiplierUpdate(
1103
+ _newMovedFundsSweepTimeoutNotifierRewardMultiplier
1104
+ );
1105
+ }
1106
+
1107
+ /// @notice Finalizes the moved funds sweep timeout notifier reward multiplier
1108
+ /// update process.
1109
+ /// @dev Can be called only by the contract owner, after the governance
1110
+ /// delay elapses.
1111
+ function finalizeMovedFundsSweepTimeoutNotifierRewardMultiplierUpdate()
1112
+ external
1113
+ onlyOwner
1114
+ {
1115
+ (
1116
+ uint64 movingFundsTxMaxTotalFee,
1117
+ uint64 movingFundsDustThreshold,
1118
+ uint32 movingFundsTimeoutResetDelay,
1119
+ uint32 movingFundsTimeout,
1120
+ uint96 movingFundsTimeoutSlashingAmount,
1121
+ uint32 movingFundsTimeoutNotifierRewardMultiplier,
1122
+ uint64 movedFundsSweepTxMaxTotalFee,
1123
+ uint32 movedFundsSweepTimeout,
1124
+ uint96 movedFundsSweepTimeoutSlashingAmount,
1125
+
1126
+ ) = bridge.movingFundsParameters();
1127
+ bridge.updateMovingFundsParameters(
1128
+ movingFundsTxMaxTotalFee,
1129
+ movingFundsDustThreshold,
1130
+ movingFundsTimeoutResetDelay,
1131
+ movingFundsTimeout,
1132
+ movingFundsTimeoutSlashingAmount,
1133
+ movingFundsTimeoutNotifierRewardMultiplier,
1134
+ movedFundsSweepTxMaxTotalFee,
1135
+ movedFundsSweepTimeout,
1136
+ movedFundsSweepTimeoutSlashingAmount,
1137
+ movingFundsData
1138
+ .getNewMovedFundsSweepTimeoutNotifierRewardMultiplier()
1139
+ );
1140
+ movingFundsData
1141
+ .finalizeMovedFundsSweepTimeoutNotifierRewardMultiplierUpdate(
1142
+ governanceDelay()
1143
+ );
1144
+ }
1145
+
1146
+ // --- Wallet creation
1147
+
1148
+ /// @notice Begins the wallet creation period update process.
1149
+ /// @dev Can be called only by the contract owner.
1150
+ /// @param _newWalletCreationPeriod New wallet creation period.
1151
+ function beginWalletCreationPeriodUpdate(uint32 _newWalletCreationPeriod)
1152
+ external
1153
+ onlyOwner
1154
+ {
1155
+ walletData.beginWalletCreationPeriodUpdate(_newWalletCreationPeriod);
1156
+ }
1157
+
1158
+ /// @notice Finalizes the wallet creation period update process.
1159
+ /// @dev Can be called only by the contract owner, after the governance
1160
+ /// delay elapses.
1161
+ function finalizeWalletCreationPeriodUpdate() external onlyOwner {
1162
+ (
1163
+ ,
1164
+ uint64 walletCreationMinBtcBalance,
1165
+ uint64 walletCreationMaxBtcBalance,
1166
+ uint64 walletClosureMinBtcBalance,
1167
+ uint32 walletMaxAge,
1168
+ uint64 walletMaxBtcTransfer,
1169
+ uint32 walletClosingPeriod
1170
+ ) = bridge.walletParameters();
1171
+ // slither-disable-next-line reentrancy-no-eth
1172
+ bridge.updateWalletParameters(
1173
+ walletData.getNewWalletCreationPeriod(),
1174
+ walletCreationMinBtcBalance,
1175
+ walletCreationMaxBtcBalance,
1176
+ walletClosureMinBtcBalance,
1177
+ walletMaxAge,
1178
+ walletMaxBtcTransfer,
1179
+ walletClosingPeriod
1180
+ );
1181
+ walletData.finalizeWalletCreationPeriodUpdate(governanceDelay());
1182
+ }
1183
+
1184
+ /// @notice Begins the wallet creation min btc balance update process.
1185
+ /// @dev Can be called only by the contract owner.
1186
+ /// @param _newWalletCreationMinBtcBalance New wallet creation min btc balance.
1187
+ function beginWalletCreationMinBtcBalanceUpdate(
1188
+ uint64 _newWalletCreationMinBtcBalance
1189
+ ) external onlyOwner {
1190
+ walletData.beginWalletCreationMinBtcBalanceUpdate(
1191
+ _newWalletCreationMinBtcBalance
1192
+ );
1193
+ }
1194
+
1195
+ /// @notice Finalizes the wallet creation min btc balance update process.
1196
+ /// @dev Can be called only by the contract owner, after the governance
1197
+ /// delay elapses.
1198
+ function finalizeWalletCreationMinBtcBalanceUpdate() external onlyOwner {
1199
+ (
1200
+ uint32 walletCreationPeriod,
1201
+ ,
1202
+ uint64 walletCreationMaxBtcBalance,
1203
+ uint64 walletClosureMinBtcBalance,
1204
+ uint32 walletMaxAge,
1205
+ uint64 walletMaxBtcTransfer,
1206
+ uint32 walletClosingPeriod
1207
+ ) = bridge.walletParameters();
1208
+ // slither-disable-next-line reentrancy-no-eth
1209
+ bridge.updateWalletParameters(
1210
+ walletCreationPeriod,
1211
+ walletData.getNewWalletCreationMinBtcBalance(),
1212
+ walletCreationMaxBtcBalance,
1213
+ walletClosureMinBtcBalance,
1214
+ walletMaxAge,
1215
+ walletMaxBtcTransfer,
1216
+ walletClosingPeriod
1217
+ );
1218
+ walletData.finalizeWalletCreationMinBtcBalanceUpdate(governanceDelay());
1219
+ }
1220
+
1221
+ /// @notice Begins the wallet creation max btc balance update process.
1222
+ /// @dev Can be called only by the contract owner.
1223
+ /// @param _newWalletCreationMaxBtcBalance New wallet creation max btc
1224
+ /// balance.
1225
+ function beginWalletCreationMaxBtcBalanceUpdate(
1226
+ uint64 _newWalletCreationMaxBtcBalance
1227
+ ) external onlyOwner {
1228
+ walletData.beginWalletCreationMaxBtcBalanceUpdate(
1229
+ _newWalletCreationMaxBtcBalance
1230
+ );
1231
+ }
1232
+
1233
+ /// @notice Finalizes the wallet creation max btc balance update process.
1234
+ /// @dev Can be called only by the contract owner, after the governance
1235
+ /// delay elapses.
1236
+ function finalizeWalletCreationMaxBtcBalanceUpdate() external onlyOwner {
1237
+ (
1238
+ uint32 walletCreationPeriod,
1239
+ uint64 walletCreationMinBtcBalance,
1240
+ ,
1241
+ uint64 walletClosureMinBtcBalance,
1242
+ uint32 walletMaxAge,
1243
+ uint64 walletMaxBtcTransfer,
1244
+ uint32 walletClosingPeriod
1245
+ ) = bridge.walletParameters();
1246
+ // slither-disable-next-line reentrancy-no-eth
1247
+ bridge.updateWalletParameters(
1248
+ walletCreationPeriod,
1249
+ walletCreationMinBtcBalance,
1250
+ walletData.getNewWalletCreationMaxBtcBalance(),
1251
+ walletClosureMinBtcBalance,
1252
+ walletMaxAge,
1253
+ walletMaxBtcTransfer,
1254
+ walletClosingPeriod
1255
+ );
1256
+ walletData.finalizeWalletCreationMaxBtcBalanceUpdate(governanceDelay());
1257
+ }
1258
+
1259
+ /// @notice Begins the wallet closure min btc balance update process.
1260
+ /// @dev Can be called only by the contract owner.
1261
+ /// @param _newWalletClosureMinBtcBalance New wallet closure min btc balance.
1262
+ function beginWalletClosureMinBtcBalanceUpdate(
1263
+ uint64 _newWalletClosureMinBtcBalance
1264
+ ) external onlyOwner {
1265
+ walletData.beginWalletClosureMinBtcBalanceUpdate(
1266
+ _newWalletClosureMinBtcBalance
1267
+ );
1268
+ }
1269
+
1270
+ /// @notice Finalizes the wallet closure min btc balance update process.
1271
+ /// @dev Can be called only by the contract owner, after the governance
1272
+ /// delay elapses.
1273
+ function finalizeWalletClosureMinBtcBalanceUpdate() external onlyOwner {
1274
+ (
1275
+ uint32 walletCreationPeriod,
1276
+ uint64 walletCreationMinBtcBalance,
1277
+ uint64 walletCreationMaxBtcBalance,
1278
+ ,
1279
+ uint32 walletMaxAge,
1280
+ uint64 walletMaxBtcTransfer,
1281
+ uint32 walletClosingPeriod
1282
+ ) = bridge.walletParameters();
1283
+ // slither-disable-next-line reentrancy-no-eth
1284
+ bridge.updateWalletParameters(
1285
+ walletCreationPeriod,
1286
+ walletCreationMinBtcBalance,
1287
+ walletCreationMaxBtcBalance,
1288
+ walletData.getNewWalletClosureMinBtcBalance(),
1289
+ walletMaxAge,
1290
+ walletMaxBtcTransfer,
1291
+ walletClosingPeriod
1292
+ );
1293
+ walletData.finalizeWalletClosureMinBtcBalanceUpdate(governanceDelay());
1294
+ }
1295
+
1296
+ /// @notice Begins the wallet max age update process.
1297
+ /// @dev Can be called only by the contract owner.
1298
+ /// @param _newWalletMaxAge New wallet max age.
1299
+ function beginWalletMaxAgeUpdate(uint32 _newWalletMaxAge)
1300
+ external
1301
+ onlyOwner
1302
+ {
1303
+ walletData.beginWalletMaxAgeUpdate(_newWalletMaxAge);
1304
+ }
1305
+
1306
+ /// @notice Finalizes the wallet max age update process.
1307
+ /// @dev Can be called only by the contract owner, after the governance
1308
+ /// delay elapses.
1309
+ function finalizeWalletMaxAgeUpdate() external onlyOwner {
1310
+ (
1311
+ uint32 walletCreationPeriod,
1312
+ uint64 walletCreationMinBtcBalance,
1313
+ uint64 walletCreationMaxBtcBalance,
1314
+ uint64 walletClosureMinBtcBalance,
1315
+ ,
1316
+ uint64 walletMaxBtcTransfer,
1317
+ uint32 walletClosingPeriod
1318
+ ) = bridge.walletParameters();
1319
+ // slither-disable-next-line reentrancy-no-eth
1320
+ bridge.updateWalletParameters(
1321
+ walletCreationPeriod,
1322
+ walletCreationMinBtcBalance,
1323
+ walletCreationMaxBtcBalance,
1324
+ walletClosureMinBtcBalance,
1325
+ walletData.getNewWalletMaxAge(),
1326
+ walletMaxBtcTransfer,
1327
+ walletClosingPeriod
1328
+ );
1329
+ walletData.finalizeWalletMaxAgeUpdate(governanceDelay());
1330
+ }
1331
+
1332
+ /// @notice Begins the wallet max btc transafer amount update process.
1333
+ /// @dev Can be called only by the contract owner.
1334
+ /// @param _newWalletMaxBtcTransfer New wallet max btc transfer.
1335
+ function beginWalletMaxBtcTransferUpdate(uint64 _newWalletMaxBtcTransfer)
1336
+ external
1337
+ onlyOwner
1338
+ {
1339
+ walletData.beginWalletMaxBtcTransferUpdate(_newWalletMaxBtcTransfer);
1340
+ }
1341
+
1342
+ /// @notice Finalizes the wallet max btc transfer amount update process.
1343
+ /// @dev Can be called only by the contract owner, after the governance
1344
+ /// delay elapses.
1345
+ function finalizeWalletMaxBtcTransferUpdate() external onlyOwner {
1346
+ (
1347
+ uint32 walletCreationPeriod,
1348
+ uint64 walletCreationMinBtcBalance,
1349
+ uint64 walletCreationMaxBtcBalance,
1350
+ uint64 walletClosureMinBtcBalance,
1351
+ uint32 walletMaxAge,
1352
+ ,
1353
+ uint32 walletClosingPeriod
1354
+ ) = bridge.walletParameters();
1355
+ // slither-disable-next-line reentrancy-no-eth
1356
+ bridge.updateWalletParameters(
1357
+ walletCreationPeriod,
1358
+ walletCreationMinBtcBalance,
1359
+ walletCreationMaxBtcBalance,
1360
+ walletClosureMinBtcBalance,
1361
+ walletMaxAge,
1362
+ walletData.getNewWalletMaxBtcTransfer(),
1363
+ walletClosingPeriod
1364
+ );
1365
+ walletData.finalizeWalletMaxBtcTransferUpdate(governanceDelay());
1366
+ }
1367
+
1368
+ /// @notice Begins the wallet closing period update process.
1369
+ /// @dev Can be called only by the contract owner.
1370
+ /// @param _newWalletClosingPeriod New wallet closing period.
1371
+ function beginWalletClosingPeriodUpdate(uint32 _newWalletClosingPeriod)
1372
+ external
1373
+ onlyOwner
1374
+ {
1375
+ walletData.beginWalletClosingPeriodUpdate(_newWalletClosingPeriod);
1376
+ }
1377
+
1378
+ /// @notice Finalizes the wallet closing period update process.
1379
+ /// @dev Can be called only by the contract owner, after the governance
1380
+ /// delay elapses.
1381
+ function finalizeWalletClosingPeriodUpdate() external onlyOwner {
1382
+ (
1383
+ uint32 walletCreationPeriod,
1384
+ uint64 walletCreationMinBtcBalance,
1385
+ uint64 walletCreationMaxBtcBalance,
1386
+ uint64 walletClosureMinBtcBalance,
1387
+ uint32 walletMaxAge,
1388
+ uint64 walletMaxBtcTransfer,
1389
+
1390
+ ) = bridge.walletParameters();
1391
+ // slither-disable-next-line reentrancy-no-eth
1392
+ bridge.updateWalletParameters(
1393
+ walletCreationPeriod,
1394
+ walletCreationMinBtcBalance,
1395
+ walletCreationMaxBtcBalance,
1396
+ walletClosureMinBtcBalance,
1397
+ walletMaxAge,
1398
+ walletMaxBtcTransfer,
1399
+ walletData.getNewWalletClosingPeriod()
1400
+ );
1401
+ walletData.finalizeWalletClosingPeriodUpdate(governanceDelay());
1402
+ }
1403
+
1404
+ // --- Fraud
1405
+
1406
+ /// @notice Begins the fraud challenge deposit amount update process.
1407
+ /// @dev Can be called only by the contract owner.
1408
+ /// @param _newFraudChallengeDepositAmount New fraud challenge deposit amount.
1409
+ function beginFraudChallengeDepositAmountUpdate(
1410
+ uint96 _newFraudChallengeDepositAmount
1411
+ ) external onlyOwner {
1412
+ fraudData.beginFraudChallengeDepositAmountUpdate(
1413
+ _newFraudChallengeDepositAmount
1414
+ );
1415
+ }
1416
+
1417
+ /// @notice Finalizes the fraud challenge deposit amount update process.
1418
+ /// @dev Can be called only by the contract owner, after the governance
1419
+ /// delay elapses.
1420
+ function finalizeFraudChallengeDepositAmountUpdate() external onlyOwner {
1421
+ (
1422
+ ,
1423
+ uint32 fraudChallengeDefeatTimeout,
1424
+ uint96 fraudSlashingAmount,
1425
+ uint32 fraudNotifierRewardMultiplier
1426
+ ) = bridge.fraudParameters();
1427
+ // slither-disable-next-line reentrancy-no-eth
1428
+ bridge.updateFraudParameters(
1429
+ fraudData.getNewFraudChallengeDepositAmount(),
1430
+ fraudChallengeDefeatTimeout,
1431
+ fraudSlashingAmount,
1432
+ fraudNotifierRewardMultiplier
1433
+ );
1434
+ fraudData.finalizeFraudChallengeDepositAmountUpdate(governanceDelay());
1435
+ }
1436
+
1437
+ /// @notice Begins the fraud challenge defeat timeout update process.
1438
+ /// @dev Can be called only by the contract owner.
1439
+ /// @param _newFraudChallengeDefeatTimeout New fraud challenge defeat timeout.
1440
+ function beginFraudChallengeDefeatTimeoutUpdate(
1441
+ uint32 _newFraudChallengeDefeatTimeout
1442
+ ) external onlyOwner {
1443
+ fraudData.beginFraudChallengeDefeatTimeoutUpdate(
1444
+ _newFraudChallengeDefeatTimeout
1445
+ );
1446
+ }
1447
+
1448
+ /// @notice Finalizes the fraud challenge defeat timeout update process.
1449
+ /// @dev Can be called only by the contract owner, after the governance
1450
+ /// delay elapses.
1451
+ function finalizeFraudChallengeDefeatTimeoutUpdate() external onlyOwner {
1452
+ (
1453
+ uint96 fraudChallengeDepositAmount,
1454
+ ,
1455
+ uint96 fraudSlashingAmount,
1456
+ uint32 fraudNotifierRewardMultiplier
1457
+ ) = bridge.fraudParameters();
1458
+ bridge.updateFraudParameters(
1459
+ fraudChallengeDepositAmount,
1460
+ fraudData.getNewFraudChallengeDefeatTimeout(),
1461
+ fraudSlashingAmount,
1462
+ fraudNotifierRewardMultiplier
1463
+ );
1464
+ fraudData.finalizeFraudChallengeDefeatTimeoutUpdate(governanceDelay());
1465
+ }
1466
+
1467
+ /// @notice Begins the fraud slashing amount update process.
1468
+ /// @dev Can be called only by the contract owner.
1469
+ /// @param _newFraudSlashingAmount New fraud slashing amount.
1470
+ function beginFraudSlashingAmountUpdate(uint96 _newFraudSlashingAmount)
1471
+ external
1472
+ onlyOwner
1473
+ {
1474
+ fraudData.beginFraudSlashingAmountUpdate(_newFraudSlashingAmount);
1475
+ }
1476
+
1477
+ /// @notice Finalizes the fraud slashing amount update process.
1478
+ /// @dev Can be called only by the contract owner, after the governance
1479
+ /// delay elapses.
1480
+ function finalizeFraudSlashingAmountUpdate() external onlyOwner {
1481
+ (
1482
+ uint96 fraudChallengeDepositAmount,
1483
+ uint32 fraudChallengeDefeatTimeout,
1484
+ ,
1485
+ uint32 fraudNotifierRewardMultiplier
1486
+ ) = bridge.fraudParameters();
1487
+ bridge.updateFraudParameters(
1488
+ fraudChallengeDepositAmount,
1489
+ fraudChallengeDefeatTimeout,
1490
+ fraudData.getNewFraudSlashingAmount(),
1491
+ fraudNotifierRewardMultiplier
1492
+ );
1493
+ fraudData.finalizeFraudSlashingAmountUpdate(governanceDelay());
1494
+ }
1495
+
1496
+ /// @notice Begins the fraud notifier reward multiplier update process.
1497
+ /// @dev Can be called only by the contract owner.
1498
+ /// @param _newFraudNotifierRewardMultiplier New fraud notifier reward
1499
+ /// multiplier.
1500
+ function beginFraudNotifierRewardMultiplierUpdate(
1501
+ uint32 _newFraudNotifierRewardMultiplier
1502
+ ) external onlyOwner {
1503
+ fraudData.beginFraudNotifierRewardMultiplierUpdate(
1504
+ _newFraudNotifierRewardMultiplier
1505
+ );
1506
+ }
1507
+
1508
+ /// @notice Finalizes the fraud notifier reward multiplier update process.
1509
+ /// @dev Can be called only by the contract owner, after the governance
1510
+ /// delay elapses.
1511
+ function finalizeFraudNotifierRewardMultiplierUpdate() external onlyOwner {
1512
+ (
1513
+ uint96 fraudChallengeDepositAmount,
1514
+ uint32 fraudChallengeDefeatTimeout,
1515
+ uint96 fraudSlashingAmount,
1516
+
1517
+ ) = bridge.fraudParameters();
1518
+ bridge.updateFraudParameters(
1519
+ fraudChallengeDepositAmount,
1520
+ fraudChallengeDefeatTimeout,
1521
+ fraudSlashingAmount,
1522
+ fraudData.getNewFraudNotifierRewardMultiplier()
1523
+ );
1524
+ fraudData.finalizeFraudNotifierRewardMultiplierUpdate(
1525
+ governanceDelay()
1526
+ );
1527
+ }
1528
+
1529
+ /// @notice Gets the governance delay parameter.
1530
+ function governanceDelay() internal view returns (uint256) {
1531
+ return governanceDelays[0];
1532
+ }
1533
+ }