diff --git a/contracts/Vault.sol b/contracts/Vault.sol index da3e95b..72f27d5 100644 --- a/contracts/Vault.sol +++ b/contracts/Vault.sol @@ -122,6 +122,7 @@ contract Vault is globalMintersPercentOfSwapFee = WadRayMath.wadDiv(1, 2); treasuryPercentOfSwapFee = WadRayMath.wadDiv(1, 2); _setupRole(CONTROLLER, _controller); + _setupRole(DEFAULT_ADMIN_ROLE, msg.sender); __Ownable_init(); __ReentrancyGuard_init(); diff --git a/hardhat.config.js b/hardhat.config.js index 29851a0..4b95863 100644 --- a/hardhat.config.js +++ b/hardhat.config.js @@ -20,20 +20,20 @@ module.exports = { goerli: { url: `https://eth-goerli.g.alchemy.com/v2/MIaPbNNNaHPp9qf5cDCOEJPVxJ_GwLVY`, accounts: [ - process.env.TESTNET_PRIVATE_KEY || "ce823841483ccf5d4d6f35fc552fc6fb86a53473ff9fcae9f32b7ebb7a3af960", + process.env.TESTNET_PRIVATE_KEY, ], }, fuji: { url: `https://omniscient-restless-thunder.avalanche-testnet.discover.quiknode.pro/933a2d24cf1a762fd73a569be25bdec21cb60a9f/ext/bc/C/rpc`, accounts: [ - process.env.TESTNET_PRIVATE_KEY || "ce823841483ccf5d4d6f35fc552fc6fb86a53473ff9fcae9f32b7ebb7a3af960", + process.env.TESTNET_PRIVATE_KEY, ], chainId: 43113, }, mainnet: { url: `https://red-neat-putty.avalanche-mainnet.quiknode.pro/d54c9d0935c483e2f8e70b7a756d882e45cd9e3f/ext/bc/C/rpc/`, accounts: [ - process.env.MAINNET_PRIVATE_KEY || "ce823841483ccf5d4d6f35fc552fc6fb86a53473ff9fcae9f32b7ebb7a3af960", + process.env.MAINNET_PRIVATE_KEY, ], chainId: 43114 } diff --git a/package.json b/package.json index 2718cb9..65846b6 100644 --- a/package.json +++ b/package.json @@ -3,7 +3,8 @@ "scripts": { "deploy": "hardhat run --network fuji scripts/deploy_vault_v1.js ", "upgrade": "hardhat run --network fuji scripts/upgrade_vault.js ", - "deploy-mainnet": "hardhat run --network mainnet scripts/deploy_mainnet_v1.js" + "deploy-mainnet": "hardhat run --network mainnet scripts/deploy_mainnet_v1.js", + "upgrade-mainnet": "hardhat run --network mainnet scripts/upgrade_vault_mainnet.js " }, "devDependencies": { "@nomiclabs/hardhat-ethers": "^2.2.1", diff --git a/scripts/deploy_mainnet_v1.js b/scripts/deploy_mainnet_v1.js index 141126f..660ff4a 100644 --- a/scripts/deploy_mainnet_v1.js +++ b/scripts/deploy_mainnet_v1.js @@ -1,7 +1,7 @@ const { ethers, upgrades } = require("hardhat"); -const datafeed = process.env.DATAFEED; -const Controller = process.env.CONTROLLER; +const datafeed = process.env.MAINNET_DATAFEED; +const Controller = process.env.MAINNET_CONTROLLER; let tokens = { zUSD: null, diff --git a/scripts/deploy_vault_v1.js b/scripts/deploy_vault_v1.js index cabc548..dac0382 100644 --- a/scripts/deploy_vault_v1.js +++ b/scripts/deploy_vault_v1.js @@ -1,7 +1,7 @@ const { ethers, upgrades } = require("hardhat"); -const Datafeed = process.env.DATAFEED; -const Controller = process.env.CONTROLLER; +const Datafeed = process.env.TESTNET_DATAFEED; +const Controller = process.env.TESTNET_CONTROLLER; let tokens = { zUSD: null, diff --git a/scripts/upgrade_vault_mainnet.js b/scripts/upgrade_vault_mainnet.js new file mode 100644 index 0000000..f286272 --- /dev/null +++ b/scripts/upgrade_vault_mainnet.js @@ -0,0 +1,14 @@ +const { ethers, upgrades } = require("hardhat"); + +// Current Impl Address of the Vault +const currentVaultAddress = process.env.MAINNET_IMPL_ADDRESS; + +async function main() { + const upgradedVault = await ethers.getContractFactory("Vault"); + + const vault = await upgrades.upgradeProxy(currentVaultAddress, upgradedVault); + + console.log("Vault upgraded", vault.address); +} + +main(); \ No newline at end of file