Skip to content

Commit

Permalink
Labelling more stakers (duneanalytics#5239)
Browse files Browse the repository at this point in the history
* update chorus one`s set of pubkeys (provided by chorus one)

* 2 more

* fix

* add more staking entities

* add Liquid restaking as a staking category

* add liquid restaking to more schemas

* refresh flows table

* trigger downstream spells update

* fix

---------

Co-authored-by: Alex Courouble <[email protected]>
Co-authored-by: jeff-dude <[email protected]>
  • Loading branch information
3 people authored Mar 20, 2024
1 parent 7f089c8 commit 1e271a2
Show file tree
Hide file tree
Showing 10 changed files with 945 additions and 576 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ FROM (
{% if is_incremental() %}
AND et.block_time >= date_trunc('day', now() - interval '7' day)
{% endif %}
AND et."from" != 0x1ef753934c40a72a60eab12a68b6f8854439aa78
GROUP BY et."from", et.block_time
) coinbase
GROUP BY coinbase.address
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ WITH tagged_entities AS (
FROM (VALUES
(0x617c8de5bde54ffbb8d92716cc947858ca38f582, 'MEV Protocol', 'Liquid Staking')
, (0xcDBF58a9A9b54a2C43800c50C7192946dE858321, 'Bitpanda', 'CEX')
, (0xb10edd6fa6067dba8d4326f1c8f0d1c791594f13, 'Bitpanda', 'CEX')
, (0x70D5cCC14a1a264c05Ff48B3ec6751b0959541aA, 'Binance US', 'CEX')
)
x (funds_origin, entity, category)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ FROM
, (0x9b8c989ff27e948f55b53bb19b3cc1947852e394, 'Kiln', 'Kiln 1', 'Staking Pool')
, (0x1e68238ce926dec62b3fbc99ab06eb1d85ce0270, 'Kiln', 'Kiln 2', 'Staking Pool')
, (0xc63d9f0040d35f328274312fc8771a986fc4ba86, 'Kiln', 'Kiln 3', 'Staking Pool')
, (0x2d5e65ff87d986d18ac224e725dc654bec3a04cd, 'Kiln', 'Kiln 4', 'Staking Pool')
, (0x746d8a8fcab7f829fa500504f60d89c5cc1ea973, 'Kiln', 'Kiln 5', 'Staking Pool')
, (0x0816df553a89c4bff7ebfd778a9706a989dd3ce3, 'Kiln', 'Kiln 6', 'Staking Pool')
, (0xef650d5dbe75f39e2ec18a4381f75c8a4d4e19c8, 'Kiln', 'Kiln 7', 'Staking Pool')
, (0xbf1556a7d625654e3d64d1f0466a60a697fac178, 'imToken', 'imToken Staking[NodeProviderInfStones]', 'Staking Pool')
, (0xbca3b7b87dcb15f0efa66136bc0e4684a3e5da4d, 'SharedStake', 'SharedStake', 'Liquid Staking')
, (0xeadcba8bf9aca93f627f31fb05470f5a0686ceca, 'StakeWise', 'StakeWise Solos', 'Staking Pool')
Expand All @@ -36,11 +40,14 @@ FROM
, (0x1692e170361cefd1eb7240ec13d048fd9af6d667, 'KuCoin', 'KuCoin 2', 'CEX')
, (0x7b915c27a0ed48e2ce726ee40f20b2bf8a88a1b3, 'KuCoin', 'KuCoin 3', 'CEX')
, (0xf8da05c625a6e601281110cba52b156e714e1dc2, 'KuCoin', 'KuCoin 4', 'CEX')
, (0x093f6c270ac22ec240f0c6fd7414ea774ca8d3e5, 'Renzo', 'Renzo 1', 'Liquid Restaking')
, (0x2641c2ded63a0c640629f5edf1189e0f53c06561, 'Renzo', 'Renzo 2', 'Liquid Restaking')
, (0xe3cbd06d7dadb3f4e6557bab7edd924cd1489e8f, 'Mantle', 'Mantle 1', 'Staking Pool')
, (0xd664b74274dfeb538d9bac494f3a4760828b02b0, 'Redacted Pirex', 'Redacted Pirex 1', 'Liquid Staking')
, (0xcbc1065255cbc3ab41a6868c22d1f1c573ab89fd, 'CREAM', 'CREAM', 'Liquid Staking')
, (0x808e7133c700cf3a66e6a25aadb1fbef6be468b4, 'Bitstamp', 'Bitstamp 1', 'CEX')
, (0x3965c5F4Bf942EcCF88bd8B3926456b16479e3E8, 'Bitstamp', 'Bitstamp 2', 'CEX')
, (0xbda371a2dce220eb25dece2d37d4d9a897614b29, 'Bitstamp', 'Bitstamp 3', 'CEX')
, (0x12ec5befa9166fa327d4c345a93f0ac99dd2a7d8, 'Blox Staking', 'Blox Staking', 'Staking Pool')
, (0x24b2f1aeced4b34133152bb20cfd6a206a0ea33c, 'staked.finance', 'staked.finance', 'Liquid Staking')
, (0x0038598ecb3b308ebc6c6e2c635bacaa3c5298a3, 'Poloniex', 'Poloniex 1', 'CEX')
Expand Down Expand Up @@ -73,11 +80,15 @@ FROM
, (0xefe9a82d56cd965d7b332c7ac1feb15c53cd4340, 'Coinbase', 'Coinbase Batch 1', 'CEX')
, (0xeee27662c2b8eba3cd936a23f039f3189633e4c8, 'Celsius', 'Celsius 1', 'Staking Pool')
, (0xbd9d540f6a671d4280d81127de555a7d8ce7e204, 'Celsius', 'Celsius 2', 'Staking Pool')
, (0xe0c8df4270f4342132ec333f6048cb703e7a9c77, 'Swell', 'Swell 1', 'Liquid Staking')
, (0xb3d9cf8e163bbc840195a97e81f8a34e295b8f39, 'Swell', 'Swell 2', 'Liquid Staking')
, (0xe0c8df4270f4342132ec333f6048cb703e7a9c77, 'Swell', 'Swell 1', 'Liquid Restaking')
, (0xb3d9cf8e163bbc840195a97e81f8a34e295b8f39, 'Swell', 'Swell 2', 'Liquid Restaking')
, (0x5e6342d8090665be14eeb8154c8a87b7249a4889, 'Swell', 'Swell 3', 'Liquid Restaking')
, (0x63952722f3b57a18a792e9e5d98b40e9f89ac8bf, 'Cumberland', 'Cumberland 1', 'CEX')
, (0x68bd0309ba98d65285a290c923ed6830ceaf2666, 'Galaxy Digital', 'Galaxy Digital', 'CEX')
, (0x5180db0237291a6449dda9ed33ad90a38787621c, 'Frax Finance', 'Frax Finance Investor Custodian', 'Liquid Staking')
, (0x234ee9e35f8e9749a002fc42970d570db716453b, 'Gate.io', 'Gate.io 1', 'CEX')
, (0xd87C8e083AECc5405B0107c90D8E0C7F70996B84, 'Gate.io', 'Gate.io 2', 'CEX')
, (0x5bbe36152d3cd3eb7183a82470b39b29eedf068b, 'Hord', 'Hord 1', 'Liquid Staking')
, (0x6c7c332a090c8d2085857cf3220ea01c6d45a723, 'Unagii', 'Unagii', 'Staking Pool')
, (0x3ccc0b321ec18997490c8bfc2c882ef83d546ddd, 'Bake', 'Bake', 'Staking Pool')
, (0x31e180e06d771dbafa3d6eea452195ad1020fbdb, 'Ethereum Hive', 'Ethereum Hive', 'Staking Pool')
Expand All @@ -88,6 +99,9 @@ FROM
, (0xec1d6163e05b3f5d0fb8f354881f6c8b793ad612, 'Bifrost', 'Bifrost', 'Liquid Staking')
, (0xf79caa45612fb183c4e258ed449bfa632d7400b9, 'Everstake', 'Everstake 1', 'Staking Pool')
, (0xd523794c879d9ec028960a231f866758e405be34, 'Everstake', 'Everstake 2', 'Staking Pool')
, (0x3763c29503214db538a1f1725f6c249fbf6b27ae, 'Everstake', 'Everstake 3', 'Staking Pool')
, (0x995fc235f0051cde7cc53b6858d3688b96c3d915, 'Everstake', 'Everstake 4', 'Staking Pool')
, (0x9ac83228f54808bbccca9cb8083a397a16b88386, 'Everstake', 'Everstake 5', 'Staking Pool')
, (0x1ef753934c40a72a60eab12a68b6f8854439aa78, 'Flipside', 'flipsidecrypto1.eth', 'Staking Pool')
, (0xcf07df57a6b338a20d50114a79fee09d28b13d72, 'cryptostake.com', 'cryptostake.com', 'Staking Pool')
, (0xfcd50905214325355a57ae9df084c5dd40d5d478, 'Sigma Prime Team', 'Sigma Prime Team', 'Solo Staker')
Expand All @@ -100,7 +114,7 @@ FROM
, (0x4befa2aa9c305238aa3e0b5d17eb20c045269e9d, 'RockX', 'RockX 1', 'Staking Pool')
, (0xe8239B17034c372CDF8A5F8d3cCb7Cf1795c4572, 'RockX', 'RockX 2', 'Staking Pool')
, (0xea674fdde714fd979de3edf0f56aa9716b898ec8, 'Ethermine', 'Ethermine', 'Staking Pool')
, (0x25e821b7197b146f7713c3b89b6a4d83516b912d, 'ether.fi', 'ether.fi', 'Liquid Staking')
, (0x25e821b7197b146f7713c3b89b6a4d83516b912d, 'ether.fi', 'ether.fi', 'Liquid Restaking')
, (0x44894aeee56c2dd589c1d5c8cb04b87576967f97, 'Upbit', 'Upbit 1', 'CEX')
, (0xcf95237ce34d4b5bf1e7de4474ee1dcc01f24ca9, 'Upbit', 'Upbit 2', 'CEX')
, (0x3085140568d02b7dca5db4070375040a6b2ece5b, 'Upbit', 'Upbit 3', 'CEX')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_coinbase
meta:
Expand All @@ -53,7 +53,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_binance
meta:
Expand All @@ -80,7 +80,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_bitcoin_suisse
meta:
Expand All @@ -107,7 +107,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_batch_contracts_tx_from
meta:
Expand All @@ -134,7 +134,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_batch_contracts_pubkey
meta:
Expand All @@ -161,7 +161,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_withdrawal_credentials
meta:
Expand All @@ -188,7 +188,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_depositor_addresses
meta:
Expand All @@ -215,7 +215,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_tx_from_addresses
meta:
Expand All @@ -242,7 +242,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_darma_capital
meta:
Expand All @@ -269,7 +269,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_stakewise_v3
meta:
Expand All @@ -296,7 +296,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_entities_chorusone
meta:
Expand All @@ -323,4 +323,4 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']
5 changes: 3 additions & 2 deletions models/staking/ethereum/staking_ethereum_deposits.sql
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ SELECT distinct d.block_time
, d.deposit_index
, d.pubkey
, d.signature
, d.withdrawal_credentials_type
, d.withdrawal_address
, d.withdrawal_credentials_type
, d.withdrawal_credentials
, d.evt_index
FROM deposit_events d
Expand All @@ -99,4 +99,5 @@ LEFT JOIN {{ ref('staking_ethereum_entities')}} etes
OR (etes.tx_from IS NOT NULL AND et."from"=etes.tx_from)
OR (etes.pubkey IS NOT NULL AND d.pubkey=etes.pubkey)
OR (etes.withdrawal_credentials IS NOT NULL AND d.withdrawal_credentials=etes.withdrawal_credentials))
AND etes.sub_entity IS NOT NULL
AND etes.sub_entity IS NOT NULL

2 changes: 1 addition & 1 deletion models/staking/ethereum/staking_ethereum_entities.sql
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{{ config(
schema = 'staking_ethereum',
alias = 'entities',

unique_key = ['depositor_address', 'tx_from', 'pubkey'],
post_hook='{{ expose_spells(\'["ethereum"]\',
"sector",
Expand All @@ -17,6 +16,7 @@
, ('tx_from', ref('staking_ethereum_entities_batch_contracts_tx_from'), 'sub')
, ('pubkey', ref('staking_ethereum_entities_batch_contracts_pubkey'), 'sub')


, ('depositor_address', ref('staking_ethereum_entities_coinbase'), 'main')
, ('depositor_address', ref('staking_ethereum_entities_binance'), 'main')
, ('depositor_address', ref('staking_ethereum_entities_bitcoin_suisse'), 'main')
Expand Down
6 changes: 3 additions & 3 deletions models/staking/ethereum/staking_ethereum_flows.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ SELECT block_time
, pubkey
, signature
, withdrawal_address
, withdrawal_credentials
, withdrawal_credentials_type
, withdrawal_credentials
, 0 AS amount_full_withdrawn
, 0 AS amount_partial_withdrawn
, tx_hash
Expand All @@ -105,11 +105,11 @@ SELECT w.block_time
, i.pubkey
, NULL AS signature
, w."address" AS withdrawal_address
, NULL AS withdrawal_credentials
, NULL AS withdrawal_credentials_type
, NULL AS withdrawal_credentials
, CASE WHEN w.amount/1e9 BETWEEN 20 AND 32 THEN w.amount/1e9 WHEN w.amount/1e9 > 32 THEN 32 END AS amount_full_withdrawn
, CASE WHEN w.amount/1e9 < 20 THEN w.amount/1e9 WHEN w.amount/1e9 > 32 THEN (w.amount/1e9)-32 END AS amount_partial_withdrawn
, NULL AS tx_hash
, NULL AS evt_index
FROM {{source('ethereum', 'withdrawals')}} w
INNER JOIN indexes i USING (validator_index)
INNER JOIN indexes i USING (validator_index)
3 changes: 3 additions & 0 deletions models/staking/ethereum/staking_ethereum_info.sql
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,7 @@ FROM (VALUES
, ('MonoMesa.eth', 'MonoMesa')
, ('buffalospace.eth', 'buffalospace00')
, ('kzg.eth', 'kassandraETH')
, ('Renzo', 'RenzoProtocol')
, ('Cumberland', 'CumberlandSays')
, ('Galaxy Digital', 'GalaxyHQ')
) AS temp_table (entity, x_username)
4 changes: 2 additions & 2 deletions models/staking/ethereum/staking_ethereum_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ models:
description: "Category of entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']
- name: sub_entity
description: "Identified sub entity name"
- name: sub_entity_unique_name
Expand All @@ -60,7 +60,7 @@ models:
description: "Category of sub entity"
tests:
- accepted_values:
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Solo Staker', 'Batch Staking Contract', 'Others']
values: ['CEX', 'Staking Pool', 'Liquid Staking', 'Liquid Restaking', 'Solo Staker', 'Batch Staking Contract', 'Others']

- name: staking_ethereum_deposits
meta:
Expand Down

0 comments on commit 1e271a2

Please sign in to comment.