Skip to content

Commit fc25c49

Browse files
committed
Add instructions to upgrade TokenStaking
Ideally, this should be automated, but this is a start
1 parent 7a27ba2 commit fc25c49

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed

deploy/60_validate_upgrade_token_staking.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// See deploy/TokenStaking_upgrade_instructions.md
2+
13
import { HardhatRuntimeEnvironment } from "hardhat/types"
24
import { DeployFunction } from "hardhat-deploy/types"
35

deploy/61_prepare_upgrade_token_staking.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// See deploy/TokenStaking_upgrade_instructions.md
2+
13
import { HardhatRuntimeEnvironment } from "hardhat/types"
24
import { DeployFunction } from "hardhat-deploy/types"
35

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Instructions to upgrade TokenStaking
2+
3+
Tested with:
4+
5+
- hardhat: 2.19.1
6+
- @openzeppelin/hardhat-upgrades: 1.28.0
7+
- @nomicfoundation/hardhat-verify: 2.0.1
8+
9+
## Summary
10+
11+
### Setup
12+
13+
git remote update
14+
git checkout <branch>
15+
16+
export CHAIN_API_URL=<...>
17+
export CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY=<...>
18+
export KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY=<...>
19+
export ETHERSCAN_API_KEY=<...>
20+
21+
### Validate and deploy implementation contract
22+
23+
yarn hardhat deploy --tags ValidateUpgradeTokenStaking --network mainnet
24+
yarn hardhat deploy --tags PrepareUpgradeTokenStaking --network mainnet
25+
26+
This will modify this OZ manifest file:
27+
.openzeppelin/mainnet.json
28+
29+
### Post-deployment stuff
30+
31+
unset CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
32+
unset KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
33+
34+
cp TokenStaking_implementation_0x<IMPLEMENTATION_ADDRESS>.json deployments/mainnet/TokenStaking.json
35+
36+
Edit deployments/mainnet/TokenStaking.json to keep proxy address instead of new implementation address
37+
38+
### Contract verification
39+
40+
Verify implementation contract using @nomicfoundation/hardhat-verify:
41+
42+
yarn hardhat verify --network mainnet <CONTRACT_ADDRESS> <CONSTRUCTOR_PARAM_1> <CONSTRUCTOR_PARAM_2> ...

0 commit comments

Comments
 (0)