Query editor
WITH official_pools AS (SELECTpool,token0,token1,feeFROM uniswap_v3_ethereum.factory_evt_poolcreatedWHERE contract_address = 0x1F98431c8aD98523631AE4a59f267346ea31F984),latest_events AS (SELECTe.contract_address AS pool,e.feeProtocol0New AS fee_protocol0,e.feeProtocol1New AS fee_protocol1,e.evt_block_time AS last_set_time,e.evt_block_number,e.evt_index,e.evt_tx_hash AS last_set_tx_hash,row_number() OVER (PARTITION BY e.contract_addressORDER BY e.evt_block_number DESC, e.evt_index DESC) AS rnFROM uniswap_v3_ethereum.uniswapv3pool_evt_setfeeprotocol eINNER JOIN official_pools p ON p.pool = e.contract_address),current_state AS (SELECTpool,fee_protocol0,fee_protocol1,last_set_time,last_set_tx_hashFROM latest_eventsWHERE rn = 1),tokens_needed AS (SELECT token0 AS contract_address FROM official_poolsUNIONSELECT token1 AS contract_address FROM official_pools),erc20 AS (SELECT e.contract_address, e.symbolFROM tokens.erc20 eINNER JOIN tokens_needed n ON n.contract_address = e.contract_addressWHERE e.blockchain = 'ethereum')SELECT'ethereum' AS chain,concat(coalesce(t0.symbol, substr(cast(p.token0 AS varchar), 1, 10)), '/', coalesce(t1.symbol, substr(cast(p.token1 AS varchar), 1, 10))) AS pair,cast(p.pool AS varchar) AS pool_address,cast(p.token0 AS varchar) AS token0_address,cast(p.token1 AS varchar) AS token1_address,p.fee / 100.0 AS pool_fee_bps,c.fee_protocol0,1.0 / c.fee_protocol0 AS protocol_share_token0,(p.fee / 100.0) / c.fee_protocol0 AS protocol_fee_bps_token0,c.fee_protocol1,1.0 / c.fee_protocol1 AS protocol_share_token1,(p.fee / 100.0) / c.fee_protocol1 AS protocol_fee_bps_token1,c.last_set_time,