@keep-network/tbtc-v2 0.1.1-dev.40 → 0.1.1-dev.41
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/TBTC.json +3 -3
- package/artifacts/TBTCToken.json +3 -3
- package/artifacts/VendingMachine.json +10 -10
- package/artifacts/solcInputs/{f1a50b67569d88ee54efa3e22c6b484e.json → e9b173393b9fd7287a0bfaa6d4eb4b71.json} +4 -4
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
- package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
- package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
- package/build/contracts/bridge/Bridge.sol/Bridge.json +71 -95
- 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/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
- package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +4 -0
- package/build/contracts/bridge/Fraud.sol/Fraud.json +138 -0
- 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/Redeem.sol/OutboundTx.dbg.json +1 -1
- package/build/contracts/bridge/Redeem.sol/OutboundTx.json +2 -2
- package/build/contracts/bridge/Redeem.sol/Redeem.dbg.json +1 -1
- package/build/contracts/bridge/Redeem.sol/Redeem.json +2 -2
- package/build/contracts/bridge/Sweep.sol/Sweep.dbg.json +1 -1
- package/build/contracts/bridge/Sweep.sol/Sweep.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/token/TBTC.sol/TBTC.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 +37 -78
- package/contracts/bridge/BridgeState.sol +115 -110
- package/contracts/bridge/{Frauds.sol → Fraud.sol} +58 -131
- package/package.json +1 -1
- package/build/contracts/bridge/Frauds.sol/Frauds.dbg.json +0 -4
- package/build/contracts/bridge/Frauds.sol/Frauds.json +0 -138
|
@@ -30,7 +30,7 @@ import "./Redeem.sol";
|
|
|
30
30
|
import "./BitcoinTx.sol";
|
|
31
31
|
import "./EcdsaLib.sol";
|
|
32
32
|
import "./Wallets.sol";
|
|
33
|
-
import "./
|
|
33
|
+
import "./Fraud.sol";
|
|
34
34
|
import "./MovingFunds.sol";
|
|
35
35
|
|
|
36
36
|
import "../bank/Bank.sol";
|
|
@@ -65,7 +65,7 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
65
65
|
using Sweep for BridgeState.Storage;
|
|
66
66
|
using Redeem for BridgeState.Storage;
|
|
67
67
|
using MovingFunds for BridgeState.Storage;
|
|
68
|
-
using
|
|
68
|
+
using Fraud for BridgeState.Storage;
|
|
69
69
|
using Wallets for Wallets.Data;
|
|
70
70
|
|
|
71
71
|
using BTCUtils for bytes;
|
|
@@ -74,10 +74,6 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
74
74
|
|
|
75
75
|
BridgeState.Storage internal self;
|
|
76
76
|
|
|
77
|
-
/// @notice Contains parameters related to frauds and the collection of all
|
|
78
|
-
/// submitted fraud challenges.
|
|
79
|
-
Frauds.Data internal frauds;
|
|
80
|
-
|
|
81
77
|
/// @notice State related with wallets.
|
|
82
78
|
Wallets.Data internal wallets;
|
|
83
79
|
|
|
@@ -208,12 +204,10 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
208
204
|
self.redemptionTxMaxFee = 10000; // 10000 satoshi
|
|
209
205
|
self.redemptionTimeout = 172800; // 48 hours
|
|
210
206
|
self.movingFundsTxMaxTotalFee = 10000; // 10000 satoshi
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
frauds.setChallengeDefeatTimeout(7 days);
|
|
216
|
-
frauds.setChallengeDepositAmount(2 ether);
|
|
207
|
+
self.fraudSlashingAmount = 10000 * 1e18; // 10000 T
|
|
208
|
+
self.fraudNotifierRewardMultiplier = 100; // 100%
|
|
209
|
+
self.fraudChallengeDefeatTimeout = 7 days;
|
|
210
|
+
self.fraudChallengeDepositAmount = 2 ether;
|
|
217
211
|
|
|
218
212
|
// TODO: Revisit initial values.
|
|
219
213
|
wallets.init(_ecdsaWalletRegistry);
|
|
@@ -503,28 +497,7 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
503
497
|
bytes32 sighash,
|
|
504
498
|
BitcoinTx.RSVSignature calldata signature
|
|
505
499
|
) external payable {
|
|
506
|
-
|
|
507
|
-
walletPublicKey.slice32(0),
|
|
508
|
-
walletPublicKey.slice32(32)
|
|
509
|
-
);
|
|
510
|
-
bytes20 walletPubKeyHash = compressedWalletPublicKey.hash160View();
|
|
511
|
-
|
|
512
|
-
Wallets.Wallet storage wallet = wallets.registeredWallets[
|
|
513
|
-
walletPubKeyHash
|
|
514
|
-
];
|
|
515
|
-
|
|
516
|
-
require(
|
|
517
|
-
wallet.state == Wallets.WalletState.Live ||
|
|
518
|
-
wallet.state == Wallets.WalletState.MovingFunds,
|
|
519
|
-
"Wallet is neither in Live nor MovingFunds state"
|
|
520
|
-
);
|
|
521
|
-
|
|
522
|
-
frauds.submitChallenge(
|
|
523
|
-
walletPublicKey,
|
|
524
|
-
walletPubKeyHash,
|
|
525
|
-
sighash,
|
|
526
|
-
signature
|
|
527
|
-
);
|
|
500
|
+
self.submitFraudChallenge(wallets, walletPublicKey, sighash, signature);
|
|
528
501
|
}
|
|
529
502
|
|
|
530
503
|
/// @notice Allows to defeat a pending fraud challenge against a wallet if
|
|
@@ -560,19 +533,7 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
560
533
|
bytes calldata preimage,
|
|
561
534
|
bool witness
|
|
562
535
|
) external {
|
|
563
|
-
|
|
564
|
-
walletPublicKey,
|
|
565
|
-
preimage,
|
|
566
|
-
witness
|
|
567
|
-
);
|
|
568
|
-
|
|
569
|
-
// Check that the UTXO key identifies a correctly spent UTXO.
|
|
570
|
-
require(
|
|
571
|
-
self.deposits[utxoKey].sweptAt > 0 || self.spentMainUTXOs[utxoKey],
|
|
572
|
-
"Spent UTXO not found among correctly spent UTXOs"
|
|
573
|
-
);
|
|
574
|
-
|
|
575
|
-
frauds.defeatChallenge(walletPublicKey, preimage, self.treasury);
|
|
536
|
+
self.defeatFraudChallenge(walletPublicKey, preimage, witness);
|
|
576
537
|
}
|
|
577
538
|
|
|
578
539
|
/// @notice Notifies about defeat timeout for the given fraud challenge.
|
|
@@ -602,35 +563,7 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
602
563
|
bytes calldata walletPublicKey,
|
|
603
564
|
bytes32 sighash
|
|
604
565
|
) external {
|
|
605
|
-
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
/// @notice Returns parameters used by the `Frauds` library.
|
|
609
|
-
/// @return slashingAmount Value of the slashing amount
|
|
610
|
-
/// @return notifierRewardMultiplier Value of the notifier reward multiplier
|
|
611
|
-
/// @return challengeDefeatTimeout Value of the challenge defeat timeout
|
|
612
|
-
/// @return challengeDepositAmount Value of the challenge deposit amount
|
|
613
|
-
function getFraudParameters()
|
|
614
|
-
external
|
|
615
|
-
view
|
|
616
|
-
returns (
|
|
617
|
-
uint256 slashingAmount,
|
|
618
|
-
uint256 notifierRewardMultiplier,
|
|
619
|
-
uint256 challengeDefeatTimeout,
|
|
620
|
-
uint256 challengeDepositAmount
|
|
621
|
-
)
|
|
622
|
-
{
|
|
623
|
-
slashingAmount = frauds.slashingAmount;
|
|
624
|
-
notifierRewardMultiplier = frauds.notifierRewardMultiplier;
|
|
625
|
-
challengeDefeatTimeout = frauds.challengeDefeatTimeout;
|
|
626
|
-
challengeDepositAmount = frauds.challengeDepositAmount;
|
|
627
|
-
|
|
628
|
-
return (
|
|
629
|
-
slashingAmount,
|
|
630
|
-
notifierRewardMultiplier,
|
|
631
|
-
challengeDefeatTimeout,
|
|
632
|
-
challengeDepositAmount
|
|
633
|
-
);
|
|
566
|
+
self.notifyFraudChallengeDefeatTimeout(walletPublicKey, sighash);
|
|
634
567
|
}
|
|
635
568
|
|
|
636
569
|
/// @notice Returns the fraud challenge identified by the given key built
|
|
@@ -638,9 +571,9 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
638
571
|
function fraudChallenges(uint256 challengeKey)
|
|
639
572
|
external
|
|
640
573
|
view
|
|
641
|
-
returns (
|
|
574
|
+
returns (Fraud.FraudChallenge memory)
|
|
642
575
|
{
|
|
643
|
-
return
|
|
576
|
+
return self.fraudChallenges[challengeKey];
|
|
644
577
|
}
|
|
645
578
|
|
|
646
579
|
/// @notice Requests redemption of the given amount from the specified
|
|
@@ -953,6 +886,32 @@ contract Bridge is Ownable, EcdsaWalletOwner {
|
|
|
953
886
|
movingFundsTxMaxTotalFee = self.movingFundsTxMaxTotalFee;
|
|
954
887
|
}
|
|
955
888
|
|
|
889
|
+
/// @notice Returns the current values of Bridge fraud parameters.
|
|
890
|
+
/// @return fraudSlashingAmount The amount slashed from each wallet member
|
|
891
|
+
/// for committing a fraud.
|
|
892
|
+
/// @return fraudNotifierRewardMultiplier The percentage of the notifier
|
|
893
|
+
/// reward from the staking contract the notifier of a fraud
|
|
894
|
+
/// receives. The value is in the range [0, 100].
|
|
895
|
+
/// @return fraudChallengeDefeatTimeout The amount of time the wallet has to
|
|
896
|
+
/// defeat a fraud challenge.
|
|
897
|
+
/// @return fraudChallengeDepositAmount The amount of ETH in wei the party
|
|
898
|
+
/// challenging the wallet for fraud needs to deposit.
|
|
899
|
+
function fraudParameters()
|
|
900
|
+
external
|
|
901
|
+
view
|
|
902
|
+
returns (
|
|
903
|
+
uint256 fraudSlashingAmount,
|
|
904
|
+
uint256 fraudNotifierRewardMultiplier,
|
|
905
|
+
uint256 fraudChallengeDefeatTimeout,
|
|
906
|
+
uint256 fraudChallengeDepositAmount
|
|
907
|
+
)
|
|
908
|
+
{
|
|
909
|
+
fraudSlashingAmount = self.fraudSlashingAmount;
|
|
910
|
+
fraudNotifierRewardMultiplier = self.fraudNotifierRewardMultiplier;
|
|
911
|
+
fraudChallengeDefeatTimeout = self.fraudChallengeDefeatTimeout;
|
|
912
|
+
fraudChallengeDepositAmount = self.fraudChallengeDepositAmount;
|
|
913
|
+
}
|
|
914
|
+
|
|
956
915
|
/// @notice Indicates if the vault with the given address is trusted or not.
|
|
957
916
|
/// Depositors can route their revealed deposits only to trusted
|
|
958
917
|
/// vaults and have trusted vaults notified about new deposits as
|
|
@@ -18,137 +18,142 @@ pragma solidity ^0.8.9;
|
|
|
18
18
|
import "./IRelay.sol";
|
|
19
19
|
import "./Deposit.sol";
|
|
20
20
|
import "./Redeem.sol";
|
|
21
|
+
import "./Fraud.sol";
|
|
21
22
|
|
|
22
23
|
import "../bank/Bank.sol";
|
|
23
24
|
|
|
24
25
|
library BridgeState {
|
|
26
|
+
// TODO: Make parameters governable
|
|
25
27
|
struct Storage {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
+
// The number of confirmations on the Bitcoin chain required to
|
|
29
|
+
// successfully evaluate an SPV proof.
|
|
28
30
|
uint256 txProofDifficultyFactor;
|
|
29
|
-
|
|
30
|
-
/// @notice Address of the Bank this Bridge belongs to.
|
|
31
|
+
// Address of the Bank this Bridge belongs to.
|
|
31
32
|
Bank bank;
|
|
32
|
-
|
|
33
|
-
/// @notice Bitcoin relay providing the current Bitcoin network
|
|
34
|
-
/// difficulty.
|
|
33
|
+
// Bitcoin relay providing the current Bitcoin network difficulty.
|
|
35
34
|
IRelay relay;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
/// be sent to. Treasury takes part in the operators rewarding
|
|
39
|
-
/// process.
|
|
35
|
+
// Address where the deposit and redemption treasury fees will be sent
|
|
36
|
+
// to. Treasury takes part in the operators rewarding process.
|
|
40
37
|
address treasury;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/// treasury and transaction fee and still satisfy the depositor.
|
|
38
|
+
// The minimal amount that can be requested to deposit.
|
|
39
|
+
// Value of this parameter must take into account the value of
|
|
40
|
+
// `depositTreasuryFeeDivisor` and `depositTxMaxFee` parameters in order
|
|
41
|
+
// to make requests that can incur the treasury and transaction fee and
|
|
42
|
+
// still satisfy the depositor.
|
|
47
43
|
uint64 depositDustThreshold;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/// because `1/50 = 0.02 = 2%`.
|
|
44
|
+
// Divisor used to compute the treasury fee taken from each deposit and
|
|
45
|
+
// transferred to the treasury upon sweep proof submission. That fee is
|
|
46
|
+
// computed as follows:
|
|
47
|
+
// `treasuryFee = depositedAmount / depositTreasuryFeeDivisor`
|
|
48
|
+
// For example, if the treasury fee needs to be 2% of each deposit,
|
|
49
|
+
// the `depositTreasuryFeeDivisor` should be set to `50` because
|
|
50
|
+
// `1/50 = 0.02 = 2%`.
|
|
56
51
|
uint64 depositTreasuryFeeDivisor;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
52
|
+
// Maximum amount of BTC transaction fee that can be incurred by each
|
|
53
|
+
// swept deposit being part of the given sweep transaction. If the
|
|
54
|
+
// maximum BTC transaction fee is exceeded, such transaction is
|
|
55
|
+
// considered a fraud.
|
|
56
|
+
//
|
|
57
|
+
// This is a per-deposit input max fee for the sweep transaction.
|
|
63
58
|
uint64 depositTxMaxFee;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
59
|
+
// Collection of all revealed deposits indexed by
|
|
60
|
+
// `keccak256(fundingTxHash | fundingOutputIndex)`.
|
|
61
|
+
// The `fundingTxHash` is `bytes32` (ordered as in Bitcoin internally)
|
|
62
|
+
// and `fundingOutputIndex` an `uint32`. This mapping may contain valid
|
|
63
|
+
// and invalid deposits and the wallet is responsible for validating
|
|
64
|
+
// them before attempting to execute a sweep.
|
|
70
65
|
mapping(uint256 => Deposit.DepositRequest) deposits;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/// address.
|
|
66
|
+
// Indicates if the vault with the given address is trusted or not.
|
|
67
|
+
// Depositors can route their revealed deposits only to trusted vaults
|
|
68
|
+
// and have trusted vaults notified about new deposits as soon as these
|
|
69
|
+
// deposits get swept. Vaults not trusted by the Bridge can still be
|
|
70
|
+
// used by Bank balance owners on their own responsibility - anyone can
|
|
71
|
+
// approve their Bank balance to any address.
|
|
78
72
|
mapping(address => bool) isVaultTrusted;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
73
|
+
// Maximum amount of the total BTC transaction fee that is acceptable in
|
|
74
|
+
// a single moving funds transaction.
|
|
75
|
+
//
|
|
76
|
+
// This is a TOTAL max fee for the moving funds transaction. Note
|
|
77
|
+
// that `depositTxMaxFee` is per single deposit and `redemptionTxMaxFee`
|
|
78
|
+
// if per single redemption. `movingFundsTxMaxTotalFee` is a total
|
|
79
|
+
// fee for the entire transaction.
|
|
86
80
|
uint64 movingFundsTxMaxTotalFee;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/// treasury and transaction fee and still satisfy the redeemer.
|
|
81
|
+
// The minimal amount that can be requested for redemption.
|
|
82
|
+
// Value of this parameter must take into account the value of
|
|
83
|
+
// `redemptionTreasuryFeeDivisor` and `redemptionTxMaxFee`
|
|
84
|
+
// parameters in order to make requests that can incur the
|
|
85
|
+
// treasury and transaction fee and still satisfy the redeemer.
|
|
93
86
|
uint64 redemptionDustThreshold;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/// be set to `50` because `1/50 = 0.02 = 2%`.
|
|
87
|
+
// Divisor used to compute the treasury fee taken from each
|
|
88
|
+
// redemption request and transferred to the treasury upon
|
|
89
|
+
// successful request finalization. That fee is computed as follows:
|
|
90
|
+
// `treasuryFee = requestedAmount / redemptionTreasuryFeeDivisor`
|
|
91
|
+
// For example, if the treasury fee needs to be 2% of each
|
|
92
|
+
// redemption request, the `redemptionTreasuryFeeDivisor` should
|
|
93
|
+
// be set to `50` because `1/50 = 0.02 = 2%`.
|
|
102
94
|
uint64 redemptionTreasuryFeeDivisor;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
95
|
+
// Maximum amount of BTC transaction fee that can be incurred by
|
|
96
|
+
// each redemption request being part of the given redemption
|
|
97
|
+
// transaction. If the maximum BTC transaction fee is exceeded, such
|
|
98
|
+
// transaction is considered a fraud.
|
|
99
|
+
//
|
|
100
|
+
// This is a per-redemption output max fee for the redemption
|
|
101
|
+
// transaction.
|
|
109
102
|
uint64 redemptionTxMaxFee;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
/// to the redeemer in full amount.
|
|
103
|
+
// Time after which the redemption request can be reported as
|
|
104
|
+
// timed out. It is counted from the moment when the redemption
|
|
105
|
+
// request was created via `requestRedemption` call. Reported
|
|
106
|
+
// timed out requests are cancelled and locked TBTC is returned
|
|
107
|
+
// to the redeemer in full amount.
|
|
116
108
|
uint256 redemptionTimeout;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
109
|
+
// Collection of all pending redemption requests indexed by
|
|
110
|
+
// redemption key built as
|
|
111
|
+
// `keccak256(walletPubKeyHash | redeemerOutputScript)`.
|
|
112
|
+
// The `walletPubKeyHash` is the 20-byte wallet's public key hash
|
|
113
|
+
// (computed using Bitcoin HASH160 over the compressed ECDSA
|
|
114
|
+
// public key) and `redeemerOutputScript` is a Bitcoin script
|
|
115
|
+
// (P2PKH, P2WPKH, P2SH or P2WSH) that will be used to lock
|
|
116
|
+
// redeemed BTC as requested by the redeemer. Requests are added
|
|
117
|
+
// to this mapping by the `requestRedemption` method (duplicates
|
|
118
|
+
// not allowed) and are removed by one of the following methods:
|
|
119
|
+
// - `submitRedemptionProof` in case the request was handled
|
|
120
|
+
// successfully
|
|
121
|
+
// - `notifyRedemptionTimeout` in case the request was reported
|
|
122
|
+
// to be timed out
|
|
131
123
|
mapping(uint256 => Redeem.RedemptionRequest) pendingRedemptions;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
124
|
+
// Collection of all timed out redemptions requests indexed by
|
|
125
|
+
// redemption key built as
|
|
126
|
+
// `keccak256(walletPubKeyHash | redeemerOutputScript)`. The
|
|
127
|
+
// `walletPubKeyHash` is the 20-byte wallet's public key hash
|
|
128
|
+
// (computed using Bitcoin HASH160 over the compressed ECDSA
|
|
129
|
+
// public key) and `redeemerOutputScript` is the Bitcoin script
|
|
130
|
+
// (P2PKH, P2WPKH, P2SH or P2WSH) that is involved in the timed
|
|
131
|
+
// out request. Timed out requests are stored in this mapping to
|
|
132
|
+
// avoid slashing the wallets multiple times for the same timeout.
|
|
133
|
+
// Only one method can add to this mapping:
|
|
134
|
+
// - `notifyRedemptionTimeout` which puts the redemption key to this
|
|
135
|
+
// mapping basing on a timed out request stored previously in
|
|
136
|
+
// `pendingRedemptions` mapping.
|
|
145
137
|
mapping(uint256 => Redeem.RedemptionRequest) timedOutRedemptions;
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
138
|
+
// The amount of stake slashed from each member of a wallet for a fraud.
|
|
139
|
+
uint256 fraudSlashingAmount;
|
|
140
|
+
// The percentage of the notifier reward from the staking contract
|
|
141
|
+
// the notifier of a fraud receives. The value is in the range [0, 100].
|
|
142
|
+
uint256 fraudNotifierRewardMultiplier;
|
|
143
|
+
// The amount of time the wallet has to defeat a fraud challenge.
|
|
144
|
+
uint256 fraudChallengeDefeatTimeout;
|
|
145
|
+
// The amount of ETH in wei the party challenging the wallet for fraud
|
|
146
|
+
// needs to deposit.
|
|
147
|
+
uint256 fraudChallengeDepositAmount;
|
|
148
|
+
// Collection of all submitted fraud challenges indexed by challenge
|
|
149
|
+
// key built as `keccak256(walletPublicKey|sighash)`.
|
|
150
|
+
mapping(uint256 => Fraud.FraudChallenge) fraudChallenges;
|
|
151
|
+
// Collection of main UTXOs that are honestly spent indexed by
|
|
152
|
+
// `keccak256(fundingTxHash | fundingOutputIndex)`. The `fundingTxHash`
|
|
153
|
+
// is `bytes32` (ordered as in Bitcoin internally) and
|
|
154
|
+
// `fundingOutputIndex` an `uint32`. A main UTXO is considered honestly
|
|
155
|
+
// spent if it was used as an input of a transaction that have been
|
|
156
|
+
// proven in the Bridge.
|
|
152
157
|
mapping(uint256 => bool) spentMainUTXOs;
|
|
153
158
|
}
|
|
154
159
|
|