Query editor
-- ForgottenETH: EtherDelta-like DEX Finder by Function Selectors-- Finds contracts that implement the same function interface as EtherDelta-style DEXes-- This catches reimplementations and forks even when bytecode differs---- Key selectors for EtherDelta pattern:-- deposit() = 0xd0e30db0-- withdraw(uint256) = 0x2e1a7d4d-- depositToken(address,uint256)= 0x338b5dea-- withdrawToken(address,uint256)= 0x9e281a98-- trade(...) = 0x0a19b14a (EtherDelta-specific)-- availableVolume(...) = 0xfb6e155f---- A contract with deposit+withdraw+depositToken is very likely an EtherDelta fork-- (WETH has deposit+withdraw but NOT depositToken)SELECTct.address,ct.block_time as deployed_at,ct."from" as deployer,bytearray_length(ct.code) as bytecode_size,-- Score: how many EtherDelta selectors are present(CASE WHEN position(0xd0e30db0 IN ct.code) > 0 THEN 1 ELSE 0 END+ CASE WHEN position(0x2e1a7d4d IN ct.code) > 0 THEN 1 ELSE 0 END+ CASE WHEN position(0x338b5dea IN ct.code) > 0 THEN 1 ELSE 0 END+ CASE WHEN position(0x9e281a98 IN ct.code) > 0 THEN 1 ELSE 0 END+ CASE WHEN position(0x0a19b14a IN ct.code) > 0 THEN 1 ELSE 0 END+ CASE WHEN position(0xfb6e155f IN ct.code) > 0 THEN 1 ELSE 0 END) as selector_match_score,-- Individual selector presenceposition(0xd0e30db0 IN ct.code) > 0 as has_deposit,position(0x2e1a7d4d IN ct.code) > 0 as has_withdraw,position(0x338b5dea IN ct.code) > 0 as has_depositToken,position(0x9e281a98 IN ct.code) > 0 as has_withdrawToken,position(0x0a19b14a IN ct.code) > 0 as has_trade,position(0xfb6e155f IN ct.code) > 0 as has_availableVolume,COALESCE(lbl.namespace, '') as dune_namespace,COALESCE(lbl.name, '') as dune_contract_nameFROM ethereum.creation_traces ctLEFT JOIN ethereum.contracts lbl ON ct.address = lbl.addressWHERE ct.block_date >= DATE '2016-01-01'AND ct.block_date < DATE '2024-01-01'-- Must have the core trio: deposit + withdraw + depositTokenAND position(0xd0e30db0 IN ct.code) > 0AND position(0x2e1a7d4d IN ct.code) > 0AND position(0x338b5dea IN ct.code) > 0-- Minimum bytecode size (real DEX > 3KB, filters out trivial contracts)AND bytearray_length(ct.code) > 3000-- Exclude already-known contractsAND ct.address NOT IN (0x2a0c0DBEcC7E4D658f48E01e3fA353F44050c208,0x8d12A197cB00D4747a1fe03395095ce2A5CC6819,0x1ce7ae555139c5ef5a57cc8d814a867ee6ee33d8,0x373c55c277b866a69dc047cad488154ab9759466,0x9a2d163ab40f88c625fd475e807bbc3556566f80,0x4d55f76ce2dbbae7b48661bef9bd144ce0c9091b,0xbf29685856fae1e228878dfb35b280c0adcc3b05,0x04f062809b244e37e7fdc21d9409469c989c2342,0xf4c27b8b002389864ac214cb13bfeef4cc5c4e8d,0x3c020e014069df790d4f4e63fd297ba4e1c8e51f,0xd8d48e52f39ab2d169c8b562c53589e6c71ac4d3,