Commit c025f418 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

contracts-bedrock: deploy additional contracts (#3224)

Deploy the `AddressManager` and the `ProxyAdmin`.
These contracts are required as part of the system on
L1. The indexer requires the `AddressManager` to be
deployed. Having the `ProxyAdmin` deployed will make
the devnet setup more similar to how the system will
be deployed in production.

Note that these deployments are only good for fresh
deployments. We will need to update the deploy scripts
to run against existing networks in the future.
Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
parent ec8d6b7c
---
'@eth-optimism/contracts-bedrock': patch
---
Add additional deployments of address manager and proxy admin
import { DeployFunction } from 'hardhat-deploy/dist/types'
import 'hardhat-deploy'
import '@eth-optimism/hardhat-deploy-config'
// TODO(tynes): This needs to be deployed for fresh networks
// but not for upgrading existing networks
const deployFn: DeployFunction = async (hre) => {
const { deploy } = hre.deployments
const { deployer } = await hre.getNamedAccounts()
const { deployConfig } = hre
await deploy('AddressManager', {
from: deployer,
args: [],
log: true,
waitConfirmations: deployConfig.deploymentWaitConfirmations,
})
}
deployFn.tags = ['Lib_AddressManager', 'legacy']
export default deployFn
import { DeployFunction } from 'hardhat-deploy/dist/types'
import 'hardhat-deploy'
import '@nomiclabs/hardhat-ethers'
import '@eth-optimism/hardhat-deploy-config'
const deployFn: DeployFunction = async (hre) => {
const { deploy } = hre.deployments
const { deployer } = await hre.getNamedAccounts()
const { deployConfig } = hre
await deploy('ProxyAdmin', {
from: deployer,
args: [deployer],
log: true,
waitConfirmations: deployConfig.deploymentWaitConfirmations,
})
const admin = await hre.deployments.get('ProxyAdmin')
const ProxyAdmin = await hre.ethers.getContractAt('ProxyAdmin', admin.address)
// This is set up for fresh networks only
const proxies = [
'L2OutputOracleProxy',
'L1CrossDomainMessengerProxy',
'L1StandardBridgeProxy',
'OptimismPortalProxy',
'OptimismMintableERC20FactoryProxy',
]
// Wait on all the txs in parallel so that the deployment goes faster
const txs = []
for (const proxy of proxies) {
const deployment = await hre.deployments.get(proxy)
const Proxy = await hre.ethers.getContractAt('Proxy', deployment.address)
const tx = await Proxy.changeAdmin(admin.address)
txs.push(tx)
}
await Promise.all(txs.map((tx) => tx.wait()))
const addressManager = await hre.deployments.get('AddressManager')
const AddressManager = await hre.ethers.getContractAt(
'AddressManager',
addressManager.address
)
const postConfig = [
await AddressManager.transferOwnership(admin.address),
await ProxyAdmin.setAddressManager(addressManager.address),
]
await Promise.all(postConfig.map((tx) => tx.wait()))
}
deployFn.tags = ['ProxyAdmin']
export default deployFn
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