mirror of
https://github.com/FlipsideCrypto/near-models.git
synced 2026-02-06 09:22:01 +00:00
.
This commit is contained in:
parent
5cee15e507
commit
9427681541
41
models/gold/core/core__ez_cex_flows.sql
Normal file
41
models/gold/core/core__ez_cex_flows.sql
Normal 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
|
||||
62
models/gold/core/core__ez_cex_flows.yml
Normal file
62
models/gold/core/core__ez_cex_flows.yml
Normal 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)"
|
||||
Loading…
Reference in New Issue
Block a user