Commit 110b5332 authored by Mark Tyneway's avatar Mark Tyneway

contracts-bedrock: dedupe code for constants

parent 41c2ee31
...@@ -2,27 +2,19 @@ import assert from 'assert' ...@@ -2,27 +2,19 @@ import assert from 'assert'
import { DeployFunction } from 'hardhat-deploy/dist/types' import { DeployFunction } from 'hardhat-deploy/dist/types'
import '@eth-optimism/hardhat-deploy-config' import '@eth-optimism/hardhat-deploy-config'
import { ethers, BigNumber } from 'ethers' import { BigNumber } from 'ethers'
import { defaultResourceConfig } from '../src/constants'
import { assertContractVariable, deploy } from '../src/deploy-utils' import { assertContractVariable, deploy } from '../src/deploy-utils'
const uint128Max = ethers.BigNumber.from('0xffffffffffffffffffffffffffffffff')
const defaultResourceConfig = {
maxResourceLimit: 20_000_000,
elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8,
minimumBaseFee: ethers.utils.parseUnits('1', 'gwei'),
systemTxMaxGas: 1_000_000,
maximumBaseFee: uint128Max,
}
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const batcherHash = hre.ethers.utils const batcherHash = hre.ethers.utils
.hexZeroPad(hre.deployConfig.batchSenderAddress, 32) .hexZeroPad(hre.deployConfig.batchSenderAddress, 32)
.toLowerCase() .toLowerCase()
const l2GenesisBlockGasLimit = hre.deployConfig.l2GenesisBlockGasLimit const l2GenesisBlockGasLimit = BigNumber.from(
hre.deployConfig.l2GenesisBlockGasLimit
)
const l2GasLimitLowerBound = BigNumber.from( const l2GasLimitLowerBound = BigNumber.from(
defaultResourceConfig.systemTxMaxGas + defaultResourceConfig.systemTxMaxGas +
defaultResourceConfig.maxResourceLimit defaultResourceConfig.maxResourceLimit
......
import assert from 'assert' import assert from 'assert'
import { ethers, BigNumber } from 'ethers' import { ethers } from 'ethers'
import { DeployFunction } from 'hardhat-deploy/dist/types' import { DeployFunction } from 'hardhat-deploy/dist/types'
import { awaitCondition } from '@eth-optimism/core-utils' import { awaitCondition } from '@eth-optimism/core-utils'
import '@eth-optimism/hardhat-deploy-config' import '@eth-optimism/hardhat-deploy-config'
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
getContractsFromArtifacts, getContractsFromArtifacts,
getDeploymentAddress, getDeploymentAddress,
} from '../src/deploy-utils' } from '../src/deploy-utils'
import { defaultResourceConfig } from '../src/constants'
const deployFn: DeployFunction = async (hre) => { const deployFn: DeployFunction = async (hre) => {
const { deployer } = await hre.getNamedAccounts() const { deployer } = await hre.getNamedAccounts()
...@@ -102,16 +103,7 @@ const deployFn: DeployFunction = async (hre) => { ...@@ -102,16 +103,7 @@ const deployFn: DeployFunction = async (hre) => {
unsafeBlockSigner: hre.deployConfig.p2pSequencerAddress, unsafeBlockSigner: hre.deployConfig.p2pSequencerAddress,
// The resource config is not exposed to the end user // The resource config is not exposed to the end user
// to simplify deploy config. It may be introduced in the future. // to simplify deploy config. It may be introduced in the future.
resourceConfig: { resourceConfig: defaultResourceConfig,
maxResourceLimit: 20_000_000,
elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8,
minimumBaseFee: ethers.utils.parseUnits('1', 'gwei'),
systemTxMaxGas: 1_000_000,
maximumBaseFee: BigNumber.from(
'0xffffffffffffffffffffffffffffffff'
).toString(),
},
}, },
} }
......
import { ethers } from 'ethers'
/** /**
* Predeploys are Solidity contracts that are injected into the initial L2 state and provide * Predeploys are Solidity contracts that are injected into the initial L2 state and provide
* various useful functions. * various useful functions.
...@@ -26,3 +28,14 @@ export const predeploys = { ...@@ -26,3 +28,14 @@ export const predeploys = {
BaseFeeVault: '0x4200000000000000000000000000000000000019', BaseFeeVault: '0x4200000000000000000000000000000000000019',
L1FeeVault: '0x420000000000000000000000000000000000001a', L1FeeVault: '0x420000000000000000000000000000000000001a',
} }
const uint128Max = ethers.BigNumber.from('0xffffffffffffffffffffffffffffffff')
export const defaultResourceConfig = {
maxResourceLimit: 20_000_000,
elasticityMultiplier: 10,
baseFeeMaxChangeDenominator: 8,
minimumBaseFee: ethers.utils.parseUnits('1', 'gwei'),
systemTxMaxGas: 1_000_000,
maximumBaseFee: uint128Max,
}
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