mirror of
https://github.com/FlipsideCrypto/solana-models.git
synced 2026-02-06 11:27:00 +00:00
add ez_transfers (#856)
This commit is contained in:
parent
f8d3fe8ec1
commit
ec1f2c24ff
13
models/descriptions/amount_usd.md
Normal file
13
models/descriptions/amount_usd.md
Normal file
@ -0,0 +1,13 @@
|
||||
{% docs amount_usd %}
|
||||
|
||||
The USD value of the transferred amount, calculated using the token price at the time of the transfer. This field enables value-based analytics and comparisons across different tokens.
|
||||
|
||||
**Data type:** Numeric (decimal)
|
||||
**Example:**
|
||||
- 123.45 (represents $123.45 USD)
|
||||
|
||||
**Business Context:**
|
||||
- Used for tracking transaction volumes, wallet activity, and payment flows in USD terms.
|
||||
- Supports analytics on large value transfers, protocol revenue, and user behavior.
|
||||
|
||||
{% enddocs %}
|
||||
14
models/descriptions/symbol.md
Normal file
14
models/descriptions/symbol.md
Normal file
@ -0,0 +1,14 @@
|
||||
{% docs symbol %}
|
||||
|
||||
The symbol of the token involved in the transfer (e.g., SOL, USDC, RAY). Used to identify the asset type in analytics and reporting.
|
||||
|
||||
**Data type:** String
|
||||
**Example:**
|
||||
- SOL
|
||||
- USDC
|
||||
|
||||
**Business Context:**
|
||||
- Enables grouping and filtering of transfers by token.
|
||||
- Supports analytics on asset flows, protocol usage, and user preferences.
|
||||
|
||||
{% enddocs %}
|
||||
37
models/gold/core/core__ez_transfers.sql
Normal file
37
models/gold/core/core__ez_transfers.sql
Normal file
@ -0,0 +1,37 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
tags = ['scheduled_core', 'exclude_change_tracking']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
a.block_timestamp,
|
||||
a.block_id,
|
||||
a.tx_id,
|
||||
COALESCE(SPLIT_PART(a.INDEX :: text, '.', 1) :: INT, a.INDEX :: INT) AS index,
|
||||
NULLIF(SPLIT_PART(a.INDEX :: text, '.', 2), '') :: INT AS inner_index,
|
||||
a.tx_from,
|
||||
a.tx_to,
|
||||
a.amount,
|
||||
a.amount * p.price AS amount_usd,
|
||||
a.mint,
|
||||
COALESCE(
|
||||
p.symbol,
|
||||
b.symbol
|
||||
) AS symbol,
|
||||
COALESCE(
|
||||
p.is_verified,
|
||||
FALSE
|
||||
) AS token_is_verified,
|
||||
a.fact_transfers_id AS ez_transfers_id,
|
||||
a.inserted_timestamp,
|
||||
a.modified_timestamp
|
||||
FROM
|
||||
{{ ref('core__fact_transfers') }} a
|
||||
LEFT JOIN {{ ref('price__ez_asset_metadata') }} b
|
||||
ON a.mint = b.token_address
|
||||
LEFT JOIN {{ ref('price__ez_prices_hourly') }} p
|
||||
ON a.mint = p.token_address
|
||||
AND DATE_TRUNC(
|
||||
'hour',
|
||||
a.block_timestamp
|
||||
) = p.hour
|
||||
36
models/gold/core/core__ez_transfers.yml
Normal file
36
models/gold/core/core__ez_transfers.yml
Normal file
@ -0,0 +1,36 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__ez_transfers
|
||||
description: |-
|
||||
Contains transfer events for Solana and SPL tokens, including pre-parsed transfer amounts, USD value, token symbol, and verification status. This table is best for analytics on asset movement, wallet activity, payment flows, and large value transfers.
|
||||
columns:
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: "{{ doc('block_timestamp') }}"
|
||||
- name: BLOCK_ID
|
||||
description: "{{ doc('block_id') }}"
|
||||
- name: TX_ID
|
||||
description: "{{ doc('tx_id') }}"
|
||||
- name: INDEX
|
||||
description: "{{ doc('index') }}"
|
||||
- name: INNER_INDEX
|
||||
description: "{{ doc('inner_index') }}"
|
||||
- name: TX_FROM
|
||||
description: "{{ doc('tx_from') }}"
|
||||
- name: TX_TO
|
||||
description: "{{ doc('tx_to') }}"
|
||||
- name: AMOUNT
|
||||
description: "{{ doc('amount') }}"
|
||||
- name: AMOUNT_USD
|
||||
description: "{{ doc('amount_usd') }}"
|
||||
- name: MINT
|
||||
description: "{{ doc('mint') }}"
|
||||
- name: SYMBOL
|
||||
description: "{{ doc('symbol') }}"
|
||||
- name: TOKEN_IS_VERIFIED
|
||||
description: '{{ doc("prices_is_verified") }}'
|
||||
- name: EZ_TRANSFERS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
Loading…
Reference in New Issue
Block a user