Commit edb10c75 authored by Mark Tyneway's avatar Mark Tyneway

contracts-governance: mint manager deploy

Add a deploy script for the new mint manager. To review this,
check the `cast` calls in the mint manager implementation
deploy script. The owners of the `MintManager` are preserved,
double check that in the `deploy-config` directory against
what the cast calls return.

To deploy this, the new implementation needs to be deployed
and then the existing owner of the `MintManager` needs to
send a transaction to the `MintManager` calling `upgrade(address)`
to the new implementation of the `MintManager`.
parent 9e0151d5
{
"upgrader": "0xC30276833798867C1dBC5c468bf51cA900b44E4c"
}
{
"upgrader": "0x2A82Ae142b2e62Cb7D10b55E323ACB1Cab663a26"
}
import { DeployFunction } from 'hardhat-deploy/dist/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import 'hardhat-deploy'
import '@eth-optimism/hardhat-deploy-config'
import '@nomiclabs/hardhat-ethers'
import { sleep } from '@eth-optimism/core-utils'
// $ cast call --rpc-url https://mainnet.optimism.io 0x4200000000000000000000000000000000000042 'owner()(address)'
// 0x724604DB3C8D86c906A27B610703fD0296Eb26D5
// $ cast call --rpc-url https://mainnet.optimism.io 0x724604DB3C8D86c906A27B610703fD0296Eb26D5 'owner()(address)'
// 0x2A82Ae142b2e62Cb7D10b55E323ACB1Cab663a26
//
// $ cast call --rpc-url https://goerli.optimism.io 0x4200000000000000000000000000000000000042 'owner()(address)'
// 0xB2DcB2Df7732030eD99241E5F9aEBB3Fb53eFCb6
// $ cast call --rpc-url https://goerli.optimism.io 0xB2DcB2Df7732030eD99241E5F9aEBB3Fb53eFCb6 'owner()(address)'
// 0xC30276833798867C1dBC5c468bf51cA900b44E4c
// Deployment steps:
// 1 - Deploy new MintManager implementation
// 2 - Multisig transaction calls `upgrade()` on the old MintManager
const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deploy } = hre.deployments
const { deployer } = await hre.getNamedAccounts()
const upgrader = hre.deployConfig.upgrader
const governanceToken = '0x4200000000000000000000000000000000000042'
if (upgrader === '' || upgrader === hre.ethers.constants.AddressZero) {
throw new Error('upgrader not set in deploy-config')
}
// There is no artifact for the originally deployed MintManager
let oldImpl: string
if (hre.network.name === 'optimism-mainnet') {
oldImpl = '0x724604DB3C8D86c906A27B610703fD0296Eb26D5'
} else if (hre.network.name === 'optimism-goerli') {
oldImpl = '0xB2DcB2Df7732030eD99241E5F9aEBB3Fb53eFCb6'
} else {
throw new Error(`unknown network ${hre.network.name}`)
}
await deploy('MintManager', {
from: deployer,
args: [upgrader, governanceToken],
log: true,
waitConfirmations: 1,
})
const GovernanceToken = await hre.ethers.getContractAt(
'GovernanceToken',
'0x4200000000000000000000000000000000000042'
)
const getAddress = hre.ethers.utils.getAddress
const Deployment__MintManager = await hre.deployments.get('MintManager')
const newImpl = Deployment__MintManager.address
while (true) {
const owner = await GovernanceToken.owner()
if (getAddress(owner) === getAddress(oldImpl)) {
console.log(`GovernanceToken.owner() is still old implementation`)
} else if (getAddress(owner) === getAddress(newImpl)) {
console.log(`GovernanceToken.owner() upgraded to new implementation!`)
break
} else {
throw new Error(
`GovernanceToken.owner() upgraded to unknown address ${owner}`
)
}
}
await sleep(5000)
}
deployFn.tags = ['MintManager']
export default deployFn
...@@ -5,6 +5,7 @@ import '@nomiclabs/hardhat-etherscan' ...@@ -5,6 +5,7 @@ import '@nomiclabs/hardhat-etherscan'
import '@nomiclabs/hardhat-waffle' import '@nomiclabs/hardhat-waffle'
import 'hardhat-gas-reporter' import 'hardhat-gas-reporter'
import 'solidity-coverage' import 'solidity-coverage'
import '@eth-optimism/hardhat-deploy-config'
import './scripts/deploy-token' import './scripts/deploy-token'
import './scripts/multi-send' import './scripts/multi-send'
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
"dependencies": { "dependencies": {
"@eth-optimism/core-utils": "^0.10.1", "@eth-optimism/core-utils": "^0.10.1",
"@eth-optimism/sdk": "^1.6.4", "@eth-optimism/sdk": "^1.6.4",
"@eth-optimism/hardhat-deploy-config": "^0.2.3",
"@ethersproject/hardware-wallets": "^5.7.0", "@ethersproject/hardware-wallets": "^5.7.0",
"@nomiclabs/hardhat-ethers": "^2.0.2", "@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-etherscan": "^3.0.1", "@nomiclabs/hardhat-etherscan": "^3.0.1",
...@@ -50,6 +51,7 @@ ...@@ -50,6 +51,7 @@
"eslint": "^8.9.0", "eslint": "^8.9.0",
"ethereum-waffle": "^3.4.0", "ethereum-waffle": "^3.4.0",
"hardhat-gas-reporter": "^1.0.7", "hardhat-gas-reporter": "^1.0.7",
"hardhat-deploy": "^0.11.4",
"prettier": "^2.3.1", "prettier": "^2.3.1",
"prettier-plugin-solidity": "^1.0.0-beta.18", "prettier-plugin-solidity": "^1.0.0-beta.18",
"solhint": "^3.3.6", "solhint": "^3.3.6",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment