Skip to content

Commit

Permalink
use envs in on-fly deposits check script
Browse files Browse the repository at this point in the history
  • Loading branch information
kovalgek committed Sep 23, 2024
1 parent 32dc66a commit a05c70a
Showing 1 changed file with 11 additions and 35 deletions.
46 changes: 11 additions & 35 deletions scripts/optimism/check-deposits-concurrent.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,19 @@
import { ethers } from "ethers";
// import { ethers } from "hardhat";
import env from "../../utils/env";
import network from "../../utils/network";
import pLimit from "p-limit";

async function main() {
const networkName = env.network();
const ethOptNetwork = network.multichain(["eth", "opt"], networkName);

//http://localhost:8545
const ethereumNode = process.env["ETHEREUM_NODE"]
const optimismNode = process.env["OPTIMISM_NODE"]



// Set up providers
// const ethereumProvider = new ethers.providers.JsonRpcProvider(ethereumNode);
const ethereumProvider = new ethers.providers.JsonRpcProvider({ url: ethereumNode, timeout: 5*60*1000 } as any);
const optimismProvider = new ethers.providers.JsonRpcProvider({ url: optimismNode, timeout: 5*60*1000 } as any);
// ethereumProvider.timeout = 12;
// optimismProvider.;
const [ethereumProvider, optimismProvider] = ethOptNetwork.getProviders({
forking: env.forking()
});

// Mainnet
// const ethBridgeAddress = "0x76943C0D61395d8F2edF9060e1533529cAe05dE6"
// const optBridgeAddress = "0x8e01013243a96601a86eb3153f0d9fa4fbfb6957"

// Sepolia
const ethBridgeAddress = "0x4Abf633d9c0F4aEebB4C2E3213c7aa1b8505D332"
const optBridgeAddress = "0x635B054A092F6aE61Ce0Fddc397A704F6626510D"
const ethBridgeAddress = process.env["L1_TOKEN_BRIDGE"] ?? "0x76943C0D61395d8F2edF9060e1533529cAe05dE6"
const optBridgeAddress = process.env["L2_TOKEN_BRIDGE"] ?? "0x8e01013243a96601a86eb3153f0d9fa4fbfb6957"

// Define the ABI on the Ethereum
const ethBridgeAbi = [
Expand All @@ -49,30 +39,18 @@ async function main() {
// creation code
// MAINNET
// https://etherscan.io/tx/0x1bc90e7c6fe12e03691f7eccf025f3a244ea5a4888c7fb274f45f5e1004110ca
// const startEthBlock = 15281202;
const startEthBlock = 15281202;

// creation code
// https://optimistic.etherscan.io/tx/0xd0a75128fcedaa0acfe5ccb2740a1a47a6a8e47bca844dee23e7b4cc747ea4d1
// const startOptBlock = 17831155;



//
// L1
// https://sepolia.etherscan.io/tx/0x477453faea59acf4517a2c1abfaba450449316c587009671540e538572eb85ff
const startEthBlock = 5272290;
// L2
// https://sepolia-optimism.etherscan.io/tx/0x792eaf25c68e91879854ab4ca9b6c933a49d25bdf78a858a1c87a8d64e5c99a3
const startOptBlock = 7967186;
// const startOptBlock = 15000000;
const startOptBlock = 17831155;

const optBlockStep = 10000; // higher value leads to rpc error "no backends available for method"
const ethBlockStep = 100000;

// Get the latest block numbers from both networks
const latestEthBlock = await ethereumProvider.getBlockNumber();
const latestOptBlock = await optimismProvider.getBlockNumber();

const fetchLogs = async (
provider: ethers.providers.JsonRpcProvider,
startBlock: number,
Expand Down Expand Up @@ -178,8 +156,6 @@ async function main() {
const fromEthereum = results[0]
const fromOptimism = results[1]

// const fromOptimism = results[0]

const table: any = {}
table.L1 = {
deposits: fromEthereum.depositsTotal.toString(),
Expand Down

0 comments on commit a05c70a

Please sign in to comment.