Query editor
/* Migration success :)There are some cases such as unnest/sequence and array/json functions the migrator won't take care of for you(but we have examples of in the docs linked below!)If you're still running into issues, check out the doc examples https://dune.com/docs/reference/dune-v2/query-engine/or reach out to us in the Dune discord in the #dune-sql channel.*/WITHtransfers AS (SELECTevt_tx_hash AS tx_hash,tr."from" AS address,-CAST(value AS double) AS amount,contract_addressFROMerc20_ethereum.evt_Transfer AS trWHEREcontract_address = 0xE1Fc4455f62a6E89476f1072530C20CF1A0622dAUNION ALLSELECTevt_tx_hash AS tx_hash,tr."to" AS address,CAST(value AS DOUBLE) AS amount,contract_addressFROMerc20_ethereum.evt_Transfer AS trWHEREcontract_address = 0xE1Fc4455f62a6E89476f1072530C20CF1A0622dA),holders AS (SELECTaddress,SUM(CAST(amount AS DOUBLE)/power(10,18)) AS balanceFROMtransfersWHEREaddress <> 0x4819CecF672177F37e5450Fa6DC78d9BaAfa74beAND address <> 0xdF9A636BF3a80059f42348e2ba65497da0fEBE17AND address <> 0x6b56102d384fbfFa5d992668ab22f20f0B88D630AND address <> 0x6575A93aBdFf85e5A6b97c2DB2b83bCEbc3574eCAND address <> 0x429829f2bda490Caa61B02180b5Eb59e254e7f52AND address <> 0xf561a95445f9ea348480e2245ba9dc51647ade20AND address <> 0x2D20d56B8f3ce115036Bf510957EFD3C06C50772GROUP BYaddressHAVINGSUM(CAST(amount AS DOUBLE)/power(10,18)) > 0ORDER BYbalance DESC NULLS FIRST)select sum(cast(balance as double)) as "Circulating Supply" from holders