mirror of
https://github.com/FlipsideCrypto/ethereum-models.git
synced 2026-02-06 15:56:54 +00:00
AN-3749/new-views (#648)
* new views,schemas,docs, price tables * overview docs * date * alias * tests for price * price refs * source db * remove price sources * unique key tests and desc
This commit is contained in:
parent
093b849c35
commit
63ca4e938a
@ -15,7 +15,7 @@ SELECT
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain',
|
||||
'address_labels'
|
||||
'dim_labels'
|
||||
) }}
|
||||
WHERE
|
||||
blockchain = 'ethereum'
|
||||
|
||||
@ -0,0 +1,19 @@
|
||||
{{ config (
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
token_address,
|
||||
id,
|
||||
symbol,
|
||||
blockchain,
|
||||
provider,
|
||||
_unique_key,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain_silver',
|
||||
'asset_metadata_all_providers'
|
||||
) }}
|
||||
WHERE
|
||||
blockchain = 'ethereum'
|
||||
20
models/bronze/prices/bronze__hourly_prices_all_providers.sql
Normal file
20
models/bronze/prices/bronze__hourly_prices_all_providers.sql
Normal file
@ -0,0 +1,20 @@
|
||||
{{ config (
|
||||
materialized = 'view'
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
HOUR,
|
||||
token_address,
|
||||
blockchain,
|
||||
provider,
|
||||
price,
|
||||
is_imputed,
|
||||
_inserted_timestamp,
|
||||
_unique_key
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain_silver',
|
||||
'token_prices_all_providers_hourly'
|
||||
) }}
|
||||
WHERE
|
||||
blockchain = 'ethereum'
|
||||
@ -21,11 +21,9 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
**Dimension Tables:**
|
||||
- [dim_contract_abis](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__dim_contract_abis)
|
||||
- [dim_contracts](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__dim_contracts)
|
||||
- [dim_dex_liquidity_pools](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__dim_dex_liquidity_pools)
|
||||
- [dim_event_signatures](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__dim_event_signatures)
|
||||
- [dim_function_signatures](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__dim_function_signatures)
|
||||
- [dim_labels](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__dim_labels)
|
||||
- [dim_nft_metadata](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__dim_nft_metadata)
|
||||
|
||||
**Fact Tables:**
|
||||
- [fact_blocks](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__fact_blocks)
|
||||
@ -33,7 +31,6 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
- [fact_decoded_event_logs](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__fact_decoded_event_logs)
|
||||
- [fact_eth_balances](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__fact_eth_balances)
|
||||
- [fact_event_logs](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__fact_event_logs)
|
||||
- [fact_hourly_token_prices](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__fact_hourly_token_prices)
|
||||
- [fact_token_balances](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__fact_token_balances)
|
||||
- [fact_token_transfers](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__fact_token_transfers)
|
||||
- [fact_traces](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__fact_traces)
|
||||
@ -43,21 +40,28 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
- [ez_balance_deltas](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_balance_deltas)
|
||||
- [ez_current_balances](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_current_balances)
|
||||
- [ez_decoded_event_logs](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_decoded_event_logs)
|
||||
- [ez_dex_swaps](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_dex_swaps)
|
||||
- [ez_eth_transfers](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_eth_transfers)
|
||||
- [ez_nft_mints](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_nft_mints)
|
||||
- [ez_nft_sales](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_nft_sales)
|
||||
- [ez_nft_transfers](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_nft_transfers)
|
||||
- [ez_snapshot](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_snapshot)
|
||||
- [ez_token_transfers](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.core__ez_token_transfers)
|
||||
|
||||
### Price Tables (ethereum.price)
|
||||
- [fact_hourly_token_prices](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.price__fact_hourly_token_prices)
|
||||
- [ez_hourly_token_prices](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.price__ez_hourly_token_prices)
|
||||
- [dim_asset_metadata](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.price__dim_asset_metadata)
|
||||
- [ez_asset_metadata](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.price__ez_asset_metadata)
|
||||
|
||||
### DeFi Tables (ethereum.defi)
|
||||
- [ez_dex_swaps](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.defi__ez_dex_swaps)
|
||||
- [dim_dex_liquidity_pools](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.defi__dim_dex_liquidity_pools)
|
||||
- [ez_liquid_staking_deposits](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.defi__ez_liquid_staking_deposits)
|
||||
- [ez_liquid_staking_withdrawals](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.defi__ez_liquid_staking_withdrawals)
|
||||
|
||||
### Aave Tables (ethereum.aave)
|
||||
### NFT Tables (ethereum.nft)
|
||||
- [dim_nft_metadata](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.nft__dim_nft_metadata)
|
||||
- [ez_nft_mints](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.nft__ez_nft_mints)
|
||||
- [ez_nft_sales](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.nft__ez_nft_sales)
|
||||
- [ez_nft_transfers](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.nft__ez_nft_transfers)
|
||||
|
||||
### Aave Tables (ethereum.aave)
|
||||
- [ez_borrows](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.aave__ez_borrows)
|
||||
- [ez_deposits](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.aave__ez_deposits)
|
||||
- [ez_flashloans](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.aave__ez_flashloans)
|
||||
@ -69,7 +73,6 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
- [ez_withdraws](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.aave__ez_withdraws)
|
||||
|
||||
### Beacon Chain Tables (ethereum.beacon_chain)
|
||||
|
||||
- [fact_blocks](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.beacon_chain__fact_blocks)
|
||||
- [fact_attestations](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.beacon_chain__fact_attestations)
|
||||
- [fact_deposits](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.beacon_chain__fact_deposits)
|
||||
@ -80,13 +83,11 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
- [ez_withdrawals](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.beacon_chain__ez_withdrawals)
|
||||
|
||||
### Chainlink Tables (ethereum.chainlink)
|
||||
|
||||
- [dim_oracle_feeds](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.chainlink__dim_oracle_feeds)
|
||||
- [ez_oracle_feeds](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.chainlink__ez_oracle_feeds)
|
||||
- [fact_oracle_feeds](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.chainlink__fact_oracle_feeds)
|
||||
|
||||
### Compound Tables (ethereum.compound)
|
||||
|
||||
- [ez_asset_details](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.compound__ez_asset_details)
|
||||
- [ez_borrows](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.compound__ez_borrows)
|
||||
- [ez_deposits](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.compound__ez_deposits)
|
||||
@ -96,7 +97,6 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
- [ez_repayments](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.compound__ez_repayments)
|
||||
|
||||
### Maker Tables (ethereum.maker)
|
||||
|
||||
- [ez_delegations](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.maker__ez_delegations)
|
||||
- [ez_deposits](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.maker__ez_deposits)
|
||||
- [ez_flash_loans](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.maker__ez_flash_loans)
|
||||
@ -107,18 +107,15 @@ There is more information on how to use dbt docs in the last section of this doc
|
||||
- [ez_withdrawals](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.maker__ez_withdrawals)
|
||||
|
||||
### Sushi Tables (ethereum.sushi)
|
||||
|
||||
- [dim_distributor_reward_schedule](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.sushi__dim_distributor_reward_schedule)
|
||||
- [ez_borrowing](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.sushi__ez_borrowing)
|
||||
- [ez_lending](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.sushi__ez_lending)
|
||||
- [ez_swaps](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.sushi__ez_swaps)
|
||||
|
||||
### Synthetix Tables (ethereum.synthetix)
|
||||
|
||||
- [ez_snx_staking](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.synthetix__ez_snx_staking)
|
||||
|
||||
### Uniswap v3 Tables (ethereum.uniswapv3)
|
||||
|
||||
- [ez_lp_actions](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.uniswapv3__ez_lp_actions)
|
||||
- [ez_pool_stats](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.uniswapv3__ez_pool_stats)
|
||||
- [ez_pools](https://flipsidecrypto.github.io/ethereum-models/#!/model/model.ethereum_models.uniswapv3__ez_pools)
|
||||
|
||||
@ -18,7 +18,7 @@ WITH prices AS (
|
||||
LOWER(token_address) AS token_address,
|
||||
AVG(price) AS price
|
||||
FROM
|
||||
{{ ref("core__fact_hourly_token_prices") }}
|
||||
{{ ref("price__ez_hourly_token_prices") }}
|
||||
GROUP BY
|
||||
1,
|
||||
2
|
||||
|
||||
@ -18,7 +18,7 @@ WITH prices AS (
|
||||
LOWER(token_address) AS token_address,
|
||||
AVG(price) AS price
|
||||
FROM
|
||||
{{ ref("core__fact_hourly_token_prices") }}
|
||||
{{ ref("price__ez_hourly_token_prices") }}
|
||||
WHERE
|
||||
price IS NOT NULL
|
||||
AND token_address IS NOT NULL
|
||||
|
||||
@ -45,7 +45,7 @@ eth_price AS (
|
||||
HOUR,
|
||||
price AS eth_price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
|
||||
AND HOUR :: DATE IN (
|
||||
|
||||
@ -55,7 +55,7 @@ hourly_prices AS (
|
||||
LOWER(token_address) AS token_address,
|
||||
AVG(price) AS price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
1 = 1
|
||||
|
||||
|
||||
@ -5,11 +5,6 @@
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
HOUR,
|
||||
token_address,
|
||||
symbol,
|
||||
decimals,
|
||||
price,
|
||||
is_imputed
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_hourly_token_prices
|
||||
description: '{{ doc("eth_prices_table_doc") }}'
|
||||
description: Deprecating soon! This is a notice that we're replacing this table with `price__ez_hourly_token_prices`. Please migrate queries to the new table by 9/14/23. There will be no column changes or any other changes of any kind.
|
||||
|
||||
columns:
|
||||
- name: HOUR
|
||||
@ -17,6 +17,4 @@ models:
|
||||
- name: DECIMALS
|
||||
description: '{{ doc("eth_prices_decimals") }}'
|
||||
- name: PRICE
|
||||
description: '{{ doc("eth_prices_price") }}'
|
||||
- name: IS_IMPUTED
|
||||
description: '{{ doc("eth_prices_imputed") }}'
|
||||
description: '{{ doc("eth_prices_price") }}'
|
||||
@ -1,5 +0,0 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__dim_dex_liquidity_pools
|
||||
description: '{{ doc("dex_lp_deprecation") }}'
|
||||
|
||||
@ -2,37 +2,11 @@
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true },
|
||||
meta={
|
||||
'database_tags':{
|
||||
'table': {
|
||||
'PROTOCOL': 'SUSHI, UNISWAP, CURVE, SYNTHETIX, BALANCER, DODO, FRAX, HASHFLOW, KYBERSWAP, MAVERICK, PANCAKESWAP, SHIBASWAP, TRADER JOE',
|
||||
'PURPOSE': 'DEX, SWAPS'
|
||||
}
|
||||
}
|
||||
}
|
||||
meta ={ 'database_tags':{ 'table':{ 'PROTOCOL': 'SUSHI, UNISWAP, CURVE, SYNTHETIX, BALANCER, DODO, FRAX, HASHFLOW, KYBERSWAP, MAVERICK, PANCAKESWAP, SHIBASWAP, TRADER JOE',
|
||||
'PURPOSE': 'DEX, SWAPS' } } }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
origin_function_signature,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
contract_address,
|
||||
pool_name,
|
||||
event_name,
|
||||
amount_in,
|
||||
amount_in_usd,
|
||||
amount_out,
|
||||
amount_out_usd,
|
||||
sender,
|
||||
tx_to,
|
||||
event_index,
|
||||
platform,
|
||||
token_in,
|
||||
token_out,
|
||||
symbol_in,
|
||||
symbol_out,
|
||||
_log_id
|
||||
FROM {{ ref('silver_dex__complete_dex_swaps') }}
|
||||
*
|
||||
FROM
|
||||
{{ ref('defi__ez_dex_swaps') }}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__ez_dex_swaps
|
||||
description: '{{ doc("eth_ez_dex_swaps_table_doc") }}'
|
||||
description: Deprecating soon! This is a notice that we're replacing this table with `defi__ez_dex_swaps`. Please migrate queries to the new table by 9/14/23. There will be no column changes or any other changes of any kind.
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
|
||||
38
models/gold/defi/defi__ez_dex_swaps.sql
Normal file
38
models/gold/defi/defi__ez_dex_swaps.sql
Normal file
@ -0,0 +1,38 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true },
|
||||
meta={
|
||||
'database_tags':{
|
||||
'table': {
|
||||
'PROTOCOL': 'SUSHI, UNISWAP, CURVE, SYNTHETIX, BALANCER, DODO, FRAX, HASHFLOW, KYBERSWAP, MAVERICK, PANCAKESWAP, SHIBASWAP, TRADER JOE',
|
||||
'PURPOSE': 'DEX, SWAPS'
|
||||
}
|
||||
}
|
||||
}
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
origin_function_signature,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
contract_address,
|
||||
pool_name,
|
||||
event_name,
|
||||
amount_in,
|
||||
amount_in_usd,
|
||||
amount_out,
|
||||
amount_out_usd,
|
||||
sender,
|
||||
tx_to,
|
||||
event_index,
|
||||
platform,
|
||||
token_in,
|
||||
token_out,
|
||||
symbol_in,
|
||||
symbol_out,
|
||||
_log_id
|
||||
FROM {{ ref('silver_dex__complete_dex_swaps') }}
|
||||
49
models/gold/defi/defi__ez_dex_swaps.yml
Normal file
49
models/gold/defi/defi__ez_dex_swaps.yml
Normal file
@ -0,0 +1,49 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: defi__ez_dex_swaps
|
||||
description: '{{ doc("eth_ez_dex_swaps_table_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("eth_block_number") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: '{{ doc("eth_block_timestamp") }}'
|
||||
- name: TX_HASH
|
||||
description: '{{ doc("eth_logs_tx_hash") }}'
|
||||
- name: CONTRACT_ADDRESS
|
||||
description: '{{ doc("eth_logs_contract_address") }}'
|
||||
- name: EVENT_NAME
|
||||
description: '{{ doc("eth_event_name") }}'
|
||||
- name: AMOUNT_IN
|
||||
description: '{{ doc("eth_dex_swaps_amount_in") }}'
|
||||
- name: AMOUNT_OUT
|
||||
description: '{{ doc("eth_dex_swaps_amount_out") }}'
|
||||
- name: AMOUNT_IN_USD
|
||||
description: '{{ doc("eth_dex_swaps_amount_in_usd") }}'
|
||||
- name: AMOUNT_OUT_USD
|
||||
description: '{{ doc("eth_dex_swaps_amount_out_usd") }}'
|
||||
- name: TOKEN_IN
|
||||
description: '{{ doc("eth_dex_swaps_token_in") }}'
|
||||
- name: TOKEN_OUT
|
||||
description: '{{ doc("eth_dex_swaps_token_out") }}'
|
||||
- name: SYMBOL_IN
|
||||
description: '{{ doc("eth_dex_swaps_symbol_in") }}'
|
||||
- name: SYMBOL_OUT
|
||||
description: '{{ doc("eth_dex_swaps_symbol_out") }}'
|
||||
- name: SENDER
|
||||
description: '{{ doc("eth_dex_swaps_sender") }}'
|
||||
- name: TX_TO
|
||||
description: '{{ doc("eth_dex_swaps_tx_to") }}'
|
||||
- name: PLATFORM
|
||||
description: '{{ doc("eth_dex_platform") }}'
|
||||
- name: EVENT_INDEX
|
||||
description: '{{ doc("eth_event_index") }}'
|
||||
- name: _LOG_ID
|
||||
description: '{{ doc("eth_log_id_events") }}'
|
||||
- name: ORIGIN_FUNCTION_SIGNATURE
|
||||
description: '{{ doc("nft_origin_sig") }}'
|
||||
- name: ORIGIN_FROM_ADDRESS
|
||||
description: '{{ doc("eth_origin_from") }}'
|
||||
- name: ORIGIN_TO_ADDRESS
|
||||
description: '{{ doc("eth_origin_to") }}'
|
||||
|
||||
@ -15,6 +15,6 @@ SELECT
|
||||
FROM
|
||||
{{ source(
|
||||
'crosschain',
|
||||
'ez_hourly_prices'
|
||||
'ez_hourly_token_prices'
|
||||
) }}
|
||||
where hour::date between '2021-12-01' and '2021-12-31' and blockchain = 'ethereum'
|
||||
@ -6,21 +6,7 @@
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
blockchain,
|
||||
commission_rate,
|
||||
contract_address,
|
||||
contract_name,
|
||||
created_at_block_id AS created_at_block_number,
|
||||
created_at_timestamp,
|
||||
created_at_tx_id AS created_at_tx_hash,
|
||||
creator_address,
|
||||
creator_name,
|
||||
image_url,
|
||||
project_name,
|
||||
token_id,
|
||||
token_metadata,
|
||||
token_metadata_uri,
|
||||
token_name
|
||||
*
|
||||
FROM
|
||||
{{ ref(
|
||||
'silver__nft_metadata'
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__dim_nft_metadata
|
||||
description: 'This table contains the metadata for popular NFT collections on the Etherum blockchain.'
|
||||
description: Deprecating soon! This is a notice that we're replacing this table with `nft__dim_nft_metadata`. Please migrate queries to the new table by 9/14/23. There will be no column changes or any other changes of any kind.
|
||||
|
||||
columns:
|
||||
- name: BLOCKCHAIN
|
||||
|
||||
@ -6,28 +6,6 @@
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_number,
|
||||
tx_hash,
|
||||
event_type,
|
||||
nft_address,
|
||||
project_name,
|
||||
nft_from_address,
|
||||
nft_to_address,
|
||||
tokenId,
|
||||
token_metadata,
|
||||
erc1155_value,
|
||||
mint_price_eth,
|
||||
mint_price_usd,
|
||||
nft_count,
|
||||
amount,
|
||||
amount_usd,
|
||||
mint_price_tokens,
|
||||
mint_price_tokens_usd,
|
||||
mint_token_symbol,
|
||||
mint_token_address,
|
||||
tx_fee,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__nft_mints') }}
|
||||
{{ ref('nft__ez_nft_mints') }}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__ez_nft_mints
|
||||
description: '{{ doc("nft_mint_doc") }}'
|
||||
description: Deprecating soon! This is a notice that we're replacing this table with `nft__ez_nft_mints`. Please migrate queries to the new table by 9/14/23. There will be no column changes or any other changes of any kind.
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
|
||||
@ -6,35 +6,6 @@
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
event_type,
|
||||
platform_address,
|
||||
platform_name,
|
||||
platform_exchange_version,
|
||||
aggregator_name,
|
||||
seller_address,
|
||||
buyer_address,
|
||||
nft_address,
|
||||
project_name,
|
||||
erc1155_value,
|
||||
tokenId,
|
||||
token_metadata,
|
||||
currency_symbol,
|
||||
currency_address,
|
||||
price,
|
||||
price_usd,
|
||||
total_fees,
|
||||
platform_fee,
|
||||
creator_fee,
|
||||
total_fees_usd,
|
||||
platform_fee_usd,
|
||||
creator_fee_usd,
|
||||
tx_fee,
|
||||
tx_fee_usd,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
origin_function_signature
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver_nft__complete_nft_sales') }}
|
||||
{{ ref('nft__ez_nft_sales') }}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__ez_nft_sales
|
||||
description: This table contains NFT sales from Blur, Opensea(Seaport), Looksrare, Rarible, x2y2, Sudoswap, NFTx and Larvalabs(Cryptopunks)
|
||||
description: Deprecating soon! This is a notice that we're replacing this table with `nft__ez_nft_sales`. Please migrate queries to the new table by 9/14/23. There will be no column changes or any other changes of any kind.
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
|
||||
@ -6,18 +6,6 @@
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_number,
|
||||
tx_hash,
|
||||
event_index,
|
||||
event_type,
|
||||
contract_address AS nft_address,
|
||||
project_name,
|
||||
from_address AS nft_from_address,
|
||||
to_address AS nft_to_address,
|
||||
tokenId,
|
||||
token_metadata,
|
||||
erc1155_value
|
||||
*
|
||||
FROM
|
||||
{{ ref('silver__nft_transfers') }}
|
||||
|
||||
{{ ref('nft__ez_nft_transfers') }}
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__ez_nft_transfers
|
||||
description: '{{ doc("nft_transfer_doc") }}'
|
||||
description: Deprecating soon! This is a notice that we're replacing this table with `nft__ez_nft_transfers`. Please migrate queries to the new table by 9/14/23. There will be no column changes or any other changes of any kind.
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
|
||||
34
models/gold/nft/nft__dim_nft_metadata.sql
Normal file
34
models/gold/nft/nft__dim_nft_metadata.sql
Normal file
@ -0,0 +1,34 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true },
|
||||
meta={
|
||||
'database_tags':{
|
||||
'table': {
|
||||
'PURPOSE': 'NFT'
|
||||
}
|
||||
}
|
||||
}
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
blockchain,
|
||||
commission_rate,
|
||||
contract_address,
|
||||
contract_name,
|
||||
created_at_block_id AS created_at_block_number,
|
||||
created_at_timestamp,
|
||||
created_at_tx_id AS created_at_tx_hash,
|
||||
creator_address,
|
||||
creator_name,
|
||||
image_url,
|
||||
project_name,
|
||||
token_id,
|
||||
token_metadata,
|
||||
token_metadata_uri,
|
||||
token_name
|
||||
FROM
|
||||
{{ source(
|
||||
'ethereum_silver',
|
||||
'nft_metadata_legacy'
|
||||
) }}
|
||||
33
models/gold/nft/nft__dim_nft_metadata.yml
Normal file
33
models/gold/nft/nft__dim_nft_metadata.yml
Normal file
@ -0,0 +1,33 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: nft__dim_nft_metadata
|
||||
description: 'This table contains the metadata for popular NFT collections on the Etherum blockchain.'
|
||||
|
||||
columns:
|
||||
- name: BLOCKCHAIN
|
||||
description: 'Blockchain where NFT is from, in this table only `ethereum`'
|
||||
- name: COMMISSION_RATE
|
||||
description: 'Royalty rate for NFT sales.'
|
||||
- name: CONTRACT_ADDRESS
|
||||
description: 'Address of NFT.'
|
||||
- name: CONTRACT_NAME
|
||||
description: 'Name of the contract address.'
|
||||
- name: CREATED_AT_BLOCK_NUMBER
|
||||
description: 'The block number at which the project was created.'
|
||||
- name: CREATED_AT_TIMESTAMP
|
||||
description: 'The block timestamp at which the project was created.'
|
||||
- name: CREATED_AT_TX_HASH
|
||||
description: 'The tx hash at which the project was created.'
|
||||
- name: CREATOR_ADDRESS
|
||||
description: 'The address of the creator of the NFT contract.'
|
||||
- name: CREATOR_NAME
|
||||
description: 'The name of the address that created the NFT contract'
|
||||
- name: IMAGE_URL
|
||||
description: 'Link to NFT image.'
|
||||
- name: PROJECT_NAME
|
||||
description: 'Name of NFT project.'
|
||||
- name: TOKEN_ID
|
||||
description: 'Token ID of the NFT contract.'
|
||||
- name: TOKEN_METADATA
|
||||
description: 'The metadata for the NFT contract.'
|
||||
|
||||
33
models/gold/nft/nft__ez_nft_mints.sql
Normal file
33
models/gold/nft/nft__ez_nft_mints.sql
Normal file
@ -0,0 +1,33 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true },
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'NFT' } } }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_number,
|
||||
tx_hash,
|
||||
event_type,
|
||||
nft_address,
|
||||
project_name,
|
||||
nft_from_address,
|
||||
nft_to_address,
|
||||
tokenId,
|
||||
token_metadata,
|
||||
erc1155_value,
|
||||
mint_price_eth,
|
||||
mint_price_usd,
|
||||
nft_count,
|
||||
amount,
|
||||
amount_usd,
|
||||
mint_price_tokens,
|
||||
mint_price_tokens_usd,
|
||||
mint_token_symbol,
|
||||
mint_token_address,
|
||||
tx_fee,
|
||||
_log_id,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('silver__nft_mints') }}
|
||||
46
models/gold/nft/nft__ez_nft_mints.yml
Normal file
46
models/gold/nft/nft__ez_nft_mints.yml
Normal file
@ -0,0 +1,46 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: nft__ez_nft_mints
|
||||
description: '{{ doc("nft_mint_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("nft_block_no") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: '{{ doc("nft_blocktime") }}'
|
||||
- name: TX_HASH
|
||||
description: '{{ doc("nft_tx_hash") }}'
|
||||
- name: EVENT_TYPE
|
||||
description: '{{ doc("nft_event_type") }}'
|
||||
- name: NFT_ADDRESS
|
||||
description: '{{ doc("nft_nft_address") }}'
|
||||
- name: PROJECT_NAME
|
||||
description: '{{ doc("nft_project_name") }}'
|
||||
- name: ERC1155_VALUE
|
||||
description: '{{ doc("nft_erc1155_value") }}'
|
||||
- name: NFT_FROM_ADDRESS
|
||||
description: '{{ doc("nft_from_address") }}'
|
||||
- name: NFT_TO_ADDRESS
|
||||
description: '{{ doc("nft_to_address") }}'
|
||||
- name: TOKENID
|
||||
description: '{{ doc("nft_tokenid") }}'
|
||||
- name: TOKEN_METADATA
|
||||
description: '{{ doc("nft_metadata") }}'
|
||||
- name: MINT_PRICE_ETH
|
||||
description: '{{ doc("nft_mint_price") }}'
|
||||
- name: MINT_PRICE_USD
|
||||
description: '{{ doc("nft_mint_price_usd") }}'
|
||||
- name: NFT_COUNT
|
||||
description: '{{ doc("nft_mint_count") }}'
|
||||
- name: TX_FEE
|
||||
description: '{{ doc("nft_tx_fee") }}'
|
||||
- name: TX_FEE_USD
|
||||
description: '{{ doc("nft_tx_fee_usd") }}'
|
||||
- name: MINT_PRICE_TOKENS
|
||||
description: '{{ doc("nft_mints_token_price") }}'
|
||||
- name: MINT_PRICE_TOKENS_USD
|
||||
description: '{{ doc("nft_mints_token_price_usd") }}'
|
||||
- name: MINT_TOKEN_SYMBOL
|
||||
description: '{{ doc("nft_mints_symbol") }}'
|
||||
- name: MINT_TOKEN_ADDRESS
|
||||
description: '{{ doc("nft_mints_token_address") }}'
|
||||
40
models/gold/nft/nft__ez_nft_sales.sql
Normal file
40
models/gold/nft/nft__ez_nft_sales.sql
Normal file
@ -0,0 +1,40 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true },
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'NFT' } } }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_number,
|
||||
block_timestamp,
|
||||
tx_hash,
|
||||
event_type,
|
||||
platform_address,
|
||||
platform_name,
|
||||
platform_exchange_version,
|
||||
aggregator_name,
|
||||
seller_address,
|
||||
buyer_address,
|
||||
nft_address,
|
||||
project_name,
|
||||
erc1155_value,
|
||||
tokenId,
|
||||
token_metadata,
|
||||
currency_symbol,
|
||||
currency_address,
|
||||
price,
|
||||
price_usd,
|
||||
total_fees,
|
||||
platform_fee,
|
||||
creator_fee,
|
||||
total_fees_usd,
|
||||
platform_fee_usd,
|
||||
creator_fee_usd,
|
||||
tx_fee,
|
||||
tx_fee_usd,
|
||||
origin_from_address,
|
||||
origin_to_address,
|
||||
origin_function_signature
|
||||
FROM
|
||||
{{ ref('silver_nft__complete_nft_sales') }}
|
||||
66
models/gold/nft/nft__ez_nft_sales.yml
Normal file
66
models/gold/nft/nft__ez_nft_sales.yml
Normal file
@ -0,0 +1,66 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: nft__ez_nft_sales
|
||||
description: This table contains NFT sales from Blur, Opensea(Seaport), Looksrare, Rarible, x2y2, Sudoswap, NFTx and Larvalabs(Cryptopunks)
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("nft_block_no") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: '{{ doc("nft_blocktime") }}'
|
||||
- name: TX_HASH
|
||||
description: '{{ doc("nft_tx_hash") }}'
|
||||
- name: EVENT_TYPE
|
||||
description: '{{ doc("nft_event_type") }}'
|
||||
- name: PLATFORM_ADDRESS
|
||||
description: '{{ doc("nft_platform_address") }}'
|
||||
- name: PLATFORM_NAME
|
||||
description: '{{ doc("nft_platform_name") }}'
|
||||
- name: PLATFORM_EXCHANGE_VERSION
|
||||
description: '{{ doc("nft_platform_exchange_version") }}'
|
||||
- name: AGGREGATOR_NAME
|
||||
description: '{{ doc("nft_aggregator_name") }}'
|
||||
- name: SELLER_ADDRESS
|
||||
description: '{{ doc("nft_seller_address") }}'
|
||||
- name: BUYER_ADDRESS
|
||||
description: '{{ doc("nft_buyer_address") }}'
|
||||
- name: NFT_ADDRESS
|
||||
description: '{{ doc("nft_nft_address") }}'
|
||||
- name: PROJECT_NAME
|
||||
description: '{{ doc("nft_project_name") }}'
|
||||
- name: ERC1155_VALUE
|
||||
description: '{{ doc("nft_erc1155_value") }}'
|
||||
- name: TOKENID
|
||||
description: '{{ doc("nft_tokenid") }}'
|
||||
- name: TOKEN_METADATA
|
||||
description: '{{ doc("nft_metadata") }}'
|
||||
- name: CURRENCY_SYMBOL
|
||||
description: '{{ doc("nft_currency_symbol") }}'
|
||||
- name: CURRENCY_ADDRESS
|
||||
description: '{{ doc("nft_currency_address") }}'
|
||||
- name: PRICE
|
||||
description: '{{ doc("nft_price") }}'
|
||||
- name: PRICE_USD
|
||||
description: '{{ doc("nft_price_usd") }}'
|
||||
- name: TOTAL_FEES
|
||||
description: '{{ doc("nft_total_fees") }}'
|
||||
- name: PLATFORM_FEE
|
||||
description: '{{ doc("nft_platform_fee") }}'
|
||||
- name: CREATOR_FEE
|
||||
description: '{{ doc("nft_creator_fee") }}'
|
||||
- name: TOTAL_FEES_USD
|
||||
description: '{{ doc("nft_total_fees_usd") }}'
|
||||
- name: PLATFORM_FEE_USD
|
||||
description: '{{ doc("nft_platform_fee_usd") }}'
|
||||
- name: CREATOR_FEE_USD
|
||||
description: '{{ doc("nft_creator_fee_usd") }}'
|
||||
- name: TX_FEE
|
||||
description: '{{ doc("nft_tx_fee") }}'
|
||||
- name: TX_FEE_USD
|
||||
description: '{{ doc("nft_tx_fee_usd") }}'
|
||||
- name: ORIGIN_FROM_ADDRESS
|
||||
description: '{{ doc("nft_origin_from") }}'
|
||||
- name: ORIGIN_TO_ADDRESS
|
||||
description: '{{ doc("nft_origin_to") }}'
|
||||
- name: ORIGIN_FUNCTION_SIGNATURE
|
||||
description: '{{ doc("nft_origin_sig") }}'
|
||||
23
models/gold/nft/nft__ez_nft_transfers.sql
Normal file
23
models/gold/nft/nft__ez_nft_transfers.sql
Normal file
@ -0,0 +1,23 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true },
|
||||
meta ={ 'database_tags':{ 'table':{ 'PURPOSE': 'NFT' } } }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
block_timestamp,
|
||||
block_number,
|
||||
tx_hash,
|
||||
event_index,
|
||||
event_type,
|
||||
contract_address AS nft_address,
|
||||
project_name,
|
||||
from_address AS nft_from_address,
|
||||
to_address AS nft_to_address,
|
||||
tokenId,
|
||||
token_metadata,
|
||||
erc1155_value
|
||||
FROM
|
||||
{{ ref('silver__nft_transfers') }}
|
||||
|
||||
30
models/gold/nft/nft__ez_nft_transfers.yml
Normal file
30
models/gold/nft/nft__ez_nft_transfers.yml
Normal file
@ -0,0 +1,30 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: nft__ez_nft_transfers
|
||||
description: '{{ doc("nft_transfer_doc") }}'
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: '{{ doc("nft_block_no") }}'
|
||||
- name: BLOCK_TIMESTAMP
|
||||
description: '{{ doc("nft_blocktime") }}'
|
||||
- name: TX_HASH
|
||||
description: '{{ doc("nft_tx_hash") }}'
|
||||
- name: EVENT_TYPE
|
||||
description: '{{ doc("nft_event_type") }}'
|
||||
- name: NFT_ADDRESS
|
||||
description: '{{ doc("nft_nft_address") }}'
|
||||
- name: PROJECT_NAME
|
||||
description: '{{ doc("nft_project_name") }}'
|
||||
- name: ERC1155_VALUE
|
||||
description: '{{ doc("nft_erc1155_value") }}'
|
||||
- name: NFT_FROM_ADDRESS
|
||||
description: '{{ doc("nft_from_address") }}'
|
||||
- name: NFT_TO_ADDRESS
|
||||
description: '{{ doc("nft_to_address") }}'
|
||||
- name: TOKENID
|
||||
description: '{{ doc("nft_tokenid") }}'
|
||||
- name: TOKEN_METADATA
|
||||
description: '{{ doc("nft_metadata") }}'
|
||||
- name: EVENT_INDEX
|
||||
description: '{{ doc("nft_event_index") }}'
|
||||
15
models/gold/price/price__dim_asset_metadata.sql
Normal file
15
models/gold/price/price__dim_asset_metadata.sql
Normal file
@ -0,0 +1,15 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
token_address,
|
||||
id,
|
||||
symbol,
|
||||
NAME,
|
||||
decimals,
|
||||
provider
|
||||
FROM
|
||||
{{ ref('silver__asset_metadata_all_providers') }}
|
||||
25
models/gold/price/price__dim_asset_metadata.yml
Normal file
25
models/gold/price/price__dim_asset_metadata.yml
Normal file
@ -0,0 +1,25 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: price__dim_asset_metadata
|
||||
description: A comprehensive dimensional table holding all provider asset metadata and other relevant details pertaining to each token_address.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- PROVIDER
|
||||
- ID
|
||||
- TOKEN_ADDRESS
|
||||
- SYMBOL
|
||||
|
||||
columns:
|
||||
- name: PROVIDER
|
||||
description: The provider or source of the data.
|
||||
- name: ID
|
||||
description: The unique identifier representing the asset.
|
||||
- name: NAME
|
||||
description: The name of asset.
|
||||
- name: SYMBOL
|
||||
description: The symbol of asset.
|
||||
- name: TOKEN_ADDRESS
|
||||
description: The specific address representing the asset in a specific platform.
|
||||
- name: DECIMALS
|
||||
description: The number of decimal places the token needs adjusted where token values exist.
|
||||
14
models/gold/price/price__ez_asset_metadata.sql
Normal file
14
models/gold/price/price__ez_asset_metadata.sql
Normal file
@ -0,0 +1,14 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
token_address,
|
||||
id,
|
||||
symbol,
|
||||
NAME,
|
||||
decimals
|
||||
FROM
|
||||
{{ ref('silver__asset_metadata_priority') }}
|
||||
20
models/gold/price/price__ez_asset_metadata.yml
Normal file
20
models/gold/price/price__ez_asset_metadata.yml
Normal file
@ -0,0 +1,20 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: price__ez_asset_metadata
|
||||
description: A convenience table holding prioritized asset metadata and other relevant details pertaining to each token_address.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TOKEN_ADDRESS
|
||||
|
||||
columns:
|
||||
- name: ID
|
||||
description: The unique identifier representing the asset.
|
||||
- name: NAME
|
||||
description: The name of asset.
|
||||
- name: SYMBOL
|
||||
description: The symbol of asset.
|
||||
- name: TOKEN_ADDRESS
|
||||
description: The specific address representing the asset in a specific platform.
|
||||
- name: DECIMALS
|
||||
description: The number of decimal places the token needs adjusted where token values exist.
|
||||
15
models/gold/price/price__ez_hourly_token_prices.sql
Normal file
15
models/gold/price/price__ez_hourly_token_prices.sql
Normal file
@ -0,0 +1,15 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
HOUR,
|
||||
token_address,
|
||||
symbol,
|
||||
decimals,
|
||||
price,
|
||||
is_imputed
|
||||
FROM
|
||||
{{ ref('silver__hourly_prices_priority') }}
|
||||
23
models/gold/price/price__ez_hourly_token_prices.yml
Normal file
23
models/gold/price/price__ez_hourly_token_prices.yml
Normal file
@ -0,0 +1,23 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: price__ez_hourly_token_prices
|
||||
description: A convenience table for determining token prices by address.
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- HOUR
|
||||
- TOKEN_ADDRESS
|
||||
|
||||
columns:
|
||||
- name: HOUR
|
||||
description: Hour that the price was recorded at
|
||||
- name: TOKEN_ADDRESS
|
||||
description: Address of the token
|
||||
- name: SYMBOL
|
||||
description: Symbol of the token
|
||||
- name: DECIMALS
|
||||
description: The number of decimals for token contract
|
||||
- name: PRICE
|
||||
description: Closing price of the recorded hour in USD
|
||||
- name: IS_IMPUTED
|
||||
description: Whether the price was imputed from an earlier record (generally used for low trade volume tokens)
|
||||
14
models/gold/price/price__fact_hourly_token_prices.sql
Normal file
14
models/gold/price/price__fact_hourly_token_prices.sql
Normal file
@ -0,0 +1,14 @@
|
||||
{{ config(
|
||||
materialized = 'view',
|
||||
persist_docs ={ "relation": true,
|
||||
"columns": true }
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
HOUR,
|
||||
token_address,
|
||||
price,
|
||||
is_imputed,
|
||||
provider
|
||||
FROM
|
||||
{{ ref('silver__hourly_prices_all_providers') }}
|
||||
16
models/gold/price/price__fact_hourly_token_prices.yml
Normal file
16
models/gold/price/price__fact_hourly_token_prices.yml
Normal file
@ -0,0 +1,16 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: price__fact_hourly_token_prices
|
||||
description: A comprehensive fact table holding provider specific hourly token prices.
|
||||
|
||||
columns:
|
||||
- name: HOUR
|
||||
description: Hour that the price was recorded at
|
||||
- name: TOKEN_ADDRESS
|
||||
description: Address of the token
|
||||
- name: PROVIDER
|
||||
description: Source of the token price.
|
||||
- name: PRICE
|
||||
description: Closing price of the recorded hour in USD
|
||||
- name: IS_IMPUTED
|
||||
description: Whether the price was imputed from an earlier record (generally used for low trade volume tokens)
|
||||
@ -112,7 +112,7 @@ atoken_prices AS (
|
||||
token_address AS atoken_address,
|
||||
AVG(price) AS hourly_atoken_price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
(
|
||||
token_address IN (
|
||||
|
||||
@ -81,7 +81,7 @@ prices AS (
|
||||
ctoken_address,
|
||||
AVG(price) AS token_price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
INNER JOIN asset_details
|
||||
ON token_address = underlying_asset_address
|
||||
WHERE
|
||||
|
||||
@ -78,7 +78,7 @@ prices AS (
|
||||
ctoken_address,
|
||||
AVG(price) AS token_price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
INNER JOIN asset_details
|
||||
ON token_address = underlying_asset_address
|
||||
WHERE
|
||||
|
||||
@ -81,7 +81,7 @@ prices AS (
|
||||
ctoken_address,
|
||||
AVG(price) AS token_price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
INNER JOIN asset_details
|
||||
ON token_address = underlying_asset_address
|
||||
WHERE
|
||||
|
||||
@ -78,7 +78,7 @@ prices AS (
|
||||
ctoken_address,
|
||||
AVG(price) AS token_price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
INNER JOIN asset_details
|
||||
ON token_address = underlying_asset_address
|
||||
WHERE
|
||||
|
||||
@ -76,7 +76,7 @@ prices AS (
|
||||
ctoken_address,
|
||||
AVG(price) AS token_price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
INNER JOIN asset_details
|
||||
ON token_address = underlying_asset_address
|
||||
WHERE
|
||||
|
||||
@ -35,7 +35,7 @@ token_prices AS (
|
||||
LOWER(token_address) AS token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
HOUR :: DATE IN (
|
||||
SELECT
|
||||
|
||||
@ -29,7 +29,7 @@ token_prices AS (
|
||||
LOWER(token_address) AS token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
HOUR :: DATE IN (
|
||||
SELECT
|
||||
|
||||
@ -30,7 +30,7 @@ token_prices AS (
|
||||
LOWER(token_address) AS token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
HOUR :: DATE IN (
|
||||
SELECT
|
||||
|
||||
@ -35,7 +35,7 @@ token_prices AS (
|
||||
LOWER(token_address) AS token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
HOUR :: DATE IN (
|
||||
SELECT
|
||||
|
||||
@ -35,7 +35,7 @@ token_prices AS (
|
||||
LOWER(token_address) AS token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
HOUR :: DATE IN (
|
||||
SELECT
|
||||
|
||||
@ -35,7 +35,7 @@ token_prices AS (
|
||||
LOWER(token_address) AS token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
HOUR :: DATE IN (
|
||||
SELECT
|
||||
|
||||
@ -12,4 +12,4 @@ SELECT
|
||||
price,
|
||||
is_imputed
|
||||
FROM
|
||||
{{ ref('silver__prices') }}
|
||||
{{ ref('silver__hourly_prices_priority') }}
|
||||
|
||||
@ -1,14 +0,0 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_dex_pool_daily_reads
|
||||
description: Deprecating soon.
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: The block at which the read has been made from the contract
|
||||
- name: CONTRACT_ADDRESS
|
||||
description: The address of the liquidity pool
|
||||
- name: BALANCE_OF_SLP_STAKED
|
||||
description: Balance of pool token that is staked in the protocol for earning rewards
|
||||
- name: TOTAL_SUPPLY_OF_SLP
|
||||
description: total number of pool tokens issued by that pool
|
||||
@ -1,18 +0,0 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__fact_dex_pool_weekly_reads
|
||||
description: Deprecating soon.
|
||||
|
||||
columns:
|
||||
- name: BLOCK_NUMBER
|
||||
description: The block at which the read has been made from the contract
|
||||
- name: PID
|
||||
description: The pool ID of that pool inside the reward contract. In sushi the reward contract is called masterchef
|
||||
- name: CONTRACT_ADDRESS
|
||||
description: The address of the liquidity pool or the reward contract
|
||||
- name: ALLOCATION_POINTS
|
||||
description: allocation points for the pools are used to calculate their share of rewards. when pid is null allocation points is showing the total allocation points for that reward contract
|
||||
- name: CALL_NAME
|
||||
description: the name of the function call. This name is attached to the function signature
|
||||
- name: FUNCTION_SIGNATURE
|
||||
description: '{{ doc("eth_function_id") }}'
|
||||
@ -1,7 +1,7 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: core__ez_snapshot
|
||||
description: A table that contains all votes on Snapshot and information about the voting space and proposal. All data in this table is off chain.
|
||||
description: Deprecating soon! This is a notice that we're replacing this table with `external.snapshot.ez_snapshot_votes`. Please migrate queries to the new table by 9/14/23. There will be no column changes or any other changes of any kind.
|
||||
columns:
|
||||
- name: ID
|
||||
description: A pseudo transaction hash assigned to all votes on snapshot.
|
||||
@ -21,7 +21,7 @@ prices AS (
|
||||
token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
token_address IN (
|
||||
SELECT
|
||||
|
||||
@ -698,7 +698,7 @@ prices AS (
|
||||
token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
token_address IN (
|
||||
SELECT
|
||||
|
||||
@ -472,7 +472,7 @@ prices AS (
|
||||
token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
token_address IN (
|
||||
SELECT
|
||||
|
||||
@ -100,7 +100,7 @@ token_prices AS (
|
||||
END AS token_address,
|
||||
price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
(
|
||||
token_address IN (
|
||||
|
||||
@ -548,7 +548,7 @@ prices_raw AS (
|
||||
decimals,
|
||||
price AS hourly_prices
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
token_address IN (
|
||||
SELECT
|
||||
|
||||
@ -739,7 +739,7 @@ all_prices AS (
|
||||
decimals,
|
||||
price AS hourly_prices
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
(
|
||||
currency_address IN (
|
||||
|
||||
@ -1,35 +0,0 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = 'token_address',
|
||||
tags = ['non_realtime']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
token_address,
|
||||
symbol,
|
||||
provider,
|
||||
id,
|
||||
CASE
|
||||
WHEN provider = 'coingecko' THEN 1
|
||||
WHEN provider = 'coinmarketcap' THEN 2
|
||||
END AS priority,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('bronze__asset_metadata') }}
|
||||
WHERE
|
||||
1 = 1
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND _inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
qualify(ROW_NUMBER() over (PARTITION BY token_address
|
||||
ORDER BY
|
||||
priority ASC)) = 1
|
||||
@ -0,0 +1,41 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ['token_address','symbol','id','provider'],
|
||||
tags = ['non_realtime']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
token_address,
|
||||
id,
|
||||
COALESCE(
|
||||
C.symbol,
|
||||
p.symbol
|
||||
) AS symbol,
|
||||
NAME,
|
||||
decimals,
|
||||
provider,
|
||||
p._inserted_timestamp
|
||||
FROM
|
||||
{{ ref('bronze__asset_metadata_all_providers') }}
|
||||
p
|
||||
LEFT JOIN {{ ref('silver__contracts') }} C
|
||||
ON LOWER(
|
||||
C.address
|
||||
) = p.token_address
|
||||
WHERE
|
||||
1 = 1
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND p._inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
qualify(ROW_NUMBER() over (PARTITION BY token_address, id, COALESCE(C.symbol, p.symbol), provider
|
||||
ORDER BY
|
||||
p._inserted_timestamp DESC)) = 1
|
||||
@ -0,0 +1,18 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__asset_metadata_all_providers
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TOKEN_ADDRESS
|
||||
- SYMBOL
|
||||
- PROVIDER
|
||||
- ID
|
||||
|
||||
columns:
|
||||
- name: TOKEN_ADDRESS
|
||||
tests:
|
||||
- not_null
|
||||
- name: PROVIDER
|
||||
tests:
|
||||
- not_null
|
||||
45
models/silver/prices/silver__asset_metadata_priority.sql
Normal file
45
models/silver/prices/silver__asset_metadata_priority.sql
Normal file
@ -0,0 +1,45 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = 'token_address',
|
||||
tags = ['non_realtime']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
p.token_address,
|
||||
p.id,
|
||||
COALESCE(
|
||||
C.symbol,
|
||||
p.symbol
|
||||
) AS symbol,
|
||||
C.name,
|
||||
C.decimals,
|
||||
p.provider,
|
||||
CASE
|
||||
WHEN p.provider = 'coingecko' THEN 1
|
||||
WHEN p.provider = 'coinmarketcap' THEN 2
|
||||
END AS priority,
|
||||
p._inserted_timestamp
|
||||
FROM
|
||||
{{ ref('bronze__asset_metadata_priority') }}
|
||||
p
|
||||
LEFT JOIN {{ ref('silver__contracts') }} C
|
||||
ON LOWER(
|
||||
C.address
|
||||
) = p.token_address
|
||||
WHERE
|
||||
1 = 1
|
||||
|
||||
{% if is_incremental() %}
|
||||
AND p._inserted_timestamp >= (
|
||||
SELECT
|
||||
MAX(
|
||||
_inserted_timestamp
|
||||
)
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
|
||||
qualify(ROW_NUMBER() over (PARTITION BY token_address
|
||||
ORDER BY
|
||||
priority ASC)) = 1
|
||||
12
models/silver/prices/silver__asset_metadata_priority.yml
Normal file
12
models/silver/prices/silver__asset_metadata_priority.yml
Normal file
@ -0,0 +1,12 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__asset_metadata_priority
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TOKEN_ADDRESS
|
||||
|
||||
columns:
|
||||
- name: TOKEN_ADDRESS
|
||||
tests:
|
||||
- not_null
|
||||
@ -1,17 +1,18 @@
|
||||
{{ config(
|
||||
materialized = 'incremental',
|
||||
unique_key = ['token_address', 'hour'],
|
||||
unique_key = ['token_address', 'hour', 'provider'],
|
||||
tags = ['non_realtime']
|
||||
) }}
|
||||
|
||||
SELECT
|
||||
HOUR,
|
||||
token_address,
|
||||
provider,
|
||||
price,
|
||||
is_imputed,
|
||||
_inserted_timestamp
|
||||
FROM
|
||||
{{ ref('bronze__hourly_prices') }}
|
||||
{{ ref('bronze__hourly_prices_all_providers') }}
|
||||
WHERE
|
||||
1 = 1
|
||||
|
||||
@ -24,4 +25,4 @@ AND _inserted_timestamp >= (
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
17
models/silver/prices/silver__hourly_prices_all_providers.yml
Normal file
17
models/silver/prices/silver__hourly_prices_all_providers.yml
Normal file
@ -0,0 +1,17 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__hourly_prices_all_providers
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
- TOKEN_ADDRESS
|
||||
- HOUR
|
||||
- PROVIDER
|
||||
|
||||
columns:
|
||||
- name: HOUR
|
||||
tests:
|
||||
- not_null
|
||||
- dbt_expectations.expect_row_values_to_have_recent_data:
|
||||
datepart: day
|
||||
interval: 1
|
||||
@ -16,9 +16,9 @@ SELECT
|
||||
) AS symbol,
|
||||
C.decimals AS decimals
|
||||
FROM
|
||||
{{ ref('silver__hourly_prices') }}
|
||||
{{ ref('bronze__hourly_prices_priority') }}
|
||||
p
|
||||
LEFT JOIN {{ ref('silver__asset_metadata') }}
|
||||
LEFT JOIN {{ ref('silver__asset_metadata_priority') }}
|
||||
m
|
||||
ON p.token_address = m.token_address
|
||||
LEFT JOIN {{ ref('silver__contracts') }} C
|
||||
@ -35,4 +35,4 @@ AND p._inserted_timestamp >= (
|
||||
FROM
|
||||
{{ this }}
|
||||
)
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
@ -1,6 +1,6 @@
|
||||
version: 2
|
||||
models:
|
||||
- name: silver__prices
|
||||
- name: silver__hourly_prices_priority
|
||||
tests:
|
||||
- dbt_utils.unique_combination_of_columns:
|
||||
combination_of_columns:
|
||||
@ -60,7 +60,7 @@ eth_prices AS (
|
||||
HOUR,
|
||||
AVG(price) AS eth_price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
token_address = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'
|
||||
GROUP BY
|
||||
|
||||
@ -46,7 +46,7 @@ backup_prices AS(
|
||||
token_address,
|
||||
AVG(price) AS price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
(
|
||||
token_address IN (
|
||||
|
||||
@ -203,7 +203,7 @@ token_prices AS (
|
||||
token_address,
|
||||
AVG(price) AS price
|
||||
FROM
|
||||
{{ ref('core__fact_hourly_token_prices') }}
|
||||
{{ ref('price__ez_hourly_token_prices') }}
|
||||
WHERE
|
||||
token_address IN (
|
||||
SELECT
|
||||
|
||||
@ -2,12 +2,12 @@ version: 2
|
||||
|
||||
sources:
|
||||
- name: crosschain
|
||||
database: crosschain
|
||||
database: "{{ 'crosschain' if target.database == 'ETHEREUM' else 'crosschain_dev' }}"
|
||||
schema: core
|
||||
tables:
|
||||
- name: address_labels
|
||||
- name: dim_date_hours
|
||||
- name: ez_hourly_prices
|
||||
- name: dim_labels
|
||||
- name: ez_hourly_token_prices
|
||||
- name: eth_dev_db
|
||||
database: ethereum_dev
|
||||
schema: silver
|
||||
@ -62,7 +62,7 @@ sources:
|
||||
- name: traces
|
||||
- name: confirm_blocks
|
||||
- name: crosschain_silver
|
||||
database: crosschain
|
||||
database: "{{ 'crosschain' if target.database == 'ETHEREUM' else 'crosschain_dev' }}"
|
||||
schema: silver
|
||||
tables:
|
||||
- name: hourly_prices_coin_gecko
|
||||
@ -70,7 +70,9 @@ sources:
|
||||
- name: hourly_prices_coin_market_cap
|
||||
- name: asset_metadata_coin_market_cap
|
||||
- name: token_prices_priority_hourly
|
||||
- name: token_prices_all_providers_hourly
|
||||
- name: asset_metadata_priority
|
||||
- name: asset_metadata_all_providers
|
||||
- name: number_sequence
|
||||
- name: apis_keys
|
||||
- name: streamline_crosschain
|
||||
|
||||
Loading…
Reference in New Issue
Block a user