{"record":{"id":"f9b4bcbd4d733d96","repo":"nautechsystems/nautilus_trader","slug":"fetching-on-chain-snapshot-for-dex-protocol-is","errorCode":null,"errorMessage":"Fetching on-chain snapshot for Dex protocol {} is not supported yet.","messagePattern":"Fetching on-chain snapshot for Dex protocol (.+?) is not supported yet\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/data/core.rs","lineNumber":2072,"sourceCode":"                    .copied(),\n            )?;\n            let on_chain_snapshot = self\n                .univ3_pool\n                .fetch_snapshot(\n                    &profiler.pool.address,\n                    profiler.pool.instrument_id,\n                    profiler.get_active_tick_values().as_slice(),\n                    &profiler.get_all_position_keys(),\n                    block_position,\n                    timestamp, // ts_event\n                    timestamp, // ts_init (same block timestamp)\n                    fee_protocol_encoding,\n                )\n                .await?;\n\n            Ok(on_chain_snapshot)\n        } else {\n            anyhow::bail!(\n                \"Fetching on-chain snapshot for Dex protocol {} is not supported yet.\",\n                profiler.pool.dex.name\n            )\n        }\n    }\n\n    fn validate_rpc_snapshot_topology(\n        profiler: &PoolProfiler,\n        snapshot: &PoolSnapshot,\n    ) -> anyhow::Result<()> {\n        let tick_spacing = i32::try_from(\n            profiler\n                .pool\n                .tick_spacing\n                .context(\"pool tick spacing is not set\")?,\n        )?;\n        let expected_positions: AHashMap<_, _> = profiler\n            .get_all_positions()","sourceCodeStart":2054,"sourceCodeEnd":2090,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/data/core.rs#L2054-L2090","documentation":"Fetching an on-chain pool snapshot requires a pool contract read ABI for the DEX protocol. Only UniswapV3 and PancakeSwapV3 pools are supported (with per-DEX feeProtocol encodings); any other DEX reaching get_on_chain_snapshot_at_position fails with this bail.","triggerScenarios":"Calling get_on_chain_snapshot (e.g. via check_snapshot_validity) or construct_pool_profiler_from_hypersync_rpc for a pool whose `pool.dex.name` is anything other than DexType::UniswapV3 or DexType::PancakeSwapV3.","commonSituations":"Registering a new V3-fork DEX (e.g. another Uniswap V3 deployment) without adding its arm to the match in get_on_chain_snapshot_at_position; pointing the bootstrap flow at a DEX that has no on-chain snapshot reader implemented.","solutions":["Add the DEX to the `matches!` list and a corresponding FeeProtocolEncoding arm in get_on_chain_snapshot_at_position if it shares the Uniswap V3 pool read ABI.","Use a sync path that does not require on-chain snapshots (event-replay-only) for unsupported DEX protocols.","Confirm the pool was created with the intended DEX type; a mislabeled DEX name in registration can route a V3 pool into the unsupported branch."],"exampleFix":"// before\nif matches!(profiler.pool.dex.name, DexType::UniswapV3 | DexType::PancakeSwapV3) {\n// after\nif matches!(profiler.pool.dex.name, DexType::UniswapV3 | DexType::PancakeSwapV3 | DexType::MyV3Fork) {\n    let fee_protocol_encoding = match profiler.pool.dex.name {\n        DexType::PancakeSwapV3 => FeeProtocolEncoding::PancakeSwapV3BasisPoints,\n        _ => FeeProtocolEncoding::UniswapV3Packed,\n    };","handlingStrategy":"fallback","validationCode":"const SUPPORTED_SNAPSHOT_DEXES: &[DexType] = &[DexType::UniswapV3, DexType::PancakeSwapV3];\nif !SUPPORTED_SNAPSHOT_DEXES.contains(&pool.dex.name) {\n    // use event-replay-only validation instead of on-chain snapshot\n}","typeGuard":"fn supports_on_chain_snapshot(dex_name: DexType) -> bool {\n    matches!(dex_name, DexType::UniswapV3 | DexType::PancakeSwapV3)\n}","tryCatchPattern":"match data.get_on_chain_snapshot(&profiler).await {\n    Err(e) if e.to_string().contains(\"is not supported yet\") => {\n        // fall back to replay-only snapshot validation\n    }\n    other => other?,\n}","preventionTips":["Only enable RPC-snapshot bootstrap for DEX types with an implemented snapshot reader.","When onboarding a V3 fork, add its DexType arm and FeeProtocolEncoding in the same change.","Keep a registry mapping DEX type -> snapshot support to check before scheduling sync."],"tags":["unsupported-operation","dex","rpc","snapshot"],"backgroundTag":"unsupported-operation","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}