Query editor
WITH eligible_addresses AS (-- Addresses that qualified for the airdropSELECT DISTINCT "to" AS wallet_address,SUM(value) / 1e18 AS total_airdrop_allocationFROM erc20_ethereum.evt_transferWHERE contract_address = FROM_HEX('76a0e27618462bdac7a29104bdcfff4e6bfcea2d') -- SOSO TokenGROUP BY 1),claimed_addresses AS (-- Addresses that have already claimed SOSO airdropSELECT "to" AS wallet_address,SUM(value) / 1e18 AS claimed_amountFROM erc20_ethereum.evt_transferWHERE contract_address = FROM_HEX('76a0e27618462bdac7a29104bdcfff4e6bfcea2d')AND "from" = FROM_HEX('0x640cb7201810bc920835a598248c4fe4898bb5e0') -- Airdrop DistributorGROUP BY 1)SELECTe.wallet_address,e.total_airdrop_allocation AS total_airdrop_allocation, -- Total amount allocatedCOALESCE(c.claimed_amount, 0) AS claimed_amount, -- Amount already claimed(e.total_airdrop_allocation - COALESCE(c.claimed_amount, 0)) AS unclaimed_amount, -- Remaining claimable amountCASEWHEN c.wallet_address IS NOT NULL THEN 'Claimed'ELSE 'Unclaimed'END AS claim_statusFROM eligible_addresses eLEFT JOIN claimed_addresses c ON e.wallet_address = c.wallet_addressORDER BY claim_status DESC, unclaimed_amount DESC;