Query editor
with stake as (select s_in."from" as address, sum(cast(s_in.value as double)/1e18) as total_stake, count(evt_tx_hash) as txns,min(evt_block_time) as first_tx, max(evt_block_time) as last_txfrom erc20_ethereum.evt_Transfer s_inwhere "contract_address" = 0x3ebb4A4e91Ad83BE51F8d596533818b246F4bEe1and "to" = 0x89cD3d08927dB0C86b8eBf299f4C7225Ee08DEaagroup by 1),unstake as (select s_out."to" as address, sum(cast(s_out.value as double)/1e18) as total_unstake, count(evt_tx_hash) as txns,min(evt_block_time) as first_tx, max(evt_block_time) as last_txfrom erc20_ethereum.evt_Transfer s_outwhere "contract_address" = 0x3ebb4A4e91Ad83BE51F8d596533818b246F4bEe1and "from" = 0x89cD3d08927dB0C86b8eBf299f4C7225Ee08DEaagroup by 1),harvest as (select hv."to" as address, sum(cast(hv.value as decimal)/1e18) as claim, count(evt_tx_hash) as txns,min(evt_block_time) as first_tx, max(evt_block_time) as last_txfrom erc20_ethereum.evt_Transfer hvwhere "contract_address" = 0x49428f057dd9d20a8e4c6873e98afd8cd7146e3band "from" = 0x89cD3d08927dB0C86b8eBf299f4C7225Ee08DEaagroup by 1),staking as (select stk.address, stk.total_stake, stk.txns as stake_txns, stk.first_tx as first_stake, stk.last_tx as last_stake,ustk.total_unstake, ustk.txns as unstake_txns, ustk.first_tx as first_unstake, ustk.last_tx as last_unstakefrom stake stkleft join unstake ustk on stk.address = ustk.address),staking_harvest as (select s.*, hv.claim as total_harvest, hv.txns as harvest_txns, hv.first_tx as first_harvest, hv.last_tx as last_harvestfrom staking sleft join harvest hv on s.address = hv.address)select row_number() over (order by total_harvest desc) as id,address, total_stake as staked_sata, stake_txns, first_stake, last_stake,coalesce(total_unstake, 0) as unstaked_sata, coalesce(unstake_txns, 0) as unstake_txns, first_unstake, last_unstake,coalesce(total_harvest, 0) as harvested_dsata, coalesce(harvest_txns, 0) as harvest_txns, first_harvest, last_harvestfrom staking_harvest shv