@keep-network/tbtc-v2 0.1.1-dev.40 → 0.1.1-dev.43
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 → f2c15d3cf1bd9566483f595c5ed30ccc.json} +25 -25
- 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/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 +191 -331
- package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
- package/build/contracts/bridge/BridgeState.sol/BridgeState.json +35 -3
- 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/EcdsaLib.sol/EcdsaLib.json +2 -2
- package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +4 -0
- package/build/contracts/bridge/Fraud.sol/Fraud.json +86 -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 +4 -22
- package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +4 -0
- package/build/contracts/bridge/{Redeem.sol → Redemption.sol}/OutboundTx.json +3 -3
- package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +4 -0
- package/build/contracts/bridge/Redemption.sol/Redemption.json +92 -0
- 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/bridge/Wallets.sol/Wallets.json +2 -47
- 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/BitcoinTx.sol +19 -26
- package/contracts/bridge/Bridge.sol +476 -534
- package/contracts/bridge/BridgeState.sol +190 -129
- package/contracts/bridge/Deposit.sol +23 -4
- package/contracts/bridge/EcdsaLib.sol +15 -0
- package/contracts/bridge/{Frauds.sol → Fraud.sol} +75 -146
- package/contracts/bridge/MovingFunds.sol +15 -9
- package/contracts/bridge/{Redeem.sol → Redemption.sol} +19 -17
- package/contracts/bridge/Sweep.sol +16 -9
- package/contracts/bridge/Wallets.sol +40 -121
- 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
- package/build/contracts/bridge/Redeem.sol/OutboundTx.dbg.json +0 -4
- package/build/contracts/bridge/Redeem.sol/Redeem.dbg.json +0 -4
- package/build/contracts/bridge/Redeem.sol/Redeem.json +0 -110
|
@@ -17,156 +17,217 @@ pragma solidity ^0.8.9;
|
|
|
17
17
|
|
|
18
18
|
import "./IRelay.sol";
|
|
19
19
|
import "./Deposit.sol";
|
|
20
|
-
import "./
|
|
20
|
+
import "./Redemption.sol";
|
|
21
|
+
import "./Fraud.sol";
|
|
22
|
+
import "./Wallets.sol";
|
|
21
23
|
|
|
22
24
|
import "../bank/Bank.sol";
|
|
23
25
|
|
|
24
26
|
library BridgeState {
|
|
27
|
+
// TODO: Make parameters governable
|
|
25
28
|
struct Storage {
|
|
26
|
-
|
|
27
|
-
/// successfully evaluate an SPV proof.
|
|
28
|
-
uint256 txProofDifficultyFactor;
|
|
29
|
-
/// TODO: Revisit whether it should be governable or not.
|
|
30
|
-
/// @notice Address of the Bank this Bridge belongs to.
|
|
29
|
+
// Address of the Bank the Bridge belongs to.
|
|
31
30
|
Bank bank;
|
|
32
|
-
|
|
33
|
-
/// @notice Bitcoin relay providing the current Bitcoin network
|
|
34
|
-
/// difficulty.
|
|
31
|
+
// Bitcoin relay providing the current Bitcoin network difficulty.
|
|
35
32
|
IRelay relay;
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
33
|
+
// ECDSA Wallet Registry contract handle.
|
|
34
|
+
EcdsaWalletRegistry ecdsaWalletRegistry;
|
|
35
|
+
// The number of confirmations on the Bitcoin chain required to
|
|
36
|
+
// successfully evaluate an SPV proof.
|
|
37
|
+
uint256 txProofDifficultyFactor;
|
|
38
|
+
// Address where the deposit and redemption treasury fees will be sent
|
|
39
|
+
// to. Treasury takes part in the operators rewarding process.
|
|
40
40
|
address treasury;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
/// treasury and transaction fee and still satisfy the depositor.
|
|
41
|
+
// The minimal amount that can be requested to deposit.
|
|
42
|
+
// Value of this parameter must take into account the value of
|
|
43
|
+
// `depositTreasuryFeeDivisor` and `depositTxMaxFee` parameters in order
|
|
44
|
+
// to make requests that can incur the treasury and transaction fee and
|
|
45
|
+
// still satisfy the depositor.
|
|
47
46
|
uint64 depositDustThreshold;
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
/// because `1/50 = 0.02 = 2%`.
|
|
47
|
+
// Divisor used to compute the treasury fee taken from each deposit and
|
|
48
|
+
// transferred to the treasury upon sweep proof submission. That fee is
|
|
49
|
+
// computed as follows:
|
|
50
|
+
// `treasuryFee = depositedAmount / depositTreasuryFeeDivisor`
|
|
51
|
+
// For example, if the treasury fee needs to be 2% of each deposit,
|
|
52
|
+
// the `depositTreasuryFeeDivisor` should be set to `50` because
|
|
53
|
+
// `1/50 = 0.02 = 2%`.
|
|
56
54
|
uint64 depositTreasuryFeeDivisor;
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
// Maximum amount of BTC transaction fee that can be incurred by each
|
|
56
|
+
// swept deposit being part of the given sweep transaction. If the
|
|
57
|
+
// maximum BTC transaction fee is exceeded, such transaction is
|
|
58
|
+
// considered a fraud.
|
|
59
|
+
//
|
|
60
|
+
// This is a per-deposit input max fee for the sweep transaction.
|
|
63
61
|
uint64 depositTxMaxFee;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
// Collection of all revealed deposits indexed by
|
|
63
|
+
// `keccak256(fundingTxHash | fundingOutputIndex)`.
|
|
64
|
+
// The `fundingTxHash` is `bytes32` (ordered as in Bitcoin internally)
|
|
65
|
+
// and `fundingOutputIndex` an `uint32`. This mapping may contain valid
|
|
66
|
+
// and invalid deposits and the wallet is responsible for validating
|
|
67
|
+
// them before attempting to execute a sweep.
|
|
70
68
|
mapping(uint256 => Deposit.DepositRequest) deposits;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
/// address.
|
|
69
|
+
// Indicates if the vault with the given address is trusted or not.
|
|
70
|
+
// Depositors can route their revealed deposits only to trusted vaults
|
|
71
|
+
// and have trusted vaults notified about new deposits as soon as these
|
|
72
|
+
// deposits get swept. Vaults not trusted by the Bridge can still be
|
|
73
|
+
// used by Bank balance owners on their own responsibility - anyone can
|
|
74
|
+
// approve their Bank balance to any address.
|
|
78
75
|
mapping(address => bool) isVaultTrusted;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
// Maximum amount of the total BTC transaction fee that is acceptable in
|
|
77
|
+
// a single moving funds transaction.
|
|
78
|
+
//
|
|
79
|
+
// This is a TOTAL max fee for the moving funds transaction. Note
|
|
80
|
+
// that `depositTxMaxFee` is per single deposit and `redemptionTxMaxFee`
|
|
81
|
+
// if per single redemption. `movingFundsTxMaxTotalFee` is a total
|
|
82
|
+
// fee for the entire transaction.
|
|
86
83
|
uint64 movingFundsTxMaxTotalFee;
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
/// treasury and transaction fee and still satisfy the redeemer.
|
|
84
|
+
// The minimal amount that can be requested for redemption.
|
|
85
|
+
// Value of this parameter must take into account the value of
|
|
86
|
+
// `redemptionTreasuryFeeDivisor` and `redemptionTxMaxFee`
|
|
87
|
+
// parameters in order to make requests that can incur the
|
|
88
|
+
// treasury and transaction fee and still satisfy the redeemer.
|
|
93
89
|
uint64 redemptionDustThreshold;
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
/// be set to `50` because `1/50 = 0.02 = 2%`.
|
|
90
|
+
// Divisor used to compute the treasury fee taken from each
|
|
91
|
+
// redemption request and transferred to the treasury upon
|
|
92
|
+
// successful request finalization. That fee is computed as follows:
|
|
93
|
+
// `treasuryFee = requestedAmount / redemptionTreasuryFeeDivisor`
|
|
94
|
+
// For example, if the treasury fee needs to be 2% of each
|
|
95
|
+
// redemption request, the `redemptionTreasuryFeeDivisor` should
|
|
96
|
+
// be set to `50` because `1/50 = 0.02 = 2%`.
|
|
102
97
|
uint64 redemptionTreasuryFeeDivisor;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
98
|
+
// Maximum amount of BTC transaction fee that can be incurred by
|
|
99
|
+
// each redemption request being part of the given redemption
|
|
100
|
+
// transaction. If the maximum BTC transaction fee is exceeded, such
|
|
101
|
+
// transaction is considered a fraud.
|
|
102
|
+
//
|
|
103
|
+
// This is a per-redemption output max fee for the redemption
|
|
104
|
+
// transaction.
|
|
109
105
|
uint64 redemptionTxMaxFee;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
/// to the redeemer in full amount.
|
|
106
|
+
// Time after which the redemption request can be reported as
|
|
107
|
+
// timed out. It is counted from the moment when the redemption
|
|
108
|
+
// request was created via `requestRedemption` call. Reported
|
|
109
|
+
// timed out requests are cancelled and locked TBTC is returned
|
|
110
|
+
// to the redeemer in full amount.
|
|
116
111
|
uint256 redemptionTimeout;
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
mapping(uint256 =>
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
mapping(uint256 =>
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
112
|
+
// Collection of all pending redemption requests indexed by
|
|
113
|
+
// redemption key built as
|
|
114
|
+
// `keccak256(walletPubKeyHash | redeemerOutputScript)`.
|
|
115
|
+
// The `walletPubKeyHash` is the 20-byte wallet's public key hash
|
|
116
|
+
// (computed using Bitcoin HASH160 over the compressed ECDSA
|
|
117
|
+
// public key) and `redeemerOutputScript` is a Bitcoin script
|
|
118
|
+
// (P2PKH, P2WPKH, P2SH or P2WSH) that will be used to lock
|
|
119
|
+
// redeemed BTC as requested by the redeemer. Requests are added
|
|
120
|
+
// to this mapping by the `requestRedemption` method (duplicates
|
|
121
|
+
// not allowed) and are removed by one of the following methods:
|
|
122
|
+
// - `submitRedemptionProof` in case the request was handled
|
|
123
|
+
// successfully
|
|
124
|
+
// - `notifyRedemptionTimeout` in case the request was reported
|
|
125
|
+
// to be timed out
|
|
126
|
+
mapping(uint256 => Redemption.RedemptionRequest) pendingRedemptions;
|
|
127
|
+
// Collection of all timed out redemptions requests indexed by
|
|
128
|
+
// redemption key built as
|
|
129
|
+
// `keccak256(walletPubKeyHash | redeemerOutputScript)`. The
|
|
130
|
+
// `walletPubKeyHash` is the 20-byte wallet's public key hash
|
|
131
|
+
// (computed using Bitcoin HASH160 over the compressed ECDSA
|
|
132
|
+
// public key) and `redeemerOutputScript` is the Bitcoin script
|
|
133
|
+
// (P2PKH, P2WPKH, P2SH or P2WSH) that is involved in the timed
|
|
134
|
+
// out request. Timed out requests are stored in this mapping to
|
|
135
|
+
// avoid slashing the wallets multiple times for the same timeout.
|
|
136
|
+
// Only one method can add to this mapping:
|
|
137
|
+
// - `notifyRedemptionTimeout` which puts the redemption key to this
|
|
138
|
+
// mapping basing on a timed out request stored previously in
|
|
139
|
+
// `pendingRedemptions` mapping.
|
|
140
|
+
mapping(uint256 => Redemption.RedemptionRequest) timedOutRedemptions;
|
|
141
|
+
// The amount of stake slashed from each member of a wallet for a fraud.
|
|
142
|
+
uint256 fraudSlashingAmount;
|
|
143
|
+
// The percentage of the notifier reward from the staking contract
|
|
144
|
+
// the notifier of a fraud receives. The value is in the range [0, 100].
|
|
145
|
+
uint256 fraudNotifierRewardMultiplier;
|
|
146
|
+
// The amount of time the wallet has to defeat a fraud challenge.
|
|
147
|
+
uint256 fraudChallengeDefeatTimeout;
|
|
148
|
+
// The amount of ETH in wei the party challenging the wallet for fraud
|
|
149
|
+
// needs to deposit.
|
|
150
|
+
uint256 fraudChallengeDepositAmount;
|
|
151
|
+
// Collection of all submitted fraud challenges indexed by challenge
|
|
152
|
+
// key built as `keccak256(walletPublicKey|sighash)`.
|
|
153
|
+
mapping(uint256 => Fraud.FraudChallenge) fraudChallenges;
|
|
154
|
+
// Collection of main UTXOs that are honestly spent indexed by
|
|
155
|
+
// `keccak256(fundingTxHash | fundingOutputIndex)`. The `fundingTxHash`
|
|
156
|
+
// is `bytes32` (ordered as in Bitcoin internally) and
|
|
157
|
+
// `fundingOutputIndex` an `uint32`. A main UTXO is considered honestly
|
|
158
|
+
// spent if it was used as an input of a transaction that have been
|
|
159
|
+
// proven in the Bridge.
|
|
152
160
|
mapping(uint256 => bool) spentMainUTXOs;
|
|
161
|
+
// Determines how frequently a new wallet creation can be requested.
|
|
162
|
+
// Value in seconds.
|
|
163
|
+
uint32 walletCreationPeriod;
|
|
164
|
+
// The minimum BTC threshold in satoshi that is used to decide about
|
|
165
|
+
// wallet creation or closing.
|
|
166
|
+
uint64 walletMinBtcBalance;
|
|
167
|
+
// The maximum BTC threshold in satoshi that is used to decide about
|
|
168
|
+
// wallet creation.
|
|
169
|
+
uint64 walletMaxBtcBalance;
|
|
170
|
+
// The maximum age of a wallet in seconds, after which the wallet
|
|
171
|
+
// moving funds process can be requested.
|
|
172
|
+
uint32 walletMaxAge;
|
|
173
|
+
// 20-byte wallet public key hash being reference to the currently
|
|
174
|
+
// active wallet. Can be unset to the zero value under certain
|
|
175
|
+
// circumstances.
|
|
176
|
+
bytes20 activeWalletPubKeyHash;
|
|
177
|
+
// Maps the 20-byte wallet public key hash (computed using Bitcoin
|
|
178
|
+
// HASH160 over the compressed ECDSA public key) to the basic wallet
|
|
179
|
+
// information like state and pending redemptions value.
|
|
180
|
+
mapping(bytes20 => Wallets.Wallet) registeredWallets;
|
|
153
181
|
}
|
|
154
182
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
183
|
+
event WalletParametersUpdated(
|
|
184
|
+
uint32 walletCreationPeriod,
|
|
185
|
+
uint64 walletMinBtcBalance,
|
|
186
|
+
uint64 walletMaxBtcBalance,
|
|
187
|
+
uint32 walletMaxAge
|
|
188
|
+
);
|
|
189
|
+
|
|
190
|
+
/// @notice Updates parameters of wallets.
|
|
191
|
+
/// @param _walletCreationPeriod New value of the wallet creation period in
|
|
192
|
+
/// seconds, determines how frequently a new wallet creation can be
|
|
193
|
+
/// requested
|
|
194
|
+
/// @param _walletMinBtcBalance New value of the wallet minimum BTC balance
|
|
195
|
+
/// in satoshis, used to decide about wallet creation or closing
|
|
196
|
+
/// @param _walletMaxBtcBalance New value of the wallet maximum BTC balance
|
|
197
|
+
/// in satoshis, used to decide about wallet creation
|
|
198
|
+
/// @param _walletMaxAge New value of the wallet maximum age in seconds,
|
|
199
|
+
/// indicates the maximum age of a wallet in seconds, after which
|
|
200
|
+
/// the wallet moving funds process can be requested
|
|
201
|
+
/// @dev Requirements:
|
|
202
|
+
/// - Wallet minimum BTC balance must be greater than zero
|
|
203
|
+
/// - Wallet maximum BTC balance must be greater than the wallet
|
|
204
|
+
/// minimum BTC balance
|
|
205
|
+
function updateWalletParameters(
|
|
206
|
+
Storage storage self,
|
|
207
|
+
uint32 _walletCreationPeriod,
|
|
208
|
+
uint64 _walletMinBtcBalance,
|
|
209
|
+
uint64 _walletMaxBtcBalance,
|
|
210
|
+
uint32 _walletMaxAge
|
|
211
|
+
) internal {
|
|
212
|
+
require(
|
|
213
|
+
_walletMinBtcBalance > 0,
|
|
214
|
+
"Wallet minimum BTC balance must be greater than zero"
|
|
215
|
+
);
|
|
216
|
+
require(
|
|
217
|
+
_walletMaxBtcBalance > _walletMinBtcBalance,
|
|
218
|
+
"Wallet maximum BTC balance must be greater than the minimum"
|
|
219
|
+
);
|
|
220
|
+
|
|
221
|
+
self.walletCreationPeriod = _walletCreationPeriod;
|
|
222
|
+
self.walletMinBtcBalance = _walletMinBtcBalance;
|
|
223
|
+
self.walletMaxBtcBalance = _walletMaxBtcBalance;
|
|
224
|
+
self.walletMaxAge = _walletMaxAge;
|
|
169
225
|
|
|
170
|
-
|
|
226
|
+
emit WalletParametersUpdated(
|
|
227
|
+
_walletCreationPeriod,
|
|
228
|
+
_walletMinBtcBalance,
|
|
229
|
+
_walletMaxBtcBalance,
|
|
230
|
+
_walletMaxAge
|
|
231
|
+
);
|
|
171
232
|
}
|
|
172
233
|
}
|
|
@@ -22,9 +22,29 @@ import "./BitcoinTx.sol";
|
|
|
22
22
|
import "./BridgeState.sol";
|
|
23
23
|
import "./Wallets.sol";
|
|
24
24
|
|
|
25
|
+
/// @title Bridge deposit
|
|
26
|
+
/// @notice The library handles the logic for revealing Bitcoin deposits to
|
|
27
|
+
/// the Bridge.
|
|
28
|
+
/// @dev The depositor puts together a P2SH or P2WSH address to deposit the
|
|
29
|
+
/// funds. This script is unique to each depositor and looks like this:
|
|
30
|
+
///
|
|
31
|
+
/// ```
|
|
32
|
+
/// <depositorAddress> DROP
|
|
33
|
+
/// <blindingFactor> DROP
|
|
34
|
+
/// DUP HASH160 <walletPubKeyHash> EQUAL
|
|
35
|
+
/// IF
|
|
36
|
+
/// CHECKSIG
|
|
37
|
+
/// ELSE
|
|
38
|
+
/// DUP HASH160 <refundPubkeyHash> EQUALVERIFY
|
|
39
|
+
/// <refundLocktime> CHECKLOCKTIMEVERIFY DROP
|
|
40
|
+
/// CHECKSIG
|
|
41
|
+
/// ENDIF
|
|
42
|
+
/// ```
|
|
43
|
+
///
|
|
44
|
+
/// Since each depositor has their own Ethereum address and their own
|
|
45
|
+
/// secret blinding factor, each depositor’s script is unique, and the hash
|
|
46
|
+
/// of each depositor’s script is unique.
|
|
25
47
|
library Deposit {
|
|
26
|
-
using Wallets for Wallets.Data;
|
|
27
|
-
|
|
28
48
|
using BTCUtils for bytes;
|
|
29
49
|
using BytesLib for bytes;
|
|
30
50
|
|
|
@@ -123,12 +143,11 @@ library Deposit {
|
|
|
123
143
|
/// deposit script unlocks to receive their BTC back.
|
|
124
144
|
function revealDeposit(
|
|
125
145
|
BridgeState.Storage storage self,
|
|
126
|
-
Wallets.Data storage wallets,
|
|
127
146
|
BitcoinTx.Info calldata fundingTx,
|
|
128
147
|
DepositRevealInfo calldata reveal
|
|
129
148
|
) external {
|
|
130
149
|
require(
|
|
131
|
-
|
|
150
|
+
self.registeredWallets[reveal.walletPubKeyHash].state ==
|
|
132
151
|
Wallets.WalletState.Live,
|
|
133
152
|
"Wallet is not in Live state"
|
|
134
153
|
);
|
|
@@ -1,3 +1,18 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
// ██████████████ ▐████▌ ██████████████
|
|
4
|
+
// ██████████████ ▐████▌ ██████████████
|
|
5
|
+
// ▐████▌ ▐████▌
|
|
6
|
+
// ▐████▌ ▐████▌
|
|
7
|
+
// ██████████████ ▐████▌ ██████████████
|
|
8
|
+
// ██████████████ ▐████▌ ██████████████
|
|
9
|
+
// ▐████▌ ▐████▌
|
|
10
|
+
// ▐████▌ ▐████▌
|
|
11
|
+
// ▐████▌ ▐████▌
|
|
12
|
+
// ▐████▌ ▐████▌
|
|
13
|
+
// ▐████▌ ▐████▌
|
|
14
|
+
// ▐████▌ ▐████▌
|
|
15
|
+
|
|
1
16
|
pragma solidity ^0.8.9;
|
|
2
17
|
|
|
3
18
|
import "@keep-network/bitcoin-spv-sol/contracts/BytesLib.sol";
|