Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
/* Imports: External */
import { ethers } from 'ethers'
import { LedgerSigner } from '@ethersproject/hardware-wallets'
import { task } from 'hardhat/config'
import * as types from 'hardhat/internal/core/params/argumentTypes'
/* Imports: Internal */
import { executeActionsFromConfig } from '../src'
task('chugsplash-deploy', 'Deploys an action bundle to L2')
.addParam('l2NodeUrl', 'Url to L2 node', types.string)
.addParam('ledgerHdPath', 'HD path to Ledger for signing executeAction txs', types.string)
.addParam('chugsplashDeployerAddress', 'Address of the ChugSplash deployer contract', types.string)
.addParam('upgradeConfigPath', 'Path to upgrade configuration JSON file', types.inputFile)
.addOptionalParam('timeoutInMs', 'Amount of time to wait before timing out of deploy in milliseconds', types.int)
.addOptionalParam('retryIntervalInMs', 'Amount of time to wait before checking for new action bundle', types.int)
.setAction(async (args, hre: any) => {
const l2Provider = new ethers.providers.JsonRpcProvider(args.l2NodeUrl)
const signer = new LedgerSigner(
l2Provider,
'default',
args.ledgerHdPath
)
return await executeActionsFromConfig({
hre,
signer,
chugsplashDeployerAddress: args.chugsplashDeployerAddress,
upgradeConfigPath: args.upgradeConfigPath,
timeoutInMs: args.timeoutInMs,
retryIntervalInMs: args.retryIntervalInMsconst DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS = 60 * 60 * 24 * 30 // 30 days
const DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT = 9_000_000
const DEFAULT_EM_MIN_TRANSACTION_GAS_LIMIT = 50_000
const DEFAULT_EM_MAX_TRANSACTION_GAS_LIMIT = 9_000_000
const DEFAULT_EM_MAX_GAS_PER_QUEUE_PER_EPOCH = 250_000_000
const DEFAULT_EM_SECONDS_PER_EPOCH = 0
const DEFAULT_EM_OVM_CHAIN_ID = 420
const DEFAULT_SCC_FRAUD_PROOF_WINDOW = 60 * 60 * 24 * 7 // 7 days
const DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW = 60 * 30 // 30 minutes
task('deploy')
.addOptionalParam(
'l1BlockTimeSeconds',
'Number of seconds on average between every L1 block.',
DEFAULT_L1_BLOCK_TIME_SECONDS,
types.int
)
.addOptionalParam(
'ctcForceInclusionPeriodSeconds',
'Number of seconds that the sequencer has to include transactions before the L1 queue.',
DEFAULT_CTC_FORCE_INCLUSION_PERIOD_SECONDS,
types.int
)
.addOptionalParam(
'ctcMaxTransactionGasLimit',
'Max gas limit for L1 queue transactions.',
DEFAULT_CTC_MAX_TRANSACTION_GAS_LIMIT,
types.int
)
.addOptionalParam(
'emMinTransactionGasLimit',
'Minimum allowed transaction gas limit.',/* Imports: External */
import { ethers } from 'ethers'
import { LedgerSigner } from '@ethersproject/hardware-wallets'
import { task } from 'hardhat/config'
import * as types from 'hardhat/internal/core/params/argumentTypes'
/* Imports: Internal */
import { executeActionsFromConfig } from '../src'
task('chugsplash-deploy', 'Deploys an action bundle to L2')
.addParam('l2NodeUrl', 'Url to L2 node', types.string)
.addParam('ledgerHdPath', 'HD path to Ledger for signing executeAction txs', types.string)
.addParam('chugsplashDeployerAddress', 'Address of the ChugSplash deployer contract', types.string)
.addParam('upgradeConfigPath', 'Path to upgrade configuration JSON file', types.inputFile)
.addOptionalParam('timeoutInMs', 'Amount of time to wait before timing out of deploy in milliseconds', types.int)
.addOptionalParam('retryIntervalInMs', 'Amount of time to wait before checking for new action bundle', types.int)
.setAction(async (args, hre: any) => {
const l2Provider = new ethers.providers.JsonRpcProvider(args.l2NodeUrl)
const signer = new LedgerSigner(
l2Provider,
'default',
args.ledgerHdPath
)
return await executeActionsFromConfig({
hre,
signer,
chugsplashDeployerAddress: args.chugsplashDeployerAddress,
upgradeConfigPath: args.upgradeConfigPath,
timeoutInMs: args.timeoutInMs,
retryIntervalInMs: args.retryIntervalInMs
})'emSecondsPerEpoch',
'Number of seconds in each epoch.',
DEFAULT_EM_SECONDS_PER_EPOCH,
types.int
)
.addOptionalParam(
'emOvmChainId',
'Chain ID for the L2 network.',
DEFAULT_EM_OVM_CHAIN_ID,
types.int
)
.addOptionalParam(
'sccFraudProofWindow',
'Number of seconds until a transaction is considered finalized.',
DEFAULT_SCC_FRAUD_PROOF_WINDOW,
types.int
)
.addOptionalParam(
'sccSequencerPublishWindow',
'Number of seconds that the sequencer is exclusively allowed to post state roots.',
DEFAULT_SCC_SEQUENCER_PUBLISH_WINDOW,
types.int
)
.addOptionalParam(
'ovmSequencerAddress',
'Address of the sequencer. Must be provided or this deployment will fail.',
undefined,
types.string
)
.addOptionalParam(
'ovmProposerAddress',
'Address of the account that will propose state roots. Must be provided or this deployment will fail.',