From 913a24ee80bb62806d9e3f87ea7af6d6267f938b Mon Sep 17 00:00:00 2001 From: david405 Date: Mon, 6 May 2024 15:38:12 +0100 Subject: [PATCH] refactored upgrade scripts --- scripts/upgrade_vault.js | 14 +++++++++++++- scripts/upgrade_vault_mainnet.js | 14 +++++++++++++- 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/scripts/upgrade_vault.js b/scripts/upgrade_vault.js index 10390bc..320d5e8 100644 --- a/scripts/upgrade_vault.js +++ b/scripts/upgrade_vault.js @@ -1,7 +1,9 @@ const { ethers, upgrades } = require("hardhat"); +const fs = require('fs'); +const { TESTNET_VAULT } = require('../keystore.json'); // Current Address of the Vault -const currentVaultAddress = process.env.TESTNET_VAULT; +const currentVaultAddress = TESTNET_VAULT; async function main() { const upgradedVault = await ethers.getContractFactory("Vault"); @@ -9,6 +11,16 @@ async function main() { const vault = await upgrades.upgradeProxy(currentVaultAddress, upgradedVault); console.log("Vault upgraded", vault.address); + + const filePath = 'keystore.json'; + + fs.unlink(filePath, (err) => { + if (err) { + console.error(`Error deleting file: ${err}`); + return; + } + console.log('File deleted successfully'); +}); } main(); \ No newline at end of file diff --git a/scripts/upgrade_vault_mainnet.js b/scripts/upgrade_vault_mainnet.js index bb73517..9939522 100644 --- a/scripts/upgrade_vault_mainnet.js +++ b/scripts/upgrade_vault_mainnet.js @@ -1,7 +1,9 @@ const { ethers, upgrades } = require("hardhat"); +const fs = require('fs'); +const { MAINNET_VAULT } = require('../keystore.json'); // Address of the Vault -const currentVaultAddress = process.env.MAINNET_VAULT; +const currentVaultAddress = MAINNET_VAULT; async function main() { const upgradedVault = await ethers.getContractFactory("Vault"); @@ -9,6 +11,16 @@ async function main() { const vault = await upgrades.upgradeProxy(currentVaultAddress, upgradedVault); console.log("Vault upgraded", vault.address); + + const filePath = 'keystore.json'; + + fs.unlink(filePath, (err) => { + if (err) { + console.error(`Error deleting file: ${err}`); + return; + } + console.log('File deleted successfully'); +}); } main(); \ No newline at end of file