Skip to content

Commit

Permalink
initiate eigenlayer project and eigenlayer source, add v2_withdrawal_…
Browse files Browse the repository at this point in the history
…queued_flattened data model
  • Loading branch information
bowenli86 committed Feb 5, 2025
1 parent 3725c08 commit 6bc5a59
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
version: 2

models:
- name: v2_withdrawal_queued_flattened
meta:
blockchain: ethereum
sector: restaking
contributors: bowenli
config:
tags: ['eigenlayer', 'restaking', 'withdrawal']
description: >
FlattenedV2 withdrawal queued events from EigenLayer
columns:
- &evt_block_time
name: evt_block_time
description: 'Block time in UTC'
- &evt_block_number
name: evt_block_number
description: 'Block Number'
- &evt_tx_hash
name: evt_tx_hash
description: 'Tx Hash'
- &evt_index
name: evt_index
description: "Event index"
- &withdrawalRoot
name: withdrawalRoot
description: "Withdrawal hash root"
- &strategy
name: strategy
description: "Strategy to withdraw from"
- &share
name: share
description: "Share of the withdrawal"
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{
config(
schema = 'eigenlayer',
alias = 'v2_withdrawal_queued_flattened',
post_hook='{{ expose_spells(\'["ethereum"]\',
"project",
"eigenlayer",
\'["bowenli"]\') }}'
)
}}


WITH
parsed_data AS (
SELECT
evt_tx_hash,
evt_index,
evt_block_time,
evt_block_number,
withdrawalRoot,
JSON_PARSE(withdrawal) AS parsed_withdrawal
FROM
{{ source('eigenlayer_ethereum', 'DelegationManager_evt_WithdrawalQueued') }}
)
SELECT
t.evt_tx_hash,
t.evt_index,
t.evt_block_time,
t.evt_block_number,
t.withdrawalRoot,
u.strategy,
v.share
FROM
parsed_data AS t
CROSS JOIN UNNEST (
TRY_CAST(
JSON_EXTRACT(parsed_withdrawal, '$.strategies') AS ARRAY(VARCHAR)
)
)
WITH
ORDINALITY AS u (strategy, ordinality)
CROSS JOIN UNNEST (
TRY_CAST(
JSON_EXTRACT(parsed_withdrawal, '$.shares') AS ARRAY(VARCHAR)
)
)
WITH
ORDINALITY AS v (share, ordinality)
WHERE
u.ordinality = v.ordinality
AND evt_block_number >= 19613848
8 changes: 8 additions & 0 deletions sources/eigenlayer/eigenlayer_ethereum_sources.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: 2

sources:
- name: eigenlayer_ethereum
description: "Decoded contracts for EigenLayer on Ethereum"

tables:
- name: DelegationManager_evt_WithdrawalQueued

0 comments on commit 6bc5a59

Please sign in to comment.