Commit 2d2aed15 authored by Maurelian's avatar Maurelian Committed by Kelvin Fichter

fix(contracts): Address review feedback on ts files

parent b3b97959
...@@ -8,7 +8,10 @@ import { ...@@ -8,7 +8,10 @@ import {
} from '../src/hardhat-deploy-ethers' } from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({ await deployAndPostDeploy({
hre, hre,
......
...@@ -8,7 +8,10 @@ import { ...@@ -8,7 +8,10 @@ import {
} from '../src/hardhat-deploy-ethers' } from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({ await deployAndPostDeploy({
hre, hre,
......
...@@ -8,7 +8,10 @@ import { ...@@ -8,7 +8,10 @@ import {
} from '../src/hardhat-deploy-ethers' } from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({ await deployAndPostDeploy({
hre, hre,
......
...@@ -8,7 +8,10 @@ import { ...@@ -8,7 +8,10 @@ import {
} from '../src/hardhat-deploy-ethers' } from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({ await deployAndPostDeploy({
hre, hre,
......
...@@ -8,7 +8,10 @@ import { ...@@ -8,7 +8,10 @@ import {
} from '../src/hardhat-deploy-ethers' } from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({ await deployAndPostDeploy({
hre, hre,
......
...@@ -10,7 +10,10 @@ import { ...@@ -10,7 +10,10 @@ import {
} from '../src/hardhat-deploy-ethers' } from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({ await deployAndPostDeploy({
hre, hre,
......
...@@ -10,7 +10,10 @@ import { ...@@ -10,7 +10,10 @@ import {
} from '../src/hardhat-deploy-ethers' } from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
// todo: this fails when trying to do a fresh deploy, because Lib_ResolvedDelegateProxy // todo: this fails when trying to do a fresh deploy, because Lib_ResolvedDelegateProxy
// requires that the implementation has already been set in the Address Manager. // requires that the implementation has already been set in the Address Manager.
......
...@@ -20,10 +20,14 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -20,10 +20,14 @@ const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts() const { deployer } = await hre.getNamedAccounts()
// Set up a reference to the proxy as if it were the L1StandardBridge contract. // Set up a reference to the proxy as if it were the L1StandardBridge contract.
const contract = await getContractFromArtifact(hre, 'Proxy__OVM_L1StandardBridge', { const contract = await getContractFromArtifact(
hre,
'Proxy__OVM_L1StandardBridge',
{
iface: 'L1StandardBridge', iface: 'L1StandardBridge',
signerOrProvider: deployer, signerOrProvider: deployer,
}) }
)
// Because of the `iface` parameter supplied to the deployment function above, the `contract` // Because of the `iface` parameter supplied to the deployment function above, the `contract`
// variable that we here will have the interface of the L1StandardBridge contract. However, // variable that we here will have the interface of the L1StandardBridge contract. However,
......
...@@ -10,10 +10,11 @@ import { ...@@ -10,10 +10,11 @@ import {
import { predeploys } from '../src/predeploys' import { predeploys } from '../src/predeploys'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
// ToDo: Clean up the method of mapping names to addresses esp.
// There's probably a more functional way to generate an object or something.
const allContractNames = [ const allContractNames = [
'ChainStorageContainer-CTC-batches', 'ChainStorageContainer-CTC-batches',
'ChainStorageContainer-SCC-batches', 'ChainStorageContainer-SCC-batches',
......
...@@ -4,14 +4,24 @@ import { ethers } from 'hardhat' ...@@ -4,14 +4,24 @@ import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/dist/types' import { DeployFunction } from 'hardhat-deploy/dist/types'
/* Imports: Internal */ /* Imports: Internal */
import { getContractFromArtifact, waitUntilTrue } from '../src/hardhat-deploy-ethers' import {
getContractFromArtifact,
waitUntilTrue,
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts() const { deployer } = await hre.getNamedAccounts()
const addressDictator = await getContractFromArtifact(hre, 'AddressDictator', { const addressDictator = await getContractFromArtifact(
hre,
'AddressDictator',
{
signerOrProvider: deployer, signerOrProvider: deployer,
}) }
const libAddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') )
const libAddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
const namedAddresses = await addressDictator.getNamedAddresses() const namedAddresses = await addressDictator.getNamedAddresses()
const finalOwner = await addressDictator.finalOwner() const finalOwner = await addressDictator.finalOwner()
let currentOwner = await libAddressManager.owner() let currentOwner = await libAddressManager.owner()
...@@ -72,15 +82,18 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -72,15 +82,18 @@ const deployFn: DeployFunction = async (hre) => {
console.log('Ownership successfully transferred. Invoking setAddresses...') console.log('Ownership successfully transferred. Invoking setAddresses...')
await addressDictator.setAddresses() await addressDictator.setAddresses()
currentOwner = await libAddressManager.owner() await waitUntilTrue(
async () => {
console.log('Verifying final ownership of Lib_AddressManager') console.log('Verifying final ownership of Lib_AddressManager')
if (!hexStringEquals(finalOwner, currentOwner)) { currentOwner = await libAddressManager.owner()
throw new Error( return hexStringEquals(currentOwner, finalOwner)
`The current address manager owner ${currentOwner}, \nis not equal to the expected owner: ${finalOwner}` },
) {
} else { // Try every 10 seconds
console.log(`Address Manager ownership was returned to ${finalOwner}.`) delay: 10_000,
retries: 1000,
} }
)
} }
deployFn.tags = ['upgrade', 'set-addresses'] deployFn.tags = ['upgrade', 'set-addresses']
......
...@@ -3,7 +3,10 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' ...@@ -3,7 +3,10 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import { hexStringEquals } from '@eth-optimism/core-utils' import { hexStringEquals } from '@eth-optimism/core-utils'
/* Imports: Internal */ /* Imports: Internal */
import { getContractFromArtifact, waitUntilTrue } from '../src/hardhat-deploy-ethers' import {
getContractFromArtifact,
waitUntilTrue,
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts() const { deployer } = await hre.getNamedAccounts()
...@@ -19,7 +22,10 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -19,7 +22,10 @@ const deployFn: DeployFunction = async (hre) => {
signerOrProvider: deployer, signerOrProvider: deployer,
} }
) )
const libAddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager') const libAddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await proxy.initialize(libAddressManager.address) await proxy.initialize(libAddressManager.address)
console.log(`Checking that contract was correctly initialized...`) console.log(`Checking that contract was correctly initialized...`)
......
...@@ -3,13 +3,20 @@ import { DeployFunction } from 'hardhat-deploy/dist/types' ...@@ -3,13 +3,20 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import { hexStringEquals } from '@eth-optimism/core-utils' import { hexStringEquals } from '@eth-optimism/core-utils'
/* Imports: Internal */ /* Imports: Internal */
import { getContractFromArtifact, waitUntilTrue } from '../src/hardhat-deploy-ethers' import {
getContractFromArtifact,
waitUntilTrue,
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts() const { deployer } = await hre.getNamedAccounts()
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager', { const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager',
{
signerOrProvider: deployer, signerOrProvider: deployer,
}) }
)
const owner = (hre as any).deployConfig.ovmAddressManagerOwner const owner = (hre as any).deployConfig.ovmAddressManagerOwner
const remoteOwner = await Lib_AddressManager.owner() const remoteOwner = await Lib_AddressManager.owner()
......
...@@ -68,25 +68,6 @@ task('deploy') ...@@ -68,25 +68,6 @@ task('deploy')
undefined, undefined,
types.string types.string
) )
// Reusable address options
.addOptionalParam(
'proxyL1CrossDomainMessenger',
'Address of the L1CrossDomainMessenger Proxy, for use in a deployment which is keeping the existing contract.',
undefined,
types.string
)
.addOptionalParam(
'proxyL1StandardBridge',
'Address of the L1StandardBridge Proxy, for use in a deployment which is keeping the existing contract.',
undefined,
types.string
)
.addOptionalParam(
'libAddressManager',
'Address of the Lib_AddressManager, for use in a deployment which is keeping the existing contract.',
undefined,
types.string
)
.addOptionalParam( .addOptionalParam(
'numDeployConfirmations', 'numDeployConfirmations',
'Number of confirmations to wait for each transaction in the deployment. More is safer.', 'Number of confirmations to wait for each transaction in the deployment. More is safer.',
......
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