• smartcontracts's avatar
    feat: introduce hardhat-deploy-config (#2755) · 27234f68
    smartcontracts authored
    * feat: introduce hardhat-deploy-config
    
    Creates a new package hardhat-deploy-config. We're using the same
    configuration system for all of our contracts package, so might as well
    turn it into a hardhat plugin to avoid duplicating code.
    
    * feat(ct): use hardhat-deploy-config
    
    * plugin: don't validate if spec not passed
    
    * contracts: update deps
    
    * contracts-bedrock: use deploy config plugin
    
    * contracts-bedrock: deploy instructions
    
    * contracts-bedrock: modularize deployment
    
    * contracts-bedrock: add deploy-config
    
    * contracts-bedrock: add in deploy config spec
    
    * lint: fix
    Co-authored-by: default avatarMark Tyneway <mark.tyneway@gmail.com>
    Co-authored-by: default avatarmergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
    27234f68
000-L2OutputOracle.deploy.ts 928 Bytes
/* Imports: Internal */
import { DeployFunction } from 'hardhat-deploy/dist/types'
import 'hardhat-deploy'

const deployFn: DeployFunction = async (hre) => {
  const { deploy } = hre.deployments
  const { deployer } = await hre.getNamedAccounts()

  if (
    typeof hre.deployConfig.startingBlockTimestamp !== 'number' ||
    isNaN(hre.deployConfig.startingBlockTimestamp)
  ) {
    throw new Error(
      'Cannot deploy L2OutputOracle without specifying a valid startingBlockTimestamp.'
    )
  }

  await deploy('L2OutputOracle', {
    from: deployer,
    args: [
      hre.deployConfig.submissionInterval,
      hre.deployConfig.l2BlockTime,
      hre.deployConfig.genesisOutput,
      hre.deployConfig.historicalBlocks,
      hre.deployConfig.startingBlockTimestamp,
      hre.deployConfig.sequencerAddress,
    ],
    log: true,
    waitConfirmations: 1,
  })
}

deployFn.tags = ['L2OutputOracle']

export default deployFn