Query editor
SELECT user as address,CASE WHEN amount_staked < 0.0001 THEN 0 ELSE amount_staked END as amount_staked,unvesting_amount FROM (SELECT user,SUM(CASE WHEN action = 'Stake' THEN amount WHEN action = 'Unstake' THEN -amount END) as amount_staked,SUM(CASE WHEN action = 'Unstake' AND claim_flag = false THEN amount ELSE 0 END) as unvesting_amountFROM (select * from (select call_block_time as evt_block_time,'Stake' as action,"from" as user,output_flyStaked/1e6 as amount,call_tx_hash as evt_tx_hash,null as claim_flagfrom fluidity_staking_v1_arbitrum.StakingV1_call_stakePermitleft join erc20_arbitrum.evt_Transfer on call_tx_hash=evt_tx_hashunion allselect evt_block_time,'Stake' as action,account as user,amount/1e6 as amount,evt_tx_hash,null as claim_flagfrom fluidity_airdrop_arbitrum.MerkleDistributorWithDeadline_evt_ClaimedAndStaked)UNION ALLselect call_block_time as evt_block_time,'Unstake' as action,"from" as user,_flyToUnstake/1e6 as amount,call_tx_hash as evt_tx_hash,CASE WHEN current_timestamp-call_block_time > INTERVAL '7' DAY THEN true ELSE false END as claim_flagfrom (fluidity_staking_v1_arbitrum.StakingV1_call_beginUnstakeleft joinerc20_arbitrum.evt_Transfer on call_tx_hash=evt_tx_hash)where call_success = true) xGROUP BY 1) p where amount_staked < 1000000000