mirror of
https://github.com/FlipsideCrypto/axelar-models.git
synced 2026-02-06 11:01:45 +00:00
axelscan initial
This commit is contained in:
parent
3d1b8671d4
commit
a263b31c37
@ -20,6 +20,8 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
### Core Tables (`Axelar`.`CORE`.`<table_name>`)
|
||||
### Governance Tables (`Axelar`.`GOV`.`<table_name>`)
|
||||
### DeFi Tables (`Axelar`.`DEFI`.`<table_name>`)
|
||||
### Statistics/Analytics Tables (`Axelar`.`STATS`.`<table_name>`)
|
||||
### Axelscan Tables (`Axelar`.`AXELSCAN`.`<table_name>`)
|
||||
|
||||
|
||||
**Core Dimension Tables:**
|
||||
@ -44,11 +46,16 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
- [fact_validators](#!/model/model.axelar_models.gov__fact_validators)
|
||||
|
||||
**DeFi EZ Tables:**
|
||||
- [ez_satellite](#!/model/model.axelar_models.defi__ez_satellite)
|
||||
- [ez_squid](#!/model/model.axelar_models.defi__ez_squid)
|
||||
- [ez_satellite](#!/model/model.axelar_models.defi__ez_bridge_satellite)
|
||||
- [ez_squid](#!/model/model.axelar_models.defi__ez_bridge_squid)
|
||||
|
||||
**Stats EZ Tables:**
|
||||
- [ez_core_metrics_hourly](#!/model/model.axelar_models.ez_core_metrics_hourly)
|
||||
- [ez_core_metrics_hourly](#!/model/model.axelar_models.stats__ez_core_metrics_hourly)
|
||||
|
||||
**Axelscan Fact Tables:**
|
||||
- [fact_gmp](#!/model/model.axelar_models.axelscan__fact_gmp)
|
||||
- [fact_transfers](#!/model/model.axelar_models.axelscan__fact_transfers)
|
||||
|
||||
|
||||
## **Data Model Overview**
|
||||
|
||||
|
||||
30
models/gold/axelscan/axelscan__fact_gmp.sql
Normal file
30
models/gold/axelscan/axelscan__fact_gmp.sql
Normal file
@ -0,0 +1,30 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'AXELSCAN',
|
||||
}} },
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
id,
|
||||
created_at,
|
||||
status,
|
||||
amount,
|
||||
destination_chain_type,
|
||||
event,
|
||||
simplified_status,
|
||||
call,
|
||||
command_id,
|
||||
fees,
|
||||
gas_status,
|
||||
is_call_from_relayer,
|
||||
is_invalid_call,
|
||||
is_invalid_destination_chain,
|
||||
is_two_way,
|
||||
time_spent,
|
||||
DATA,
|
||||
axelscan_gmp_id AS fact_gmp_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
FROM
|
||||
{{ ref('silver__axelscan_gmp') }}
|
||||
45
models/gold/axelscan/axelscan__fact_gmp.yml
Normal file
45
models/gold/axelscan/axelscan__fact_gmp.yml
Normal file
@ -0,0 +1,45 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: axelscan__fact_gmp
|
||||
columns:
|
||||
- name: ID
|
||||
description: The unique identifier for the transaction
|
||||
- name: CREATED_AT
|
||||
description: The timestamp the transaction was created
|
||||
- name: STATUS
|
||||
description: The status of the transaction
|
||||
- name: AMOUNT
|
||||
description: The amount of the transaction
|
||||
- name: DESTINATION_CHAIN_TYPE
|
||||
description: The type of destination chain
|
||||
- name: EVENT
|
||||
description: The name of the event
|
||||
- name: SIMPLIFIED_STATUS
|
||||
description: The simplified status of the transaction
|
||||
- name: CALL
|
||||
description: The call object
|
||||
- name: COMMAND_ID
|
||||
description: The ID of the command
|
||||
- name: FEES
|
||||
description: The fees of the transaction
|
||||
- name: GAS_STATUS
|
||||
description: The gas status of the transaction
|
||||
- name: IS_CALL_FROM_RELAYER
|
||||
description: Whether the call is from a relayer
|
||||
- name: IS_INVALID_CALL
|
||||
description: Whether the call is invalid
|
||||
- name: IS_INVALID_DESTINATION_CHAIN
|
||||
description: Whether the destination chain is invalid
|
||||
- name: IS_TWO_WAY
|
||||
description: Whether the transaction is two way
|
||||
- name: TIME_SPENT
|
||||
description: The time spent object
|
||||
- name: DATA
|
||||
description: The raw API response
|
||||
- name: FACT_GMP_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
|
||||
28
models/gold/axelscan/axelscan__fact_transfers.sql
Normal file
28
models/gold/axelscan/axelscan__fact_transfers.sql
Normal file
@ -0,0 +1,28 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'AXELSCAN',
|
||||
}} },
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
id,
|
||||
created_at,
|
||||
status,
|
||||
send_amount,
|
||||
send_amount_received,
|
||||
send_fee,
|
||||
send_denom,
|
||||
source_chain,
|
||||
destination_chain,
|
||||
sender_address,
|
||||
recipient_address,
|
||||
simplified_status,
|
||||
link,
|
||||
send,
|
||||
DATA,
|
||||
axelscan_transfers_id AS fact_transfers_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
FROM
|
||||
{{ ref('silver__axelscan_transfers') }}
|
||||
41
models/gold/axelscan/axelscan__fact_transfers.yml
Normal file
41
models/gold/axelscan/axelscan__fact_transfers.yml
Normal file
@ -0,0 +1,41 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: axelscan__fact_transfers
|
||||
columns:
|
||||
- name: ID
|
||||
description: The unique identifier for the transfer
|
||||
- name: CREATED_AT
|
||||
description: The timestamp the transfer was created
|
||||
- name: STATUS
|
||||
description: The status of the transfer
|
||||
- name: SEND_AMOUNT
|
||||
description: The amount of the transfer
|
||||
- name: SEND_AMOUNT_RECEIVED
|
||||
description: The amount of the transfer received
|
||||
- name: SEND_FEE
|
||||
description: The fees of the transfer
|
||||
- name: SEND_DENOM
|
||||
description: The denomination of the transfer
|
||||
- name: SOURCE_CHAIN
|
||||
description: The source chain of the transfer
|
||||
- name: DESTINATION_CHAIN
|
||||
description: The destination chain of the transfer
|
||||
- name: SENDER_ADDRESS
|
||||
description: The address of the sender
|
||||
- name: RECIPIENT_ADDRESS
|
||||
description: The address of the recipient
|
||||
- name: SIMPLIFIED_STATUS
|
||||
description: The simplified status of the transfer
|
||||
- name: LINK
|
||||
description: The link object of the transfer
|
||||
- name: SEND
|
||||
description: The send object of the transfer
|
||||
- name: DATA
|
||||
description: The raw API response
|
||||
- name: FACT_TRANSFERS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
- name: INSERTED_TIMESTAMP
|
||||
description: '{{ doc("inserted_timestamp") }}'
|
||||
- name: MODIFIED_TIMESTAMP
|
||||
description: '{{ doc("modified_timestamp") }}'
|
||||
|
||||
76
models/silver/defi/axelscan/silver__axelscan_gmp.sql
Normal file
76
models/silver/defi/axelscan/silver__axelscan_gmp.sql
Normal file
@ -0,0 +1,76 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "id",
|
||||
incremental_strategy = 'merge',
|
||||
merge_exclude_columns = ["inserted_timestamp"],
|
||||
cluster_by = 'created_at::DATE',
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
WITH base AS (
|
||||
|
||||
SELECT
|
||||
id,
|
||||
DATA,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('bronze_api__axelscan_searchgmp') }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
_inserted_timestamp :: DATE >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) :: DATE
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
qualify (ROW_NUMBER() over (PARTITION BY id
|
||||
ORDER BY
|
||||
_inserted_timestamp DESC) = 1)
|
||||
)
|
||||
SELECT
|
||||
id,
|
||||
TO_TIMESTAMP(
|
||||
COALESCE(
|
||||
DATA :call :created_at :ms,
|
||||
DATA :gas_paid :created_at :ms,
|
||||
DATA :approved :created_at :ms,
|
||||
DATA :express_executed :created_at :ms,
|
||||
DATA :confirm :block_timestamp
|
||||
) :: STRING
|
||||
) :: datetime AS created_at,
|
||||
DATA :status :: STRING AS status,
|
||||
DATA :amount :: FLOAT AS amount,
|
||||
COALESCE(
|
||||
DATA :call :destination_chain_type,
|
||||
DATA :gas_paid :destination_chain_type
|
||||
) :: STRING AS destination_chain_type,
|
||||
COALESCE(
|
||||
DATA :call :event,
|
||||
DATA :gas_paid :event,
|
||||
DATA :approved :event,
|
||||
DATA :express_executed :event,
|
||||
DATA :confirm :event
|
||||
) :: STRING AS event,
|
||||
DATA :simplified_status :: STRING AS simplified_status,
|
||||
DATA :call AS call,
|
||||
DATA :command_id :: STRING AS command_id,
|
||||
DATA :fees AS fees,
|
||||
DATA :gas_status :: STRING AS gas_status,
|
||||
DATA :is_call_from_relayer :: STRING AS is_call_from_relayer,
|
||||
DATA :is_invalid_call :: STRING AS is_invalid_call,
|
||||
DATA :is_invalid_destination_chain :: STRING AS is_invalid_destination_chain,
|
||||
DATA :is_two_way :: STRING AS is_two_way,
|
||||
DATA :time_spent AS time_spent,
|
||||
DATA,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['id']
|
||||
) }} AS axelscan_gmp_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
_inserted_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
base
|
||||
39
models/silver/defi/axelscan/silver__axelscan_gmp.yml
Normal file
39
models/silver/defi/axelscan/silver__axelscan_gmp.yml
Normal file
@ -0,0 +1,39 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__axelscan_gmp
|
||||
columns:
|
||||
- name: ID
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
- name: CREATED_AT
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 2
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
- name: STATUS
|
||||
tests:
|
||||
- not_null
|
||||
- name: AMOUNT
|
||||
- name: DESTINATION_CHAIN_TYPE
|
||||
- name: EVENT
|
||||
tests:
|
||||
- not_null
|
||||
- name: SIMPLIFIED_STATUS
|
||||
tests:
|
||||
- not_null
|
||||
- name: CALL
|
||||
- name: COMMAND_ID
|
||||
- name: FEES
|
||||
- name: GAS_STATUS
|
||||
- name: IS_CALL_FROM_RELAYER
|
||||
- name: IS_INVALID_CALL
|
||||
- name: IS_INVALID_DESTINATION_CHAIN
|
||||
- name: IS_TWO_WAY
|
||||
- name: TIME_SPENT
|
||||
- name: DATA
|
||||
|
||||
59
models/silver/defi/axelscan/silver__axelscan_transfers.sql
Normal file
59
models/silver/defi/axelscan/silver__axelscan_transfers.sql
Normal file
@ -0,0 +1,59 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = "id",
|
||||
incremental_strategy = 'merge',
|
||||
merge_exclude_columns = ["inserted_timestamp"],
|
||||
cluster_by = 'created_at::DATE',
|
||||
tags = ['noncore']
|
||||
) }}
|
||||
|
||||
WITH base AS (
|
||||
|
||||
SELECT
|
||||
id,
|
||||
DATA,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('bronze_api__axelscan_searchtransfers') }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
WHERE
|
||||
_inserted_timestamp :: DATE >= (
|
||||
SELECT
|
||||
MAX(_inserted_timestamp) :: DATE
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
qualify (ROW_NUMBER() over (PARTITION BY id
|
||||
ORDER BY
|
||||
_inserted_timestamp DESC) = 1)
|
||||
)
|
||||
SELECT
|
||||
id,
|
||||
TO_TIMESTAMP(
|
||||
DATA :send :created_at :ms :: STRING
|
||||
) :: datetime AS created_at,
|
||||
DATA :status :: STRING AS status,
|
||||
DATA :send :amount :: FLOAT AS send_amount,
|
||||
DATA :send :amount_received :: FLOAT AS send_amount_received,
|
||||
DATA :send :fee :: FLOAT AS send_fee,
|
||||
DATA :send :denom :: STRING AS send_denom,
|
||||
DATA :send :source_chain :: STRING AS source_chain,
|
||||
DATA :send :destination_chain :: STRING AS destination_chain,
|
||||
DATA :send :sender_address :: STRING AS sender_address,
|
||||
DATA :send :recipient_address :: STRING AS recipient_address,
|
||||
DATA :simplified_status :: STRING AS simplified_status,
|
||||
DATA :link AS link,
|
||||
DATA :send AS send,
|
||||
DATA,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['id']
|
||||
) }} AS axelscan_transfers_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
_inserted_timestamp,
|
||||
'{{ invocation_id }}' AS _invocation_id
|
||||
FROM
|
||||
base
|
||||
41
models/silver/defi/axelscan/silver__axelscan_transfers.yml
Normal file
41
models/silver/defi/axelscan/silver__axelscan_transfers.yml
Normal file
@ -0,0 +1,41 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__axelscan_transfers
|
||||
columns:
|
||||
- name: ID
|
||||
tests:
|
||||
- not_null
|
||||
- unique
|
||||
- name: CREATED_AT
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 2
|
||||
- dbt_expectations.expect_column_values_to_be_in_type_list:
|
||||
column_type_list:
|
||||
- TIMESTAMP_NTZ
|
||||
- name: STATUS
|
||||
tests:
|
||||
- not_null
|
||||
- name: SEND_AMOUNT
|
||||
- name: SEND_AMOUNT_RECEIVED
|
||||
- name: SEND_FEE
|
||||
- name: SEND_DENOM
|
||||
- name: SOURCE_CHAIN
|
||||
tests:
|
||||
- not_null
|
||||
- name: DESTINATION_CHAIN
|
||||
- name: SENDER_ADDRESS
|
||||
tests:
|
||||
- not_null
|
||||
- name: RECIPIENT_ADDRESS
|
||||
tests:
|
||||
- not_null
|
||||
- name: SIMPLIFIED_STATUS
|
||||
tests:
|
||||
- not_null
|
||||
- name: LINK
|
||||
- name: SEND
|
||||
- name: DATA
|
||||
|
||||
Loading…
Reference in New Issue
Block a user