Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Week-on-week DSR deposit volumes
select
date_trunc('week', act_at) as act_at_week,
sum(amount / 1e18) as volume
from (
select
e.block_signed_at as act_at,
'0x' || encode(e.tx_hash, 'hex') as tx_hash,
live.hex_to_int(encode(e.topics[4], 'hex')) as amount,
'DSR_DEPOSIT' as act
from live.block_log_events e
where topics[1] = '\x3b4da69f00000000000000000000000000000000000000000000000000000000'
and sender = '\x9759a6ac90977b93b58547b4a71c78317f391a28'
and tx_hash in
(
select
tx_hash
from live.block_log_events
where topics[1] = '\x049878f300000000000000000000000000000000000000000000000000000000'
and sender = '\x197e90f9fad81970ba7976f33cbd77088e5d7cf7'
)
) yy
group by 1
order by 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.