Skip to content

Commit e64f7b3

Browse files
feat(smart-contract): Add prepare trasnfer staked keys upgrade script for multisig upgrade call
1 parent 94c1e22 commit e64f7b3

File tree

1 file changed

+84
-0
lines changed

1 file changed

+84
-0
lines changed
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { config } from "@sentry/core";
2+
import { safeVerify } from "../../utils/safeVerify.mjs";
3+
4+
import { PoolBeaconAbi } from "@sentry/core";
5+
6+
// Find this in the deployed PoolProxyDeployer's public fields. This should reflect which set of proxies you want to change; staking pools, key buckets, or esXai buckets
7+
// https://arbiscan.io/address/0x68D78D1E81379EfD9C61f8E9131D52CE571AF4fD#readProxyContract
8+
const beaconAddress = "0x5f9D168d3435747335b1B3dC7e4d42e3510087C7";
9+
const currentContractImplementationName = "StakingPool2";
10+
const newContractImplementationName = "StakingPool3";
11+
12+
const REFEREE_ADDRESS = config.refereeAddress;
13+
const POOL_FACTORY_ADDRESS = config.poolFactoryAddress;
14+
const NODE_LICENSE_ADDRESS = config.nodeLicenseAddress;
15+
16+
async function main() {
17+
18+
// get the deployer
19+
const [deployer] = (await ethers.getSigners());
20+
21+
console.log("Upgrading Referee...");
22+
const Referee11 = await ethers.getContractFactory("Referee11", deployer);
23+
console.log("Got Referee factory");
24+
const refereeImplementationAddress = await upgrades.prepareUpgrade(REFEREE_ADDRESS, Referee11);
25+
console.log("Referee upgraded to version 11");
26+
console.log(refereeImplementationAddress);
27+
28+
console.log("Upgrading PoolFactory...");
29+
const PoolFactory3 = await ethers.getContractFactory("PoolFactory3");
30+
console.log("Got PoolFactory factory");
31+
const poolFactoryImplementationAddress = await upgrades.prepareUpgrade(POOL_FACTORY_ADDRESS, PoolFactory3);
32+
console.log("PoolFactory upgraded to version 3");
33+
console.log(poolFactoryImplementationAddress);
34+
35+
console.log("Upgrading NodeLicense...");
36+
const NodeLicense10 = await ethers.getContractFactory("NodeLicense10");
37+
console.log("Got NodeLicense factory");
38+
const nodeLicenseImplementationAddress = await upgrades.prepareUpgrade(NODE_LICENSE_ADDRESS, NodeLicense10);
39+
console.log("NodeLicense upgraded to version 10");
40+
console.log(nodeLicenseImplementationAddress);
41+
42+
// UPGRADE PoolBeacon
43+
// Create instance of the beacon
44+
const beacon = new ethers.Contract(beaconAddress, PoolBeaconAbi, deployer);
45+
console.log("Found beacon:", await beacon.getAddress());
46+
47+
// Validate the new implementation is upgrade safe
48+
console.log("Validating upgrade viability...");
49+
const CurrentImplementationFactory = await ethers.getContractFactory(currentContractImplementationName);
50+
const NewImplementationFactory = await ethers.getContractFactory(newContractImplementationName);
51+
await upgrades.validateUpgrade(CurrentImplementationFactory, NewImplementationFactory, { kind: "beacon" });
52+
console.log("New implementation validated as upgrade safe");
53+
54+
// Deploy the new implementation
55+
console.log("Deploying the new implementation");
56+
const NewImplementation = await ethers.deployContract(newContractImplementationName);
57+
await NewImplementation.waitForDeployment();
58+
const stakingPoolImplementationAddress = await NewImplementation.getAddress();
59+
60+
console.log(`UPDATE ECOSYSTEM BEACON:`); //0xD88c8E0aE21beA6adE41A41130Bb4cd43e6b1723
61+
console.log(`Proxy: ${REFEREE_ADDRESS} (Referee) -> implementation: ${refereeImplementationAddress}`);
62+
console.log(`Proxy: ${POOL_FACTORY_ADDRESS} (PoolFactory) -> implementation: ${poolFactoryImplementationAddress}`);
63+
console.log(`Proxy: ${NODE_LICENSE_ADDRESS} (NodeLicense) -> implementation: ${poolFactoryImplementationAddress}`);
64+
65+
console.log(``);
66+
console.log(``);
67+
68+
console.log(`UPDATE STAKING POOL BEACON ${beaconAddress}:`);
69+
console.log(`Beacon.update -> implementation: ${stakingPoolImplementationAddress}`);
70+
71+
console.log("Starting verification... ");
72+
await safeVerify({ skipWaitForDeployTx: true, contractAddress: stakingPoolImplementationAddress });
73+
await safeVerify({ skipWaitForDeployTx: true, contract: refereeImplementationAddress });
74+
await safeVerify({ skipWaitForDeployTx: true, contract: poolFactoryImplementationAddress });
75+
await safeVerify({ skipWaitForDeployTx: true, contract: nodeLicenseImplementationAddress });
76+
console.log("Verification complete ");
77+
}
78+
79+
// We recommend this pattern to be able to use async/await everywhere
80+
// and properly handle errors.
81+
main().catch((error) => {
82+
console.error(error);
83+
process.exitCode = 1;
84+
});

0 commit comments

Comments
 (0)