@keep-network/tbtc-v2 0.1.1-dev.74 → 0.1.1-dev.75

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 (69) hide show
  1. package/artifacts/Bank.json +3 -3
  2. package/artifacts/Bridge.json +14 -1
  3. package/artifacts/DefaultProxyAdmin.json +2 -2
  4. package/artifacts/Deposit.json +7 -7
  5. package/artifacts/DepositSweep.json +7 -7
  6. package/artifacts/EcdsaDkgValidator.json +2 -2
  7. package/artifacts/EcdsaInactivity.json +1 -1
  8. package/artifacts/Fraud.json +7 -7
  9. package/artifacts/KeepRegistry.json +1 -1
  10. package/artifacts/KeepStake.json +2 -2
  11. package/artifacts/KeepToken.json +2 -2
  12. package/artifacts/KeepTokenStaking.json +1 -1
  13. package/artifacts/MovingFunds.json +10 -10
  14. package/artifacts/NuCypherStakingEscrow.json +1 -1
  15. package/artifacts/NuCypherToken.json +2 -2
  16. package/artifacts/RandomBeaconStub.json +1 -1
  17. package/artifacts/Redemption.json +9 -9
  18. package/artifacts/ReimbursementPool.json +2 -2
  19. package/artifacts/Relay.json +9 -9
  20. package/artifacts/SortitionPool.json +3 -3
  21. package/artifacts/T.json +2 -2
  22. package/artifacts/TBTC.json +3 -3
  23. package/artifacts/TBTCToken.json +3 -3
  24. package/artifacts/TokenStaking.json +1 -1
  25. package/artifacts/TokenholderGovernor.json +9 -9
  26. package/artifacts/TokenholderTimelock.json +8 -8
  27. package/artifacts/VendingMachine.json +10 -10
  28. package/artifacts/VendingMachineKeep.json +1 -1
  29. package/artifacts/VendingMachineNuCypher.json +1 -1
  30. package/artifacts/WalletRegistry.json +6 -6
  31. package/artifacts/WalletRegistry_Implementation.json +1 -1
  32. package/artifacts/WalletRegistry_Proxy.json +6 -6
  33. package/artifacts/Wallets.json +7 -7
  34. package/artifacts/solcInputs/{3d39c8183330efd748c005f3c281bf2c.json → 49c80d59bf0ae61f27a8bb5db19af68a.json} +3 -3
  35. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
  36. package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
  37. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
  38. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.json +2 -2
  39. package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  40. package/build/contracts/bridge/Bridge.sol/Bridge.json +58 -42
  41. package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
  42. package/build/contracts/bridge/BridgeState.sol/BridgeState.json +8 -2
  43. package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
  44. package/build/contracts/bridge/Deposit.sol/Deposit.json +2 -2
  45. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +1 -1
  46. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.json +2 -2
  47. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
  48. package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
  49. package/build/contracts/bridge/Fraud.sol/Fraud.json +2 -2
  50. package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +1 -1
  51. package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
  52. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
  53. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.json +2 -2
  54. package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
  55. package/build/contracts/bridge/Redemption.sol/OutboundTx.json +2 -2
  56. package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
  57. package/build/contracts/bridge/Redemption.sol/Redemption.json +2 -2
  58. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
  59. package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
  60. package/build/contracts/bridge/Wallets.sol/Wallets.json +2 -2
  61. package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
  62. package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +1 -1
  63. package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
  64. package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
  65. package/contracts/bridge/Bridge.sol +30 -6
  66. package/contracts/bridge/BridgeState.sol +33 -7
  67. package/contracts/bridge/MovingFunds.sol +10 -1
  68. package/export.json +13 -0
  69. package/package.json +1 -1
@@ -91,6 +91,14 @@ library BridgeState {
91
91
  // than `redemptionDustThreshold` in order to prevent redemption requests
92
92
  // with values lower or equal to `movingFundsDustThreshold`.
93
93
  uint64 movingFundsDustThreshold;
94
+ // Time after which the moving funds timeout can be reset in case the
95
+ // target wallet commitment cannot be submitted due to a lack of live
96
+ // wallets in the system. It is counted from the moment when the wallet
97
+ // was requested to move their funds and switched to the MovingFunds
98
+ // state or from the moment the timeout was reset the last time.
99
+ // Value in seconds. This value should be lower than the value
100
+ // of the `movingFundsTimeout`.
101
+ uint32 movingFundsTimeoutResetDelay;
94
102
  // Time after which the moving funds process can be reported as
95
103
  // timed out. It is counted from the moment when the wallet
96
104
  // was requested to move their funds and switched to the MovingFunds
@@ -283,6 +291,7 @@ library BridgeState {
283
291
  event MovingFundsParametersUpdated(
284
292
  uint64 movingFundsTxMaxTotalFee,
285
293
  uint64 movingFundsDustThreshold,
294
+ uint32 movingFundsTimeoutResetDelay,
286
295
  uint32 movingFundsTimeout,
287
296
  uint96 movingFundsTimeoutSlashingAmount,
288
297
  uint256 movingFundsTimeoutNotifierRewardMultiplier,
@@ -471,10 +480,17 @@ library BridgeState {
471
480
  /// funds transaction.
472
481
  /// @param _movingFundsDustThreshold New value of the moving funds dust
473
482
  /// threshold. It is the minimal satoshi amount that makes sense to
474
- // be transferred during the moving funds process. Moving funds
475
- // wallets having their BTC balance below that value can begin
476
- // closing immediately as transferring such a low value may not be
477
- // possible due to BTC network fees.
483
+ /// be transferred during the moving funds process. Moving funds
484
+ /// wallets having their BTC balance below that value can begin
485
+ /// closing immediately as transferring such a low value may not be
486
+ /// possible due to BTC network fees.
487
+ /// @param _movingFundsTimeoutResetDelay New value of the moving funds
488
+ /// timeout reset delay in seconds. It is the time after which the
489
+ /// moving funds timeout can be reset in case the target wallet
490
+ /// commitment cannot be submitted due to a lack of live wallets
491
+ /// in the system. It is counted from the moment when the wallet
492
+ /// was requested to move their funds and switched to the MovingFunds
493
+ /// state or from the moment the timeout was reset the last time.
478
494
  /// @param _movingFundsTimeout New value of the moving funds timeout in
479
495
  /// seconds. It is the time after which the moving funds process can
480
496
  /// be reported as timed out. It is counted from the moment when the
@@ -510,7 +526,9 @@ library BridgeState {
510
526
  /// - Moving funds transaction max total fee must be greater than zero,
511
527
  /// - Moving funds dust threshold must be greater than zero and lower
512
528
  /// than the redemption dust threshold,
513
- /// - Moving funds timeout must be greater than zero,
529
+ /// - Moving funds timeout reset delay must be greater than zero,
530
+ /// - Moving funds timeout must be greater than the moving funds
531
+ /// timeout reset delay,
514
532
  /// - Moving funds timeout notifier reward multiplier must be in the
515
533
  /// range [0, 100],
516
534
  /// - Moved funds sweep transaction max total fee must be greater than zero,
@@ -521,6 +539,7 @@ library BridgeState {
521
539
  Storage storage self,
522
540
  uint64 _movingFundsTxMaxTotalFee,
523
541
  uint64 _movingFundsDustThreshold,
542
+ uint32 _movingFundsTimeoutResetDelay,
524
543
  uint32 _movingFundsTimeout,
525
544
  uint96 _movingFundsTimeoutSlashingAmount,
526
545
  uint256 _movingFundsTimeoutNotifierRewardMultiplier,
@@ -541,8 +560,13 @@ library BridgeState {
541
560
  );
542
561
 
543
562
  require(
544
- _movingFundsTimeout > 0,
545
- "Moving funds timeout must be greater than zero"
563
+ _movingFundsTimeoutResetDelay > 0,
564
+ "Moving funds timeout reset delay must be greater than zero"
565
+ );
566
+
567
+ require(
568
+ _movingFundsTimeout > _movingFundsTimeoutResetDelay,
569
+ "Moving funds timeout must be greater than its reset delay"
546
570
  );
547
571
 
548
572
  require(
@@ -567,6 +591,7 @@ library BridgeState {
567
591
 
568
592
  self.movingFundsTxMaxTotalFee = _movingFundsTxMaxTotalFee;
569
593
  self.movingFundsDustThreshold = _movingFundsDustThreshold;
594
+ self.movingFundsTimeoutResetDelay = _movingFundsTimeoutResetDelay;
570
595
  self.movingFundsTimeout = _movingFundsTimeout;
571
596
  self
572
597
  .movingFundsTimeoutSlashingAmount = _movingFundsTimeoutSlashingAmount;
@@ -582,6 +607,7 @@ library BridgeState {
582
607
  emit MovingFundsParametersUpdated(
583
608
  _movingFundsTxMaxTotalFee,
584
609
  _movingFundsDustThreshold,
610
+ _movingFundsTimeoutResetDelay,
585
611
  _movingFundsTimeout,
586
612
  _movingFundsTimeoutSlashingAmount,
587
613
  _movingFundsTimeoutNotifierRewardMultiplier,
@@ -268,7 +268,8 @@ library MovingFunds {
268
268
  /// - The wallet must be in the MovingFunds state,
269
269
  /// - The target wallets commitment must not be already submitted for
270
270
  /// the given moving funds wallet,
271
- /// - Live wallets count must be zero.
271
+ /// - Live wallets count must be zero,
272
+ /// - The moving funds timeout reset delay must be elapsed.
272
273
  function resetMovingFundsTimeout(
273
274
  BridgeState.Storage storage self,
274
275
  bytes20 walletPubKeyHash
@@ -292,6 +293,14 @@ library MovingFunds {
292
293
 
293
294
  require(self.liveWalletsCount == 0, "Live wallets count must be zero");
294
295
 
296
+ require(
297
+ /* solhint-disable-next-line not-rely-on-time */
298
+ block.timestamp >
299
+ wallet.movingFundsRequestedAt +
300
+ self.movingFundsTimeoutResetDelay,
301
+ "Moving funds timeout cannot be reset yet"
302
+ );
303
+
295
304
  /* solhint-disable-next-line not-rely-on-time */
296
305
  wallet.movingFundsRequestedAt = uint32(block.timestamp);
297
306
 
package/export.json CHANGED
@@ -15078,6 +15078,11 @@
15078
15078
  "name": "movingFundsDustThreshold",
15079
15079
  "indexed": false
15080
15080
  },
15081
+ {
15082
+ "type": "uint32",
15083
+ "name": "movingFundsTimeoutResetDelay",
15084
+ "indexed": false
15085
+ },
15081
15086
  {
15082
15087
  "type": "uint32",
15083
15088
  "name": "movingFundsTimeout",
@@ -15780,6 +15785,10 @@
15780
15785
  "type": "uint64",
15781
15786
  "name": "movingFundsDustThreshold"
15782
15787
  },
15788
+ {
15789
+ "type": "uint32",
15790
+ "name": "movingFundsTimeoutResetDelay"
15791
+ },
15783
15792
  {
15784
15793
  "type": "uint32",
15785
15794
  "name": "movingFundsTimeout"
@@ -17110,6 +17119,10 @@
17110
17119
  "type": "uint64",
17111
17120
  "name": "movingFundsDustThreshold"
17112
17121
  },
17122
+ {
17123
+ "type": "uint32",
17124
+ "name": "movingFundsTimeoutResetDelay"
17125
+ },
17113
17126
  {
17114
17127
  "type": "uint32",
17115
17128
  "name": "movingFundsTimeout"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keep-network/tbtc-v2",
3
- "version": "0.1.1-dev.74+main.b6bc47e2d628da3f7dda68233621f9ba1b79ff50",
3
+ "version": "0.1.1-dev.75+main.3200921e06b730fa5ec437a73211a9708e3fae9e",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "artifacts/",