Query editor
-- ============================================================================-- Aragon governance-takeover risk screen v2 ("Token of Power"-class)-- Universe : DAOs whose Voting app delegatecalls the SAME base impl as the-- exploited TOP DAO -> 0xde3a93028f2283cc28756b3674bd657eafb992f4-- Pipeline : fingerprint sibling Voting proxies (delegatecall traces)-- -> recover gov token via shared deploy-tx clustering-- -> supply / mintability / liveness / DEX price-- -> liquid treasury (WETH+stables in DAO app cluster)-- -> mint-and-dump value-at-risk (WETH+stables in the token's pools)-- -> rank by extractable - cost_to_acquire_majority-- CAVEAT : `minted_after_launch` = supply grew, NOT proof the Voting app can-- mint. Confirm via ACL (MINT_ROLE held by Voting/Token Manager)-- before treating a mintable row as a real mint-and-dump target.-- `cost_51pct` is a SPOT lower bound (ignores buy-side slippage).-- `pool_var_usd` excludes singleton-vault DEXs (Balancer V2 / Uniswap-- V4): their one-contract-for-all-pools design aggregates unrelated-- liquidity and massively inflates per-token VaR.-- Note : aragon_ethereum.voting_* decoded tables are empty -> liveness from-- raw traces; heavy balance scans are bounded to the live+traded set.-- ============================================================================WITH weth_px AS (SELECT amount_usd/token_sold_amount AS p FROM dex.tradesWHERE blockchain='ethereum' AND token_sold_address=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2AND token_sold_amount>1 AND amount_usd>0 ORDER BY block_time DESC LIMIT 1),same_logic AS (SELECT "from" AS voting_proxy, COUNT(*) AS lifetime_calls, MAX(block_time) AS last_active,MAX(CASE WHEN block_time > TIMESTAMP '2025-01-01' THEN 1 ELSE 0 END) AS alive_2025FROM ethereum.tracesWHERE "to" = 0xde3a93028f2283cc28756b3674bd657eafb992f4 AND call_type='delegatecall'GROUP BY 1),vproxy_tx AS (SELECT ct.address AS voting_proxy, ct.tx_hash AS dao_txFROM ethereum.creation_traces ct JOIN same_logic sl ON sl.voting_proxy=ct.address),cluster AS (SELECT v.voting_proxy, sib.address AS memberFROM vproxy_tx v JOIN ethereum.creation_traces sib ON sib.tx_hash=v.dao_tx),tok AS (SELECT c.voting_proxy, c.member AS gov_token,SUM(CASE WHEN t."from"=0x0000000000000000000000000000000000000000 THEN t.valueWHEN t."to" =0x0000000000000000000000000000000000000000 THEN -t.value ELSE 0 END)/1e18 AS total_supply,SUM(CASE WHEN t."from"=0x0000000000000000000000000000000000000000 THEN 1 ELSE 0 END) AS mint_events,MIN(t.evt_block_time) AS first_xfer,MAX(CASE WHEN t."from"=0x0000000000000000000000000000000000000000 THEN t.evt_block_time END) AS last_mintFROM cluster c JOIN erc20_ethereum.evt_Transfer t ON t.contract_address=c.memberGROUP BY 1,2),gov AS (SELECT * FROM (SELECT tok.*, ROW_NUMBER() OVER (PARTITION BY voting_proxy ORDER BY total_supply DESC) rnFROM tok WHERE total_supply>0) WHERE rn=1),price AS (SELECT gov_token, price_usd FROM (SELECT token_bought_address AS gov_token, amount_usd/token_bought_amount AS price_usd,ROW_NUMBER() OVER (PARTITION BY token_bought_address ORDER BY block_time DESC) rnFROM dex.trades WHERE blockchain='ethereum'AND token_bought_address IN (SELECT gov_token FROM gov)