Query editor
with total_supply as (SELECT 'EEFI' as connector,round(sum(tokens_minted), 2) as total_supplyFROM (SELECT date_trunc('day', evt_block_time) as daily,sum(value / 1e18) as tokens_mintedFROM erc20_ethereum.evt_Transfer AS tWHERE t.contract_address = 0x857FfC55B1Aa61A7fF847C82072790cAE73cd883AND t."from" = 0x0000000000000000000000000000000000000000GROUP BY date_trunc('day', evt_block_time)UNION ALLSELECT date_trunc('day', evt_block_time) as daily, -sum(value / 1e18) as tokens_mintedFROM erc20_ethereum.evt_Transfer AS tWHERE t.contract_address = 0x857FfC55B1Aa61A7fF847C82072790cAE73cd883AND t."to" = 0x0000000000000000000000000000000000000000GROUP BY date_trunc('day', evt_block_time)))select address,sum(total) as presale_eefi_claimed,max(prices.price) * sum(total) as claimed_eefi_value,21665 - sum(total) as eefi_remaining_to_claim,max(prices.price) * (21665 - sum(total)) as unclaimed_eefi_value,max(total_supply) as total_supply,(21665 - sum(total)) + max(total_supply) as total_supply_including_unclaimed_presales,((21665 - sum(total)) + max(total_supply)) * max(prices.price) as fdv_including_unclaimed_tokensfrom (select sum(CAST(value as double)/pow(10,COALESCE(b.decimals, 18))) as total, to as addressfrom erc20_ethereum.evt_Transfer aleft join tokens.erc20 b on a.contract_address = b.contract_address and b.blockchain = 'ethereum'where a.contract_address = 0x4cFc3f4095D19b84603C11FD8A2F0154e9036a98and (a."from" = 0x8177cf86A69Fe1EabA3238a9eeaA725DC79dd665 or a."to" = 0x8177cf86A69Fe1EabA3238a9eeaA725DC79dd665)group by 2union allselect -sum(CAST(value as double)/pow(10,COALESCE(b.decimals, 18))) as total, "from" as addressfrom erc20_ethereum.evt_Transfer aleft join tokens.erc20 b on a.contract_address = b.contract_address and b.blockchain = 'ethereum'where a.contract_address = 0x4cFc3f4095D19b84603C11FD8A2F0154e9036a98and (a."from" = 0x8177cf86A69Fe1EabA3238a9eeaA725DC79dd665 or a."to" = 0x8177cf86A69Fe1EabA3238a9eeaA725DC79dd665)group by 2)join total_supplyon total_supply.connector = 'EEFI'join (select token_address as contract_address, token_price_usd as pricefrom dex.prices_latestwhere token_address = 0x857FfC55B1Aa61A7fF847C82072790cAE73cd883order by block_time desclimit 1) as priceson prices.contract_address = 0x857FfC55B1Aa61A7fF847C82072790cAE73cd883where address = 0x8177cf86A69Fe1EabA3238a9eeaA725DC79dd665group by address