Query editor
withpools as (select distinct project_contract_address as address, project as dex_namefrom dex.trades), cexes as (select address, max(cex_name) as cex_namefrom cex.addressesgroup by address), names as (select address, max_by(namespace, created_at) as namespace, max_by(name, created_at) as namefrom ethereum.contractsgroup by address), creations as (select address, min(block_time) as block_timefrom ethereum.creation_tracesgroup by address), vestings as (select address, min(block_time) as createdfrom ethereum.creation_traceswhere bytearray_substring(code, 1, 616) = 0x608060405234801561001057600080fd5b506004361061011b5760003560e01c8063718da7ee116100b2578063d85349f711610081578063f2fde38b11610066578063f2fde38b14610223578063f7260d3e14610256578063fc0c546a1461025e5761011b565b8063d85349f714610213578063e834a8341461021b5761011b565b8063718da7ee146101745780638da5cb5b146101a7578063af38d757146101d8578063cbf0b0c0146101e05761011b565b80634a4e5776116100ee5780634a4e5776146101525780634e71d92d1461015a5780635d1fbf5414610164578063715018a61461016c5761011b565b80631989488b146101205780631f2698ab1461013a578063460ad4391461014257806348a0d7541461014a575b600080fd5b610128610266565b60408051918252519081900360200190f35b61012861028a565b6101286102ae565b6101286102d2565b6101286102ee565b610162610312565b005b6101286103f9565b61016261041d565b6101626004803603602081101561018a57600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610534565b6101af6106fa565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b610128610716565b610162600480360360208110156101f657600080fd5b503573ffffffffffffffffffffffffffffffffffffffff1661087b565b610128610aa1565b610128610ac5565b6101626004803603602081101561023957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610acb565b6101af610c6c565b6101af610c88565b7fgroup by address)selectaffiliation, balance, balance_total, balance / balance_total as balance_percent, transfers, transfers_total, cast(transfers as double) / transfers_total as transfers_percent, addresses, addresses_total, cast(addresses as double) / addresses_total as addresses_percentfrom (selectcasewhen address = 0xa0446d8804611944f1b527ecd37d7dcbe442caba then 'Staking V1'when address = 0x9a0c8ff858d273f57072d714bca7411d717501d7 then 'Staking V2'when address = 0x5e89f8d81c74e311458277ea1be3d3247c7cd7d1 then 'Foundation'when dex_name is not null then 'DEXs'when cex_name is not null then 'CEXs'when created is not null then 'Vestings'when namespace is not null then case whenposition('gnosis_safe' in namespace) > 0 or position('gnosis_multisig' in namespace) > 0 then 'Multisigs' else 'SCs' end -- 'SCs: ' || split_part(namespace, '_', 1)when creations.block_time is not null then 'SCs: Noname'when balance < 1e1 or balance is null then 'W1: Wallets with less than 10 1INCH'when balance < 1e2 then 'W2: Wallets with 10-100 1INCH'when balance < 1e3 then 'W3: Wallets with 100-1k 1INCH'when balance < 1e4 then 'W4: Wallets with 1k-10k 1INCH'when balance < 1e5 then 'W5: Wallets with 10k-100k 1INCH'