mirror of
https://github.com/FlipsideCrypto/aptos-models.git
synced 2026-02-06 11:46:43 +00:00
checks
This commit is contained in:
parent
ba1711c6c6
commit
cbeafae80d
@ -107,3 +107,10 @@ vars:
|
||||
- AWS_LAMBDA_APTOS_API
|
||||
- DBT_CLOUD_APTOS
|
||||
- INTERNAL_DEV
|
||||
prod-2xl:
|
||||
API_INTEGRATION: aws_aptos_api_prod_v2
|
||||
EXTERNAL_FUNCTION_URI: mxus3semvi.execute-api.us-east-1.amazonaws.com/prod/
|
||||
ROLES:
|
||||
- AWS_LAMBDA_APTOS_API
|
||||
- DBT_CLOUD_APTOS
|
||||
- INTERNAL_DEV
|
||||
@ -1,5 +1,5 @@
|
||||
{% docs core__fact_transfers %}
|
||||
|
||||
This table contains Deposit and Withdraw events on the aptos blockchain. Note: transfers with a 0 amount are excluded.
|
||||
This table contains Deposit and Withdraw events from the coin module as well as Deposit, Withdraw, DepositEvent, and WithdrawEvent from the fungible_asset module on the aptos blockchain. Note: transfers with a 0 amount are excluded.
|
||||
|
||||
{% enddocs %}
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
tags = ['noncore']
|
||||
materialized = 'incremental',
|
||||
unique_key = ['token_address'],
|
||||
incremental_strategy = 'merge',
|
||||
merge_exclude_columns = ["inserted_timestamp"],
|
||||
post_hook = "ALTER TABLE {{ this }} ADD SEARCH OPTIMIZATION ON EQUALITY(token_address,symbol);",
|
||||
tags = ['core','full_test']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
@ -12,10 +16,47 @@ SELECT
|
||||
creator_address,
|
||||
transaction_created_timestamp,
|
||||
transaction_version_created,
|
||||
coin_info_id AS dim_token_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['token_address']
|
||||
) }} AS dim_token_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
FROM
|
||||
{{ ref(
|
||||
'silver__coin_info'
|
||||
) }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(modified_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
UNION ALL
|
||||
SELECT
|
||||
token_address,
|
||||
NAME,
|
||||
symbol,
|
||||
decimals,
|
||||
NULL AS coin_type_hash,
|
||||
NULL AS creator_address,
|
||||
NULL AS transaction_created_timestamp,
|
||||
NULL AS transaction_version_created,
|
||||
{{ dbt_utils.generate_surrogate_key(
|
||||
['token_address']
|
||||
) }} AS dim_token_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
FROM
|
||||
{{ ref('silver__fungible_asset_metadata') }}
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(modified_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
@ -6,6 +6,9 @@ models:
|
||||
columns:
|
||||
- name: TOKEN_ADDRESS
|
||||
description: '{{ doc("token_address") }}'
|
||||
data_tests:
|
||||
- not_null
|
||||
- unique
|
||||
- name: NAME
|
||||
description: 'The full token name'
|
||||
- name: SYMBOL
|
||||
|
||||
@ -20,13 +20,44 @@ SELECT
|
||||
account_address,
|
||||
amount,
|
||||
token_address,
|
||||
FALSE AS is_fungible,
|
||||
NULL :: STRING AS store_address,
|
||||
transfers_id AS fact_transfers_id,
|
||||
inserted_timestamp,
|
||||
modified_timestamp
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
FROM
|
||||
{{ ref(
|
||||
'silver__transfers'
|
||||
) }}
|
||||
{{ ref('silver__transfers') }}
|
||||
WHERE
|
||||
amount <> 0
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND modified_timestamp >= (
|
||||
SELECT
|
||||
MAX(modified_timestamp)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
UNION ALL
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
version,
|
||||
success,
|
||||
event_index,
|
||||
NULL AS creation_number,
|
||||
transfer_event,
|
||||
owner_address AS account_address,
|
||||
amount,
|
||||
metadata_address AS token_address,
|
||||
TRUE AS is_fungible,
|
||||
store_address,
|
||||
transfers_fungible_id AS fact_transfers_id,
|
||||
SYSDATE() AS inserted_timestamp,
|
||||
SYSDATE() AS modified_timestamp,
|
||||
FROM
|
||||
{{ ref('silver__transfers_fungible') }}
|
||||
WHERE
|
||||
amount <> 0
|
||||
|
||||
|
||||
@ -26,6 +26,8 @@ models:
|
||||
description: '{{ doc("amount") }}'
|
||||
- name: TOKEN_ADDRESS
|
||||
description: '{{ doc("token_address") }}'
|
||||
- name: IS_FUNGIBLE
|
||||
description: 'Boolean indicating if the transfer used the legacy coin transfer mechanism or the fungible_asset module'
|
||||
- name: FACT_TRANSFERS_ID
|
||||
description: '{{ doc("pk") }}'
|
||||
tests:
|
||||
|
||||
@ -136,11 +136,11 @@ SELECT
|
||||
WHEN event_resource IN (
|
||||
'WithdrawEvent',
|
||||
'Withdraw'
|
||||
) THEN 'Withdraw'
|
||||
) THEN 'WithdrawEvent'
|
||||
WHEN event_resource IN (
|
||||
'DepositEvent',
|
||||
'Deposit'
|
||||
) THEN 'Deposit'
|
||||
) THEN 'DepositEvent'
|
||||
END AS transfer_event,
|
||||
e.store_address,
|
||||
COALESCE(
|
||||
|
||||
Loading…
Reference in New Issue
Block a user