Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{% set nft_models = [
ref('aavegotchi_polygon_base_trades')
,ref('aurem_polygon_base_trades')
,ref('courtyard_polygon_base_trades')
,ref('dew_polygon_base_trades')
,ref('decentraland_polygon_base_trades')
,ref('element_polygon_base_trades')
Expand Down Expand Up @@ -60,4 +61,4 @@ SELECT * FROM (
{% endfor %}
)
)
select * from base_union
select * from base_union
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

version: 2
models:

Expand Down Expand Up @@ -42,6 +41,16 @@ models:
description: "NFT trades view for collectionswap"


- name: courtyard_trades_view
meta:
blockchain: ["polygon"]
sector: nft
contributors: mukhtaryah
config:
tags: ['nft', 'trades', 'courtyard', 'polygon']
description: "NFT trades view for courtyard"


- name: cryptopunks_trades_view
meta:
blockchain: ["ethereum"]
Expand Down Expand Up @@ -259,5 +268,4 @@ models:
contributors: hildobby
config:
tags: ['nft', 'trades', 'blast']
description: "NFT trades view for fantasy"

description: "NFT trades view for fantasy"
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{{ config(
schema = 'nft',
materialized = 'view',
post_hook='{{ expose_spells(\'["polygon"]\',
"sector",
"nft",
\'["mukhtaryah"]\') }}'
)
}}

SELECT
blockchain,
project,
version,
block_date,
block_month,
block_time,
block_number,
tx_hash,
'' as project_contract_address,
trade_type as trade_category,
'Trade' as trade_type,
buyer,
seller,
nft_contract_address,
token_id as nft_token_id,
token_amount as nft_amount,
price as price_raw,
payment_token as currency_contract,
platform_fee_usd as platform_fee_amount_raw,
royalty_fee_usd as royalty_fee_amount_raw,
'' as platform_fee_address,
'' as royalty_fee_address,
sub_idx as sub_tx_trade_id,
tx_hash as tx_from,
tx_hash as tx_to,
'' as tx_data_marker
FROM {{ ref('courtyard_polygon_trades') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{{ config(
schema = 'courtyard_polygon',
alias = 'base_trades',
materialized = 'view'
)
}}

SELECT
blockchain,
project,
version as project_version,
block_time,
block_date,
block_month,
block_number,
tx_hash,
cast(null as varbinary) as project_contract_address,
trade_type as trade_category,
'Trade' as trade_type,
buyer,
seller,
nft_contract_address,
token_id as nft_token_id,
token_amount as nft_amount,
price as price_raw,
payment_token as currency_contract,
platform_fee_usd as platform_fee_amount_raw,
royalty_fee_usd as royalty_fee_amount_raw,
cast(null as varbinary) as platform_fee_address,
cast(null as varbinary) as royalty_fee_address,
sub_idx as sub_tx_trade_id,
tx_hash as tx_from,
tx_hash as tx_to,
cast(null as varbinary) as tx_data_marker
FROM {{ ref('courtyard_polygon_trades') }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
version: 2

models:
- name: courtyard_polygon_trades
meta:
blockchain: polygon
sector: nft
project: courtyard
contributors: mukhtaryah
config:
tags: ['polygon', 'courtyard', 'trades', 'nft']
description: >
Courtyard trades on Polygon
columns:
- name: blockchain
description: "Blockchain where the trade occurred (polygon)"
- name: project
description: "Project name (courtyard)"
- name: version
description: "Project version"
- name: block_time
description: "UTC event block time"
- name: block_date
description: "UTC event block date"
- name: block_month
description: "UTC event block month"
- name: block_number
description: "Block number"
- name: tx_hash
description: "Transaction hash"
- name: evt_index
description: "Event index"
- name: buyer
description: "Buyer wallet address"
- name: seller
description: "Seller wallet address"
- name: nft_contract_address
description: "NFT contract address"
- name: token_id
description: "NFT token ID"
- name: amount_usd
description: "Trade amount in USD"
- name: platform_fee_usd
description: "Platform fee in USD"

- name: courtyard_polygon_base_trades
meta:
blockchain: polygon
sector: nft
project: courtyard
contributors: mukhtaryah
config:
tags: ['polygon', 'courtyard', 'base_trades', 'nft']
description: >
Courtyard base trades on Polygon
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{{ config(
schema = 'courtyard_polygon',
alias = 'trades',
partition_by = ['block_month'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
unique_key = ['block_date', 'tx_hash', 'evt_index', 'nft_contract_address', 'token_id', 'sub_type', 'sub_idx'],
post_hook='{{ expose_spells(\'["polygon"]\',
"project",
"courtyard",
\'["mukhtaryah"]\') }}'
)
}}

-- Courtyard trades on Polygon via Seaport
SELECT
s.blockchain,
'courtyard' as project,
s.version,
s.block_date,
s.block_month,
s.block_time,
s.block_number,
s.tx_hash,
s.evt_index,
s.buyer,
s.seller,
s.amount_usd as price_usd,
s.platform_fee_amount_usd as platform_fee_usd,
s.royalty_fee_amount_usd as royalty_fee_usd,
s.nft_contract_address,
s.token_id,
s.token_standard,
s.number_of_items as token_amount,
s.trade_type,
s.currency_contract as payment_token,
s.amount_raw as price,
s.sub_type,
s.sub_idx
FROM {{ ref('seaport_polygon_trades') }} s
WHERE s.nft_contract_address = 0x251be3a17af4892035c37ebf5890f4a4d889dcad
{% if is_incremental() %}
AND s.block_time >= date_trunc('day', now() - interval '7' day)
{% endif %}