Query editor
withgovv2_evt as (select*fromethereum.logswhereblock_number >= 21683156and contract_address = 0x636dEb767Cd7D0f15ca4aB8eA9a9b26E98B426AC -- liquity governance),deposit as (selectblock_time,varbinary_substring (topic1, 13) as "user",varbinary_to_uint256 (varbinary_substring (data, 33, 32)) as amount,varbinary_to_uint256 (varbinary_substring (data, 33, 32)) * to_unixtime(block_time) as pw, --partial weight1. as f, -- factor to multiply pw1 as directionfromgovv2_evtwheretopic0 = 0x5cd37895bb9287e542a426d6abbc93d7daca0979bd43264d320d4fd224a5fc5e -- DepositLQTY),withdraw as (selectblock_time,varbinary_substring (topic1, 13) as "user",varbinary_to_uint256 (varbinary_substring (data, 33, 32)) as amount,-1 as directionfromgovv2_evtwheretopic0 = 0x2870fe177552976b0dbc3166ded2169d5d73275fc565df30894320fd3608f339 -- WithdrawLQTY),b as ( -- balanceselectblock_time,"user",sum(cast(amount as int256) * direction) over (partition by"user"order byblock_time asc rows between unbounded precedingand current row) as cumsumfrom(selectblock_time,"user",amount,directionfromdepositunionselectblock_time,"user",amount,direction