@keep-network/tbtc-v2 1.8.0 → 1.8.2
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/Bridge.json +1998 -1972
- package/artifacts/Bridge_v2_Implementation.json +2817 -0
- package/artifacts/Deposit.json +7 -7
- package/artifacts/Redemption.json +95 -171
- package/build/contracts/GovernanceUtils.sol/GovernanceUtils.dbg.json +1 -1
- package/build/contracts/Timelock.sol/Timelock.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 +74 -48
- package/build/contracts/bridge/BridgeGovernance.sol/BridgeGovernance.dbg.json +1 -1
- package/build/contracts/bridge/BridgeGovernance.sol/BridgeGovernance.json +2 -2
- package/build/contracts/bridge/BridgeGovernanceParameters.sol/BridgeGovernanceParameters.dbg.json +1 -1
- 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/IRedemptionWatchtower.dbg.json +1 -1
- 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/RedemptionWatchtower.sol/RedemptionWatchtower.dbg.json +1 -1
- package/build/contracts/bridge/RedemptionWatchtower.sol/RedemptionWatchtower.json +2 -2
- package/build/contracts/bridge/VendingMachine.sol/VendingMachine.dbg.json +1 -1
- package/build/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.dbg.json +1 -1
- package/build/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.dbg.json +1 -1
- package/build/contracts/bridge/WalletProposalValidator.sol/WalletProposalValidator.dbg.json +1 -1
- package/build/contracts/bridge/WalletProposalValidator.sol/WalletProposalValidator.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/cross-chain/AbstractL1BTCDepositor.sol/AbstractL1BTCDepositor.dbg.json +1 -1
- package/build/contracts/cross-chain/L2TBTC.sol/L2TBTC.dbg.json +1 -1
- package/build/contracts/cross-chain/starknet/StarkNetBitcoinDepositor.sol/StarkNetBitcoinDepositor.dbg.json +1 -1
- package/build/contracts/cross-chain/starknet/interfaces/IStarkGateBridge.sol/IStarkGateBridge.dbg.json +1 -1
- package/build/contracts/cross-chain/utils/Crosschain.sol/CrosschainUtils.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/BTCDepositorWormhole.sol/BTCDepositorWormhole.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/L1BTCDepositorWormhole.sol/L1BTCDepositorWormhole.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/L2BTCDepositorWormhole.sol/L2BTCDepositorWormhole.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/L2WormholeGateway.sol/L2WormholeGateway.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/Wormhole.sol/IWormhole.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/Wormhole.sol/IWormholeGateway.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/Wormhole.sol/IWormholeReceiver.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/Wormhole.sol/IWormholeRelayer.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/Wormhole.sol/IWormholeTokenBridge.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/Wormhole.sol/WormholeTypes.dbg.json +1 -1
- package/build/contracts/cross-chain/wormhole/Wormhole.sol/WormholeUtils.dbg.json +1 -1
- package/build/contracts/integrator/AbstractBTCDepositor.sol/AbstractBTCDepositor.dbg.json +1 -1
- package/build/contracts/integrator/IBridge.sol/IBridge.dbg.json +1 -1
- package/build/contracts/integrator/IBridge.sol/IBridgeTypes.dbg.json +1 -1
- package/build/contracts/integrator/ITBTCVault.sol/ITBTCVault.dbg.json +1 -1
- package/build/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.dbg.json +1 -1
- package/build/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.json +2 -2
- package/build/contracts/relay/LightRelay.sol/ILightRelay.dbg.json +1 -1
- package/build/contracts/relay/LightRelay.sol/LightRelay.dbg.json +1 -1
- package/build/contracts/relay/LightRelay.sol/RelayUtils.dbg.json +1 -1
- package/build/contracts/relay/LightRelayMaintainerProxy.sol/LightRelayMaintainerProxy.dbg.json +1 -1
- package/build/contracts/test/BankStub.sol/BankStub.dbg.json +1 -1
- package/build/contracts/test/BridgeStub.sol/BridgeStub.dbg.json +1 -1
- package/build/contracts/test/BridgeStub.sol/BridgeStub.json +74 -48
- package/build/contracts/test/HeartbeatStub.sol/HeartbeatStub.dbg.json +1 -1
- package/build/contracts/test/LightRelayStub.sol/LightRelayStub.dbg.json +1 -1
- package/build/contracts/test/MockBridgeForStarkNet.sol/MockBridgeForStarkNet.dbg.json +1 -1
- package/build/contracts/test/MockStarkGateBridge.sol/MockStarkGateBridge.dbg.json +1 -1
- package/build/contracts/test/MockTBTCBridge.sol/MockTBTCBridge.dbg.json +1 -1
- package/build/contracts/test/MockTBTCBridgeWithSweep.sol/MockTBTCBridgeWithSweep.dbg.json +1 -1
- package/build/contracts/test/MockTBTCToken.sol/MockTBTCToken.dbg.json +1 -1
- package/build/contracts/test/MockTBTCVault.sol/MockTBTCVault.dbg.json +1 -1
- package/build/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.dbg.json +1 -1
- package/build/contracts/test/ReentrancyAttacker.sol/ReentrancyAttacker.dbg.json +1 -1
- package/build/contracts/test/SepoliaLightRelay.sol/SepoliaLightRelay.dbg.json +1 -1
- package/build/contracts/test/SystemTestRelay.sol/SystemTestRelay.dbg.json +1 -1
- package/build/contracts/test/SystemTestRelay.sol/SystemTestRelay.json +2 -2
- package/build/contracts/test/TestBTCDepositor.sol/MockBridge.dbg.json +1 -1
- package/build/contracts/test/TestBTCDepositor.sol/MockTBTCVault.dbg.json +1 -1
- package/build/contracts/test/TestBTCDepositor.sol/TestBTCDepositor.dbg.json +1 -1
- package/build/contracts/test/TestBitcoinTx.sol/TestBitcoinTx.dbg.json +1 -1
- package/build/contracts/test/TestBitcoinTx.sol/TestBitcoinTx.json +2 -2
- package/build/contracts/test/TestERC20.sol/TestERC20.dbg.json +1 -1
- package/build/contracts/test/TestERC721.sol/TestERC721.dbg.json +1 -1
- package/build/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.dbg.json +1 -1
- package/build/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.dbg.json +1 -1
- 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/TBTCOptimisticMinting.sol/TBTCOptimisticMinting.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.dbg.json +1 -1
- package/build/contracts/vault/TBTCVault.sol/TBTCVault.json +2 -2
- package/contracts/bridge/Bridge.sol +34 -0
- package/contracts/bridge/Deposit.sol +7 -5
- package/deploy/80_upgrade_bridge_v2.ts +107 -54
- package/deploy/81_upgrade_bridge_v2_vault_fix.ts +160 -0
- package/export/artifacts/contracts/bridge/Bridge.sol/Bridge.json +4891 -4170
- package/export/artifacts/contracts/bridge/BridgeGovernance.sol/BridgeGovernance.json +207 -207
- package/export/artifacts/contracts/bridge/RedemptionWatchtower.sol/RedemptionWatchtower.json +104 -104
- package/export/artifacts/contracts/bridge/VendingMachine.sol/VendingMachine.json +67 -67
- package/export/artifacts/contracts/bridge/VendingMachineV2.sol/VendingMachineV2.json +24 -24
- package/export/artifacts/contracts/bridge/VendingMachineV3.sol/VendingMachineV3.json +26 -26
- package/export/artifacts/contracts/bridge/WalletProposalValidator.sol/WalletProposalValidator.json +72 -72
- package/export/artifacts/contracts/cross-chain/L2TBTC.sol/L2TBTC.json +40 -40
- package/export/artifacts/contracts/cross-chain/starknet/StarkNetBitcoinDepositor.sol/StarkNetBitcoinDepositor.json +3360 -3360
- package/export/artifacts/contracts/cross-chain/wormhole/BTCDepositorWormhole.sol/BTCDepositorWormhole.json +117 -117
- package/export/artifacts/contracts/cross-chain/wormhole/L1BTCDepositorWormhole.sol/L1BTCDepositorWormhole.json +140 -140
- package/export/artifacts/contracts/cross-chain/wormhole/L2BTCDepositorWormhole.sol/L2BTCDepositorWormhole.json +37 -37
- package/export/artifacts/contracts/cross-chain/wormhole/L2WormholeGateway.sol/L2WormholeGateway.json +51 -51
- package/export/artifacts/contracts/maintainer/MaintainerProxy.sol/MaintainerProxy.json +103 -103
- package/export/artifacts/contracts/relay/LightRelay.sol/LightRelay.json +57 -57
- package/export/artifacts/contracts/relay/LightRelayMaintainerProxy.sol/LightRelayMaintainerProxy.json +31 -31
- package/export/artifacts/contracts/test/BankStub.sol/BankStub.json +2 -2
- package/export/artifacts/contracts/test/BridgeStub.sol/BridgeStub.json +5130 -4414
- package/export/artifacts/contracts/test/HeartbeatStub.sol/HeartbeatStub.json +4 -4
- package/export/artifacts/contracts/test/LightRelayStub.sol/LightRelayStub.json +59 -59
- package/export/artifacts/contracts/test/MockBridgeForStarkNet.sol/MockBridgeForStarkNet.json +730 -730
- package/export/artifacts/contracts/test/MockStarkGateBridge.sol/MockStarkGateBridge.json +956 -956
- package/export/artifacts/contracts/test/MockTBTCBridge.sol/MockTBTCBridge.json +781 -781
- package/export/artifacts/contracts/test/MockTBTCBridgeWithSweep.sol/MockTBTCBridgeWithSweep.json +458 -458
- package/export/artifacts/contracts/test/MockTBTCToken.sol/MockTBTCToken.json +1273 -1273
- package/export/artifacts/contracts/test/MockTBTCVault.sol/MockTBTCVault.json +305 -305
- package/export/artifacts/contracts/test/ReceiveApprovalStub.sol/ReceiveApprovalStub.json +7 -7
- package/export/artifacts/contracts/test/ReentrancyAttacker.sol/ReentrancyAttacker.json +204 -204
- package/export/artifacts/contracts/test/SepoliaLightRelay.sol/SepoliaLightRelay.json +59 -59
- package/export/artifacts/contracts/test/SystemTestRelay.sol/SystemTestRelay.json +19 -19
- package/export/artifacts/contracts/test/TestBTCDepositor.sol/MockBridge.json +34 -34
- package/export/artifacts/contracts/test/TestBTCDepositor.sol/MockTBTCVault.json +20 -20
- package/export/artifacts/contracts/test/TestBTCDepositor.sol/TestBTCDepositor.json +52 -52
- package/export/artifacts/contracts/test/TestBitcoinTx.sol/TestBitcoinTx.json +124 -124
- package/export/artifacts/contracts/test/TestERC20.sol/TestERC20.json +6 -6
- package/export/artifacts/contracts/test/TestERC721.sol/TestERC721.json +8 -8
- package/export/artifacts/contracts/test/TestEcdsaLib.sol/TestEcdsaLib.json +4 -4
- package/export/artifacts/contracts/test/WormholeBridgeStub.sol/WormholeBridgeStub.json +37 -37
- package/export/artifacts/contracts/token/TBTC.sol/TBTC.json +2 -2
- package/export/artifacts/contracts/vault/DonationVault.sol/DonationVault.json +11 -11
- package/export/artifacts/contracts/vault/TBTCVault.sol/TBTCVault.json +144 -144
- package/export/deploy/80_upgrade_bridge_v2.js +127 -90
- package/export/deploy/81_upgrade_bridge_v2_vault_fix.js +211 -0
- package/export/typechain/AbstractBTCRedeemer.js +2 -0
- package/export/typechain/IBank.js +2 -0
- package/export/typechain/IL2WormholeGateway.js +2 -0
- package/export/typechain/INttManager.js +2 -0
- package/export/typechain/INttManagerWithExecutor.js +2 -0
- package/export/typechain/L1BTCDepositorNtt.js +2 -0
- package/export/typechain/L1BTCDepositorNttWithExecutor.js +2 -0
- package/export/typechain/L1BTCRedeemerWormhole.js +2 -0
- package/export/typechain/L2BTCRedeemerWormhole.js +2 -0
- package/export/typechain/MockBank.js +2 -0
- package/export/typechain/MockBridgeWithRebateStaking.js +2 -0
- package/export/typechain/MockL1BTCRedeemerWormhole.js +2 -0
- package/export/typechain/MockNttManager.js +2 -0
- package/export/typechain/MockNttManagerWithExecutor.js +2 -0
- package/export/typechain/NativeBTCDepositor.js +2 -0
- package/export/typechain/RebateStaking.js +2 -0
- package/export/typechain/TestBTCRedeemer.js +2 -0
- package/export/typechain/TestBTCUtilsHelper.js +2 -0
- package/export/typechain/TransceiverStructs.js +2 -0
- package/export/typechain/factories/AbstractBTCRedeemer__factory.js +204 -0
- package/export/typechain/factories/BridgeGovernance__factory.js +1 -1
- package/export/typechain/factories/BridgeState__factory.js +1 -1
- package/export/typechain/factories/BridgeStub__factory.js +27 -1
- package/export/typechain/factories/Bridge__factory.js +27 -1
- package/export/typechain/factories/DepositSweep__factory.js +1 -1
- package/export/typechain/factories/Deposit__factory.js +1 -1
- package/export/typechain/factories/Fraud__factory.js +1 -1
- package/export/typechain/factories/IBank__factory.js +138 -0
- package/export/typechain/factories/IL2WormholeGateway__factory.js +61 -0
- package/export/typechain/factories/INttManagerWithExecutor__factory.js +183 -0
- package/export/typechain/factories/INttManager__factory.js +51 -0
- package/export/typechain/factories/L1BTCDepositorNttWithExecutor__factory.js +1454 -0
- package/export/typechain/factories/L1BTCDepositorNtt__factory.js +920 -0
- package/export/typechain/factories/L1BTCRedeemerWormhole__factory.js +622 -0
- package/export/typechain/factories/L2BTCRedeemerWormhole__factory.js +348 -0
- package/export/typechain/factories/MaintainerProxy__factory.js +1 -1
- package/export/typechain/factories/MockBank__factory.js +248 -0
- package/export/typechain/factories/MockBridgeWithRebateStaking__factory.js +129 -0
- package/export/typechain/factories/MockL1BTCRedeemerWormhole__factory.js +638 -0
- package/export/typechain/factories/MockNttManagerWithExecutor__factory.js +423 -0
- package/export/typechain/factories/MockNttManager__factory.js +211 -0
- package/export/typechain/factories/MovingFunds__factory.js +1 -1
- package/export/typechain/factories/NativeBTCDepositor__factory.js +635 -0
- package/export/typechain/factories/RebateStaking__factory.js +720 -0
- package/export/typechain/factories/RedemptionWatchtower__factory.js +1 -1
- package/export/typechain/factories/Redemption__factory.js +1 -1
- package/export/typechain/factories/SystemTestRelay__factory.js +1 -1
- package/export/typechain/factories/TBTCVault__factory.js +1 -1
- package/export/typechain/factories/TestBTCRedeemer__factory.js +425 -0
- package/export/typechain/factories/TestBTCUtilsHelper__factory.js +109 -0
- package/export/typechain/factories/TestBitcoinTx__factory.js +1 -1
- package/export/typechain/factories/TransceiverStructs__factory.js +853 -0
- package/export/typechain/factories/WalletProposalValidator__factory.js +1 -1
- package/export/typechain/factories/Wallets__factory.js +1 -1
- package/export/typechain/index.js +40 -2
- package/export.json +40910 -0
- package/package.json +1 -1
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
import { HardhatRuntimeEnvironment } from "hardhat/types"
|
|
2
|
+
import { DeployFunction } from "hardhat-deploy/types"
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @notice This deployment script upgrades the Bridge contract to v2 with the
|
|
6
|
+
* vault=0x0 deposit fix. The fix is implemented as a reinitializer
|
|
7
|
+
* function that runs once during the upgrade.
|
|
8
|
+
*
|
|
9
|
+
* @dev IMPORTANT DEPLOYMENT NOTES:
|
|
10
|
+
*
|
|
11
|
+
* MAINNET:
|
|
12
|
+
* - The upgrade MUST go through the Timelock contract (24h delay)
|
|
13
|
+
* - Council multisig (6-of-9) schedules and executes via Timelock
|
|
14
|
+
* - Timeline: ~36-40 hours total (schedule + 24h delay + execute)
|
|
15
|
+
* - See consensus document for detailed rollout plan
|
|
16
|
+
*
|
|
17
|
+
* SEPOLIA (for upgrade mechanism testing):
|
|
18
|
+
* - No Timelock required, direct EOA upgrade
|
|
19
|
+
* - The reinitializer has MAINNET-SPECIFIC hardcoded values:
|
|
20
|
+
* - Deposit key: specific to the mainnet vault=0x0 deposit
|
|
21
|
+
* - TBTCVault: mainnet address (0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD)
|
|
22
|
+
* - On Sepolia, the reinitializer will FAIL if:
|
|
23
|
+
* - The deposit doesn't exist (revealedAt == 0)
|
|
24
|
+
* - The vault is already set (vault != 0x0)
|
|
25
|
+
* - For testing on Sepolia, either:
|
|
26
|
+
* - Create a mock deposit with vault=0x0 first, OR
|
|
27
|
+
* - Use a mainnet fork (recommended for accurate testing)
|
|
28
|
+
*
|
|
29
|
+
* Context:
|
|
30
|
+
* - Wallet 71bfad9a has a deposit with vault=0x0 that is blocking all sweeps
|
|
31
|
+
* - This deposit was revealed on 2026-01-08 by depositor 0xe7c9a5298A2d2e48B5df3F9D361BA1469B0f436B
|
|
32
|
+
* - The reinitializer fixes the deposit's vault to point to TBTCVault
|
|
33
|
+
*
|
|
34
|
+
* Usage:
|
|
35
|
+
* # For Sepolia (testing upgrade mechanism - will fail on reinitializer):
|
|
36
|
+
* yarn deploy --tags UpgradeBridgeVaultFix --network sepolia
|
|
37
|
+
*
|
|
38
|
+
* # For Mainnet (production - requires Timelock):
|
|
39
|
+
* # See consensus document for Timelock-based deployment
|
|
40
|
+
*/
|
|
41
|
+
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
|
|
42
|
+
const { ethers, helpers, deployments, getNamedAccounts } = hre
|
|
43
|
+
const { get, log } = deployments
|
|
44
|
+
const { deployer } = await getNamedAccounts()
|
|
45
|
+
|
|
46
|
+
log("=".repeat(80))
|
|
47
|
+
log("Upgrading Bridge with vault=0x0 deposit fix")
|
|
48
|
+
log("=".repeat(80))
|
|
49
|
+
|
|
50
|
+
// WARNING: This script expects no changes in the external libraries and uses
|
|
51
|
+
// `get` function to load the ones that were already published before.
|
|
52
|
+
// If there are any changes in the external libraries make sure to deploy fresh
|
|
53
|
+
// versions of the libraries and link them to the implementation.
|
|
54
|
+
const Deposit = await get("Deposit")
|
|
55
|
+
const DepositSweep = await get("DepositSweep")
|
|
56
|
+
const Redemption = await get("Redemption")
|
|
57
|
+
const Wallets = await get("Wallets")
|
|
58
|
+
const Fraud = await get("Fraud")
|
|
59
|
+
const MovingFunds = await get("MovingFunds")
|
|
60
|
+
|
|
61
|
+
log("Using existing libraries:")
|
|
62
|
+
log(` Deposit: ${Deposit.address}`)
|
|
63
|
+
log(` DepositSweep: ${DepositSweep.address}`)
|
|
64
|
+
log(` Redemption: ${Redemption.address}`)
|
|
65
|
+
log(` Wallets: ${Wallets.address}`)
|
|
66
|
+
log(` Fraud: ${Fraud.address}`)
|
|
67
|
+
log(` MovingFunds: ${MovingFunds.address}`)
|
|
68
|
+
|
|
69
|
+
// Get the existing Bridge proxy
|
|
70
|
+
const bridgeDeployment = await get("Bridge")
|
|
71
|
+
log(`\nExisting Bridge proxy: ${bridgeDeployment.address}`)
|
|
72
|
+
|
|
73
|
+
// Perform the upgrade with the reinitializer call
|
|
74
|
+
const [bridge, proxyDeployment] = await helpers.upgrades.upgradeProxy(
|
|
75
|
+
"Bridge",
|
|
76
|
+
"Bridge",
|
|
77
|
+
{
|
|
78
|
+
contractName: "Bridge",
|
|
79
|
+
factoryOpts: {
|
|
80
|
+
signer: await ethers.getSigner(deployer),
|
|
81
|
+
libraries: {
|
|
82
|
+
Deposit: Deposit.address,
|
|
83
|
+
DepositSweep: DepositSweep.address,
|
|
84
|
+
Redemption: Redemption.address,
|
|
85
|
+
Wallets: Wallets.address,
|
|
86
|
+
Fraud: Fraud.address,
|
|
87
|
+
MovingFunds: MovingFunds.address,
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
proxyOpts: {
|
|
91
|
+
kind: "transparent",
|
|
92
|
+
// Allow external libraries linking. We need to ensure manually that the
|
|
93
|
+
// external libraries we link are upgrade safe, as the OpenZeppelin plugin
|
|
94
|
+
// doesn't perform such a validation yet.
|
|
95
|
+
// See: https://docs.openzeppelin.com/upgrades-plugins/1.x/faq#why-cant-i-use-external-libraries
|
|
96
|
+
unsafeAllow: ["external-library-linking"],
|
|
97
|
+
// Use call option to invoke the reinitializer instead of the original initializer
|
|
98
|
+
call: {
|
|
99
|
+
fn: "initializeV2_FixVaultZeroDeposit",
|
|
100
|
+
args: [],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
|
|
106
|
+
log("\nUpgrade completed!")
|
|
107
|
+
log(" New implementation deployed")
|
|
108
|
+
log(` Bridge proxy: ${proxyDeployment.address}`)
|
|
109
|
+
log(` Bridge instance: ${bridge.address}`)
|
|
110
|
+
|
|
111
|
+
// Verify on Etherscan if on mainnet
|
|
112
|
+
if (hre.network.tags.etherscan) {
|
|
113
|
+
log("\nVerifying on Etherscan...")
|
|
114
|
+
await hre.run("verify", {
|
|
115
|
+
address: proxyDeployment.address,
|
|
116
|
+
constructorArgsParams: proxyDeployment.args,
|
|
117
|
+
})
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// Verify on Tenderly if configured
|
|
121
|
+
if (hre.network.tags.tenderly) {
|
|
122
|
+
log("\nVerifying on Tenderly...")
|
|
123
|
+
await hre.tenderly.verify({
|
|
124
|
+
name: "Bridge",
|
|
125
|
+
address: bridge.address,
|
|
126
|
+
})
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
log(`\n${"=".repeat(80)}`)
|
|
130
|
+
log("Upgrade complete. Verify the deposit vault was fixed:")
|
|
131
|
+
log("=".repeat(80))
|
|
132
|
+
log(`
|
|
133
|
+
Post-upgrade verification commands:
|
|
134
|
+
|
|
135
|
+
1. Check new implementation:
|
|
136
|
+
cast call ${bridgeDeployment.address} "implementation()" --rpc-url <RPC_URL>
|
|
137
|
+
|
|
138
|
+
2. Verify deposit vault was fixed (should return TBTCVault address):
|
|
139
|
+
cast call ${bridgeDeployment.address} \\
|
|
140
|
+
"deposits(uint256)(address,uint64,uint32,address,uint64,uint32,bytes32)" \\
|
|
141
|
+
0xf3bc9cd6f46f4c206bc8711e40bb5692e8fe5f0ac4d4da0a709dc71bb751c98a \\
|
|
142
|
+
--rpc-url <RPC_URL>
|
|
143
|
+
|
|
144
|
+
3. Expected vault value after fix:
|
|
145
|
+
- Mainnet TBTCVault: 0x9C070027cdC9dc8F82416B2e5314E11DFb4FE3CD
|
|
146
|
+
- Sepolia TBTCVault: Check deployments/sepolia/TBTCVault.json
|
|
147
|
+
|
|
148
|
+
4. Check for DepositVaultFixed event in the upgrade transaction
|
|
149
|
+
`)
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
export default func
|
|
153
|
+
|
|
154
|
+
func.tags = ["UpgradeBridgeVaultFix"]
|
|
155
|
+
func.dependencies = ["Bridge"]
|
|
156
|
+
|
|
157
|
+
// IMPORTANT: Set to false when ready to deploy
|
|
158
|
+
// When running the upgrade, set this to false and run:
|
|
159
|
+
// yarn deploy --tags UpgradeBridgeVaultFix --network <NETWORK>
|
|
160
|
+
func.skip = async () => true
|