Skip to content

Commit

Permalink
added default role to vault_init
Browse files Browse the repository at this point in the history
  • Loading branch information
David405 committed Sep 4, 2023
1 parent f88cdfe commit aacb538
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 8 deletions.
1 change: 1 addition & 0 deletions contracts/Vault.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy_mainnet_v1.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
4 changes: 2 additions & 2 deletions scripts/deploy_vault_v1.js
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
14 changes: 14 additions & 0 deletions scripts/upgrade_vault_mainnet.js
Original file line number Diff line number Diff line change
@@ -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();

0 comments on commit aacb538

Please sign in to comment.