diff --git a/deploy/001_deploy_hub_v2.ts b/deploy/001_deploy_hub_v2.ts index a0c442b3..dc3ae9f6 100644 --- a/deploy/001_deploy_hub_v2.ts +++ b/deploy/001_deploy_hub_v2.ts @@ -2,27 +2,25 @@ import { DeployFunction } from 'hardhat-deploy/types'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { - if ( - hre.helpers.isDeployed('Hub') && - (hre.helpers.contractDeployments.contracts['Hub'].version === undefined || - hre.helpers.contractDeployments.contracts['Hub'].version?.startsWith('1.')) - ) { - return; - } - const { deployer } = await hre.getNamedAccounts(); - if (hre.network.name === 'hardhat') { - hre.helpers.resetDeploymentsJson(); - console.log('Hardhat deployments config reset.'); - } + if ( + !hre.helpers.isDeployed('Hub') || + (hre.helpers.contractDeployments.contracts['Hub'].version !== undefined && + !hre.helpers.contractDeployments.contracts['Hub'].version.startsWith('1.')) + ) { + if (hre.network.name === 'hardhat') { + hre.helpers.resetDeploymentsJson(); + console.log('Hardhat deployments config reset.'); + } - if (!hre.helpers.isDeployed('Hub')) { - console.log('Deploying Hub V2...'); + if (!hre.helpers.isDeployed('Hub')) { + console.log('Deploying Hub V2...'); - const Hub = await hre.deployments.deploy('Hub', { contract: 'HubV2', from: deployer, log: true }); + const Hub = await hre.deployments.deploy('Hub', { contract: 'HubV2', from: deployer, log: true }); - hre.helpers.updateDeploymentsJson('Hub', Hub.address); + hre.helpers.updateDeploymentsJson('Hub', Hub.address); + } } // New HubController should be manually deployed for testnet/mainnet: @@ -31,7 +29,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // 3. Transfer ownership of the new HubController to the MultiSig Wallet. // 4. Update address of new HubController to deployments/otp_{testnet/mainnet}_contracts.json and commit the change // 5. Add software burner wallet that will be used for redeployment of other contracts to the MultiSig (remove after redeployment). - if (!hre.helpers.isDeployed('HubController') && !['otp_testnet', 'otp_mainnet'].includes(hre.network.name)) { + if (!hre.helpers.isDeployed('HubController')) { let previousHubControllerAddress; if (hre.helpers.inConfig('HubController')) { previousHubControllerAddress = hre.helpers.contractDeployments.contracts['HubController'].evmAddress; diff --git a/deploy/002_deploy_hub.ts b/deploy/002_deploy_hub.ts index abb3aa13..58713148 100644 --- a/deploy/002_deploy_hub.ts +++ b/deploy/002_deploy_hub.ts @@ -2,27 +2,25 @@ import { DeployFunction } from 'hardhat-deploy/types'; import { HardhatRuntimeEnvironment } from 'hardhat/types'; const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { - if ( - hre.helpers.isDeployed('Hub') && - (hre.helpers.contractDeployments.contracts['Hub'].version === undefined || - hre.helpers.contractDeployments.contracts['Hub'].version?.startsWith('2.')) - ) { - return; - } - const { deployer } = await hre.getNamedAccounts(); - if (hre.network.name === 'hardhat') { - hre.helpers.resetDeploymentsJson(); - console.log('Hardhat deployments config reset.'); - } + if ( + !hre.helpers.isDeployed('Hub') || + (hre.helpers.contractDeployments.contracts['Hub'].version !== undefined && + !hre.helpers.contractDeployments.contracts['Hub'].version.startsWith('2.')) + ) { + if (hre.network.name === 'hardhat') { + hre.helpers.resetDeploymentsJson(); + console.log('Hardhat deployments config reset.'); + } - if (!hre.helpers.isDeployed('Hub')) { - console.log('Deploying Hub V1...'); + if (!hre.helpers.isDeployed('Hub')) { + console.log('Deploying Hub V1...'); - const Hub = await hre.deployments.deploy('Hub', { from: deployer, log: true }); + const Hub = await hre.deployments.deploy('Hub', { from: deployer, log: true }); - hre.helpers.updateDeploymentsJson('Hub', Hub.address); + hre.helpers.updateDeploymentsJson('Hub', Hub.address); + } } // New HubController should be manually deployed for testnet/mainnet: @@ -31,7 +29,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { // 3. Transfer ownership of the new HubController to the MultiSig Wallet. // 4. Update address of new HubController to deployments/otp_{testnet/mainnet}_contracts.json and commit the change // 5. Add software burner wallet that will be used for redeployment of other contracts to the MultiSig (remove after redeployment). - if (!hre.helpers.isDeployed('HubController') && !['otp_testnet', 'otp_mainnet'].includes(hre.network.name)) { + if (!hre.helpers.isDeployed('HubController')) { let previousHubControllerAddress; if (hre.helpers.inConfig('HubController')) { previousHubControllerAddress = hre.helpers.contractDeployments.contracts['HubController'].evmAddress;