Query editor
---- This query iterates all staking (manual stake, auto-stake, unstake) and claiming events for illuvium stakers.---- Important note : because autostake events overlap with claiming events (claims are always auto-staked) you should always-- use the is_claim field to specify if you want the staking or the claiming events.--WITH events AS (---- v1 ILV Pool events--SELECT'v1_ILVPool_ManualStake' as "source",_by as "address",cast(amount as int256) as amount_ilv,cast(0 as int256) as amount_slp,cast(0 as int256) as amount_silv,evt_block_time as "block_time",evt_index as "index",from_unixtime(t2._lockUntil) "locked_until"FROM illuvium_ethereum.IlluviumCorePool_evt_Staked t1 LEFT JOIN illuvium_ethereum.IlluviumCorePool_call_stake t2 ON t1.evt_tx_hash = t2.call_tx_hashWHERE t1.contract_address = 0x25121eddf746c884dde4619b573a7b10714e2a36UNION ALLSELECT'v1_ILVPool_YieldClaim' as "source",_by as "address",case when sIlv = false then cast(amount as int256) else cast(0 as int256) end as amount_ilv,cast(0 as int256) as amount_slp,case when sIlv = true then cast(amount as int256) else cast(0 as int256) end as amount_silv,evt_block_time as "block_time",evt_index as "index",null as "locked_until"FROM illuvium_ethereum."IlluviumCorePool_evt_YieldClaimed" t1WHERE contract_address = 0x25121eddf746c884dde4619b573a7b10714e2a36UNION ALLSELECT'v1_ILVPool_AutoStake' as "source", -- v1 does not generate an event when auto-staking yield_by as "address",case when sIlv = false then cast(amount as int256) else cast(0 as int256) end as amount_ilv,cast(0 as int256) as amount_slp,case when sIlv = true then cast(amount as int256) else cast(0 as int256) end as amount_silv,evt_block_time + interval '1' second as "block_time",(evt_index+1) as "index", -- add 1 to the index so claim and autostake don't coincide.evt_block_time + interval '356' day as "locked_until"FROM illuvium_ethereum."IlluviumCorePool_evt_YieldClaimed" t1WHERE contract_address = 0x25121eddf746c884dde4619b573a7b10714e2a36AND sIlv = falseUNION ALLSELECT'v1_ILVPool_Unstake' as "source",_by as "address",cast(amount as int256) as amount_ilv,cast(0 as int256) as amount_slp,cast(0 as int256) as amount_silv,evt_block_time as "block_time",evt_index as "index",null as "locked_until"FROM illuvium_ethereum."IlluviumCorePool_evt_Unstaked" t1WHERE contract_address = 0x25121eddf746c884dde4619b573a7b10714e2a36