Skip to content

Commit

Permalink
Merge branch 'main' into patch-20
Browse files Browse the repository at this point in the history
  • Loading branch information
Hosuke authored Nov 17, 2024
2 parents b8b10cd + 5e42805 commit 00710da
Showing 1 changed file with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,21 @@
)
}}


with deduplicated_royalties as (
select * from (
select
call_tx_hash
,call_block_number
,call_block_time
,value
,tokenAddress
,tokenId
,output_amounts
,output_recipients
,row_number() over (partition by call_tx_hash, call_block_time, tokenAddress, tokenId, tokenAddress, value order by call_trace_address) as row_number
from {{source('king_of_destiny_nova','MarketplaceV3_call_GetRoyalty')}}
) where row_number = 1
)
select
'nova' as blockchain
,'king_of_destiny' as project
Expand Down Expand Up @@ -41,7 +55,7 @@ left join {{source('king_of_destiny_nova','MarketplaceV3_DirectListingsLogic_ev
{% if is_incremental() %}
and {{incremental_predicate('l.evt_block_time')}}
{% endif %}
left join {{source('king_of_destiny_nova','MarketplaceV3_call_GetRoyalty')}} r
left join deduplicated_royalties r
on s.evt_tx_hash = r.call_tx_hash
and s.evt_block_number = r.call_block_number
and s.totalPricePaid = r.value
Expand All @@ -50,9 +64,6 @@ left join {{source('king_of_destiny_nova','MarketplaceV3_call_GetRoyalty')}} r
{% if is_incremental() %}
and {{incremental_predicate('r.call_block_time')}}
{% endif %}
WHERE
s.evt_tx_hash != 0xde7696b64c41bc6ffe2834ba51da7f04121f49c08fc89de724413bf81e6e16be
and (s.evt_index not in (13, 19))
{% if is_incremental() %}
and {{incremental_predicate('s.evt_block_time')}}
Where {{incremental_predicate('s.evt_block_time')}}
{% endif %}

0 comments on commit 00710da

Please sign in to comment.