-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
initiate eigenlayer project and eigenlayer source, add v2_withdrawal_…
…queued_flattened data model
- Loading branch information
Showing
3 changed files
with
93 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
dbt_subprojects/daily_spellbook/models/eigenlayer/eigenlayer_schema.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
51 changes: 51 additions & 0 deletions
51
dbt_subprojects/daily_spellbook/models/eigenlayer/v2_withdrawal_queued_flattened.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |