Query editor
WITH latest_price AS (SELECT(token_bought_amount / token_sold_amount) AS priceFROM dex.tradesWHEREtoken_bought_address = 0x888cea2bbdd5d47a4032cf63668d7525c74af57aAND token_sold_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2ORDER BYDATE_TRUNC('day', block_time) DESCLIMIT 1), latest_eth_price AS (SELECTmedian_price AS eth_priceFROM dex.pricesWHEREcontract_address = 0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2ORDER BYDATE_TRUNC('day', hour) DESCLIMIT 1), internal_addrs_eth as (-- Query 1: Addresses with tokens locked and rewardsselect * from (VALUES(0x72453ca299e210fec55e825509da19a2e0bb4f0e), -- team locked - original address - 0x8DE39859Bf6BeE5BeF8551e668e4841e2f7d46C5(0x823f220b641aaa693a6d6527aD832382459956EB), -- dreamlabs incubator locked (this address is empty as dreamlabs seems to have staked it here: 0xf9fa02cc165dbd70ff34d27b5ac9e0ae6d74d756)(0x9A279223bc5CA20750FC5394f519251f6d53943c), -- buybacks locked(0x18fde6a2c1e63cbc758154944aa6e61b5f4029c2) -- staking rewards) as t(addr)),latest_cir as (-- Query 1: Calculate Circulating Supplyselectevt_block_time as "time","from", "to",-cast(value as double)/1e18 as amount,contract_address -- Include contract_address in the resultFROM erc20_ethereum.evt_Transfer trwhere contract_address = 0x888cea2bbdd5d47a4032cf63668d7525c74af57aand "from" in (select addr from internal_addrs_eth)and "to" not in (select addr from internal_addrs_eth)UNION ALLselectevt_block_time as "time","from", "to",cast(value as double)/1e18 as amount,contract_address -- Include contract_address in the resultFROM erc20_ethereum.evt_Transfer trwhere contract_address = 0x888cea2bbdd5d47a4032cf63668d7525c74af57aand "to" in (select addr from internal_addrs_eth)and "from" not in (select addr from internal_addrs_eth)),market_data AS (SELECTlatest_eth_price.eth_price AS eth_price,(100000000 - SUM(amount)) AS circulating_supply