Skip to content

Commit

Permalink
Init NFT subproject
Browse files Browse the repository at this point in the history
  • Loading branch information
0xRobin committed Jun 5, 2024
1 parent 8cf1c59 commit 129df80
Show file tree
Hide file tree
Showing 472 changed files with 767 additions and 2,070 deletions.
37 changes: 0 additions & 37 deletions dbt_project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,6 @@ models:
optimism:
+schema: velodrome_optimism

nft:
+schema: nft
ethereum:
+schema: nft_ethereum
metadata:
+schema: nft_ethereum_metadata
+materialized: table
+file_format: delta
+tags: "static"

cex:
+schema: cex
arbitrum:
Expand Down Expand Up @@ -348,28 +338,6 @@ models:
fantom:
+schema: wigoswap_fantom

bend_dao:
+schema: bend_dao
ethereum:
+schema: bend_dao_ethereum

seaport:
+schema: seaport
ethereum:
+schema: seaport_ethereum
bnb:
+schema: seaport_bnb
arbitrum:
+schema: seaport_arbitrum
optimism:
+schema: seaport_optimism
avalanche_c:
+schema: seaport_avalanche_c
polygon:
+schema: seaport_polygon
base:
+schema: seaport_base

balances:
+schema: balances
ethereum:
Expand Down Expand Up @@ -488,11 +456,6 @@ models:
optimism:
+schema: lifi_optimism

astaria:
+schema: astaria
ethereum:
+schema: astaria_ethereum

aragon:
+schema: aragon
ethereum:
Expand Down
2 changes: 1 addition & 1 deletion docs/seeds/seed_overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Seeds will be required in these sector-level spell additions to ensure proper le
3. Within the [model schema file](/models/_sector/dex/trades/arbitrum/_schema.yml#L20-L23), call the [generic seed test](/tests/generic/check_dex_base_trades_seed.sql) with parameters necessary:
- Seed file name.
- Filter(s) for project versions, if the spell is split into versions per project.
4. Ultimately, following the above steps, the test query built and executed against seed files lives in the generic seed macro [here](/macros/test-helpers/check_seed_macro.sql).
4. Ultimately, following the above steps, the test query built and executed against seed files lives in the generic seed macro [here](/macros/generic-tests/check_seed_macro.sql).

## How Do I Track Seed Tests Running During Development?

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
{% macro check_column_types_macro(model, column_types) %}
with test_sample as (
select * from {{model}} limit 1
)
, equality_checks as (
{%- for col, col_type in column_types.items() %}
select '{{col}}' column_name, '{{col_type}}' as expected_type, typeof({{col}}) as actual_type
from test_sample
{% if not loop.last %}union all{% endif %}
{% endfor -%}
)
select * from equality_checks where not contains(split(expected_type,'/'),actual_type)
{% endmacro %}

-- this tests checks the column types of a model
{% test check_column_types(model, column_types) %}
{{ check_column_types_macro(model,column_types) }}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
-- this macro is used in generic tests that check a model for every row in a seed file.
-- you need to specify the matching columns and the columns to check for equality.
-- filter: dictionary filter of column:value that is applied to the seed file
-- below the macro you'll find the actual generic tests

{% macro check_seed_macro(model, seed_file, seed_matching_columns=[], seed_check_columns=[], filter=None) %}

Expand Down Expand Up @@ -102,3 +103,14 @@
-- equality check can be null so we have to check explicitly for nulls
where equality_check is distinct from true
{% endmacro %}


{% test check_seed(model, seed_file, match_columns=[], check_columns=[], filter=None) %}

{{ config(severity = 'error') }}
{%- set seed_check_columns = check_columns -%}
{%- set seed_matching_columns = match_columns -%}
{%- set seed = seed_file -%}
{{ check_seed_macro(model,seed,seed_matching_columns,seed_check_columns,filter) }}

{% endtest %}
13 changes: 0 additions & 13 deletions macros/test-helpers/check_column_types_macro.sql

This file was deleted.

5 changes: 0 additions & 5 deletions macros/test-helpers/test_helpers_schema.yml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,3 @@ FROM {{ source('alienswap_base','Alienswap_evt_OrderFulfilled') }} s
WHERE s.evt_block_time >= timestamp '{{alienswap_usage_start_date}}'
{% endif %}
)

-- this will be removed once tx_from and tx_to are available in the base event tables
{{ add_nft_tx_data('base_trades', 'base') }}
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,3 @@ with base_trades as (
where s.evt_block_time >= timestamp '{{tevaera_usage_start_date}}'
{% endif %}
)

-- this will be removed once tx_from and tx_to are available in the base event tables
{{ add_nft_tx_data('base_trades', 'zksync') }}
114 changes: 0 additions & 114 deletions models/bend_dao/ethereum/bend_dao_ethereum_schema.yml
Original file line number Diff line number Diff line change
@@ -1,114 +1,6 @@
version: 2

models:
- name: bend_dao_ethereum_lending
meta:
blockchain: ethereum
project: bend_dao
contributors: [Henrystats]
config:
tags: ['ethereum','bend_dao','v1','lending']
description: >
bend_dao lending (repay & borrow) on ethereum
tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- block_date
- blockchain
- project
- version
- evt_type
- tx_hash
- evt_index
- check_seed:
seed_file: ref('bend_dao_nft_lending')
match_columns:
- block_number
- tx_hash
- token_id
check_columns:
- amount_original
- evt_type
- borrower
columns:
- &blockchain
name: blockchain
description: "Blockchain"
- &project
name: project
description: "Project"
- &version
name: version
description: "Project version"
- &lending_category
name: lending_category
description: "Type of loans offered by the project, usually either pool to borrower or peer to peer"
- &block_time
name: block_time
description: "UTC event block time"
- &block_date
name: block_date
description: "UTC event block date"
- &block_month
name: block_month
description: "UTC event block month"
- &token_id
name: token_id
description: "NFT Token ID"
- &collection
name: collection
description: "NFT collection name"
- &amount_usd
name: amount_usd
description: "USD value of the trade at time of execution"
- &token_standard
name: token_standard
description: "Token standard"
- &evt_type
name: evt_type
description: "Event type (Borrow, Repay)"
- &borrower
name: borrower
description: "Address that took the loan"
- &lender
name: lender
description: "Address that faciliated the loan"
- &amount_original
name: amount_original
description: "Traded amount in original currency"
- &amount_raw
name: amount_raw
description: "Traded amount in original currency before decimals correction"
- &collateral_currency_symbol
name: collateral_currency_symbol
description: "Symbol of collateral currency used for loan"
- &collateral_currency_contract
name: collateral_currency_contract
description: "Contract address of collateral currency used for loan"
- &nft_contract_address
name: nft_contract_address
description: "NFT contract address"
- &project_contract_address
name: project_contract_address
description: "Contract address used by the project, in this case bend_dao contract"
- &tx_hash
name: tx_hash
description: "Transaction hash"
- &block_number
name: block_number
description: "Block number in which the transaction was executed "
- &tx_from
name: tx_from
description: "Address that initiated the transaction"
- &tx_to
name: tx_to
description: "Address that received the transaction"
- &evt_index
name: evt_index
description: "Index of the corresponding lending event"
- &lien_id
name: lien_id
description: "Unique loan id "

- name: bend_dao_ethereum_airdrop_claims
meta:
Expand All @@ -126,10 +18,6 @@ models:
- recipient
- evt_index
columns:
- *blockchain
- *block_time
- *block_number
- *project
- &airdrop_number
name: airdrop_number
description: "Airdrop identifier number"
Expand All @@ -139,7 +27,6 @@ models:
- &contract_address
name: contract_address
description: "Contract addressed used"
- *tx_hash
- name: amount_raw
description: "Raw amount of tokens"
- name: amount_original
Expand All @@ -152,4 +39,3 @@ models:
- &token_symbol
name: token_symbol
description: "Token symbol"
- *evt_index
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ config(

alias = 'current_bids',
unique_key='punk_id',
post_hook='{{ expose_spells(\'["ethereum"]\',
Expand Down Expand Up @@ -51,7 +51,7 @@ with combined_events_table as (
, block_number
, sub_tx_trade_id as evt_index
, tx_hash
from {{ ref('cryptopunks_ethereum_base_trades') }}
from {{ source('nft', 'base_trades') }}
WHERE project = 'cryptopunks'
) a
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ config(

alias = 'current_listings',
unique_key='punk_id',
post_hook='{{ expose_spells(\'["ethereum"]\',
Expand Down Expand Up @@ -33,7 +33,7 @@ with all_listing_events as (
, sub_tx_trade_id as evt_index
, block_time as evt_block_time
, tx_hash as evt_tx_hash
from {{ ref('cryptopunks_ethereum_base_trades') }}
from {{ source('nft', 'base_trades') }}
where project = 'cryptopunks'
)
, all_transfers as (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ config(

alias = 'floor_price_over_time',
unique_key='day',
post_hook='{{ expose_spells(\'["ethereum"]\',
Expand Down Expand Up @@ -33,7 +33,7 @@ with all_listing_events as (
, sub_tx_trade_id as evt_index
, block_time as evt_block_time
, tx_hash as evt_tx_hash
from {{ ref('cryptopunks_ethereum_base_trades') }}
from {{ source('nft', 'base_trades') }}
where project = 'cryptopunks'
)
, all_transfers as (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{ config(

alias = 'listings_over_time',
unique_key='day',
post_hook='{{ expose_spells(\'["ethereum"]\',
Expand Down Expand Up @@ -33,7 +33,7 @@ with all_listing_events as (
, sub_tx_trade_id as evt_index
, block_time as evt_block_time
, tx_hash as evt_tx_hash
from {{ ref('cryptopunks_ethereum_base_trades') }}
from {{ source('nft', 'base_trades') }}
where project = 'cryptopunks'
)
, all_transfers as (
Expand Down
Loading

0 comments on commit 129df80

Please sign in to comment.