Query editor
-- query 2 All accounts with active vesting positionwith active_vesting_pos as (select vest.*from hmx_arbitrum.Vester_evt_LogVest vestleft join (select * from hmx_arbitrum.Vester_evt_LogAbort) abort on vest.owner = abort.owner and vest.itemIndex = abort.itemIndexwhere abort.owner is null),claim_history as (select owner, itemIndex, max(evt_block_time) as last_claimed ,sum(vestedAmount) as claimed from hmx_arbitrum.Vester_evt_LogClaimgroup by owner, itemIndex),dp_bal as (select account, sum(amount) as dpAmountfrom ( -- check these 2 table pls(select caller as account, -cast(amount as decimal) as amount from hmx_arbitrum.HMXStaking_evt_LogWithdrawwhere token = 0x26e7db328167aef8d8231135f444d0674cb466fc)union all(select user as account, cast(amount as decimal) as amount from hmx_arbitrum.HMXStaking_evt_LogDepositwhere token = 0x26e7db328167aef8d8231135f444d0674cb466fc))group by account)select vesting.*, dpAmountfrom (select owner, sum(vestingEsHmxBeforeClaim) as totalVestingEsHmxBeforeClaim,sum(vestingEsHmxAfterClaim) as totalVestingEsHmxAfterClaimfrom(select owner, itemIndex, amount, claimedAmount, pendingClaimedAmount, from_unixtime(startTime) as startTime, from_unixtime(endTime) as endTime,endTime - startTime as duration,amount - claimedAmount as vestingEsHmxBeforeClaim,amount - claimedAmount - pendingClaimedAmount as vestingEsHmxAfterClaimfrom(select evt_tx_hash, active_vesting_pos.owner, active_vesting_pos.itemIndex, amount, startTime, endTime,coalesce(claimed, 0) as claimedAmount,amount * ((least(to_unixtime(current_timestamp), endTime)) - least(endTime, to_unixtime(coalesce(last_claimed, from_unixtime(startTime))))) / (endTime - startTime) as pendingClaimedAmountfrom active_vesting_posleft join claim_history on active_vesting_pos.owner = claim_history.owner and active_vesting_pos.itemIndex = claim_history.itemIndex)where endTime - startTime = 31536000)group by owner) vesting left join dp_bal on vesting.owner = dp_bal.account