Query editor
with outgoing as (select sum(value) / 1e18 as value, "to" as accountfrom erc20_arbitrum.evt_Transferwhere "from" = 0xee1D57aCE6350D70E8161632769d29D34B2FbfC8and contract_address = 0xD5954c3084a1cCd70B4dA011E67760B8e78aeE84group by 2), incoming as (select sum(value) / 1e18 * 0.99 as value, "from" as accountfrom erc20_arbitrum.evt_Transferwhere "to" = 0xee1D57aCE6350D70E8161632769d29D34B2FbfC8and contract_address = 0xD5954c3084a1cCd70B4dA011E67760B8e78aeE84group by 2), total as (selectincoming.account,(incoming.value - coalesce(outgoing.value, 0)) as balancefromincomingleft joinoutgoing on (incoming.account = outgoing.account))-- Adding total staked amount as the first rowselect 0x0000000000000000000000000000000000000000 as account, sum(balance) as balance from totalwherebalance > 0 andaccount not in (0xd2bcFd6b84E778D2DE5Bb6A167EcBBef5D053A06)UNION ALL-- Individual balancesselect account, balance from totalwherebalance > 0 andaccount not in (0xd2bcFd6b84E778D2DE5Bb6A167EcBBef5D053A06)order by balance desc;