Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making nft tables' trade_category more consistent #1841

Merged
merged 5 commits into from
Nov 10, 2022
Merged
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 @@ -202,7 +202,7 @@ SELECT
, token_standard
, 1 as number_of_items
, 'Single Item Trade' as trade_type
, case when tx_from = seller then 'Sell' else 'Buy' end as trade_category
, case when tx_from = seller then 'Offer Accepted' else 'Buy' end as trade_category
, 'Trade' as evt_type
, seller
, buyer
Expand Down
4 changes: 2 additions & 2 deletions models/element/avalanche_c/element_avalanche_c_events.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WITH element_txs AS (
, 'erc721' AS token_standard
, 'Single Item Trade' AS trade_type
, 1 AS number_of_items
, 'Sell' AS trade_category
, 'Offer Accepted' AS trade_category
, ee.maker AS seller
, ee.taker AS buyer
, ee.erc20TokenAmount AS amount_raw
Expand Down Expand Up @@ -73,7 +73,7 @@ WITH element_txs AS (
, 'erc1155' AS token_standard
, 'Single Item Trade' AS trade_type
, 1 AS number_of_items
, 'Sell' AS trade_category
, 'Offer Accepted' AS trade_category
, ee.maker AS seller
, ee.taker AS buyer
, ee.erc20FillAmount AS amount_raw
Expand Down
4 changes: 2 additions & 2 deletions models/element/bnb/element_bnb_events.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WITH element_txs AS (
, 'erc721' AS token_standard
, 'Single Item Trade' AS trade_type
, 1 AS number_of_items
, 'Sell' AS trade_category
, 'Offer Accepted' AS trade_category
, ee.maker AS seller
, ee.taker AS buyer
, ee.erc20TokenAmount AS amount_raw
Expand Down Expand Up @@ -73,7 +73,7 @@ WITH element_txs AS (
, 'erc1155' AS token_standard
, 'Single Item Trade' AS trade_type
, 1 AS number_of_items
, 'Sell' AS trade_category
, 'Offer Accepted' AS trade_category
, ee.maker AS seller
, ee.taker AS buyer
, ee.erc20FillAmount AS amount_raw
Expand Down
4 changes: 2 additions & 2 deletions models/element/ethereum/element_ethereum_events.sql
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ WITH element_txs AS (
, 'erc721' AS token_standard
, 'Single Item Trade' AS trade_type
, 1 AS number_of_items
, 'Sell' AS trade_category
, 'Offer Accepted' AS trade_category
, ee.maker AS seller
, ee.taker AS buyer
, ee.erc20TokenAmount AS amount_raw
Expand Down Expand Up @@ -73,7 +73,7 @@ WITH element_txs AS (
, 'erc1155' AS token_standard
, 'Single Item Trade' AS trade_type
, 1 AS number_of_items
, 'Sell' AS trade_category
, 'Offer Accepted' AS trade_category
, ee.maker AS seller
, ee.taker AS buyer
, ee.erc20FillAmount AS amount_raw
Expand Down
18 changes: 9 additions & 9 deletions models/seaport/ethereum/seaport_ethereum_view_transactions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -246,23 +246,23 @@ with iv_availadv as (
,a.fee_amount / power(10, e2.decimals) as fee_amount
,a.fee_amount / power(10, e2.decimals) * p2.price as fee_usd_amount
,a.zone as zone_address
,case when spc1.call_tx_hash is not null then 'Auction'
when spc2.call_tx_hash is not null and spc2.parameters:basicOrderType::integer between 16 and 23 then 'Auction'
,case when spc1.call_tx_hash is not null then 'Auction Settled'
when spc2.call_tx_hash is not null and spc2.parameters:basicOrderType::integer between 16 and 23 then 'Auction Settled'
when spc2.call_tx_hash is not null and spc2.parameters:basicOrderType::integer between 0 and 7 then 'Buy'
when spc2.call_tx_hash is not null then 'Buy'
when spc3.call_tx_hash is not null and spc3.advancedOrder:parameters:consideration[0]:identifierOrCriteria > '0' then 'Trait Offer'
when spc3.call_tx_hash is not null then 'Collection Offer'
else 'Private Sales'
when spc3.call_tx_hash is not null and spc3.advancedOrder:parameters:consideration[0]:identifierOrCriteria > '0' then 'Trait Offer Accepted'
when spc3.call_tx_hash is not null then 'Collection Offer Accepted'
else 'Private Sale'
end as category
,case when spc1.call_tx_hash is not null then 'Collection/Trait Offers' -- include English Auction and Dutch Auction
,case when spc1.call_tx_hash is not null then 'Collection/Trait Offer Accepted' -- include English Auction and Dutch Auction
when spc2.call_tx_hash is not null and spc2.parameters:basicOrderType::integer between 0 and 15 then 'Buy' -- Buy it directly
when spc2.call_tx_hash is not null and spc2.parameters:basicOrderType::integer between 16 and 23 and spc2.parameters:considerationIdentifier = a.nft_token_id then 'Individual Offer'
when spc2.call_tx_hash is not null and spc2.parameters:basicOrderType::integer between 16 and 23 and spc2.parameters:considerationIdentifier = a.nft_token_id then 'Individual Offer Accepted'
when spc2.call_tx_hash is not null then 'Buy'
when spc3.call_tx_hash is not null and a.original_currency_contract = '0x0000000000000000000000000000000000000000' then 'Buy'
when spc3.call_tx_hash is not null then 'Collection/Trait Offers' -- offer for collection
when spc3.call_tx_hash is not null then 'Collection/Trait Offer Accepted' -- offer for collection
when spc4.call_tx_hash is not null then 'Bulk Purchase' -- bundles of NFTs are purchased through aggregators or in a cart
when spc5.call_tx_hash is not null then 'Bulk Purchase' -- bundles of NFTs are purchased through aggregators or in a cart
when spc6.call_tx_hash is not null then 'Private Sales' -- sales for designated address
when spc6.call_tx_hash is not null then 'Private Sale' -- sales for designated address
else 'Buy'
end as order_type

Expand Down
2 changes: 1 addition & 1 deletion models/zora/ethereum/zora_ethereum_events.sql
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ WITH zora_trades AS (
, z3_ape_af.evt_block_time AS block_time
, z3_ape_af.evt_block_number AS block_number
, z3_ape_af.tokenId AS token_id
, 'Private Buy' AS trade_category
, 'Private Sale' AS trade_category
, get_json_object(z3_ape_af.ask, '$.seller') AS seller
, get_json_object(z3_ape_af.ask, '$.buyer') AS buyer
, get_json_object(z3_ape_af.ask, '$.price') AS amount_raw
Expand Down