Commit 8fc55444 authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: add deploy files

Add the L1 deployment files for:
- `L1ERC721Bridge`
- `L1ERC721BridgeProxy`
parent 0fe6c13a
......@@ -9,6 +9,7 @@ const proxies = [
'L1StandardBridgeProxy',
'OptimismPortalProxy',
'OptimismMintableERC20FactoryProxy',
'L1ERC721BridgeProxy',
]
const deployFn: DeployFunction = async (hre) => {
......
......@@ -5,6 +5,8 @@ import 'hardhat-deploy'
import '@nomiclabs/hardhat-ethers'
import '@eth-optimism/hardhat-deploy-config'
import { predeploys } from '../src/constants'
const upgradeABIs = {
L2OutputOracleProxy: async (deployConfig) => [
'initialize(bytes32,address,address)',
......@@ -39,6 +41,7 @@ const deployFn: DeployFunction = async (hre) => {
const portalProxy = await get('OptimismPortalProxy')
const messengerProxy = await get('L1CrossDomainMessengerProxy')
const bridgeProxy = await get('L1StandardBridgeProxy')
const erc721BridgeProxy = await get('L1ERC721BridgeProxy')
let nonce = await l1.getTransactionCount(deployer)
const implTxs = [
......@@ -100,6 +103,13 @@ const deployFn: DeployFunction = async (hre) => {
waitConfirmations: deployConfig.deploymentWaitConfirmations,
nonce: ++nonce,
}),
deploy('L1ERC721Bridge', {
from: deployer,
args: [messengerProxy.address, predeploys.L2ERC721Bridge],
log: true,
waitConfirmations: deployConfig.waitConfirmations,
nonce: ++nonce,
}),
]
await Promise.all(implTxs)
......@@ -154,11 +164,23 @@ const deployFn: DeployFunction = async (hre) => {
await tx.wait()
console.log('Done')
const erc721Bridge = await get('L1ERC721Bridge')
const erc721BridgeProxyContract = await hre.ethers.getContractAt(
'Proxy',
erc721BridgeProxy.address
)
console.log(`Upgrading L1ERC721Bridge at ${erc721Bridge.address}`)
tx = await erc721BridgeProxyContract.upgradeTo(erc721Bridge.address)
console.log(`Awaiting TX hash ${tx.hash}.`)
await tx.wait()
console.log('Done')
await validateOracle(hre, deployConfig, deployL2StartingTimestamp)
await validatePortal(hre)
await validateMessenger(hre)
await validateBridge(hre)
await validateTokenFactory(hre)
await validateERC721Bridge(hre)
}
const validateOracle = async (hre, deployConfig, deployL2StartingTimestamp) => {
......@@ -244,6 +266,23 @@ const validateBridge = async (hre) => {
}
}
// The messenger address should be set to the proxy messenger
// The other bridge should be set to the predeploy on L2
const validateERC721Bridge = async (hre) => {
const messenger = await hre.deployments.get('L1CrossDomainMessengerProxy')
const proxy = await hre.deployments.get('L1ERC721BridgeProxy')
const L1ERC721Bridge = await hre.ethers.getContractAt(
'L1ERC721Bridge',
proxy.address
)
if (messenger.address !== (await L1ERC721Bridge.messenger())) {
throw new Error('misconfigured messenger')
}
if ((await L1ERC721Bridge.otherBridge()) !== predeploys.L2ERC721Bridge) {
throw new Error('misconfigured otherBridge')
}
}
const validateTokenFactory = async (hre) => {
const bridge = await hre.deployments.get('L1StandardBridgeProxy')
const proxy = await hre.deployments.get('OptimismMintableERC20FactoryProxy')
......
......@@ -14,6 +14,7 @@ const deployFn: DeployFunction = async (hre) => {
'L1StandardBridgeProxy',
'OptimismPortalProxy',
'OptimismMintableERC20FactoryProxy',
'L1ERC721BridgeProxy',
]
// Wait on all the txs in parallel so that the deployment goes faster
......
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