@keep-network/tbtc-v2 0.1.1-dev.72 → 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 (89) hide show
  1. package/artifacts/Bank.json +15 -15
  2. package/artifacts/Bridge.json +14 -1
  3. package/artifacts/DefaultProxyAdmin.json +5 -5
  4. package/artifacts/Deposit.json +10 -10
  5. package/artifacts/DepositSweep.json +11 -11
  6. package/artifacts/EcdsaDkgValidator.json +9 -9
  7. package/artifacts/EcdsaInactivity.json +8 -8
  8. package/artifacts/Fraud.json +21 -21
  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 +33 -33
  14. package/artifacts/NuCypherStakingEscrow.json +1 -1
  15. package/artifacts/NuCypherToken.json +2 -2
  16. package/artifacts/RandomBeaconStub.json +5 -5
  17. package/artifacts/Redemption.json +22 -22
  18. package/artifacts/ReimbursementPool.json +5 -5
  19. package/artifacts/Relay.json +9 -9
  20. package/artifacts/SortitionPool.json +9 -9
  21. package/artifacts/T.json +2 -2
  22. package/artifacts/TBTC.json +17 -17
  23. package/artifacts/TBTCToken.json +15 -15
  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 +18 -18
  28. package/artifacts/VendingMachineKeep.json +1 -1
  29. package/artifacts/VendingMachineNuCypher.json +1 -1
  30. package/artifacts/WalletRegistry.json +17 -17
  31. package/artifacts/WalletRegistry_Implementation.json +73 -73
  32. package/artifacts/WalletRegistry_Proxy.json +17 -17
  33. package/artifacts/Wallets.json +12 -12
  34. package/artifacts/solcInputs/49c80d59bf0ae61f27a8bb5db19af68a.json +272 -0
  35. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
  36. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.json +2 -2
  37. package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
  38. package/build/contracts/bank/Bank.sol/Bank.json +2 -2
  39. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
  40. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.json +2 -2
  41. package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  42. package/build/contracts/bridge/Bridge.sol/Bridge.json +58 -42
  43. package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
  44. package/build/contracts/bridge/BridgeState.sol/BridgeState.json +8 -2
  45. package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
  46. package/build/contracts/bridge/Deposit.sol/Deposit.json +2 -2
  47. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +1 -1
  48. package/build/contracts/bridge/DepositSweep.sol/DepositSweep.json +2 -2
  49. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
  50. package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
  51. package/build/contracts/bridge/Fraud.sol/Fraud.json +2 -2
  52. package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +1 -1
  53. package/build/contracts/bridge/Heartbeat.sol/Heartbeat.json +2 -2
  54. package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
  55. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
  56. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.json +2 -2
  57. package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
  58. package/build/contracts/bridge/Redemption.sol/OutboundTx.json +2 -2
  59. package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
  60. package/build/contracts/bridge/Redemption.sol/Redemption.json +2 -2
  61. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
  62. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.json +2 -2
  63. package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
  64. package/build/contracts/bridge/Wallets.sol/Wallets.json +2 -2
  65. package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
  66. package/build/contracts/token/TBTC.sol/TBTC.json +2 -2
  67. package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +1 -1
  68. package/build/contracts/vault/DonationVault.sol/DonationVault.json +2 -2
  69. package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
  70. package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
  71. package/build/contracts/vault/TBTCVault.sol/TBTCVault.json +2 -2
  72. package/contracts/GovernanceUtils.sol +3 -3
  73. package/contracts/bank/Bank.sol +2 -2
  74. package/contracts/bridge/BitcoinTx.sol +7 -7
  75. package/contracts/bridge/Bridge.sol +221 -203
  76. package/contracts/bridge/BridgeState.sol +75 -49
  77. package/contracts/bridge/Deposit.sol +5 -5
  78. package/contracts/bridge/DepositSweep.sol +12 -12
  79. package/contracts/bridge/Fraud.sol +25 -25
  80. package/contracts/bridge/Heartbeat.sol +1 -1
  81. package/contracts/bridge/MovingFunds.sol +81 -72
  82. package/contracts/bridge/Redemption.sol +32 -31
  83. package/contracts/bridge/Wallets.sol +29 -29
  84. package/contracts/vault/DonationVault.sol +9 -9
  85. package/contracts/vault/IVault.sol +4 -4
  86. package/contracts/vault/TBTCVault.sol +14 -14
  87. package/export.json +13 -0
  88. package/package.json +3 -3
  89. package/artifacts/solcInputs/55df7785455cbf6ded1b912686e91d3f.json +0 -269
@@ -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
@@ -178,9 +186,9 @@ library BridgeState {
178
186
  // to this mapping by the `requestRedemption` method (duplicates
179
187
  // not allowed) and are removed by one of the following methods:
180
188
  // - `submitRedemptionProof` in case the request was handled
181
- // successfully
189
+ // successfully,
182
190
  // - `notifyRedemptionTimeout` in case the request was reported
183
- // to be timed out
191
+ // to be timed out.
184
192
  mapping(uint256 => Redemption.RedemptionRequest) pendingRedemptions;
185
193
  // Collection of all timed out redemptions requests indexed by
186
194
  // redemption key built as
@@ -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,
@@ -315,7 +324,7 @@ library BridgeState {
315
324
  //// deposit. Value of this parameter must take into account the value
316
325
  /// of `depositTreasuryFeeDivisor` and `depositTxMaxFee` parameters
317
326
  /// in order to make requests that can incur the treasury and
318
- /// transaction fee and still satisfy the depositor
327
+ /// transaction fee and still satisfy the depositor.
319
328
  /// @param _depositTreasuryFeeDivisor New value of the treasury fee divisor.
320
329
  /// It is the divisor used to compute the treasury fee taken from
321
330
  /// each deposit and transferred to the treasury upon sweep proof
@@ -323,16 +332,16 @@ library BridgeState {
323
332
  /// `treasuryFee = depositedAmount / depositTreasuryFeeDivisor`
324
333
  /// For example, if the treasury fee needs to be 2% of each deposit,
325
334
  /// the `depositTreasuryFeeDivisor` should be set to `50`
326
- /// because `1/50 = 0.02 = 2%`
335
+ /// because `1/50 = 0.02 = 2%`.
327
336
  /// @param _depositTxMaxFee New value of the deposit tx max fee in satoshis.
328
337
  /// It is the maximum amount of BTC transaction fee that can
329
338
  /// be incurred by each swept deposit being part of the given sweep
330
339
  /// transaction. If the maximum BTC transaction fee is exceeded,
331
- /// such transaction is considered a fraud
340
+ /// such transaction is considered a fraud.
332
341
  /// @dev Requirements:
333
- /// - Deposit dust threshold must be greater than zero
334
- /// - Deposit treasury fee divisor must be greater than zero
335
- /// - Deposit transaction max fee must be greater than zero
342
+ /// - Deposit dust threshold must be greater than zero,
343
+ /// - Deposit treasury fee divisor must be greater than zero,
344
+ /// - Deposit transaction max fee must be greater than zero.
336
345
  function updateDepositParameters(
337
346
  Storage storage self,
338
347
  uint64 _depositDustThreshold,
@@ -397,20 +406,20 @@ library BridgeState {
397
406
  /// redeemer in full amount.
398
407
  /// @param _redemptionTimeoutSlashingAmount New value of the redemption
399
408
  /// timeout slashing amount in T, it is the amount slashed from each
400
- /// wallet member for redemption timeout
409
+ /// wallet member for redemption timeout.
401
410
  /// @param _redemptionTimeoutNotifierRewardMultiplier New value of the
402
411
  /// redemption timeout notifier reward multiplier as percentage,
403
412
  /// it determines the percentage of the notifier reward from the
404
413
  /// staking contact the notifier of a redemption timeout receives.
405
- /// The value must be in the range [0, 100]
414
+ /// The value must be in the range [0, 100].
406
415
  /// @dev Requirements:
407
416
  /// - Redemption dust threshold must be greater than moving funds dust
408
- /// threshold
409
- /// - Redemption treasury fee divisor must be greater than zero
410
- /// - Redemption transaction max fee must be greater than zero
411
- /// - Redemption timeout must be greater than zero
417
+ /// threshold,
418
+ /// - Redemption treasury fee divisor must be greater than zero,
419
+ /// - Redemption transaction max fee must be greater than zero,
420
+ /// - Redemption timeout must be greater than zero,
412
421
  /// - Redemption timeout notifier reward multiplier must be in the
413
- /// range [0, 100]
422
+ /// range [0, 100].
414
423
  function updateRedemptionParameters(
415
424
  Storage storage self,
416
425
  uint64 _redemptionDustThreshold,
@@ -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
@@ -482,12 +498,12 @@ library BridgeState {
482
498
  /// MovingFunds state.
483
499
  /// @param _movingFundsTimeoutSlashingAmount New value of the moving funds
484
500
  /// timeout slashing amount in T, it is the amount slashed from each
485
- /// wallet member for moving funds timeout
501
+ /// wallet member for moving funds timeout.
486
502
  /// @param _movingFundsTimeoutNotifierRewardMultiplier New value of the
487
503
  /// moving funds timeout notifier reward multiplier as percentage,
488
504
  /// it determines the percentage of the notifier reward from the
489
505
  /// staking contact the notifier of a moving funds timeout receives.
490
- /// The value must be in the range [0, 100]
506
+ /// The value must be in the range [0, 100].
491
507
  /// @param _movedFundsSweepTxMaxTotalFee New value of the moved funds sweep
492
508
  /// transaction max total fee in satoshis. It is the maximum amount
493
509
  /// of the total BTC transaction fee that is acceptable in a single
@@ -500,27 +516,30 @@ library BridgeState {
500
516
  /// funds.
501
517
  /// @param _movedFundsSweepTimeoutSlashingAmount New value of the moved
502
518
  /// funds sweep timeout slashing amount in T, it is the amount
503
- /// slashed from each wallet member for moved funds sweep timeout
519
+ /// slashed from each wallet member for moved funds sweep timeout.
504
520
  /// @param _movedFundsSweepTimeoutNotifierRewardMultiplier New value of
505
521
  /// the moved funds sweep timeout notifier reward multiplier as
506
522
  /// percentage, it determines the percentage of the notifier reward
507
523
  /// from the staking contact the notifier of a moved funds sweep
508
- /// timeout receives. The value must be in the range [0, 100]
524
+ /// timeout receives. The value must be in the range [0, 100].
509
525
  /// @dev Requirements:
510
- /// - Moving funds transaction max total fee must be greater than zero
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
- /// than the redemption dust threshold
513
- /// - Moving funds timeout must be greater than zero
528
+ /// than the redemption dust threshold,
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
- /// range [0, 100]
516
- /// - Moved funds sweep transaction max total fee must be greater than zero
517
- /// - Moved funds sweep timeout must be greater than zero
533
+ /// range [0, 100],
534
+ /// - Moved funds sweep transaction max total fee must be greater than zero,
535
+ /// - Moved funds sweep timeout must be greater than zero,
518
536
  /// - Moved funds sweep timeout notifier reward multiplier must be in the
519
- /// range [0, 100]
537
+ /// range [0, 100].
520
538
  function updateMovingFundsParameters(
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,
@@ -595,29 +621,29 @@ library BridgeState {
595
621
  /// @notice Updates parameters of wallets.
596
622
  /// @param _walletCreationPeriod New value of the wallet creation period in
597
623
  /// seconds, determines how frequently a new wallet creation can be
598
- /// requested
624
+ /// requested.
599
625
  /// @param _walletCreationMinBtcBalance New value of the wallet minimum BTC
600
- /// balance in satoshi, used to decide about wallet creation
626
+ /// balance in satoshi, used to decide about wallet creation.
601
627
  /// @param _walletCreationMaxBtcBalance New value of the wallet maximum BTC
602
- /// balance in satoshi, used to decide about wallet creation
628
+ /// balance in satoshi, used to decide about wallet creation.
603
629
  /// @param _walletClosureMinBtcBalance New value of the wallet minimum BTC
604
- /// balance in satoshi, used to decide about wallet closure
630
+ /// balance in satoshi, used to decide about wallet closure.
605
631
  /// @param _walletMaxAge New value of the wallet maximum age in seconds,
606
632
  /// indicates the maximum age of a wallet in seconds, after which
607
- /// the wallet moving funds process can be requested
633
+ /// the wallet moving funds process can be requested.
608
634
  /// @param _walletMaxBtcTransfer New value of the wallet maximum BTC transfer
609
635
  /// in satoshi, determines the maximum amount that can be transferred
610
- /// to a single target wallet during the moving funds process
636
+ /// to a single target wallet during the moving funds process.
611
637
  /// @param _walletClosingPeriod New value of the wallet closing period in
612
638
  /// seconds, determines the length of the wallet closing period,
613
639
  // i.e. the period when the wallet remains in the Closing state
614
- // and can be subject of deposit fraud challenges
640
+ // and can be subject of deposit fraud challenges.
615
641
  /// @dev Requirements:
616
- /// - Wallet minimum BTC balance must be greater than zero
642
+ /// - Wallet minimum BTC balance must be greater than zero,
617
643
  /// - Wallet maximum BTC balance must be greater than the wallet
618
- /// minimum BTC balance
619
- /// - Wallet maximum BTC transfer must be greater than zero
620
- /// - Wallet closing period must be greater than zero
644
+ /// minimum BTC balance,
645
+ /// - Wallet maximum BTC transfer must be greater than zero,
646
+ /// - Wallet closing period must be greater than zero.
621
647
  function updateWalletParameters(
622
648
  Storage storage self,
623
649
  uint32 _walletCreationPeriod,
@@ -667,20 +693,20 @@ library BridgeState {
667
693
  /// @notice Updates parameters related to frauds.
668
694
  /// @param _fraudChallengeDepositAmount New value of the fraud challenge
669
695
  /// deposit amount in wei, it is the amount of ETH the party
670
- /// challenging the wallet for fraud needs to deposit
696
+ /// challenging the wallet for fraud needs to deposit.
671
697
  /// @param _fraudChallengeDefeatTimeout New value of the challenge defeat
672
698
  /// timeout in seconds, it is the amount of time the wallet has to
673
- /// defeat a fraud challenge. The value must be greater than zero
699
+ /// defeat a fraud challenge. The value must be greater than zero.
674
700
  /// @param _fraudSlashingAmount New value of the fraud slashing amount in T,
675
701
  /// it is the amount slashed from each wallet member for committing
676
- /// a fraud
702
+ /// a fraud.
677
703
  /// @param _fraudNotifierRewardMultiplier New value of the fraud notifier
678
704
  /// reward multiplier as percentage, it determines the percentage of
679
705
  /// the notifier reward from the staking contact the notifier of
680
- /// a fraud receives. The value must be in the range [0, 100]
706
+ /// a fraud receives. The value must be in the range [0, 100].
681
707
  /// @dev Requirements:
682
- /// - Fraud challenge defeat timeout must be greater than 0
683
- /// - Fraud notifier reward multiplier must be in the range [0, 100]
708
+ /// - Fraud challenge defeat timeout must be greater than 0,
709
+ /// - Fraud notifier reward multiplier must be in the range [0, 100].
684
710
  function updateFraudParameters(
685
711
  Storage storage self,
686
712
  uint256 _fraudChallengeDepositAmount,
@@ -123,13 +123,13 @@ library Deposit {
123
123
  /// outputs. The deposit may be routed to one of the trusted vaults.
124
124
  /// When a deposit is routed to a vault, vault gets notified when
125
125
  /// the deposit gets swept and it may execute the appropriate action.
126
- /// @param fundingTx Bitcoin funding transaction data, see `BitcoinTx.Info`
127
- /// @param reveal Deposit reveal data, see `RevealInfo struct
126
+ /// @param fundingTx Bitcoin funding transaction data, see `BitcoinTx.Info`.
127
+ /// @param reveal Deposit reveal data, see `RevealInfo struct.
128
128
  /// @dev Requirements:
129
- /// - `reveal.walletPubKeyHash` must identify a `Live` wallet
130
- /// - `reveal.vault` must be 0x0 or point to a trusted vault
129
+ /// - `reveal.walletPubKeyHash` must identify a `Live` wallet,
130
+ /// - `reveal.vault` must be 0x0 or point to a trusted vault,
131
131
  /// - `reveal.fundingOutputIndex` must point to the actual P2(W)SH
132
- /// output of the BTC deposit transaction
132
+ /// output of the BTC deposit transaction,
133
133
  /// - `reveal.depositor` must be the Ethereum address used in the
134
134
  /// P2(W)SH BTC deposit transaction,
135
135
  /// - `reveal.blindingFactor` must be the blinding factor used in the
@@ -105,11 +105,11 @@ library DepositSweep {
105
105
  /// during the reveal transaction, minus their fee share.
106
106
  ///
107
107
  /// It is possible to prove the given sweep only one time.
108
- /// @param sweepTx Bitcoin sweep transaction data
109
- /// @param sweepProof Bitcoin sweep proof data
108
+ /// @param sweepTx Bitcoin sweep transaction data.
109
+ /// @param sweepProof Bitcoin sweep proof data.
110
110
  /// @param mainUtxo Data of the wallet's main UTXO, as currently known on
111
111
  /// the Ethereum chain. If no main UTXO exists for the given wallet,
112
- /// this parameter is ignored
112
+ /// this parameter is ignored.
113
113
  /// @param vault Optional address of the vault where all swept deposits
114
114
  /// should be routed to. All deposits swept as part of the transaction
115
115
  /// must have their `vault` parameters set to the same address.
@@ -123,7 +123,7 @@ library DepositSweep {
123
123
  /// - `sweepTx` components must match the expected structure. See
124
124
  /// `BitcoinTx.Info` docs for reference. Their values must exactly
125
125
  /// correspond to appropriate Bitcoin transaction fields to produce
126
- /// a provable transaction hash.
126
+ /// a provable transaction hash,
127
127
  /// - The `sweepTx` should represent a Bitcoin transaction with 1..n
128
128
  /// inputs. If the wallet has no main UTXO, all n inputs should
129
129
  /// correspond to P2(W)SH revealed deposits UTXOs. If the wallet has
@@ -131,14 +131,14 @@ library DepositSweep {
131
131
  /// main UTXO and remaining n-1 inputs should correspond to P2(W)SH
132
132
  /// revealed deposits UTXOs. That transaction must have only
133
133
  /// one P2(W)PKH output locking funds on the 20-byte wallet public
134
- /// key hash.
134
+ /// key hash,
135
135
  /// - All revealed deposits that are swept by `sweepTx` must have
136
136
  /// their `vault` parameters set to the same address as the address
137
- /// passed in the `vault` function parameter.
137
+ /// passed in the `vault` function parameter,
138
138
  /// - `sweepProof` components must match the expected structure. See
139
139
  /// `BitcoinTx.Proof` docs for reference. The `bitcoinHeaders`
140
140
  /// field must contain a valid number of block headers, not less
141
- /// than the `txProofDifficultyFactor` contract constant.
141
+ /// than the `txProofDifficultyFactor` contract constant,
142
142
  /// - `mainUtxo` components must point to the recent main UTXO
143
143
  /// of the given wallet, as currently known on the Ethereum chain.
144
144
  /// If there is no main UTXO, this parameter is ignored.
@@ -261,14 +261,14 @@ library DepositSweep {
261
261
  /// Bitcoin transaction.
262
262
  /// @param mainUtxo Data of the wallet's main UTXO, as currently known on
263
263
  /// the Ethereum chain. If no main UTXO exists for the given wallet,
264
- /// this parameter is ignored
264
+ /// this parameter is ignored.
265
265
  /// @return wallet Data of the sweeping wallet.
266
266
  /// @return resolvedMainUtxo The actual main UTXO of the sweeping wallet
267
267
  /// resolved by cross-checking the `mainUtxo` parameter with
268
268
  /// the chain state. If the validation went well, this is the
269
269
  /// plain-text main UTXO corresponding to the `wallet.mainUtxoHash`.
270
270
  /// @dev Requirements:
271
- /// - Sweeping wallet must be either in Live or MovingFunds state.
271
+ /// - Sweeping wallet must be either in Live or MovingFunds state,
272
272
  /// - If the main UTXO of the sweeping wallet exists in the storage,
273
273
  /// the passed `mainUTXO` parameter must be equal to the stored one.
274
274
  function resolveDepositSweepingWallet(
@@ -319,7 +319,7 @@ library DepositSweep {
319
319
  /// @param sweepTxOutputVector Bitcoin sweep transaction output vector.
320
320
  /// This function assumes vector's structure is valid so it must be
321
321
  /// validated using e.g. `BTCUtils.validateVout` function before
322
- /// it is passed here
322
+ /// it is passed here.
323
323
  /// @return walletPubKeyHash 20-byte wallet public key hash.
324
324
  /// @return value 8-byte sweep transaction output value.
325
325
  function processDepositSweepTxOutput(
@@ -502,8 +502,8 @@ library DepositSweep {
502
502
  }
503
503
 
504
504
  /// @notice Parses a Bitcoin transaction input starting at the given index.
505
- /// @param inputVector Bitcoin transaction input vector
506
- /// @param inputStartingIndex Index the given input starts at
505
+ /// @param inputVector Bitcoin transaction input vector.
506
+ /// @param inputStartingIndex Index the given input starts at.
507
507
  /// @return outpointTxHash 32-byte hash of the Bitcoin transaction which is
508
508
  /// pointed in the given input's outpoint.
509
509
  /// @return outpointIndex 4-byte index of the Bitcoin transaction output
@@ -109,9 +109,9 @@ library Fraud {
109
109
  /// proof of a transaction that consumes the given input according
110
110
  /// to protocol rules. To prevent spurious allegations, the caller
111
111
  /// must deposit ETH that is returned back upon justified fraud
112
- /// challenge or confiscated otherwise
112
+ /// challenge or confiscated otherwise.
113
113
  /// @param walletPublicKey The public key of the wallet in the uncompressed
114
- /// and unprefixed format (64 bytes)
114
+ /// and unprefixed format (64 bytes).
115
115
  /// @param preimageSha256 The hash that was generated by applying SHA-256
116
116
  /// one time over the preimage used during input signing. The preimage
117
117
  /// is a serialized subset of the transaction and its structure
@@ -119,17 +119,17 @@ library Fraud {
119
119
  /// Notice that applying SHA-256 over the `preimageSha256` results
120
120
  /// in `sighash`. The path from `preimage` to `sighash` looks like
121
121
  /// this:
122
- /// preimage -> (SHA-256) -> preimageSha256 -> (SHA-256) -> sighash
122
+ /// preimage -> (SHA-256) -> preimageSha256 -> (SHA-256) -> sighash.
123
123
  /// @param signature Bitcoin signature in the R/S/V format
124
124
  /// @dev Requirements:
125
125
  /// - Wallet behind `walletPublicKey` must be in Live or MovingFunds
126
- /// or Closing state
126
+ /// or Closing state,
127
127
  /// - The challenger must send appropriate amount of ETH used as
128
- /// fraud challenge deposit
128
+ /// fraud challenge deposit,
129
129
  /// - The signature (represented by r, s and v) must be generated by
130
130
  /// the wallet behind `walletPubKey` during signing of `sighash`
131
- /// which was calculated from `preimageSha256`
132
- /// - Wallet can be challenged for the given signature only once
131
+ /// which was calculated from `preimageSha256`,
132
+ /// - Wallet can be challenged for the given signature only once.
133
133
  function submitFraudChallenge(
134
134
  BridgeState.Storage storage self,
135
135
  bytes calldata walletPublicKey,
@@ -210,21 +210,21 @@ library Fraud {
210
210
  /// resolved and the amount of ether deposited by the challenger is
211
211
  /// sent to the treasury.
212
212
  /// @param walletPublicKey The public key of the wallet in the uncompressed
213
- /// and unprefixed format (64 bytes)
213
+ /// and unprefixed format (64 bytes).
214
214
  /// @param preimage The preimage which produces sighash used to generate the
215
215
  /// ECDSA signature that is the subject of the fraud claim. It is a
216
216
  /// serialized subset of the transaction. The exact subset used as
217
217
  /// the preimage depends on the transaction input the signature is
218
- /// produced for. See BIP-143 for reference
218
+ /// produced for. See BIP-143 for reference.
219
219
  /// @param witness Flag indicating whether the preimage was produced for a
220
220
  /// witness input. True for witness, false for non-witness input.
221
221
  /// @dev Requirements:
222
222
  /// - `walletPublicKey` and `sighash` calculated as `hash256(preimage)`
223
- /// must identify an open fraud challenge
223
+ /// must identify an open fraud challenge,
224
224
  /// - the preimage must be a valid preimage of a transaction generated
225
- /// according to the protocol rules and already proved in the Bridge
225
+ /// according to the protocol rules and already proved in the Bridge,
226
226
  /// - before a defeat attempt is made the transaction that spends the
227
- /// given UTXO must be proven in the Bridge
227
+ /// given UTXO must be proven in the Bridge.
228
228
  function defeatFraudChallenge(
229
229
  BridgeState.Storage storage self,
230
230
  bytes calldata walletPublicKey,
@@ -277,16 +277,16 @@ library Fraud {
277
277
  /// challenge is marked as resolved and the amount of ether
278
278
  /// deposited by the challenger is sent to the treasury.
279
279
  /// @param walletPublicKey The public key of the wallet in the uncompressed
280
- /// and unprefixed format (64 bytes)
280
+ /// and unprefixed format (64 bytes),
281
281
  /// @param heartbeatMessage Off-chain heartbeat message meeting the heartbeat
282
282
  /// message format requirements which produces sighash used to
283
283
  /// generate the ECDSA signature that is the subject of the fraud
284
- /// claim
284
+ /// claim.
285
285
  /// @dev Requirements:
286
286
  /// - `walletPublicKey` and `sighash` calculated as
287
- /// `hash256(heartbeatMessage)` must identify an open fraud challenge
287
+ /// `hash256(heartbeatMessage)` must identify an open fraud challenge,
288
288
  /// - `heartbeatMessage` must follow a strict format of heartbeat
289
- /// messages
289
+ /// messages.
290
290
  function defeatFraudChallengeWithHeartbeat(
291
291
  BridgeState.Storage storage self,
292
292
  bytes calldata walletPublicKey,
@@ -355,8 +355,8 @@ library Fraud {
355
355
  /// deposited is returned to the challenger and the challenger is
356
356
  /// rewarded.
357
357
  /// @param walletPublicKey The public key of the wallet in the uncompressed
358
- /// and unprefixed format (64 bytes)
359
- /// @param walletMembersIDs Identifiers of the wallet signing group members
358
+ /// and unprefixed format (64 bytes).
359
+ /// @param walletMembersIDs Identifiers of the wallet signing group members.
360
360
  /// @param preimageSha256 The hash that was generated by applying SHA-256
361
361
  /// one time over the preimage used during input signing. The preimage
362
362
  /// is a serialized subset of the transaction and its structure
@@ -364,20 +364,20 @@ library Fraud {
364
364
  /// Notice that applying SHA-256 over the `preimageSha256` results
365
365
  /// in `sighash`. The path from `preimage` to `sighash` looks like
366
366
  /// this:
367
- /// preimage -> (SHA-256) -> preimageSha256 -> (SHA-256) -> sighash
367
+ /// preimage -> (SHA-256) -> preimageSha256 -> (SHA-256) -> sighash.
368
368
  /// @dev Requirements:
369
369
  /// - The wallet must be in the Live or MovingFunds or Closing or
370
- /// Terminated state
370
+ /// Terminated state,
371
371
  /// - The `walletPublicKey` and `sighash` calculated from
372
- /// `preimageSha256` must identify an open fraud challenge
372
+ /// `preimageSha256` must identify an open fraud challenge,
373
373
  /// - The expression `keccak256(abi.encode(walletMembersIDs))` must
374
374
  /// be exactly the same as the hash stored under `membersIdsHash`
375
375
  /// for the given `walletID`. Those IDs are not directly stored
376
376
  /// in the contract for gas efficiency purposes but they can be
377
377
  /// read from appropriate `DkgResultSubmitted` and `DkgResultApproved`
378
- /// events of the `WalletRegistry` contract
378
+ /// events of the `WalletRegistry` contract,
379
379
  /// - The amount of time indicated by `challengeDefeatTimeout` must pass
380
- /// after the challenge was reported
380
+ /// after the challenge was reported.
381
381
  function notifyFraudChallengeDefeatTimeout(
382
382
  BridgeState.Storage storage self,
383
383
  bytes calldata walletPublicKey,
@@ -504,7 +504,7 @@ library Fraud {
504
504
  /// ECDSA signature that is the subject of the fraud claim. It is a
505
505
  /// serialized subset of the transaction. The exact subset used as
506
506
  /// the preimage depends on the transaction input the signature is
507
- /// produced for. See BIP-143 for reference
507
+ /// produced for. See BIP-143 for reference.
508
508
  /// @return utxoKey UTXO key that identifies spent input.
509
509
  function extractUtxoKeyFromNonWitnessPreimage(bytes calldata preimage)
510
510
  internal
@@ -588,7 +588,7 @@ library Fraud {
588
588
 
589
589
  /// @notice Extracts the sighash type from the given preimage.
590
590
  /// @param preimage Serialized subset of the transaction. See BIP-143 for
591
- /// reference
591
+ /// reference.
592
592
  /// @dev Sighash type is stored as the last 4 bytes in the preimage (little
593
593
  /// endian).
594
594
  /// @return sighashType Sighash type as a 32-bit integer.
@@ -90,7 +90,7 @@ library Heartbeat {
90
90
  /// heartbeat message.
91
91
  /// @param message Message signed by the wallet. It is a potential heartbeat
92
92
  /// message, Bitcoin transaction preimage, or an arbitrary signed
93
- /// bytes
93
+ /// bytes.
94
94
  /// @dev Wallet heartbeat message must be exactly 16 bytes long with the first
95
95
  /// 8 bytes set to 0xffffffffffffffff.
96
96
  /// @return True if valid heartbeat message, false otherwise.