Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,8 @@ const deployFn: DeployFunction = async (hre) => {
]
await Promise.all(implTxs)

let tx
// Reset the nonce for the next set of transactions
nonce = await l1.getTransactionCount(deployer)

const upgradeTxs: any[] = []
for (const [proxy, upgrader] of Object.entries(upgradeABIs)) {
const upgraderOut = await upgrader(deployConfig)
const implName = proxy.replace('Proxy', '')
Expand All @@ -121,44 +119,41 @@ const deployFn: DeployFunction = async (hre) => {
'Proxy',
proxyDeployment.address
)
upgradeTxs.push(
proxyContract.upgradeToAndCall(
implContract.address,
implContract.interface.encodeFunctionData(
upgraderOut[0] as string,
upgraderOut[1] as any[]
),
{
nonce: ++nonce,
}
console.log(`Upgrading contract impl ${implName}.`)
tx = await proxyContract.upgradeToAndCall(
implContract.address,
implContract.interface.encodeFunctionData(
upgraderOut[0] as string,
upgraderOut[1] as any[]
)
)
console.log(`Awaiting TX hash ${tx.hash}.`)
await tx.wait()
console.log('Done.')
}

const bridge = await get('L1StandardBridge')
const bridgeProxyContract = await hre.ethers.getContractAt(
'Proxy',
bridgeProxy.address
)
upgradeTxs.push(
bridgeProxyContract.upgradeTo(bridge.address, {
nonce: ++nonce,
})
)
console.log(`Upgrading L1StandardBridge at ${bridge.address}.`)
tx = await bridgeProxyContract.upgradeTo(bridge.address)
console.log(`Awaiting TX hash ${tx.hash}.`)
await tx.wait()
console.log('Done')

const factory = await get('OptimismMintableERC20Factory')
const factoryProxy = await get('OptimismMintableERC20FactoryProxy')
const factoryProxyContract = await hre.ethers.getContractAt(
'Proxy',
factoryProxy.address
)
upgradeTxs.push(
factoryProxyContract.upgradeTo(factory.address, {
nonce: ++nonce,
})
)
const rawTxs = await Promise.all(upgradeTxs)
await Promise.all(rawTxs.map((tx) => tx.wait()))
console.log(`Upgrading OptimismMintableERC20Factory at ${factory.address}.`)
tx = await factoryProxyContract.upgradeTo(factory.address)
console.log(`Awaiting TX hash ${tx.hash}.`)
await tx.wait()
console.log('Done')

await validateOracle(hre, deployConfig, deployL2StartingTimestamp)
await validatePortal(hre)
Expand Down
13 changes: 3 additions & 10 deletions packages/contracts-bedrock/deploy/002-ConfigureProxyAdmin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,12 @@ const deployFn: DeployFunction = async (hre) => {
'OptimismMintableERC20FactoryProxy',
]

const { deployer } = await hre.getNamedAccounts()
let nonce = await hre.ethers.provider.getTransactionCount(deployer)
// Subtract 1 from the nonce to simplify the loop below
nonce = nonce - 1

// 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, { nonce: ++nonce })
const tx = await Proxy.changeAdmin(admin.address)
txs.push(tx)
}
await Promise.all(txs.map((tx) => tx.wait()))
Expand All @@ -38,10 +33,8 @@ const deployFn: DeployFunction = async (hre) => {
)

const postConfig = [
await AddressManager.transferOwnership(admin.address, { nonce: ++nonce }),
await ProxyAdmin.setAddressManager(addressManager.address, {
nonce: ++nonce,
}),
await AddressManager.transferOwnership(admin.address),
await ProxyAdmin.setAddressManager(addressManager.address),
]
await Promise.all(postConfig.map((tx) => tx.wait()))
}
Expand Down