Skip to content

Commit

Permalink
annotate
Browse files Browse the repository at this point in the history
  • Loading branch information
alexshchur committed Dec 10, 2024
1 parent 4c70e11 commit f1d7cef
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion dbt_subprojects/dex/models/_projects/paraswap/stats.sql
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ ordered_entities as (
from entities
order by block_time, tx_hash
)
select blockchain, entity, contract_address, count(*) as qty, sum(varbinary_to_decimal(from_hex(substring(to_hex(tx_hash),1,0+8)))) as txhash_checksum
select
blockchain,
entity,
contract_address,
count(*) as qty,
-- a rubbish but tolerable way to get the checksum of the txhash. Is consistent with internal counterparty query though
sum(varbinary_to_decimal(from_hex(substring(to_hex(tx_hash),1,0+8)))) as txhash_checksum
from ordered_entities
group by 1,2,3
order by qty desc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,13 @@ ordered_entities as (
from entities
order by block_time, tx_hash
)
select blockchain, entity, contract_address, count(*) as qty, sum(varbinary_to_decimal(from_hex(substring(to_hex(tx_hash),1,0+8)))) as txhash_checksum
select
blockchain,
entity,
contract_address,
count(*) as qty,
-- a rubbish but tolerable way to get the checksum of the txhash. Is consistent with internal counterparty query though
sum(varbinary_to_decimal(from_hex(substring(to_hex(tx_hash),1,0+8)))) as txhash_checksum
from ordered_entities
group by 1,2,3
order by qty desc

0 comments on commit f1d7cef

Please sign in to comment.