Skip to content

Commit

Permalink
feat: combined rollups map module
Browse files Browse the repository at this point in the history
  • Loading branch information
catalyst17 committed Jan 5, 2024
1 parent be3c9ff commit 45bc701
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 5 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
-include .env
export

START_BLOCK ?= 18664500
START_BLOCK ?= 4051031
STOP_BLOCK ?= 0

.PHONY: build
Expand All @@ -10,7 +10,7 @@ build:

.PHONY: run
run: build
substreams run -e $(ENDPOINT) substreams.yaml map_combine_transactions -s $(START_BLOCK) -t $(STOP_BLOCK)
substreams run -e $(ENDPOINT) substreams.yaml map_combine_rollups -s $(START_BLOCK) -t $(STOP_BLOCK)

.PHONY: sink
sink: build
Expand All @@ -19,7 +19,7 @@ sink: build

.PHONY: gui
gui: build
substreams gui -e $(ENDPOINT) substreams.yaml map_combine_transactions -s $(START_BLOCK) -t $(STOP_BLOCK)
substreams gui -e $(ENDPOINT) substreams.yaml map_combine_rollups -s $(START_BLOCK) -t $(STOP_BLOCK)

.PHONY: protogen
protogen:
Expand Down
11 changes: 11 additions & 0 deletions proto/combined_rollups.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
syntax = "proto3";

package eth.rollup.v1;

import "nitro_rollup.proto";
import "op_rollup.proto";

message CombinedRollups {
repeated NitroRollup nitroRollups = 1;
repeated OPRollup opRollups = 2;
}
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
mod map_index_op_rollup_creations;
mod map_index_nitro_rollup_creations;
mod map_combine_rollups;
mod map_filter_chronicle_transactions;
mod map_filter_aa_transactions;
mod map_combine_transactions;
Expand Down
9 changes: 9 additions & 0 deletions src/map_combine_rollups.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
use crate::pb::eth::rollup::v1::{CombinedRollups, NitroRollups, OpRollups};

#[substreams::handlers::map]
fn map_combine_rollups(
nitro_rollups: NitroRollups,
op_rollups: OpRollups
) -> Result<CombinedRollups, Vec<substreams::errors::Error>> {
Ok(CombinedRollups { nitro_rollups: nitro_rollups.rollups, op_rollups: op_rollups.rollups })
}
8 changes: 8 additions & 0 deletions src/pb/eth.rollup.v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,12 @@ pub struct NitroRollup {
#[prost(message, optional, tag="13")]
pub created_at: ::core::option::Option<::prost_types::Timestamp>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CombinedRollups {
#[prost(message, repeated, tag="1")]
pub nitro_rollups: ::prost::alloc::vec::Vec<NitroRollup>,
#[prost(message, repeated, tag="2")]
pub op_rollups: ::prost::alloc::vec::Vec<OpRollup>,
}
// @@protoc_insertion_point(module)
13 changes: 11 additions & 2 deletions substreams.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ network: mainnet

protobuf:
files:
- chronicle_transaction.proto
- aa_transaction.proto
- op_rollup.proto
- nitro_rollup.proto
- combined_rollups.proto
- chronicle_transaction.proto
- aa_transaction.proto
- combined_transactions.proto
importPaths:
- ./proto
Expand All @@ -37,6 +38,14 @@ modules:
- source: sf.ethereum.type.v2.Block
output:
type: proto:eth.rollup.v1.OpRollups

- name: map_combine_rollups
kind: map
inputs:
- map: map_index_nitro_rollup_creations
- map: map_index_op_rollup_creations
output:
type: proto:eth.rollup.v1.CombinedRollups

- name: map_filter_aa_transactions
kind: map
Expand Down

0 comments on commit 45bc701

Please sign in to comment.