Skip to content

Commit

Permalink
Replaced Buy Now with Buy (#1496)
Browse files Browse the repository at this point in the history
  • Loading branch information
hildobby authored Sep 5, 2022
1 parent 9b5cefe commit 5b5315d
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions models/seaport/ethereum/seaport_ethereum_schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ models:
meta:
blockchain: ethereum
project: seaport
contributors: sohwak, soispoke
contributors: sohwak, soispoke, hildobby
config:
tags: ['ethereum','seaport','opensea','transaction']
description: >
Expand Down Expand Up @@ -81,7 +81,7 @@ models:
meta:
blockchain: ethereum
project: seaport
contributors: soispoke, sohwak
contributors: soispoke, sohwak, hildobby
config:
tags: ['ethereum','seaport','transfers']
description: >
Expand Down
28 changes: 14 additions & 14 deletions models/seaport/ethereum/seaport_ethereum_transfers.sql
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ with p1_call as (


,p1_add_rn as (select (max(case when purchase_method = 'Offer Accepted' and sub_type = 'offer' and sub_idx = 0 then token_contract_address
when purchase_method = 'Buy Now' and sub_type = 'consideration' then token_contract_address
when purchase_method = 'Buy' and sub_type = 'consideration' then token_contract_address
end) over (partition by tx_hash, evt_index)) as avg_original_currency_contract
,sum(case when purchase_method = 'Offer Accepted' and sub_type = 'offer' and sub_idx = 0 then original_amount
when purchase_method = 'Buy Now' and sub_type = 'consideration' then original_amount
when purchase_method = 'Buy' and sub_type = 'consideration' then original_amount
end) over (partition by tx_hash, evt_index)
/ nft_transfer_count as avg_original_amount
,sum(case when fee_royalty_yn = 'fee' then original_amount end) over (partition by tx_hash, evt_index) / nft_transfer_count as avg_fee_amount
Expand All @@ -95,19 +95,19 @@ with p1_call as (
,a.*
from (select case when purchase_method = 'Offer Accepted' and sub_type = 'consideration' and fee_royalty_idx = 1 then 'fee'
when purchase_method = 'Offer Accepted' and sub_type = 'consideration' and fee_royalty_idx = 2 then 'royalty'
when purchase_method = 'Buy Now' and sub_type = 'consideration' and fee_royalty_idx = 2 then 'fee'
when purchase_method = 'Buy Now' and sub_type = 'consideration' and fee_royalty_idx = 3 then 'royalty'
when purchase_method = 'Buy' and sub_type = 'consideration' and fee_royalty_idx = 2 then 'fee'
when purchase_method = 'Buy' and sub_type = 'consideration' and fee_royalty_idx = 3 then 'royalty'
end as fee_royalty_yn
,case when purchase_method = 'Offer Accepted' and main_type = 'order' then 'Individual Offer'
when purchase_method = 'Offer Accepted' and main_type = 'basic_order' then 'Individual Offer'
when purchase_method = 'Offer Accepted' and main_type = 'advanced_order' then 'Collection/Trait Offers'
else 'Buy Now'
else 'Buy'
end as order_type
,a.*
from (select (count(case when item_type in ('2','3') then 1 end) over (partition by tx_hash, evt_index)) as nft_transfer_count
,(sum(case when item_type in ('0','1') then 1 end) over (partition by tx_hash, evt_index, sub_type order by sub_idx)) as fee_royalty_idx
,case when max(case when (sub_type,sub_idx,item_type) in (('offer',0,'1')) then 1 else 0 end) over (partition by tx_hash) = 1 then 'Offer Accepted'
else 'Buy Now'
else 'Buy'
end as purchase_method
,a.*
from p1_evt a
Expand Down Expand Up @@ -356,7 +356,7 @@ with p1_call as (
,case when evt_tx_hash is null then true else false end as reverted
,'Bulk Purchase' as trade_type
,'Bulk Purchase' as order_type
,'Buy Now' as purchase_method
,'Buy' as purchase_method
from p2_evt a
)

Expand Down Expand Up @@ -519,10 +519,10 @@ with p1_call as (


,p3_add_rn as (select (max(case when purchase_method = 'Offer Accepted' and sub_type = 'offer' and sub_idx = 0 then token_contract_address::string
when purchase_method = 'Buy Now' and sub_type = 'consideration' then token_contract_address::string
when purchase_method = 'Buy' and sub_type = 'consideration' then token_contract_address::string
end) over (partition by tx_hash, evt_index)) as avg_original_currency_contract
,sum(case when purchase_method = 'Offer Accepted' and sub_type = 'offer' and sub_idx = 0 then original_amount
when purchase_method = 'Buy Now' and sub_type = 'consideration' then original_amount
when purchase_method = 'Buy' and sub_type = 'consideration' then original_amount
end) over (partition by tx_hash, evt_index)
/ nft_transfer_count as avg_original_amount
,sum(case when fee_royalty_yn = 'fee' then original_amount end) over (partition by tx_hash, evt_index) / nft_transfer_count as avg_fee_amount
Expand All @@ -532,19 +532,19 @@ with p1_call as (
,a.*
from (select case when purchase_method = 'Offer Accepted' and sub_type = 'consideration' and fee_royalty_idx = 1 then 'fee'
when purchase_method = 'Offer Accepted' and sub_type = 'consideration' and fee_royalty_idx = 2 then 'royalty'
when purchase_method = 'Buy Now' and sub_type = 'consideration' and fee_royalty_idx = 2 then 'fee'
when purchase_method = 'Buy Now' and sub_type = 'consideration' and fee_royalty_idx = 3 then 'royalty'
when purchase_method = 'Buy' and sub_type = 'consideration' and fee_royalty_idx = 2 then 'fee'
when purchase_method = 'Buy' and sub_type = 'consideration' and fee_royalty_idx = 3 then 'royalty'
end as fee_royalty_yn
,case when purchase_method = 'Offer Accepted' and main_type = 'order' then 'Individual Offer'
when purchase_method = 'Offer Accepted' and main_type = 'basic_order' then 'Individual Offer'
when purchase_method = 'Offer Accepted' and main_type = 'advanced_order' then 'Collection/Trait Offers'
else 'Buy Now'
else 'Buy'
end as order_type
,a.*
from (select count(case when item_type in ('2','3') then 1 end) over (partition by tx_hash, evt_index) as nft_transfer_count
,sum(case when item_type in ('0','1') then 1 end) over (partition by tx_hash, evt_index, sub_type order by sub_idx) as fee_royalty_idx
,case when max(case when (sub_type,sub_idx,item_type) in (('offer',0,'1')) then 1 else 0 end) over (partition by tx_hash) = 1 then 'Offer Accepted'
else 'Buy Now'
else 'Buy'
end as purchase_method
,a.*
from p3_evt a
Expand Down Expand Up @@ -786,7 +786,7 @@ with p1_call as (
,false as reverted
,'' as offer_order_type
,'Private Sales' as order_type
,'Buy Now' as purchase_method
,'Buy' as purchase_method
,nft_transfer_count
from p4_add_rn a
where offer_item_type in ('2','3')
Expand Down
12 changes: 6 additions & 6 deletions models/seaport/ethereum/seaport_ethereum_view_transactions.sql
Original file line number Diff line number Diff line change
Expand Up @@ -244,22 +244,22 @@ with iv_availadv as (
,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'
when spc2.call_tx_hash is not null and spc2.parameters:basicOrderType::integer between 0 and 7 then 'Buy Now'
when spc2.call_tx_hash is not null then 'Buy Now'
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'
end as category
,case when spc1.call_tx_hash is not null then 'Collection/Trait Offers' -- 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 Now' -- Buy it directly
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 then 'Buy Now'
when spc3.call_tx_hash is not null and a.original_currency_contract = '0x0000000000000000000000000000000000000000' then 'Buy Now'
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 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
else 'Buy Now'
else 'Buy'
end as order_type

from iv_txn_level a
Expand Down

0 comments on commit 5b5315d

Please sign in to comment.