Query editor
-- Blackhole DEX (Algebra CL / Thena ve(3,3) fork) on Avalanche-- ═══════════════════════════════════════════════════════════════-- FEE FLOW CLARIFICATION (confirmed on-chain):-- Trading fees → Bribe contracts → veNFT VOTERS (NOT LPs)-- LP earnings → BZBLACK emissions from GaugeManager only---- Column guide:-- lp_emissions_apy_pct = APY for LPs (emissions only)-- voter_fee_apy_pct = APY for veNFT voters who voted for this pool (fee only)-- lp_total_apy_pct = total LP APY = emissions only (fees excluded)---- Emission token: BZBLACK 0x40dedf55455641d39931623942bafa9974951881-- Pool token: BLACK 0xcd94a87696fac69edae3a70fe5725307ae1c43f6 (price proxy)-- GaugeManager: 0xe9a9a87345067d4b70b031dd731f41d9c0893bd6-- AlgebraFactory: 0x512eb749541B7cf294be882D636218c84a5e9E5F-- ═══════════════════════════════════════════════════════════════WITH-- CL pools from AlgebraFactory (standard + custom)v3_pools AS (SELECT token0, token1, pool AS pool_addressFROM blackhole_avalanche_c.algebrafactory_evt_poolUNIONSELECT token0, token1, pool AS pool_addressFROM blackhole_avalanche_c.algebrafactory_evt_custompool),-- Gauge -> Pool mappinggauge_pool AS (SELECT DISTINCT _0 AS pool_address, output_0 AS gauge_addressFROM blackhole_avalanche_c.gaugemanager_call_gaugesWHERE output_0 != 0x0000000000000000000000000000000000000000),-- Latest fee per pool (fee in ppm units: 500 = 0.05%)-- NOTE: fee goes to voters via Bribe, not to LPspool_fee AS (SELECT pool_address, fee_ppmFROM (SELECT contract_address AS pool_address,fee AS fee_ppm,ROW_NUMBER() OVER (PARTITION BY contract_address ORDER BY evt_block_time DESC) AS rnFROM blackhole_avalanche_c.algebrapool_evt_fee) WHERE rn = 1),token_info AS (SELECT contract_address AS address, symbol, decimalsFROM tokens.erc20 WHERE blockchain = 'avalanche_c'),-- BZBLACK emissions per gauge per epoch (GaugeManager DistributeReward decoded table)distribute_events AS (SELECTCAST(date_trunc('week', evt_block_time + INTERVAL '4' DAY) AS TIMESTAMP) - INTERVAL '4' DAY AS epoch_ts,gauge AS gauge_address,CAST(amount AS DOUBLE) / 1e18 AS black_emittedFROM blackhole_avalanche_c.gaugemanager_evt_distributereward),