From 2cd705479ffe10716b0ed272a3a7bd5a35f7ca26 Mon Sep 17 00:00:00 2001 From: Liam Horne Date: Wed, 5 May 2021 20:30:26 -0700 Subject: [PATCH] build: add artifacts to dist --- packages/contracts/src/contract-data.ts | 147 +++++++++++++++++++----- packages/contracts/tsconfig.json | 4 +- 2 files changed, 120 insertions(+), 31 deletions(-) diff --git a/packages/contracts/src/contract-data.ts b/packages/contracts/src/contract-data.ts index 586b5a2504c7..404a3ebd6a7e 100644 --- a/packages/contracts/src/contract-data.ts +++ b/packages/contracts/src/contract-data.ts @@ -2,36 +2,125 @@ import * as path from 'path' import { predeploys as l2Addresses } from './predeploys' import { Network } from './connect-contracts' +const Mainnet__Lib_AddressManager = require('../deployments/mainnet/Lib_AddressManager.json') +const Mainnet__OVM_CanonicalTransactionChain = require('../deployments/mainnet/OVM_CanonicalTransactionChain.json') +const Mainnet__OVM_ExecutionManager = require('../deployments/mainnet/OVM_ExecutionManager.json') +const Mainnet__OVM_FraudVerifier = require('../deployments/mainnet/OVM_FraudVerifier.json') +const Mainnet__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/OVM_L1CrossDomainMessenger.json') +const Mainnet__OVM_L1ETHGateway = require('../deployments/mainnet/OVM_L1ETHGateway.json') +const Mainnet__OVM_L1MultiMessageRelayer = require('../deployments/mainnet/OVM_L1MultiMessageRelayer.json') +const Mainnet__OVM_SafetyChecker = require('../deployments/mainnet/OVM_SafetyChecker.json') +const Mainnet__OVM_StateCommitmentChain = require('../deployments/mainnet/OVM_StateCommitmentChain.json') +const Mainnet__OVM_StateManagerFactory = require('../deployments/mainnet/OVM_StateManagerFactory.json') +const Mainnet__OVM_StateTransitionerFactory = require('../deployments/mainnet/OVM_StateTransitionerFactory.json') +const Mainnet__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/mainnet/Proxy__OVM_L1CrossDomainMessenger.json') +const Mainnet__Proxy__OVM_L1ETHGateway = require('../deployments/mainnet/Proxy__OVM_L1ETHGateway.json') +const Mainnet__mockOVM_BondManager = require('../deployments/mainnet/mockOVM_BondManager.json') + +const Kovan__Lib_AddressManager = require('../deployments/kovan/Lib_AddressManager.json') +const Kovan__OVM_CanonicalTransactionChain = require('../deployments/kovan/OVM_CanonicalTransactionChain.json') +const Kovan__OVM_ExecutionManager = require('../deployments/kovan/OVM_ExecutionManager.json') +const Kovan__OVM_FraudVerifier = require('../deployments/kovan/OVM_FraudVerifier.json') +const Kovan__OVM_L1CrossDomainMessenger = require('../deployments/kovan/OVM_L1CrossDomainMessenger.json') +const Kovan__OVM_L1ETHGateway = require('../deployments/kovan/OVM_L1ETHGateway.json') +const Kovan__OVM_L1MultiMessageRelayer = require('../deployments/kovan/OVM_L1MultiMessageRelayer.json') +const Kovan__OVM_SafetyChecker = require('../deployments/kovan/OVM_SafetyChecker.json') +const Kovan__OVM_StateCommitmentChain = require('../deployments/kovan/OVM_StateCommitmentChain.json') +const Kovan__OVM_StateManagerFactory = require('../deployments/kovan/OVM_StateManagerFactory.json') +const Kovan__OVM_StateTransitionerFactory = require('../deployments/kovan/OVM_StateTransitionerFactory.json') +const Kovan__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/kovan/Proxy__OVM_L1CrossDomainMessenger.json') +const Kovan__Proxy__OVM_L1ETHGateway = require('../deployments/kovan/Proxy__OVM_L1ETHGateway.json') +const Kovan__mockOVM_BondManager = require('../deployments/kovan/mockOVM_BondManager.json') + +const Goerli__Lib_AddressManager = require('../deployments/goerli/Lib_AddressManager.json') +const Goerli__OVM_CanonicalTransactionChain = require('../deployments/goerli/OVM_CanonicalTransactionChain.json') +const Goerli__OVM_ExecutionManager = require('../deployments/goerli/OVM_ExecutionManager.json') +const Goerli__OVM_FraudVerifier = require('../deployments/goerli/OVM_FraudVerifier.json') +const Goerli__OVM_L1CrossDomainMessenger = require('../deployments/goerli/OVM_L1CrossDomainMessenger.json') +const Goerli__OVM_L1ETHGateway = require('../deployments/goerli/OVM_L1ETHGateway.json') +const Goerli__OVM_L1MultiMessageRelayer = require('../deployments/goerli/OVM_L1MultiMessageRelayer.json') +const Goerli__OVM_SafetyChecker = require('../deployments/goerli/OVM_SafetyChecker.json') +const Goerli__OVM_StateCommitmentChain = require('../deployments/goerli/OVM_StateCommitmentChain.json') +const Goerli__OVM_StateManagerFactory = require('../deployments/goerli/OVM_StateManagerFactory.json') +const Goerli__OVM_StateTransitionerFactory = require('../deployments/goerli/OVM_StateTransitionerFactory.json') +const Goerli__Proxy__OVM_L1CrossDomainMessenger = require('../deployments/goerli/Proxy__OVM_L1CrossDomainMessenger.json') +const Goerli__Proxy__OVM_L1ETHGateway = require('../deployments/goerli/Proxy__OVM_L1ETHGateway.json') +const Goerli__mockOVM_BondManager = require('../deployments/goerli/mockOVM_BondManager.json') + + export const getL1ContractData = (network: Network) => { - const contractNames = [ - 'Lib_AddressManager', - 'OVM_CanonicalTransactionChain', - 'OVM_ExecutionManager', - 'OVM_FraudVerifier', - 'OVM_L1CrossDomainMessenger', - 'OVM_L1ETHGateway', - 'OVM_L1MultiMessageRelayer', - 'OVM_SafetyChecker', - 'OVM_StateCommitmentChain', - 'OVM_StateManagerFactory', - 'OVM_StateTransitionerFactory', - 'Proxy__OVM_L1CrossDomainMessenger', - 'Proxy__OVM_L1ETHGateway', - 'mockOVM_BondManager', - ] - return contractNames.reduce( - ( - contractData: { [key: string]: { address: string; abi: any[] } }, - contractName - ) => { - contractData[contractName] = require(path.resolve( - __dirname, - `../deployments/${network}/${contractName}.json` - )) - return contractData - }, - {} - ) + return { + 'Lib_AddressManager': { + mainnet: Mainnet__Lib_AddressManager, + kovan: Kovan__Lib_AddressManager, + goerli: Goerli__Lib_AddressManager + }[network], + 'OVM_CanonicalTransactionChain': { + mainnet: Mainnet__OVM_CanonicalTransactionChain, + kovan: Kovan__OVM_CanonicalTransactionChain, + goerli: Goerli__OVM_CanonicalTransactionChain + }[network], + 'OVM_ExecutionManager': { + mainnet: Mainnet__OVM_ExecutionManager, + kovan: Kovan__OVM_ExecutionManager, + goerli: Goerli__OVM_ExecutionManager + }[network], + 'OVM_FraudVerifier': { + mainnet: Mainnet__OVM_FraudVerifier, + kovan: Kovan__OVM_FraudVerifier, + goerli: Goerli__OVM_FraudVerifier + }[network], + 'OVM_L1CrossDomainMessenger': { + mainnet: Mainnet__OVM_L1CrossDomainMessenger, + kovan: Kovan__OVM_L1CrossDomainMessenger, + goerli: Goerli__OVM_L1CrossDomainMessenger + }[network], + 'OVM_L1ETHGateway': { + mainnet: Mainnet__OVM_L1ETHGateway, + kovan: Kovan__OVM_L1ETHGateway, + goerli: Goerli__OVM_L1ETHGateway + }[network], + 'OVM_L1MultiMessageRelayer': { + mainnet: Mainnet__OVM_L1MultiMessageRelayer, + kovan: Kovan__OVM_L1MultiMessageRelayer, + goerli: Goerli__OVM_L1MultiMessageRelayer + }[network], + 'OVM_SafetyChecker': { + mainnet: Mainnet__OVM_SafetyChecker, + kovan: Kovan__OVM_SafetyChecker, + goerli: Goerli__OVM_SafetyChecker + }[network], + 'OVM_StateCommitmentChain': { + mainnet: Mainnet__OVM_StateCommitmentChain, + kovan: Kovan__OVM_StateCommitmentChain, + goerli: Goerli__OVM_StateCommitmentChain + }[network], + 'OVM_StateManagerFactory': { + mainnet: Mainnet__OVM_StateManagerFactory, + kovan: Kovan__OVM_StateManagerFactory, + goerli: Goerli__OVM_StateManagerFactory + }[network], + 'OVM_StateTransitionerFactory': { + mainnet: Mainnet__OVM_StateTransitionerFactory, + kovan: Kovan__OVM_StateTransitionerFactory, + goerli: Goerli__OVM_StateTransitionerFactory + }[network], + 'Proxy__OVM_L1CrossDomainMessenger': { + mainnet: Mainnet__Proxy__OVM_L1CrossDomainMessenger, + kovan: Kovan__Proxy__OVM_L1CrossDomainMessenger, + goerli: Goerli__Proxy__OVM_L1CrossDomainMessenger + }[network], + 'Proxy__OVM_L1ETHGateway': { + mainnet: Mainnet__Proxy__OVM_L1ETHGateway, + kovan: Kovan__Proxy__OVM_L1ETHGateway, + goerli: Goerli__Proxy__OVM_L1ETHGateway + }[network], + 'mockOVM_BondManager': { + mainnet: Mainnet__mockOVM_BondManager, + kovan: Kovan__mockOVM_BondManager, + goerli: Goerli__mockOVM_BondManager + }[network], + } } export const getL2ContractData = () => { diff --git a/packages/contracts/tsconfig.json b/packages/contracts/tsconfig.json index 31f3c37def37..9622d152c5da 100644 --- a/packages/contracts/tsconfig.json +++ b/packages/contracts/tsconfig.json @@ -1,8 +1,8 @@ { "extends": "../../tsconfig.json", "compilerOptions": { - "resolveJsonModule": true + "resolveJsonModule": true }, - "include": ["./test**/*", "src/**/*"], + "include": ["./test", "src/**/*", "deployments"], "files": ["./hardhat.config.ts"] }