tenderly-wizard-v6
Version:
A tool for managing virtual testnets using Tenderly
42 lines (41 loc) • 1.81 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
// @ts-ignore
const hardhat_1 = require("hardhat");
const env_config_1 = __importDefault(require("../env-config"));
const util_1 = require("../utils/util");
async function main() {
const ok = (0, util_1.checkRequiredEnvVariables)([
"ACCESS_CONTROL_SAFE_ADDRESS",
"INVESTMENT_SAFE_ADDRESS",
"INVESTMENT_ROLES_ADDRESS",
"ACCESS_CONTROL_ROLES_ADDRESS",
]);
if (!ok) {
process.exit(1);
}
// set gas for all accounts
await (0, util_1.setGas)();
// @audit the whitelist object is being read from .env variables,
// need a better solution for this. Currently, this function is
// being called by execSync in wizard.ts
if (!process.env.SELECTED_WHITELIST) {
console.error("No whitelist selected");
process.exit(1);
}
const whitelist = JSON.parse(process.env.SELECTED_WHITELIST);
const { ACCESS_CONTROL_ROLES_ADDRESS, ACCESS_CONTROL_SAFE_ADDRESS, INVESTMENT_ROLES_ADDRESS, INVESTMENT_SAFE_ADDRESS, } = env_config_1.default;
// get caller address
const [caller, manager, dummyOwnerOne, dummyOwnerTwo, dummyOwnerThree, security,] = await hardhat_1.ethers.getSigners();
const { className, path: whitelistPath } = whitelist;
// import the whitelist class
const whitelistClass = require(whitelistPath)[className];
// instantiate the whitelist class
const whitelistClassInstance = new whitelistClass(INVESTMENT_ROLES_ADDRESS, security);
// execute the whitelist
await whitelistClassInstance.execute(ACCESS_CONTROL_ROLES_ADDRESS, INVESTMENT_SAFE_ADDRESS);
}
main();