Commit 5be495e0 authored by Mark Tyneway's avatar Mark Tyneway Committed by GitHub

Merge pull request #4370 from ethereum-optimism/willc/attdeploy

feat(contracts-periphery): Add deploy script for AttestationStation
parents 0be2fa71 c12aeb2f
---
'@eth-optimism/contracts-periphery': patch
---
Add deploy script for attestations tation
......@@ -2,6 +2,7 @@ import { DeployConfig } from '../../src'
const config: DeployConfig = {
ddd: '0x9C6373dE60c2D3297b18A8f964618ac46E011B58',
l2ProxyOwnerAddress: '',
}
export default config
......@@ -2,6 +2,7 @@ import { DeployConfig } from '../../src'
const config: DeployConfig = {
ddd: '0x9C6373dE60c2D3297b18A8f964618ac46E011B58',
l2ProxyOwnerAddress: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
}
export default config
import { DeployConfig } from '../../src'
// TODO(tynes): kovan is deprecated, delete this file
const config: DeployConfig = {
ddd: '0x9C6373dE60c2D3297b18A8f964618ac46E011B58',
l2ProxyOwnerAddress: '',
}
export default config
......@@ -2,6 +2,7 @@ import { DeployConfig } from '../../src'
const config: DeployConfig = {
ddd: '0x9C6373dE60c2D3297b18A8f964618ac46E011B58',
l2ProxyOwnerAddress: '',
}
export default config
......@@ -2,6 +2,7 @@ import { DeployConfig } from '../../src'
const config: DeployConfig = {
ddd: '0x9C6373dE60c2D3297b18A8f964618ac46E011B58',
l2ProxyOwnerAddress: '',
}
export default config
import { DeployConfig } from '../../src'
// TODO(tynes): optimism-kovan is deprecated, delete this file
const config: DeployConfig = {
ddd: '0x9C6373dE60c2D3297b18A8f964618ac46E011B58',
l2ProxyOwnerAddress: '',
}
export default config
/* Imports: External */
import { DeployFunction } from 'hardhat-deploy/dist/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import '@nomiclabs/hardhat-ethers'
import '@eth-optimism/hardhat-deploy-config'
import 'hardhat-deploy'
const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployer } = await hre.getNamedAccounts()
console.log(`Deploying AttestationStation with ${deployer}`)
const { deploy } = await hre.deployments.deterministic('AttestationStation', {
salt: hre.ethers.utils.solidityKeccak256(
['string'],
['AttestationStation']
),
from: deployer,
args: [],
log: true,
})
await deploy()
const Deployment__AttestationStation = await hre.deployments.get(
'AttestationStation'
)
const addr = Deployment__AttestationStation.address
console.log(`AttestationStation deployed to ${addr}`)
}
deployFn.tags = ['AttestationStation', 'AttestationStationEnvironment']
export default deployFn
import { DeployFunction } from 'hardhat-deploy/dist/types'
import { HardhatRuntimeEnvironment } from 'hardhat/types'
import '@eth-optimism/hardhat-deploy-config'
import '@nomiclabs/hardhat-ethers'
import 'hardhat-deploy'
import {
assertContractVariable,
deploy,
} from '@eth-optimism/contracts-bedrock/src/deploy-utils'
import { utils } from 'ethers'
const { getAddress } = utils
/**
* Deploys the AttestationStationProxy
*/
const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployer } = await hre.getNamedAccounts()
console.log(`Deploying AttestationStationProxy with ${deployer}`)
const Deployment__AttestationStation = await hre.deployments.get(
'AttestationStation'
)
await deploy({
hre,
name: 'AttestationStationProxy',
contract: 'Proxy',
args: [deployer],
postDeployAction: async (contract) => {
await assertContractVariable(contract, 'admin', deployer)
},
})
const Deployment__AttestationStationProxy = await hre.deployments.get(
'AttestationStationProxy'
)
const addr = Deployment__AttestationStationProxy.address
console.log(`AttestationStationProxy deployed to ${addr}`)
console.log(
`Using AttestationStation implementation at ${Deployment__AttestationStation.address}`
)
const Proxy = await hre.ethers.getContractAt('Proxy', addr)
const implementation = await Proxy.callStatic.implementation()
console.log(`implementation is set to ${implementation}`)
if (
getAddress(implementation) !==
getAddress(Deployment__AttestationStation.address)
) {
console.log('implementation not set to AttestationStation contract')
console.log(
`Setting implementation to ${Deployment__AttestationStation.address}`
)
const tx = await Proxy.upgradeTo(Deployment__AttestationStation.address)
const receipt = await tx.wait()
console.log(`implementation set in tx ${receipt.transactionHash}`)
} else {
console.log('implementation already set to AttestationStation contract')
}
const l2ProxyOwnerAddress = hre.deployConfig.l2ProxyOwnerAddress
const admin = await Proxy.callStatic.admin()
console.log(`admin is set to ${admin}`)
if (getAddress(admin) !== getAddress(l2ProxyOwnerAddress)) {
console.log('admin not set correctly')
console.log(`Setting admin to ${l2ProxyOwnerAddress}`)
const tx = await Proxy.changeAdmin(l2ProxyOwnerAddress)
const receipt = await tx.wait()
console.log(`admin set in ${receipt.transactionHash}`)
} else {
console.log('admin already set to L2 Proxy Owner Address')
}
console.log('Contract deployment complete')
}
deployFn.tags = ['AttestationStationProxy']
deployFn.dependencies = ['AttestationStation']
export default deployFn
......@@ -12,6 +12,16 @@ export interface DeployConfig {
* the DDD to transfer ownership to the final contract owner very quickly after deployment.
*/
ddd: string
/**
* Address of the Proxy owner on L2
*/
l2ProxyOwnerAddress: string
/**
* Number of confs before considering it final
*/
numDeployConfirmations?: number
}
/**
......@@ -21,4 +31,11 @@ export const configSpec: DeployConfigSpec<DeployConfig> = {
ddd: {
type: 'address',
},
l2ProxyOwnerAddress: {
type: 'address',
},
numDeployConfirmations: {
type: 'number',
default: 1,
},
}
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