@keep-network/tbtc-v2 0.1.1-dev.96 → 0.1.1-dev.97
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.
- package/artifacts/Bank.json +3 -3
- package/artifacts/Bridge.json +43 -43
- package/artifacts/Deposit.json +7 -7
- package/artifacts/DepositSweep.json +7 -7
- package/artifacts/EcdsaDkgValidator.json +1 -1
- package/artifacts/EcdsaInactivity.json +1 -1
- package/artifacts/EcdsaSortitionPool.json +2 -2
- package/artifacts/Fraud.json +9 -9
- package/artifacts/KeepRegistry.json +1 -1
- package/artifacts/KeepStake.json +2 -2
- package/artifacts/KeepToken.json +2 -2
- package/artifacts/KeepTokenStaking.json +1 -1
- package/artifacts/MovingFunds.json +9 -9
- package/artifacts/NuCypherStakingEscrow.json +1 -1
- package/artifacts/NuCypherToken.json +2 -2
- package/artifacts/RandomBeaconStub.json +1 -1
- package/artifacts/Redemption.json +9 -9
- package/artifacts/ReimbursementPool.json +2 -2
- package/artifacts/Relay.json +9 -9
- package/artifacts/T.json +2 -2
- package/artifacts/TBTC.json +3 -3
- package/artifacts/TBTCToken.json +3 -3
- package/artifacts/TBTCVault.json +12 -12
- package/artifacts/TokenStaking.json +1 -1
- package/artifacts/TokenholderGovernor.json +9 -9
- package/artifacts/TokenholderTimelock.json +8 -8
- package/artifacts/VendingMachine.json +10 -10
- package/artifacts/VendingMachineKeep.json +1 -1
- package/artifacts/VendingMachineNuCypher.json +1 -1
- package/artifacts/WalletRegistry.json +5 -5
- package/artifacts/WalletRegistryGovernance.json +2 -2
- package/artifacts/Wallets.json +9 -9
- package/artifacts/solcInputs/{3cf46a7694ce157f71d9dbf4db692b09.json → 5e62cff1ead0900b07facca4b559e818.json} +5 -5
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
- package/build/contracts/bank/IReceiveBalanceApproval.sol/IReceiveBalanceApproval.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.json +2 -2
- package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
- package/build/contracts/bridge/Bridge.sol/Bridge.json +61 -61
- package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
- package/build/contracts/bridge/BridgeState.sol/BridgeState.json +2 -2
- package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
- package/build/contracts/bridge/Deposit.sol/Deposit.json +2 -2
- package/build/contracts/bridge/DepositSweep.sol/DepositSweep.dbg.json +1 -1
- package/build/contracts/bridge/DepositSweep.sol/DepositSweep.json +2 -2
- package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
- package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +1 -1
- package/build/contracts/bridge/Fraud.sol/Fraud.json +2 -2
- package/build/contracts/bridge/Heartbeat.sol/Heartbeat.dbg.json +1 -1
- package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
- package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
- package/build/contracts/bridge/MovingFunds.sol/MovingFunds.json +2 -2
- package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/OutboundTx.json +2 -2
- package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +1 -1
- package/build/contracts/bridge/Redemption.sol/Redemption.json +2 -2
- package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
- package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
- package/build/contracts/bridge/Wallets.sol/Wallets.json +2 -2
- package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
- package/build/contracts/vault/DonationVault.sol/DonationVault.dbg.json +1 -1
- package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
- package/contracts/bridge/Bridge.sol +2 -2
- package/contracts/bridge/Fraud.sol +7 -32
- package/contracts/bridge/MovingFunds.sol +18 -51
- package/contracts/bridge/Redemption.sol +5 -24
- package/contracts/bridge/Wallets.sol +309 -143
- package/export.json +32 -32
- package/package.json +1 -1
|
@@ -359,6 +359,8 @@ library MovingFunds {
|
|
|
359
359
|
BitcoinTx.UTXO calldata mainUtxo,
|
|
360
360
|
bytes20 walletPubKeyHash
|
|
361
361
|
) external {
|
|
362
|
+
// Wallet state is validated in `notifyWalletFundsMoved`.
|
|
363
|
+
|
|
362
364
|
// The actual transaction proof is performed here. After that point, we
|
|
363
365
|
// can assume the transaction happened on Bitcoin chain and has
|
|
364
366
|
// a sufficient number of confirmations as determined by
|
|
@@ -566,31 +568,19 @@ library MovingFunds {
|
|
|
566
568
|
bytes20 walletPubKeyHash,
|
|
567
569
|
uint32[] calldata walletMembersIDs
|
|
568
570
|
) external {
|
|
569
|
-
|
|
570
|
-
walletPubKeyHash
|
|
571
|
-
];
|
|
571
|
+
// Wallet state is validated in `notifyWalletMovingFundsTimeout`.
|
|
572
572
|
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
);
|
|
573
|
+
uint32 movingFundsRequestedAt = self
|
|
574
|
+
.registeredWallets[walletPubKeyHash]
|
|
575
|
+
.movingFundsRequestedAt;
|
|
577
576
|
|
|
578
577
|
require(
|
|
579
578
|
/* solhint-disable-next-line not-rely-on-time */
|
|
580
|
-
block.timestamp >
|
|
581
|
-
wallet.movingFundsRequestedAt + self.movingFundsTimeout,
|
|
579
|
+
block.timestamp > movingFundsRequestedAt + self.movingFundsTimeout,
|
|
582
580
|
"Moving funds has not timed out yet"
|
|
583
581
|
);
|
|
584
582
|
|
|
585
|
-
self.
|
|
586
|
-
self.movingFundsTimeoutSlashingAmount,
|
|
587
|
-
self.movingFundsTimeoutNotifierRewardMultiplier,
|
|
588
|
-
msg.sender,
|
|
589
|
-
wallet.ecdsaWalletID,
|
|
590
|
-
walletMembersIDs
|
|
591
|
-
);
|
|
592
|
-
|
|
593
|
-
self.terminateWallet(walletPubKeyHash);
|
|
583
|
+
self.notifyWalletMovingFundsTimeout(walletPubKeyHash, walletMembersIDs);
|
|
594
584
|
|
|
595
585
|
// slither-disable-next-line reentrancy-events
|
|
596
586
|
emit MovingFundsTimedOut(walletPubKeyHash);
|
|
@@ -614,14 +604,7 @@ library MovingFunds {
|
|
|
614
604
|
bytes20 walletPubKeyHash,
|
|
615
605
|
BitcoinTx.UTXO calldata mainUtxo
|
|
616
606
|
) external {
|
|
617
|
-
|
|
618
|
-
walletPubKeyHash
|
|
619
|
-
];
|
|
620
|
-
|
|
621
|
-
require(
|
|
622
|
-
wallet.state == Wallets.WalletState.MovingFunds,
|
|
623
|
-
"Wallet must be in MovingFunds state"
|
|
624
|
-
);
|
|
607
|
+
// Wallet state is validated in `notifyWalletMovingFundsBelowDust`.
|
|
625
608
|
|
|
626
609
|
uint64 walletBtcBalance = self.getWalletBtcBalance(
|
|
627
610
|
walletPubKeyHash,
|
|
@@ -633,7 +616,7 @@ library MovingFunds {
|
|
|
633
616
|
"Wallet BTC balance must be below the moving funds dust threshold"
|
|
634
617
|
);
|
|
635
618
|
|
|
636
|
-
self.
|
|
619
|
+
self.notifyWalletMovingFundsBelowDust(walletPubKeyHash);
|
|
637
620
|
|
|
638
621
|
// slither-disable-next-line reentrancy-events
|
|
639
622
|
emit MovingFundsBelowDustReported(walletPubKeyHash);
|
|
@@ -1045,6 +1028,8 @@ library MovingFunds {
|
|
|
1045
1028
|
uint32 movingFundsTxOutputIndex,
|
|
1046
1029
|
uint32[] calldata walletMembersIDs
|
|
1047
1030
|
) external {
|
|
1031
|
+
// Wallet state is validated in `notifyWalletMovedFundsSweepTimeout`.
|
|
1032
|
+
|
|
1048
1033
|
MovedFundsSweepRequest storage sweepRequest = self
|
|
1049
1034
|
.movedFundsSweepRequests[
|
|
1050
1035
|
uint256(
|
|
@@ -1070,36 +1055,18 @@ library MovingFunds {
|
|
|
1070
1055
|
);
|
|
1071
1056
|
|
|
1072
1057
|
bytes20 walletPubKeyHash = sweepRequest.walletPubKeyHash;
|
|
1073
|
-
Wallets.Wallet storage wallet = self.registeredWallets[
|
|
1074
|
-
walletPubKeyHash
|
|
1075
|
-
];
|
|
1076
|
-
Wallets.WalletState walletState = wallet.state;
|
|
1077
1058
|
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
walletState == Wallets.WalletState.Terminated,
|
|
1082
|
-
"Wallet must be in Live or MovingFunds or Terminated state"
|
|
1059
|
+
self.notifyWalletMovedFundsSweepTimeout(
|
|
1060
|
+
walletPubKeyHash,
|
|
1061
|
+
walletMembersIDs
|
|
1083
1062
|
);
|
|
1084
1063
|
|
|
1064
|
+
Wallets.Wallet storage wallet = self.registeredWallets[
|
|
1065
|
+
walletPubKeyHash
|
|
1066
|
+
];
|
|
1085
1067
|
sweepRequest.state = MovedFundsSweepRequestState.TimedOut;
|
|
1086
1068
|
wallet.pendingMovedFundsSweepRequestsCount--;
|
|
1087
1069
|
|
|
1088
|
-
if (
|
|
1089
|
-
walletState == Wallets.WalletState.Live ||
|
|
1090
|
-
walletState == Wallets.WalletState.MovingFunds
|
|
1091
|
-
) {
|
|
1092
|
-
self.ecdsaWalletRegistry.seize(
|
|
1093
|
-
self.movedFundsSweepTimeoutSlashingAmount,
|
|
1094
|
-
self.movedFundsSweepTimeoutNotifierRewardMultiplier,
|
|
1095
|
-
msg.sender,
|
|
1096
|
-
wallet.ecdsaWalletID,
|
|
1097
|
-
walletMembersIDs
|
|
1098
|
-
);
|
|
1099
|
-
|
|
1100
|
-
self.terminateWallet(walletPubKeyHash);
|
|
1101
|
-
}
|
|
1102
|
-
|
|
1103
1070
|
// slither-disable-next-line reentrancy-events
|
|
1104
1071
|
emit MovedFundsSweepTimedOut(
|
|
1105
1072
|
walletPubKeyHash,
|
|
@@ -974,6 +974,8 @@ library Redemption {
|
|
|
974
974
|
uint32[] calldata walletMembersIDs,
|
|
975
975
|
bytes calldata redeemerOutputScript
|
|
976
976
|
) external {
|
|
977
|
+
// Wallet state is validated in `notifyWalletRedemptionTimeout`.
|
|
978
|
+
|
|
977
979
|
uint256 redemptionKey = uint256(
|
|
978
980
|
keccak256(abi.encodePacked(walletPubKeyHash, redeemerOutputScript))
|
|
979
981
|
);
|
|
@@ -996,40 +998,19 @@ library Redemption {
|
|
|
996
998
|
request.requestedAmount -
|
|
997
999
|
request.treasuryFee;
|
|
998
1000
|
|
|
999
|
-
require(
|
|
1000
|
-
wallet.state == Wallets.WalletState.Live ||
|
|
1001
|
-
wallet.state == Wallets.WalletState.MovingFunds ||
|
|
1002
|
-
wallet.state == Wallets.WalletState.Terminated,
|
|
1003
|
-
"Wallet must be in Live, MovingFunds or Terminated state"
|
|
1004
|
-
);
|
|
1005
|
-
|
|
1006
1001
|
// It is worth noting that there is no need to check if
|
|
1007
1002
|
// `timedOutRedemption` mapping already contains the given redemption
|
|
1008
1003
|
// key. There is no possibility to re-use a key of a reported timed-out
|
|
1009
1004
|
// redemption because the wallet responsible for causing the timeout is
|
|
1010
1005
|
// moved to a state that prevents it to receive new redemption requests.
|
|
1011
1006
|
|
|
1007
|
+
// Propagate timeout consequences to the wallet
|
|
1008
|
+
self.notifyWalletRedemptionTimeout(walletPubKeyHash, walletMembersIDs);
|
|
1009
|
+
|
|
1012
1010
|
// Move the redemption from pending redemptions to timed-out redemptions
|
|
1013
1011
|
self.timedOutRedemptions[redemptionKey] = request;
|
|
1014
1012
|
delete self.pendingRedemptions[redemptionKey];
|
|
1015
1013
|
|
|
1016
|
-
if (
|
|
1017
|
-
wallet.state == Wallets.WalletState.Live ||
|
|
1018
|
-
wallet.state == Wallets.WalletState.MovingFunds
|
|
1019
|
-
) {
|
|
1020
|
-
// Slash the wallet operators and reward the notifier
|
|
1021
|
-
self.ecdsaWalletRegistry.seize(
|
|
1022
|
-
self.redemptionTimeoutSlashingAmount,
|
|
1023
|
-
self.redemptionTimeoutNotifierRewardMultiplier,
|
|
1024
|
-
msg.sender,
|
|
1025
|
-
wallet.ecdsaWalletID,
|
|
1026
|
-
walletMembersIDs
|
|
1027
|
-
);
|
|
1028
|
-
|
|
1029
|
-
// Propagate timeout consequences to the wallet
|
|
1030
|
-
self.notifyWalletTimedOutRedemption(walletPubKeyHash);
|
|
1031
|
-
}
|
|
1032
|
-
|
|
1033
1014
|
// slither-disable-next-line reentrancy-events
|
|
1034
1015
|
emit RedemptionTimedOut(walletPubKeyHash, redeemerOutputScript);
|
|
1035
1016
|
|