@dydxfoundation/governance
Version:
dYdX governance smart contracts
28 lines (27 loc) • 1.18 kB
JavaScript
;
/**
* Get the deployer address that was used for the deployment on a given network.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.getDeployerSigner = void 0;
const config_1 = __importDefault(require("../config"));
const hre_1 = require("../hre");
const impersonate_account_1 = require("../migrations/helpers/impersonate-account");
const MAINNET_DEPLOYER_ADDRESS = '0x301DF37d653b281AF83a1DDf4464eF21A622eC83';
async function getDeployerSigner() {
const hre = (0, hre_1.getHre)();
if (config_1.default.isHardhat() && config_1.default.FORK_MAINNET) {
return (0, impersonate_account_1.impersonateAndFundAccount)(config_1.default.OVERRIDE_DEPLOYER_ADDRESS || MAINNET_DEPLOYER_ADDRESS);
}
else if (config_1.default.OVERRIDE_DEPLOYER_ADDRESS) {
return hre.ethers.getSigner(config_1.default.OVERRIDE_DEPLOYER_ADDRESS);
}
else {
const accounts = await hre.ethers.getSigners();
return accounts[0];
}
}
exports.getDeployerSigner = getDeployerSigner;