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 {
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager')
const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({
hre,
......
......@@ -8,7 +8,10 @@ import {
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager')
const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({
hre,
......
......@@ -8,7 +8,10 @@ import {
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager')
const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({
hre,
......
......@@ -8,7 +8,10 @@ import {
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager')
const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({
hre,
......
......@@ -8,7 +8,10 @@ import {
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager')
const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({
hre,
......
......@@ -10,7 +10,10 @@ import {
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => {
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager')
const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await deployAndPostDeploy({
hre,
......
......@@ -10,7 +10,10 @@ import {
} from '../src/hardhat-deploy-ethers'
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
// requires that the implementation has already been set in the Address Manager.
......
......@@ -20,10 +20,14 @@ const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts()
// Set up a reference to the proxy as if it were the L1StandardBridge contract.
const contract = await getContractFromArtifact(hre, 'Proxy__OVM_L1StandardBridge', {
iface: 'L1StandardBridge',
signerOrProvider: deployer,
})
const contract = await getContractFromArtifact(
hre,
'Proxy__OVM_L1StandardBridge',
{
iface: 'L1StandardBridge',
signerOrProvider: deployer,
}
)
// 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,
......
......@@ -10,10 +10,11 @@ import {
import { predeploys } from '../src/predeploys'
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 = [
'ChainStorageContainer-CTC-batches',
'ChainStorageContainer-SCC-batches',
......
......@@ -4,14 +4,24 @@ import { ethers } from 'hardhat'
import { DeployFunction } from 'hardhat-deploy/dist/types'
/* Imports: Internal */
import { getContractFromArtifact, waitUntilTrue } from '../src/hardhat-deploy-ethers'
import {
getContractFromArtifact,
waitUntilTrue,
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts()
const addressDictator = await getContractFromArtifact(hre, 'AddressDictator', {
signerOrProvider: deployer,
})
const libAddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager')
const addressDictator = await getContractFromArtifact(
hre,
'AddressDictator',
{
signerOrProvider: deployer,
}
)
const libAddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
const namedAddresses = await addressDictator.getNamedAddresses()
const finalOwner = await addressDictator.finalOwner()
let currentOwner = await libAddressManager.owner()
......@@ -72,15 +82,18 @@ const deployFn: DeployFunction = async (hre) => {
console.log('Ownership successfully transferred. Invoking setAddresses...')
await addressDictator.setAddresses()
currentOwner = await libAddressManager.owner()
console.log('Verifying final ownership of Lib_AddressManager')
if (!hexStringEquals(finalOwner, currentOwner)) {
throw new Error(
`The current address manager owner ${currentOwner}, \nis not equal to the expected owner: ${finalOwner}`
)
} else {
console.log(`Address Manager ownership was returned to ${finalOwner}.`)
}
await waitUntilTrue(
async () => {
console.log('Verifying final ownership of Lib_AddressManager')
currentOwner = await libAddressManager.owner()
return hexStringEquals(currentOwner, finalOwner)
},
{
// Try every 10 seconds
delay: 10_000,
retries: 1000,
}
)
}
deployFn.tags = ['upgrade', 'set-addresses']
......
......@@ -3,7 +3,10 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import { hexStringEquals } from '@eth-optimism/core-utils'
/* Imports: Internal */
import { getContractFromArtifact, waitUntilTrue } from '../src/hardhat-deploy-ethers'
import {
getContractFromArtifact,
waitUntilTrue,
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts()
......@@ -19,7 +22,10 @@ const deployFn: DeployFunction = async (hre) => {
signerOrProvider: deployer,
}
)
const libAddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager')
const libAddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager'
)
await proxy.initialize(libAddressManager.address)
console.log(`Checking that contract was correctly initialized...`)
......
......@@ -3,13 +3,20 @@ import { DeployFunction } from 'hardhat-deploy/dist/types'
import { hexStringEquals } from '@eth-optimism/core-utils'
/* Imports: Internal */
import { getContractFromArtifact, waitUntilTrue } from '../src/hardhat-deploy-ethers'
import {
getContractFromArtifact,
waitUntilTrue,
} from '../src/hardhat-deploy-ethers'
const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts()
const Lib_AddressManager = await getContractFromArtifact(hre, 'Lib_AddressManager', {
signerOrProvider: deployer,
})
const Lib_AddressManager = await getContractFromArtifact(
hre,
'Lib_AddressManager',
{
signerOrProvider: deployer,
}
)
const owner = (hre as any).deployConfig.ovmAddressManagerOwner
const remoteOwner = await Lib_AddressManager.owner()
......
......@@ -68,25 +68,6 @@ task('deploy')
undefined,
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(
'numDeployConfirmations',
'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