mirror of
https://github.com/scroll-tech/scroll.git
synced 2026-01-14 08:28:02 -05:00
Co-authored-by: Haichen Shen <shenhaichen@gmail.com> Co-authored-by: maskpp <maskpp266@gmail.com> Co-authored-by: Lawliet-Chan <1576710154@qq.com> Co-authored-by: xinran chen <lawliet@xinran-m1x.local> Co-authored-by: HAOYUatHZ <haoyu@protonmail.com> Co-authored-by: Orest Tarasiuk <830847+OrestTa@users.noreply.github.com> Co-authored-by: colin <102356659+colinlyguo@users.noreply.github.com> Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com> Co-authored-by: Péter Garamvölgyi <peter@scroll.io>
43 lines
1.5 KiB
TypeScript
43 lines
1.5 KiB
TypeScript
/* eslint-disable node/no-missing-import */
|
|
import * as dotenv from "dotenv";
|
|
import { constants } from "ethers";
|
|
|
|
import * as hre from "hardhat";
|
|
import { ethers } from "hardhat";
|
|
import { selectAddressFile } from "./utils";
|
|
|
|
dotenv.config();
|
|
|
|
const L1_MESSAGE_QUEUE = process.env.L1_MESSAGE_QUEUE || "none";
|
|
|
|
async function main() {
|
|
const addressFile = selectAddressFile(hre.network.name);
|
|
|
|
const [deployer] = await ethers.getSigners();
|
|
|
|
const ScrollChain = await ethers.getContractAt("ScrollChain", addressFile.get("ScrollChain.proxy"), deployer);
|
|
|
|
if ((await ScrollChain.owner()) === constants.AddressZero) {
|
|
const tx = await ScrollChain.initialize(L1_MESSAGE_QUEUE, constants.AddressZero);
|
|
console.log("initialize ScrollChain, hash:", tx.hash);
|
|
const receipt = await tx.wait();
|
|
console.log(`✅ Done, gas used: ${receipt.gasUsed}`);
|
|
}
|
|
|
|
const L1RollupOperatorAddress = process.env.L1_ROLLUP_OPERATOR_ADDR!;
|
|
if ((await ScrollChain.isBatchFinalized(L1RollupOperatorAddress)) === false) {
|
|
console.log("L1_ROLLUP_OPERATOR_ADDR", L1RollupOperatorAddress);
|
|
const tx = await ScrollChain.updateSequencer(L1RollupOperatorAddress, true);
|
|
console.log("updateOperator ScrollChain, hash:", tx.hash);
|
|
const receipt = await tx.wait();
|
|
console.log(`✅ Done, gas used: ${receipt.gasUsed}`);
|
|
}
|
|
}
|
|
|
|
// We recommend this pattern to be able to use async/await everywhere
|
|
// and properly handle errors.
|
|
main().catch((error) => {
|
|
console.error(error);
|
|
process.exitCode = 1;
|
|
});
|