Query editor
withdeposits as (SELECTnft_id, sum(value) as valuefrom (SELECTcast(value / 1e18 as DECIMAL) as value, tokenId as nft_idfrom scale_base.VotingEscrow_evt_Deposit--where evt_block_time <= cast('2023-06-08 00:00:00' as TIMESTAMP)UNION allSELECT(-1) * cast(value / 1e18 as DECIMAL) as value, tokenId as nft_idfrom scale_base.VotingEscrow_evt_Withdraw--where evt_block_time <= cast('2023-06-08 00:00:00' as TIMESTAMP))xGROUP by 1),nft_transfers as (SELECTold_owner, new_owner, nft_id, evt_tx_hashfrom (SELECT"from" as old_owner, to as new_owner, tokenId as nft_id, evt_block_time, evt_tx_hash, row_number() over (partition by tokenId order by evt_block_time desc) as row_numfrom scale_base.VotingEscrow_evt_Transfer--where evt_block_time <= cast('2023-06-08 00:00:00' as TIMESTAMP))xwhere row_num = 1order by nft_id asc)--10205, sanity_check_transfers as (SELECTnft_id, COUNT(evt_tx_hash) as counterfrom nft_transferswhere nft_id > cast(0 as uint256)GROUP by 1order by 2 desc, 1)--SELECT * from sanity_check_transfers--10205, sanity_check_deposits as (SELECT * from depositsorder by nft_id asc