Skip to content

Instantly share code, notes, and snippets.

@gane5h
Created January 22, 2020 00:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gane5h/7b905e5a09ae9e2de5e7d3a8b9875f78 to your computer and use it in GitHub Desktop.
Save gane5h/7b905e5a09ae9e2de5e7d3a8b9875f78 to your computer and use it in GitHub Desktop.
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
@ylisa11
Copy link

ylisa11 commented Mar 21, 2024

Can u please provide some instructions on which database or interface to connect? With just a .sql we just can't get anything qaq. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment