Commit 85c77a95 authored by Mark Tyneway's avatar Mark Tyneway

ctp: AttestationStation deterministic proxy

Deploys the proxy in a deterministic manner for
the attestationstation
parent 9c3a4a66
import { DeployConfig } from '../../src' import { DeployConfig } from '../../src'
const config: DeployConfig = { const config: DeployConfig = {
ddd: '0x9C6373dE60c2D3297b18A8f964618ac46E011B58', ddd: '0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266',
l2ProxyOwnerAddress: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', l2ProxyOwnerAddress: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8',
optimistName: 'OP Citizenship', optimistName: 'OP Citizenship',
optimistSymbol: 'OPNFT', optimistSymbol: 'OPNFT',
......
...@@ -3,10 +3,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types' ...@@ -3,10 +3,7 @@ import { HardhatRuntimeEnvironment } from 'hardhat/types'
import '@eth-optimism/hardhat-deploy-config' import '@eth-optimism/hardhat-deploy-config'
import '@nomiclabs/hardhat-ethers' import '@nomiclabs/hardhat-ethers'
import 'hardhat-deploy' import 'hardhat-deploy'
import { import { assertContractVariable } from '@eth-optimism/contracts-bedrock/src/deploy-utils'
assertContractVariable,
deploy,
} from '@eth-optimism/contracts-bedrock/src/deploy-utils'
import { utils } from 'ethers' import { utils } from 'ethers'
const { getAddress } = utils const { getAddress } = utils
...@@ -16,6 +13,11 @@ const { getAddress } = utils ...@@ -16,6 +13,11 @@ const { getAddress } = utils
*/ */
const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const { deployer } = await hre.getNamedAccounts() const { deployer } = await hre.getNamedAccounts()
const ddd = hre.deployConfig.ddd
if (getAddress(deployer) !== getAddress(ddd)) {
throw new Error('Must deploy with the ddd')
}
console.log(`Deploying AttestationStationProxy with ${deployer}`) console.log(`Deploying AttestationStationProxy with ${deployer}`)
...@@ -23,15 +25,21 @@ const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { ...@@ -23,15 +25,21 @@ const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
'AttestationStation' 'AttestationStation'
) )
await deploy({ const { deploy } = await hre.deployments.deterministic(
hre, 'AttestationStationProxy',
name: 'AttestationStationProxy', {
contract: 'Proxy', salt: hre.ethers.utils.solidityKeccak256(
args: [deployer], ['string'],
postDeployAction: async (contract) => { ['AttestationStationProxy']
await assertContractVariable(contract, 'admin', deployer) ),
}, contract: 'Proxy',
}) from: deployer,
args: [deployer],
log: true,
}
)
await deploy()
const Deployment__AttestationStationProxy = await hre.deployments.get( const Deployment__AttestationStationProxy = await hre.deployments.get(
'AttestationStationProxy' 'AttestationStationProxy'
...@@ -44,6 +52,11 @@ const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { ...@@ -44,6 +52,11 @@ const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
const Proxy = await hre.ethers.getContractAt('Proxy', addr) const Proxy = await hre.ethers.getContractAt('Proxy', addr)
const AttestationStation = await hre.ethers.getContractAt(
'AttestationStation',
addr
)
const implementation = await Proxy.callStatic.implementation() const implementation = await Proxy.callStatic.implementation()
console.log(`implementation is set to ${implementation}`) console.log(`implementation is set to ${implementation}`)
if ( if (
...@@ -76,6 +89,9 @@ const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => { ...@@ -76,6 +89,9 @@ const deployFn: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
console.log('admin already set to L2 Proxy Owner Address') console.log('admin already set to L2 Proxy Owner Address')
} }
console.log('Contract deployment complete') console.log('Contract deployment complete')
// Assert that the variables are set correctly
assertContractVariable(AttestationStation, 'version', '0.0.1')
} }
deployFn.tags = ['AttestationStationProxy'] deployFn.tags = ['AttestationStationProxy']
......
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