Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

initiate eigenlayer project and eigenlayer source, add v2_withdrawal_queued_flattened data model #7622

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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') }}
Comment on lines +21 to +23
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be incremental?

)
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