Skip to content

Commit

Permalink
feat(validtor-bot): function to find latest l2 batch on l1
Browse files Browse the repository at this point in the history
  • Loading branch information
madhurMongia committed Oct 14, 2024
1 parent 03aa3b8 commit 6a53b6a
Show file tree
Hide file tree
Showing 7 changed files with 264 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0x72c7d51647cBeaca636d0E20A66ca2F682da3539",
"address": "0x854374483572FFcD4d0225290346279d0718240b",
"abi": [
{
"inputs": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0xa3C6608539693C13434e4E29c9aB53Dd029178BE",
"address": "0x2f1788F7B74e01c4C85578748290467A5f063B0b",
"abi": [
{
"inputs": [
Expand Down
3 changes: 3 additions & 0 deletions relayer-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,8 @@
"typescript": "^4.9.5",
"web3": "^1.10.4",
"web3-batched-send": "^1.0.3"
},
"devDependencies": {
"ts-node": "^10.9.2"
}
}
8 changes: 4 additions & 4 deletions relayer-cli/src/devnetRelayExample.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { relayAllFrom } from "./utils/relay";
import * as fs from "fs";

// let chain_ids = [5, 10200];
let chain_ids = [11155111];
const epochPeriod = 1800; // 30 min
let chain_ids = [10200, 11155111];
const epochPeriod = 3600; // 30 min
["SIGINT", "SIGTERM", "SIGQUIT", "EXIT", "MODULE_NOT_FOUND"].forEach((signal) =>
process.on(signal, async () => {
console.log("exit");
Expand All @@ -22,7 +22,7 @@ const epochPeriod = 1800; // 30 min
for (const chain_id of chain_ids) {
let nonce = await initialize(chain_id);
// This is libghtbulb switch address in arbitrum sepolia
const sender = "0x28d6D503F4c5734cD926E96b63C61527d975B382";
const sender = "0x79bbe10dd6625ae26eb857d5940154f8765dba82";
nonce = await relayAllFrom(chain_id, nonce, sender);
if (nonce != null) await updateStateFile(chain_id, Math.floor(Date.now() / 1000), nonce);
}
Expand All @@ -34,7 +34,7 @@ const epochPeriod = 1800; // 30 min
})();

async function initialize(chain_id: number): Promise<number> {
if (chain_id !== 11155111) throw new Error("Invalid chainid");
if (!chain_ids.includes(chain_id)) throw new Error("Invalid chainid");

const lock_file_name = "./src/state/" + chain_id + ".pid";

Expand Down
8 changes: 6 additions & 2 deletions validator-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,11 @@
"scripts": {
"start": "npx ts-node ./src/ArbToEth/watcher.ts",
"start-chiado-devnet": "npx ts-node ./src/devnet/arbToChiado/happyPath.ts",
"start-sepolia-devnet": "npx ts-node ./src/devnet/arbToSepolia/happyPath.ts"
"start-sepolia-devnet": "npx ts-node ./src/devnet/arbToSepolia/happyPath.ts",
"start-chaido-testnet": "npx ts-node ./src/ArbToEth/watcherArbToGnosis.ts"
},
"dependencies": {
"@arbitrum/sdk": "^3.1.2",
"@arbitrum/sdk": "4.0.1",
"@flashbots/ethers-provider-bundle": "^0.6.2",
"@kleros/vea-contracts": "workspace:^",
"@typechain/ethers-v5": "^10.2.0",
Expand All @@ -24,5 +25,8 @@
"typescript": "^4.9.5",
"web3": "^1.10.4",
"web3-batched-send": "^1.0.3"
},
"devDependencies": {
"ts-node": "^10.9.2"
}
}
Loading

0 comments on commit 6a53b6a

Please sign in to comment.