Query editor
-- when you mint LP token, it is transferred from NULL address to your address-- when burn, it is sent from you to NULL (0x0000000000000000000000000000000000000000)WITHliq_transfer_in AS (SELECTdate_trunc('week', evt_block_time) AS week -- for bonusQ, making a histogram, tx.to as holder, contract_address as pool, sum(cast(amount0 as double)/1e18) as token0inFROM uniswap_v3_ethereum.Pair_evt_Mint m --erc20_ethereum.evt_Transfer table does not show any result w/V3 pool addressLEFT JOIN ethereum.transactions txON tx.hash = m.evt_tx_hashWHERE contract_address = {{D8_Pool Address}}AND to != 0x0000000000000000000000000000000000000000GROUP BY 1, 2, 3), liq_transfers_out as (SELECTdate_trunc('week', evt_block_time) AS week, tx."from" as holder, contract_address as pool, sum(cast(amount0 as double)/1e18) as token0outFROM uniswap_v3_ethereum.Pair_evt_Burn bLEFT JOIN ethereum.transactions txON tx.hash = b.evt_tx_hashWHERE contract_address = {{D8_Pool Address}}AND "from" != 0x0000000000000000000000000000000000000000GROUP BY 1, 2, 3), net_balance as (SELECTt_in.week, t_in.pool, t_in.holder, t_in.token0in - COALESCE(t_out.token0out, 0) as balanceFROM liq_transfer_in t_inLEFT JOIN liq_transfers_out t_out ON t_in.holder = t_out.holderAND t_in.pool = t_out.poolAND t_in.week = t_out.weekWHERE t_in.token0in - COALESCE(t_out.token0out, 0) > 0), total_supply as ( -- calculate once. sum of all balance is the total liquidity in the poolSELECTweek, pool, sum(balance) total_balanceFROM net_balanceGROUP BY 1, 2)SELECTnt.week, nt.pool, holder, case when tr.address is not null then 'contract'else 'eoa/wallet'