Query editor
WITH pndc_mined AS (SELECTc."to" AS address,SUM(c."value" / 1e18) AS total_pndc_minedFROM ethereum.transactions AS aINNER JOIN ethereum.traces_decoded AS bON a.hash = b.tx_hashINNER JOIN erc20_ethereum.evt_Transfer AS cON a.hash = c.evt_tx_hashWHEREa.to = 0xe7f01261EF9792095E22aBBF7F6f7B881D423C28 /* Pond Claims contract */AND a.success = TRUEAND b.function_name = 'claim'AND c.contract_address = 0x423f4e6138E475D85CF7Ea071AC92097Ed631eea /* $PNDC */GROUP BYc."to"),pndc_sold AS (SELECTd.tx_from AS address,SUM(d.token_sold_amount) AS total_pndc_soldFROM dex.trades AS dWHEREd.blockchain = 'ethereum'AND d.token_sold_address = 0x423f4e6138E475D85CF7Ea071AC92097Ed631eea /* $PNDC */GROUP BYd.tx_from),pndc_bought AS (SELECTd.tx_to AS address,SUM(d.token_bought_amount) AS total_pndc_boughtFROM dex.trades AS dWHEREd.blockchain = 'ethereum'AND d.token_bought_address = 0x423f4e6138E475D85CF7Ea071AC92097Ed631eea /* $PNDC */GROUP BYd.tx_to),pndc_counts AS (SELECTm.address AS address,m.total_pndc_mined,s.total_pndc_sold,COALESCE(b.total_pndc_bought, 0) AS total_pndc_boughtFROM pndc_mined AS mJOIN pndc_sold AS sON m.address = s.addressLEFT JOIN pndc_bought AS bON m.address = b.address)SELECTpc.address,pc.total_pndc_mined,pc.total_pndc_sold,pc.total_pndc_bought,