@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.
Files changed (49) hide show
  1. package/artifacts/TBTC.json +3 -3
  2. package/artifacts/TBTCToken.json +3 -3
  3. package/artifacts/VendingMachine.json +10 -10
  4. package/artifacts/solcInputs/{f1a50b67569d88ee54efa3e22c6b484e.json → f2c15d3cf1bd9566483f595c5ed30ccc.json} +25 -25
  5. package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
  6. package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
  7. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.dbg.json +1 -1
  8. package/build/contracts/bridge/BitcoinTx.sol/BitcoinTx.json +2 -2
  9. package/build/contracts/bridge/Bridge.sol/Bridge.dbg.json +1 -1
  10. package/build/contracts/bridge/Bridge.sol/Bridge.json +191 -331
  11. package/build/contracts/bridge/BridgeState.sol/BridgeState.dbg.json +1 -1
  12. package/build/contracts/bridge/BridgeState.sol/BridgeState.json +35 -3
  13. package/build/contracts/bridge/Deposit.sol/Deposit.dbg.json +1 -1
  14. package/build/contracts/bridge/Deposit.sol/Deposit.json +2 -2
  15. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.dbg.json +1 -1
  16. package/build/contracts/bridge/EcdsaLib.sol/EcdsaLib.json +2 -2
  17. package/build/contracts/bridge/Fraud.sol/Fraud.dbg.json +4 -0
  18. package/build/contracts/bridge/Fraud.sol/Fraud.json +86 -0
  19. package/build/contracts/bridge/IRelay.sol/IRelay.dbg.json +1 -1
  20. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.dbg.json +1 -1
  21. package/build/contracts/bridge/MovingFunds.sol/MovingFunds.json +4 -22
  22. package/build/contracts/bridge/Redemption.sol/OutboundTx.dbg.json +4 -0
  23. package/build/contracts/bridge/{Redeem.sol → Redemption.sol}/OutboundTx.json +3 -3
  24. package/build/contracts/bridge/Redemption.sol/Redemption.dbg.json +4 -0
  25. package/build/contracts/bridge/Redemption.sol/Redemption.json +92 -0
  26. package/build/contracts/bridge/Sweep.sol/Sweep.dbg.json +1 -1
  27. package/build/contracts/bridge/Sweep.sol/Sweep.json +2 -2
  28. package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
  29. package/build/contracts/bridge/Wallets.sol/Wallets.dbg.json +1 -1
  30. package/build/contracts/bridge/Wallets.sol/Wallets.json +2 -47
  31. package/build/contracts/token/TBTC.sol/TBTC.dbg.json +1 -1
  32. package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
  33. package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
  34. package/contracts/bridge/BitcoinTx.sol +19 -26
  35. package/contracts/bridge/Bridge.sol +476 -534
  36. package/contracts/bridge/BridgeState.sol +190 -129
  37. package/contracts/bridge/Deposit.sol +23 -4
  38. package/contracts/bridge/EcdsaLib.sol +15 -0
  39. package/contracts/bridge/{Frauds.sol → Fraud.sol} +75 -146
  40. package/contracts/bridge/MovingFunds.sol +15 -9
  41. package/contracts/bridge/{Redeem.sol → Redemption.sol} +19 -17
  42. package/contracts/bridge/Sweep.sol +16 -9
  43. package/contracts/bridge/Wallets.sol +40 -121
  44. package/package.json +1 -1
  45. package/build/contracts/bridge/Frauds.sol/Frauds.dbg.json +0 -4
  46. package/build/contracts/bridge/Frauds.sol/Frauds.json +0 -138
  47. package/build/contracts/bridge/Redeem.sol/OutboundTx.dbg.json +0 -4
  48. package/build/contracts/bridge/Redeem.sol/Redeem.dbg.json +0 -4
  49. 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 "./Redeem.sol";
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
- /// @notice The number of confirmations on the Bitcoin chain required to
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
- /// TODO: Make it governable.
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
- /// TODO: Revisit whether it should be governable or not.
37
- /// @notice Address where the deposit and redemption treasury fees will
38
- /// be sent to. Treasury takes part in the operators rewarding
39
- /// process.
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
- /// TODO: Make it governable.
42
- /// @notice The minimal amount that can be requested to deposit.
43
- /// Value of this parameter must take into account the value of
44
- /// `depositTreasuryFeeDivisor` and `depositTxMaxFee`
45
- /// parameters in order to make requests that can incur the
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
- /// TODO: Make it governable.
49
- /// @notice Divisor used to compute the treasury fee taken from each
50
- /// deposit and transferred to the treasury upon sweep proof
51
- /// submission. That fee is computed as follows:
52
- /// `treasuryFee = depositedAmount / depositTreasuryFeeDivisor`
53
- /// For example, if the treasury fee needs to be 2% of each deposit,
54
- /// the `depositTreasuryFeeDivisor` should be set to `50`
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
- /// TODO: Make it governable.
58
- /// @notice Maximum amount of BTC transaction fee that can be incurred by
59
- /// each swept deposit being part of the given sweep
60
- /// transaction. If the maximum BTC transaction fee is exceeded,
61
- /// such transaction is considered a fraud.
62
- /// @dev This is a per-deposit input max fee for the sweep transaction.
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
- /// @notice Collection of all revealed deposits indexed by
65
- /// keccak256(fundingTxHash | fundingOutputIndex).
66
- /// The fundingTxHash is bytes32 (ordered as in Bitcoin internally)
67
- /// and fundingOutputIndex an uint32. This mapping may contain valid
68
- /// and invalid deposits and the wallet is responsible for
69
- /// validating them before attempting to execute a sweep.
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
- /// @notice Indicates if the vault with the given address is trusted or not.
72
- /// Depositors can route their revealed deposits only to trusted
73
- /// vaults and have trusted vaults notified about new deposits as
74
- /// soon as these deposits get swept. Vaults not trusted by the
75
- /// Bridge can still be used by Bank balance owners on their own
76
- /// responsibility - anyone can approve their Bank balance to any
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
- /// TODO: Make it governable.
80
- /// @notice Maximum amount of the total BTC transaction fee that is
81
- /// acceptable in a single moving funds transaction.
82
- /// @dev This is a TOTAL max fee for the moving funds transaction. Note
83
- /// that `depositTxMaxFee` is per single deposit and `redemptionTxMaxFee`
84
- /// if per single redemption. `movingFundsTxMaxTotalFee` is a total
85
- /// fee for the entire transaction.
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
- /// TODO: Make it governable.
88
- /// @notice The minimal amount that can be requested for redemption.
89
- /// Value of this parameter must take into account the value of
90
- /// `redemptionTreasuryFeeDivisor` and `redemptionTxMaxFee`
91
- /// parameters in order to make requests that can incur the
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
- /// TODO: Make it governable.
95
- /// @notice Divisor used to compute the treasury fee taken from each
96
- /// redemption request and transferred to the treasury upon
97
- /// successful request finalization. That fee is computed as follows:
98
- /// `treasuryFee = requestedAmount / redemptionTreasuryFeeDivisor`
99
- /// For example, if the treasury fee needs to be 2% of each
100
- /// redemption request, the `redemptionTreasuryFeeDivisor` should
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
- /// TODO: Make it governable.
104
- /// @notice Maximum amount of BTC transaction fee that can be incurred by
105
- /// each redemption request being part of the given redemption
106
- /// transaction. If the maximum BTC transaction fee is exceeded, such
107
- /// transaction is considered a fraud.
108
- /// @dev This is a per-redemption output max fee for the redemption transaction.
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
- /// TODO: Make it governable.
111
- /// @notice Time after which the redemption request can be reported as
112
- /// timed out. It is counted from the moment when the redemption
113
- /// request was created via `requestRedemption` call. Reported
114
- /// timed out requests are cancelled and locked TBTC is returned
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
- /// @notice Collection of all pending redemption requests indexed by
118
- /// redemption key built as
119
- /// keccak256(walletPubKeyHash | redeemerOutputScript). The
120
- /// walletPubKeyHash is the 20-byte wallet's public key hash
121
- /// (computed using Bitcoin HASH160 over the compressed ECDSA
122
- /// public key) and redeemerOutputScript is a Bitcoin script
123
- /// (P2PKH, P2WPKH, P2SH or P2WSH) that will be used to lock
124
- /// redeemed BTC as requested by the redeemer. Requests are added
125
- /// to this mapping by the `requestRedemption` method (duplicates
126
- /// not allowed) and are removed by one of the following methods:
127
- /// - `submitRedemptionProof` in case the request was handled
128
- /// successfully
129
- /// - `notifyRedemptionTimeout` in case the request was reported
130
- /// to be timed out
131
- mapping(uint256 => Redeem.RedemptionRequest) pendingRedemptions;
132
- /// @notice Collection of all timed out redemptions requests indexed by
133
- /// redemption key built as
134
- /// keccak256(walletPubKeyHash | redeemerOutputScript). The
135
- /// walletPubKeyHash is the 20-byte wallet's public key hash
136
- /// (computed using Bitcoin HASH160 over the compressed ECDSA
137
- /// public key) and redeemerOutputScript is the Bitcoin script
138
- /// (P2PKH, P2WPKH, P2SH or P2WSH) that is involved in the timed
139
- /// out request. Timed out requests are stored in this mapping to
140
- /// avoid slashing the wallets multiple times for the same timeout.
141
- /// Only one method can add to this mapping:
142
- /// - `notifyRedemptionTimeout` which puts the redemption key
143
- /// to this mapping basing on a timed out request stored
144
- /// previously in `pendingRedemptions` mapping.
145
- mapping(uint256 => Redeem.RedemptionRequest) timedOutRedemptions;
146
- /// @notice Collection of main UTXOs that are honestly spent indexed by
147
- /// keccak256(fundingTxHash | fundingOutputIndex). The fundingTxHash
148
- /// is bytes32 (ordered as in Bitcoin internally) and
149
- /// fundingOutputIndex an uint32. A main UTXO is considered honestly
150
- /// spent if it was used as an input of a transaction that have been
151
- /// proven in the Bridge.
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
- // TODO: Is it the right place for this function? Should we move it to Bridge?
156
- /// @notice Determines the current Bitcoin SPV proof difficulty context.
157
- /// @return proofDifficulty Bitcoin proof difficulty context.
158
- function proofDifficultyContext(Storage storage self)
159
- internal
160
- view
161
- returns (BitcoinTx.ProofDifficulty memory proofDifficulty)
162
- {
163
- IRelay relay = self.relay;
164
- proofDifficulty.currentEpochDifficulty = relay
165
- .getCurrentEpochDifficulty();
166
- proofDifficulty.previousEpochDifficulty = relay
167
- .getPrevEpochDifficulty();
168
- proofDifficulty.difficultyFactor = self.txProofDifficultyFactor;
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
- return proofDifficulty;
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
- wallets.registeredWallets[reveal.walletPubKeyHash].state ==
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";