Query editor
with claims as (selectreward / 1e18 as claimed,varbinary_ltrim(user) as urn,evt_block_date as block_date,evt_block_time as block_timefrom sky_ethereum.stakingrewards_evt_rewardpaidwhere contract_address = 0x38E4254bD82ED5Ee97CD1C4278FAae748d998865),stakes as (selectamount / 1e18 as staked,varbinary_ltrim(user) as urn,evt_block_date as block_date,evt_block_time as block_timefrom sky_ethereum.stakingrewards_evt_stakedwhere contract_address = 0x38E4254bD82ED5Ee97CD1C4278FAae748d998865),withdrawals as (select amount / 1e18 as withdrawn,varbinary_ltrim(user) as urn,evt_block_date as block_date,evt_block_time as block_timefrom sky_ethereum.stakingrewards_evt_withdrawnwhere contract_address = 0x38E4254bD82ED5Ee97CD1C4278FAae748d998865),lockstake_open as (selectvarbinary_ltrim(owner) as user,index,varbinary_ltrim(urn) as urnfrom sky_ethereum.lockstakeengine_evt_openwhere contract_address = 0xCe01C90dE7FD1bcFa39e237FE6D8D9F569e8A6a3),claims_u as (select claimed, user, c.block_time, c.block_date from claims c join lockstake_open using(urn)),stakes_u as (select staked, user, s.block_time, s.block_date from stakes s join lockstake_open using(urn)),withdrawals_u as (select withdrawn, user, w.block_time, w.block_date from withdrawals w join lockstake_open using(urn)),balances as (select max_by(balance, block_time) as balance, user, block_datefrom (selectsum(v) over (partition by userorder by block_time descrows betweencurrent rowand unbounded following) as balance,user,block_date,