Skip to content

Commit 4d2a755

Browse files
authored
feat: add 4337 source and staging models (#3127)
* feat: add 4337 source and staging models * feat(docs): add 4337 source to docs
1 parent f51a5f9 commit 4d2a755

File tree

4 files changed

+118
-0
lines changed

4 files changed

+118
-0
lines changed

apps/docs/docs/integrate/datasets/index.mdx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,13 @@ Here are some of our featured public datasets:
6767
</div>
6868
<h3>Superchain</h3>
6969
</a>
70+
<a href="#superchain-4337" className="datalink-card">
71+
<div className="datalink-header">
72+
<img src={OptimismLogo} alt="Optimism Logo" className="datalink-logo" />
73+
<span className="tag">Updated daily</span>
74+
</div>
75+
<h3>Superchain 4337</h3>
76+
</a>
7077
<a href="#arbitrum-one" className="datalink-card">
7178
<div className="datalink-header">
7279
<img src={ArbitrumLogo} alt="Arbitrum Logo" className="datalink-logo" />
@@ -475,6 +482,37 @@ For example, to get all transactions to the 4337 EntryPoint contracts for all OP
475482
order by dt, chain
476483
```
477484

485+
### Superchain 4337
486+
487+
<img src={OptimismLogo} width="100" />
488+
489+
<Button
490+
size={"compact"}
491+
color={"blue"}
492+
target={"_blank"}
493+
link={
494+
"https://console.cloud.google.com/bigquery/analytics-hub/exchanges/projects/87806073973/locations/us/dataExchanges/open_source_observer_190181416ae/listings/superchain_4337_account_abstraction_data"
495+
}
496+
children={"Subscribe on BigQuery"}
497+
/>{" "}
498+
499+
The Superchain 4337 dataset provides comprehensive data about ERC-4337 (Account Abstraction) activity across all OP Stack chains. This dataset is crucial for understanding the adoption and usage patterns of smart contract wallets, bundlers, and paymasters in the Superchain ecosystem. The data helps track which applications are leading the way in improving onchain UX through account abstraction.
500+
501+
All tables are partitioned by date (`dt`) and clustered by chain name (`chain`). The dataset includes decoded UserOps and Paymaster IDs to trace events from unique user smart contract wallet addresses to their wallet providers, paymasters, bundlers, and the applications they interact with.
502+
503+
For example, to see which paymasters are handling the most UserOperations across all chains:
504+
505+
```sql
506+
select
507+
chain,
508+
paymaster,
509+
approx_count_distinct(userophash) as user_ops
510+
from `optimism_superchain_4337_account_abstraction_data.useroperationevent_logs_v1`
511+
where dt > '2025-02-01'
512+
group by 1,2
513+
order by 3 desc
514+
```
515+
478516
### Arbitrum One
479517

480518
<img src={ArbitrumLogo} width="100" />
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
MODEL (
2+
name metrics.stg_superchain__4337_traces,
3+
kind INCREMENTAL_BY_TIME_RANGE (
4+
time_column block_timestamp,
5+
batch_size 180,
6+
batch_concurrency 1,
7+
lookback 7
8+
),
9+
start '2021-10-01',
10+
cron '@daily',
11+
partitioned_by (DAY("block_timestamp"), "chain"),
12+
grain (block_timestamp, chain, transaction_hash, userop_hash, from_address, to_address, sender_address, paymaster_address, method_id)
13+
);
14+
15+
select
16+
@from_unix_timestamp(block_timestamp) as block_timestamp,
17+
transaction_hash,
18+
userop_hash,
19+
from_address,
20+
to_address,
21+
userop_sender as sender_address,
22+
userop_paymaster as paymaster_address,
23+
CAST(useropevent_actualgascost AS DECIMAL(38, 0)) as userop_gas_price,
24+
CAST(useropevent_actualgasused AS DECIMAL(38, 0)) as userop_gas_used,
25+
CAST(value AS DECIMAL(38, 0)) as value,
26+
method_id,
27+
@chain_name(chain) as chain
28+
from @oso_source('bigquery.optimism_superchain_4337_account_abstraction_data.enriched_entrypoint_traces_v1')
29+
where
30+
network = 'mainnet'
31+
and status = '1'
32+
and trace_type in ('call', 'create', 'create2')
33+
and call_type != 'staticcall'
34+
and useropevent_success = true
35+
-- Bigquery requires we specify partitions to filter for this data source
36+
and dt between @start_dt and @end_dt
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
MODEL (
2+
name metrics.stg_superchain__4337_userop_logs,
3+
kind INCREMENTAL_BY_TIME_RANGE (
4+
time_column block_timestamp,
5+
batch_size 180,
6+
batch_concurrency 1,
7+
lookback 7
8+
),
9+
start '2021-10-01',
10+
cron '@daily',
11+
partitioned_by (DAY("block_timestamp"), "chain"),
12+
grain (block_timestamp, chain, transaction_hash, userop_hash, sender_address, paymaster_address, contract_address)
13+
);
14+
15+
select
16+
@from_unix_timestamp(block_timestamp) as block_timestamp,
17+
transaction_hash,
18+
userophash as userop_hash,
19+
sender as sender_address,
20+
paymaster as paymaster_address,
21+
contract_address,
22+
CAST(actualGasCost AS DECIMAL(38, 0)) as userop_gas_price,
23+
CAST(actualGasUsed AS DECIMAL(38, 0)) as userop_gas_used,
24+
@chain_name(chain) as chain
25+
from @oso_source('bigquery.optimism_superchain_4337_account_abstraction_data.useroperationevent_logs_v1')
26+
where
27+
network = 'mainnet'
28+
and success = true
29+
-- Bigquery requires we specify partitions to filter for this data source
30+
and dt between @start_dt and @end_dt

warehouse/metrics_tools/local/utils.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,20 @@
6262
),
6363
table="bigquery.optimism_superchain_raw_onchain_data.traces",
6464
),
65+
"opensource-observer.optimism_superchain_4337_account_abstraction_data.useroperationevent_logs_v1": TableMappingDestination(
66+
row_restriction=RowRestriction(
67+
time_column="dt",
68+
wheres=["chain_id = 252"],
69+
),
70+
table="bigquery.optimism_superchain_4337_account_abstraction_data.useroperationevent_logs_v1",
71+
),
72+
"opensource-observer.optimism_superchain_4337_account_abstraction_data.enriched_entrypoint_traces_v1": TableMappingDestination(
73+
row_restriction=RowRestriction(
74+
time_column="dt",
75+
wheres=["chain_id = 252"],
76+
),
77+
table="bigquery.optimism_superchain_4337_account_abstraction_data.enriched_entrypoint_traces_v1",
78+
),
6579
}
6680

6781
defillama_tables = {

0 commit comments

Comments
 (0)