Merge pull request #504 from FlipsideCrypto/quick-PR-for-cex-flows
Some checks are pending
docs_update / docs_update (push) Waiting to run
docs_update / notify-failure (push) Blocked by required conditions

add EZ cex flows
This commit is contained in:
eric-laurello 2025-11-03 18:46:00 -05:00 committed by GitHub
commit 6031cffdb8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,41 @@
{{ config(
materialized = 'view',
tags = ['scheduled_non_core']
) }}
WITH labels AS (
SELECT
address,
label_subtype,
project_name AS exchange_name
FROM
{{ ref('core__dim_address_labels') }}
WHERE
label_type = 'cex'
)
SELECT
A.*,
COALESCE(
from_label.exchange_name,
to_label.exchange_name
) AS exchange_name,
CASE
WHEN from_label.address IS NOT NULL
AND to_label.address IS NULL THEN 'withdrawal'
WHEN to_label.address IS NOT NULL
AND from_label.address IS NULL THEN 'deposit'
WHEN from_label.address IS NOT NULL
AND to_label.address IS NOT NULL THEN 'internal_transfer'
END AS direction
FROM
{{ ref('core__ez_token_transfers') }} A
LEFT JOIN labels from_label
ON A.from_address = from_label.address
LEFT JOIN labels to_label
ON A.to_address = to_label.address
WHERE
COALESCE(
to_label.address,
from_label.address
) IS NOT NULL

View File

@ -0,0 +1,62 @@
version: 2
models:
- name: core__ez_cex_flows
description: "An EZ view that filters down to transfers involving centralized exchanges -- full ez_token_transfers continued here: {{ doc('core__ez_token_transfers') }}"
columns:
- name: BLOCK_ID
description: "{{ doc('block_id')}}"
- name: BLOCK_TIMESTAMP
description: "{{ doc('block_timestamp')}}"
- name: TX_HASH
description: "{{ doc('tx_hash')}}"
- name: CONTRACT_ADDRESS
description: "{{ doc('contract_address')}}"
- name: FROM_ADDRESS
description: "{{ doc('from_address')}}"
- name: TO_ADDRESS
description: "{{ doc('to_address')}}"
- name: MEMO
description: "{{ doc('memo')}}"
- name: AMOUNT_RAW
description: "{{ doc('amount_raw')}}"
- name: AMOUNT_RAW_PRECISE
description: "{{ doc('amount_adj')}}"
- name: TRANSFER_TYPE
description: "{{ doc('transfer_type')}}"
- name: HAS_PRICE
description: "Boolean value indicating if the token has a price"
- name: TRANSFER_ACTION
description: "{{ doc('transfer_action')}}"
- name: RECEIPT_SUCCEEDED
description: "{{ doc('receipt_succeeded')}}"
- name: EZ_TOKEN_TRANSFERS_ID
description: "{{doc('id')}}"
- name: INSERTED_TIMESTAMP
description: "{{doc('inserted_timestamp')}}"
- name: MODIFIED_TIMESTAMP
description: "{{doc('modified_timestamp')}}"
- name: TOKEN_IS_VERIFIED
description: "{{ doc('token_is_verified') }}"
- name: EXCHANGE_NAME
description: "The name of the centralized exchange associated with the address label"
- name: DIRECTION
description: "The direction of the transfer relative to the exchange (withdrawal or deposit or internal_transfer)"