Skip to content

Commit

Permalink
Add instructions to upgrade TokenStaking
Browse files Browse the repository at this point in the history
Ideally, this should be automated, but this is a start
  • Loading branch information
cygnusv committed Nov 24, 2023
1 parent ac84ec2 commit 60bf211
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 0 deletions.
2 changes: 2 additions & 0 deletions deploy/60_validate_upgrade_token_staking.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// See deploy/TokenStaking_upgrade_instructions.md

import { HardhatRuntimeEnvironment } from "hardhat/types"
import { DeployFunction } from "hardhat-deploy/types"

Expand Down
2 changes: 2 additions & 0 deletions deploy/61_prepare_upgrade_token_staking.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
// See deploy/TokenStaking_upgrade_instructions.md

import { HardhatRuntimeEnvironment } from "hardhat/types"
import { DeployFunction } from "hardhat-deploy/types"

Expand Down
41 changes: 41 additions & 0 deletions deploy/TokenStaking_upgrade_instructions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Instructions to upgrade TokenStaking
Tested with:

* hardhat: 2.19.1
* @openzeppelin/hardhat-upgrades: 1.28.0
* @nomicfoundation/hardhat-verify: 2.0.1

## Summary

### Setup

git remote update
git checkout <branch>

export CHAIN_API_URL=<...>
export CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY=<...>
export KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY=<...>
export ETHERSCAN_API_KEY=<...>

### Validate and deploy implementation contract

yarn hardhat deploy --tags ValidateUpgradeTokenStaking --network mainnet
yarn hardhat deploy --tags PrepareUpgradeTokenStaking --network mainnet

This will modify this OZ manifest file:
.openzeppelin/mainnet.json

### Post-deployment stuff

unset CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY
unset KEEP_CONTRACT_OWNER_ACCOUNT_PRIVATE_KEY

cp TokenStaking_implementation_0x<IMPLEMENTATION_ADDRESS>.json deployments/mainnet/TokenStaking.json

Edit deployments/mainnet/TokenStaking.json to keep proxy address instead of new implementation address

### Contract verification

Verify implementation contract using @nomicfoundation/hardhat-verify:

yarn hardhat verify --network mainnet <CONTRACT_ADDRESS> <CONSTRUCTOR_PARAM_1> <CONSTRUCTOR_PARAM_2> ...

0 comments on commit 60bf211

Please sign in to comment.