Skip to content

Commit

Permalink
activate forced transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
josojo committed Feb 11, 2024
1 parent 7b7b6e5 commit 3707861
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions src/scripts/activateForcedTransactions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/* eslint-disable import/no-dynamic-require, global-require */
/* eslint-disable no-console, no-inner-declarations, no-undef, import/no-unresolved, no-restricted-syntax */
const path = require('path');
const { ethers } = require('hardhat');
require('dotenv').config({ path: path.resolve(__dirname, '../.env') });
const common = require('../common/common');

async function main() {
/*
* Check deploy parameters
* Check that every necessary parameter is fullfilled
*/
const args = process.argv.slice(2);
const deploymentName = args[0];
const deployParameters = require(`../../deployments/${deploymentName}/deploy_parameters.json`);
const deploymentOutput = require(`../../deployments/${deploymentName}/deploy_output.json`);

const mandatoryDeploymentOutput = [
'polygonZkEVMAddress',
'deployerAddress',
];
for (const parameterName of mandatoryDeploymentOutput) {
if (deploymentOutput[parameterName] === undefined || deploymentOutput[parameterName] === '') {
throw new Error(`Missing parameter: ${parameterName}`);
}
}
const {
polygonZkEVMAddress,
deployerAddress,
} = deploymentOutput;

const currentProvider = await common.loadProvider(deployParameters, process.env);
const deployer = await common.loadDeployer(currentProvider, deployParameters);

if (deployerAddress === undefined || deployerAddress.toLowerCase() !== deployer.address.toLowerCase()) {
throw new Error('Wrong deployer address');
}

const zkevm = (await ethers.getContractAt(
'contracts/ForkableZkEVM.sol:ForkableZkEVM',
polygonZkEVMAddress,
)).connect(deployer);

const tx0 = await zkevm.connect(deployer).activateForceBatches( { gasLimit: 500000 });

Check failure on line 44 in src/scripts/activateForcedTransactions.js

View workflow job for this annotation

GitHub Actions / Code linting (16.x, ubuntu-latest)

There should be no space after this paren
await tx0.wait();
console.log('Activate forced batches');
console.log('by the following tx: ', tx0.hash);

Check failure on line 47 in src/scripts/activateForcedTransactions.js

View workflow job for this annotation

GitHub Actions / Code linting (16.x, ubuntu-latest)

Block must not be padded by blank lines

}

main().catch((e) => {
console.error(e);
process.exit(1);
});

0 comments on commit 3707861

Please sign in to comment.