@keep-network/tbtc-v2 0.1.1-dev.70 → 0.1.1-dev.73
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 +11 -11
- package/artifacts/Bridge.json +1 -1
- package/artifacts/DefaultProxyAdmin.json +2 -2
- package/artifacts/Deposit.json +10 -10
- package/artifacts/DepositSweep.json +13 -13
- package/artifacts/EcdsaDkgValidator.json +2 -2
- package/artifacts/EcdsaInactivity.json +1 -1
- package/artifacts/Fraud.json +23 -23
- 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 +31 -31
- package/artifacts/NuCypherStakingEscrow.json +1 -1
- package/artifacts/NuCypherToken.json +2 -2
- package/artifacts/RandomBeaconStub.json +1 -1
- package/artifacts/Redemption.json +20 -20
- package/artifacts/ReimbursementPool.json +2 -2
- package/artifacts/Relay.json +7 -7
- package/artifacts/SortitionPool.json +3 -3
- package/artifacts/T.json +2 -2
- package/artifacts/TBTC.json +3 -3
- package/artifacts/TBTCToken.json +3 -3
- package/artifacts/TokenStaking.json +1 -1
- package/artifacts/TokenholderGovernor.json +9 -9
- package/artifacts/TokenholderTimelock.json +8 -8
- package/artifacts/VendingMachine.json +9 -9
- package/artifacts/VendingMachineKeep.json +1 -1
- package/artifacts/VendingMachineNuCypher.json +1 -1
- package/artifacts/WalletRegistry.json +6 -6
- package/artifacts/WalletRegistry_Implementation.json +1 -1
- package/artifacts/WalletRegistry_Proxy.json +6 -6
- package/artifacts/Wallets.json +14 -14
- package/artifacts/solcInputs/{922f95457ca7980d018c851fb3308a7e.json → 6b8b6752e7756c1730fe99037bcdde62.json} +18 -18
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.json +2 -2
- package/build/contracts/bank/Bank.sol/Bank.dbg.json +1 -1
- package/build/contracts/bank/Bank.sol/Bank.json +2 -2
- 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 +2 -2
- 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/Heartbeat.sol/Heartbeat.json +2 -2
- 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/VendingMachine.sol/VendingMachine.json +2 -2
- 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/DonationVault.sol/DonationVault.json +2 -2
- package/build/contracts/vault/IVault.sol/IVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.json +98 -2
- package/contracts/GovernanceUtils.sol +3 -3
- package/contracts/bank/Bank.sol +2 -2
- package/contracts/bridge/BitcoinTx.sol +7 -7
- package/contracts/bridge/Bridge.sol +192 -195
- package/contracts/bridge/BridgeState.sol +43 -44
- package/contracts/bridge/Deposit.sol +5 -7
- package/contracts/bridge/DepositSweep.sol +12 -12
- package/contracts/bridge/Fraud.sol +25 -25
- package/contracts/bridge/Heartbeat.sol +1 -1
- package/contracts/bridge/MovingFunds.sol +72 -72
- package/contracts/bridge/Redemption.sol +31 -39
- package/contracts/bridge/Wallets.sol +29 -29
- package/contracts/vault/DonationVault.sol +9 -9
- package/contracts/vault/IVault.sol +4 -4
- package/contracts/vault/TBTCVault.sol +40 -8
- package/package.json +1 -1
|
@@ -129,14 +129,14 @@ library Wallets {
|
|
|
129
129
|
/// UTXO of the given active wallet, as currently known on the
|
|
130
130
|
/// Ethereum chain. If there is no active wallet at the moment, or
|
|
131
131
|
/// the active wallet has no main UTXO, this parameter can be
|
|
132
|
-
/// empty as it is ignored
|
|
133
|
-
/// - Wallet creation must not be in progress
|
|
132
|
+
/// empty as it is ignored,
|
|
133
|
+
/// - Wallet creation must not be in progress,
|
|
134
134
|
/// - If the active wallet is set, one of the following
|
|
135
135
|
/// conditions must be true:
|
|
136
136
|
/// - The active wallet BTC balance is above the minimum threshold
|
|
137
137
|
/// and the active wallet is old enough, i.e. the creation period
|
|
138
|
-
/// was elapsed since its creation time
|
|
139
|
-
/// - The active wallet BTC balance is above the maximum threshold
|
|
138
|
+
/// was elapsed since its creation time,
|
|
139
|
+
/// - The active wallet BTC balance is above the maximum threshold.
|
|
140
140
|
function requestNewWallet(
|
|
141
141
|
BridgeState.Storage storage self,
|
|
142
142
|
BitcoinTx.UTXO calldata activeWalletMainUtxo
|
|
@@ -181,7 +181,7 @@ library Wallets {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
/// @notice Gets BTC balance for given the wallet.
|
|
184
|
-
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
184
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet.
|
|
185
185
|
/// @param walletMainUtxo Data of the wallet's main UTXO, as currently
|
|
186
186
|
/// known on the Ethereum chain.
|
|
187
187
|
/// @return walletBtcBalance Current BTC balance for the given wallet.
|
|
@@ -227,8 +227,8 @@ library Wallets {
|
|
|
227
227
|
/// @param publicKeyX Wallet's public key's X coordinate.
|
|
228
228
|
/// @param publicKeyY Wallet's public key's Y coordinate.
|
|
229
229
|
/// @dev Requirements:
|
|
230
|
-
/// - The only caller authorized to call this function is `registry
|
|
231
|
-
/// - Given wallet data must not belong to an already registered wallet
|
|
230
|
+
/// - The only caller authorized to call this function is `registry`,
|
|
231
|
+
/// - Given wallet data must not belong to an already registered wallet.
|
|
232
232
|
function registerNewWallet(
|
|
233
233
|
BridgeState.Storage storage self,
|
|
234
234
|
bytes32 ecdsaWalletID,
|
|
@@ -268,8 +268,8 @@ library Wallets {
|
|
|
268
268
|
/// @param publicKeyX Wallet's public key's X coordinate.
|
|
269
269
|
/// @param publicKeyY Wallet's public key's Y coordinate.
|
|
270
270
|
/// @dev Requirements:
|
|
271
|
-
/// - The only caller authorized to call this function is `registry
|
|
272
|
-
/// - Wallet must be in Live state
|
|
271
|
+
/// - The only caller authorized to call this function is `registry`,
|
|
272
|
+
/// - Wallet must be in Live state.
|
|
273
273
|
function notifyWalletHeartbeatFailed(
|
|
274
274
|
BridgeState.Storage storage self,
|
|
275
275
|
bytes32 publicKeyX,
|
|
@@ -298,9 +298,9 @@ library Wallets {
|
|
|
298
298
|
/// still in the Live state. That means multiple action timeouts can
|
|
299
299
|
/// be reported for the same wallet but only the first report
|
|
300
300
|
/// requests the wallet to move their funds.
|
|
301
|
-
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
301
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet.
|
|
302
302
|
/// @dev Requirements:
|
|
303
|
-
/// - The wallet must be in the `Live` or `MovingFunds` state
|
|
303
|
+
/// - The wallet must be in the `Live` or `MovingFunds` state.
|
|
304
304
|
function notifyWalletTimedOutRedemption(
|
|
305
305
|
BridgeState.Storage storage self,
|
|
306
306
|
bytes20 walletPubKeyHash
|
|
@@ -322,19 +322,19 @@ library Wallets {
|
|
|
322
322
|
|
|
323
323
|
/// @notice Notifies that the wallet is either old enough or has too few
|
|
324
324
|
/// satoshis left and qualifies to be closed.
|
|
325
|
-
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
325
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet.
|
|
326
326
|
/// @param walletMainUtxo Data of the wallet's main UTXO, as currently
|
|
327
327
|
/// known on the Ethereum chain.
|
|
328
328
|
/// @dev Requirements:
|
|
329
|
-
/// - Wallet must not be set as the current active wallet
|
|
329
|
+
/// - Wallet must not be set as the current active wallet,
|
|
330
330
|
/// - Wallet must exceed the wallet maximum age OR the wallet BTC
|
|
331
331
|
/// balance must be lesser than the minimum threshold. If the latter
|
|
332
332
|
/// case is true, the `walletMainUtxo` components must point to the
|
|
333
333
|
/// recent main UTXO of the given wallet, as currently known on the
|
|
334
334
|
/// Ethereum chain. If the wallet has no main UTXO, this parameter
|
|
335
335
|
/// can be empty as it is ignored since the wallet balance is
|
|
336
|
-
/// assumed to be zero
|
|
337
|
-
/// - Wallet must be in Live state
|
|
336
|
+
/// assumed to be zero,
|
|
337
|
+
/// - Wallet must be in Live state.
|
|
338
338
|
function notifyCloseableWallet(
|
|
339
339
|
BridgeState.Storage storage self,
|
|
340
340
|
bytes20 walletPubKeyHash,
|
|
@@ -370,9 +370,9 @@ library Wallets {
|
|
|
370
370
|
/// funds request refers to the current active wallet, such a wallet
|
|
371
371
|
/// is no longer considered active and the active wallet slot
|
|
372
372
|
/// is unset allowing to trigger a new wallet creation immediately.
|
|
373
|
-
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
373
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet.
|
|
374
374
|
/// @dev Requirements:
|
|
375
|
-
/// - The caller must make sure that the wallet is in the Live state
|
|
375
|
+
/// - The caller must make sure that the wallet is in the Live state.
|
|
376
376
|
function moveFunds(
|
|
377
377
|
BridgeState.Storage storage self,
|
|
378
378
|
bytes20 walletPubKeyHash
|
|
@@ -403,10 +403,10 @@ library Wallets {
|
|
|
403
403
|
}
|
|
404
404
|
|
|
405
405
|
/// @notice Begins the closing period of the given wallet.
|
|
406
|
-
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
406
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet.
|
|
407
407
|
/// @dev Requirements:
|
|
408
408
|
/// - The caller must make sure that the wallet is in the
|
|
409
|
-
/// MovingFunds state
|
|
409
|
+
/// MovingFunds state.
|
|
410
410
|
function beginWalletClosing(
|
|
411
411
|
BridgeState.Storage storage self,
|
|
412
412
|
bytes20 walletPubKeyHash
|
|
@@ -423,10 +423,10 @@ library Wallets {
|
|
|
423
423
|
/// @notice Notifies about the end of the closing period for the given wallet.
|
|
424
424
|
/// Closes the wallet ultimately and notifies the ECDSA registry
|
|
425
425
|
/// about this fact.
|
|
426
|
-
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
426
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet.
|
|
427
427
|
/// @dev Requirements:
|
|
428
|
-
/// - The wallet must be in the Closing state
|
|
429
|
-
/// - The wallet closing period must have elapsed
|
|
428
|
+
/// - The wallet must be in the Closing state,
|
|
429
|
+
/// - The wallet closing period must have elapsed.
|
|
430
430
|
function notifyWalletClosingPeriodElapsed(
|
|
431
431
|
BridgeState.Storage storage self,
|
|
432
432
|
bytes20 walletPubKeyHash
|
|
@@ -450,9 +450,9 @@ library Wallets {
|
|
|
450
450
|
|
|
451
451
|
/// @notice Finalizes the closing period of the given wallet and notifies
|
|
452
452
|
/// the ECDSA registry about this fact.
|
|
453
|
-
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
453
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet.
|
|
454
454
|
/// @dev Requirements:
|
|
455
|
-
/// - The caller must make sure that the wallet is in the Closing state
|
|
455
|
+
/// - The caller must make sure that the wallet is in the Closing state.
|
|
456
456
|
function finalizeWalletClosing(
|
|
457
457
|
BridgeState.Storage storage self,
|
|
458
458
|
bytes20 walletPubKeyHash
|
|
@@ -471,7 +471,7 @@ library Wallets {
|
|
|
471
471
|
/// active wallet, such a wallet is no longer considered active and
|
|
472
472
|
/// the active wallet slot is unset allowing to trigger a new wallet
|
|
473
473
|
/// creation immediately.
|
|
474
|
-
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
474
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet.
|
|
475
475
|
/// @dev Requirements:
|
|
476
476
|
/// - The caller must make sure that the wallet is in the
|
|
477
477
|
/// Live or MovingFunds or Closing state.
|
|
@@ -503,16 +503,16 @@ library Wallets {
|
|
|
503
503
|
/// successfully. Checks if the funds were moved to the expected
|
|
504
504
|
/// target wallets. Closes the source wallet if everything went
|
|
505
505
|
/// good and reverts otherwise.
|
|
506
|
-
/// @param walletPubKeyHash 20-byte public key hash of the wallet
|
|
506
|
+
/// @param walletPubKeyHash 20-byte public key hash of the wallet.
|
|
507
507
|
/// @param targetWalletsHash 32-byte keccak256 hash over the list of
|
|
508
508
|
/// 20-byte public key hashes of the target wallets actually used
|
|
509
509
|
/// within the moving funds transactions.
|
|
510
510
|
/// @dev Requirements:
|
|
511
511
|
/// - The caller must make sure the moving funds transaction actually
|
|
512
|
-
/// happened on Bitcoin chain and fits the protocol requirements
|
|
513
|
-
/// - The source wallet must be in the MovingFunds state
|
|
512
|
+
/// happened on Bitcoin chain and fits the protocol requirements,
|
|
513
|
+
/// - The source wallet must be in the MovingFunds state,
|
|
514
514
|
/// - The target wallets commitment must be submitted by the source
|
|
515
|
-
/// wallet
|
|
515
|
+
/// wallet,
|
|
516
516
|
/// - The actual target wallets used in the moving funds transaction
|
|
517
517
|
/// must be exactly the same as the target wallets commitment.
|
|
518
518
|
function notifyWalletFundsMoved(
|
|
@@ -49,10 +49,10 @@ contract DonationVault is IVault {
|
|
|
49
49
|
/// @notice Transfers the given `amount` of the Bank balance from the
|
|
50
50
|
/// caller to the Donation Vault and immediately decreases the
|
|
51
51
|
/// vault's balance in the Bank by the transferred `amount`.
|
|
52
|
-
/// @param amount Amount of the Bank balance to donate
|
|
52
|
+
/// @param amount Amount of the Bank balance to donate.
|
|
53
53
|
/// @dev Requirements:
|
|
54
54
|
/// - The caller's balance in the Bank must be greater than or equal
|
|
55
|
-
/// to the `amount
|
|
55
|
+
/// to the `amount`,
|
|
56
56
|
/// - Donation Vault must have an allowance for caller's balance in
|
|
57
57
|
/// the Bank for at least `amount`.
|
|
58
58
|
function donate(uint256 amount) external {
|
|
@@ -73,11 +73,11 @@ contract DonationVault is IVault {
|
|
|
73
73
|
/// `owner` to the Donation Vault and immediately decreases the
|
|
74
74
|
/// vault's balance in the Bank by the transferred `amount`.
|
|
75
75
|
/// @param owner Address of the Bank balance owner who approved their
|
|
76
|
-
/// balance to be used by the vault
|
|
76
|
+
/// balance to be used by the vault.
|
|
77
77
|
/// @param amount The amount of the Bank balance approved by the owner
|
|
78
|
-
/// to be used by the vault
|
|
78
|
+
/// to be used by the vault.
|
|
79
79
|
/// @dev Requirements:
|
|
80
|
-
/// - Can only be called by the Bank via `approveBalanceAndCall
|
|
80
|
+
/// - Can only be called by the Bank via `approveBalanceAndCall`,
|
|
81
81
|
/// - The `owner` balance in the Bank must be greater than or equal
|
|
82
82
|
/// to the `amount`.
|
|
83
83
|
function receiveBalanceApproval(address owner, uint256 amount)
|
|
@@ -99,13 +99,13 @@ contract DonationVault is IVault {
|
|
|
99
99
|
/// @notice Ignores the deposited amounts and does not increase depositors'
|
|
100
100
|
/// individual balances. The vault decreases its own tBTC balance
|
|
101
101
|
/// in the Bank by the total deposited amount.
|
|
102
|
-
/// @param depositors Addresses of depositors whose deposits have been swept
|
|
102
|
+
/// @param depositors Addresses of depositors whose deposits have been swept.
|
|
103
103
|
/// @param depositedAmounts Amounts deposited by individual depositors and
|
|
104
|
-
/// swept
|
|
104
|
+
/// swept.
|
|
105
105
|
/// @dev Requirements:
|
|
106
106
|
/// - Can only be called by the Bank after the Bridge swept deposits
|
|
107
|
-
/// and Bank increased balance for the vault
|
|
108
|
-
/// - The `depositors` array must not be empty
|
|
107
|
+
/// and Bank increased balance for the vault,
|
|
108
|
+
/// - The `depositors` array must not be empty,
|
|
109
109
|
/// - The `depositors` array length must be equal to the
|
|
110
110
|
/// `depositedAmounts` array length.
|
|
111
111
|
function receiveBalanceIncrease(
|
|
@@ -25,9 +25,9 @@ interface IVault {
|
|
|
25
25
|
/// and call the vault to use the approved balance in a single
|
|
26
26
|
/// transaction.
|
|
27
27
|
/// @param owner Address of the Bank balance owner who approved their
|
|
28
|
-
/// balance to be used by the vault
|
|
28
|
+
/// balance to be used by the vault.
|
|
29
29
|
/// @param amount The amount of the Bank balance approved by the owner
|
|
30
|
-
/// to be used by the vault
|
|
30
|
+
/// to be used by the vault.
|
|
31
31
|
// @dev The implementation must ensure this function can only be called
|
|
32
32
|
/// by the Bank. The Bank does _not_ guarantee that the `amount`
|
|
33
33
|
/// approved by the `owner` currently exists on their balance. That is,
|
|
@@ -46,9 +46,9 @@ interface IVault {
|
|
|
46
46
|
/// depositor does not have to execute additional transaction after
|
|
47
47
|
/// the deposit gets swept by the Bridge to approve and transfer
|
|
48
48
|
/// their balance to the vault.
|
|
49
|
-
/// @param depositors Addresses of depositors whose deposits have been swept
|
|
49
|
+
/// @param depositors Addresses of depositors whose deposits have been swept.
|
|
50
50
|
/// @param depositedAmounts Amounts deposited by individual depositors and
|
|
51
|
-
/// swept
|
|
51
|
+
/// swept.
|
|
52
52
|
/// @dev The implementation must ensure this function can only be called
|
|
53
53
|
/// by the Bank. The Bank guarantees that the vault's balance was
|
|
54
54
|
/// increased by the sum of all deposited amounts before this function
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
|
|
16
16
|
pragma solidity ^0.8.9;
|
|
17
17
|
|
|
18
|
+
import "@keep-network/random-beacon/contracts/Governable.sol";
|
|
19
|
+
|
|
18
20
|
import "./IVault.sol";
|
|
19
21
|
import "../bank/Bank.sol";
|
|
20
22
|
import "../token/TBTC.sol";
|
|
@@ -27,7 +29,7 @@ import "../token/TBTC.sol";
|
|
|
27
29
|
/// Bank.
|
|
28
30
|
/// @dev TBTC Vault is the owner of TBTC token contract and is the only contract
|
|
29
31
|
/// minting the token.
|
|
30
|
-
contract TBTCVault is IVault {
|
|
32
|
+
contract TBTCVault is IVault, Governable {
|
|
31
33
|
Bank public bank;
|
|
32
34
|
TBTC public tbtcToken;
|
|
33
35
|
|
|
@@ -53,13 +55,43 @@ contract TBTCVault is IVault {
|
|
|
53
55
|
|
|
54
56
|
bank = _bank;
|
|
55
57
|
tbtcToken = _tbtcToken;
|
|
58
|
+
|
|
59
|
+
_transferGovernance(msg.sender);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/// @notice Allows the governance of the TBTCVault to recover any ERC20
|
|
63
|
+
/// token sent mistakenly to the TBTC token contract address.
|
|
64
|
+
/// @param token Address of the recovered ERC20 token contract.
|
|
65
|
+
/// @param recipient Address the recovered token should be sent to.
|
|
66
|
+
/// @param amount Recovered amount.
|
|
67
|
+
function recoverERC20(
|
|
68
|
+
IERC20 token,
|
|
69
|
+
address recipient,
|
|
70
|
+
uint256 amount
|
|
71
|
+
) external onlyGovernance {
|
|
72
|
+
tbtcToken.recoverERC20(token, recipient, amount);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/// @notice Allows the governance of the TBTCVault to recover any ERC721
|
|
76
|
+
/// token sent mistakenly to the TBTC token contract address.
|
|
77
|
+
/// @param token Address of the recovered ERC721 token contract.
|
|
78
|
+
/// @param recipient Address the recovered token should be sent to.
|
|
79
|
+
/// @param tokenId Identifier of the recovered token.
|
|
80
|
+
/// @param data Additional data.
|
|
81
|
+
function recoverERC721(
|
|
82
|
+
IERC721 token,
|
|
83
|
+
address recipient,
|
|
84
|
+
uint256 tokenId,
|
|
85
|
+
bytes calldata data
|
|
86
|
+
) external onlyGovernance {
|
|
87
|
+
tbtcToken.recoverERC721(token, recipient, tokenId, data);
|
|
56
88
|
}
|
|
57
89
|
|
|
58
90
|
/// @notice Transfers the given `amount` of the Bank balance from caller
|
|
59
91
|
/// to TBTC Vault, and mints `amount` of TBTC to the caller.
|
|
60
92
|
/// @dev TBTC Vault must have an allowance for caller's balance in the Bank
|
|
61
93
|
/// for at least `amount`.
|
|
62
|
-
/// @param amount Amount of TBTC to mint
|
|
94
|
+
/// @param amount Amount of TBTC to mint.
|
|
63
95
|
function mint(uint256 amount) external {
|
|
64
96
|
address minter = msg.sender;
|
|
65
97
|
require(
|
|
@@ -73,8 +105,8 @@ contract TBTCVault is IVault {
|
|
|
73
105
|
/// @notice Transfers the given `amount` of the Bank balance from the caller
|
|
74
106
|
/// to TBTC Vault and mints `amount` of TBTC to the caller.
|
|
75
107
|
/// @dev Can only be called by the Bank via `approveBalanceAndCall`.
|
|
76
|
-
/// @param owner The owner who approved their Bank balance
|
|
77
|
-
/// @param amount Amount of TBTC to mint
|
|
108
|
+
/// @param owner The owner who approved their Bank balance.
|
|
109
|
+
/// @param amount Amount of TBTC to mint.
|
|
78
110
|
function receiveBalanceApproval(address owner, uint256 amount)
|
|
79
111
|
external
|
|
80
112
|
override
|
|
@@ -108,7 +140,7 @@ contract TBTCVault is IVault {
|
|
|
108
140
|
/// `amount` back to the caller's balance in the Bank.
|
|
109
141
|
/// @dev Caller must have at least `amount` of TBTC approved to
|
|
110
142
|
/// TBTC Vault.
|
|
111
|
-
/// @param amount Amount of TBTC to redeem
|
|
143
|
+
/// @param amount Amount of TBTC to redeem.
|
|
112
144
|
function redeem(uint256 amount) external {
|
|
113
145
|
_redeem(msg.sender, amount);
|
|
114
146
|
}
|
|
@@ -118,9 +150,9 @@ contract TBTCVault is IVault {
|
|
|
118
150
|
/// @dev This function is doing the same as `redeem` but it allows to
|
|
119
151
|
/// execute redemption without an additional approval transaction.
|
|
120
152
|
/// The function can be called only via `approveAndCall` of TBTC token.
|
|
121
|
-
/// @param from TBTC token holder executing redemption
|
|
122
|
-
/// @param amount Amount of TBTC to redeem
|
|
123
|
-
/// @param token TBTC token address
|
|
153
|
+
/// @param from TBTC token holder executing redemption.
|
|
154
|
+
/// @param amount Amount of TBTC to redeem.
|
|
155
|
+
/// @param token TBTC token address.
|
|
124
156
|
function receiveApproval(
|
|
125
157
|
address from,
|
|
126
158
|
uint256 amount,
|