Skip to content

Commit 60bf211

Browse files
committed
Add instructions to upgrade TokenStaking
Ideally, this should be automated, but this is a start
1 parent ac84ec2 commit 60bf211

File tree

3 files changed

+45
-0
lines changed

3 files changed

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

0 commit comments

Comments
 (0)