This repository was archived by the owner on Apr 4, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathupgradeGov.ts
More file actions
32 lines (25 loc) · 1.32 KB
/
upgradeGov.ts
File metadata and controls
32 lines (25 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import {ArenaGovernor__factory, ArenaGovernor} from '../../typechain';
import deployedAddrsJson from '../../deployments/polygonAddresses.json';
import {HardhatRuntimeEnvironment} from 'hardhat/types';
import {verifyContract} from './verify';
let deployerAddress: string;
let governor: ArenaGovernor;
export async function upgradeGov(hre: HardhatRuntimeEnvironment) {
const networkId = hre.network.config.chainId as number;
const [deployer] = await hre.ethers.getSigners();
deployerAddress = await deployer.getAddress();
console.log(`Deployer: ${deployerAddress}`);
console.log(`token address: ${deployedAddrsJson.token}`);
console.log(`timelock address: ${deployedAddrsJson.timelock}`);
console.log(`deploying governor...`);
const ArenaGovernorFactory = (await hre.ethers.getContractFactory('ArenaGovernor')) as ArenaGovernor__factory;
governor = await ArenaGovernorFactory.deploy(deployedAddrsJson.token, deployedAddrsJson.timelock);
await governor.deployed();
console.log(`governor address: ${governor.address}`);
console.log(`sleeping for 30s...`);
// sleep for 30s for network propagation
await new Promise((f) => setTimeout(f, 30_000));
console.log('verifying address on etherscan...');
await verifyContract(hre, governor.address, [deployedAddrsJson.token, deployedAddrsJson.timelock]);
process.exit(0);
}