{"record":{"id":"646707059ff764a1","repo":"nautechsystems/nautilus_trader","slug":"rpc-parsing-of-collectprotocol-event-is-not-define","errorCode":null,"errorMessage":"RPC parsing of CollectProtocol event is not defined in this dex: {}:{}","messagePattern":"RPC parsing of CollectProtocol event is not defined in this dex: (.+?):(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/exchanges/extended.rs","lineNumber":583,"sourceCode":"                self.dex.chain,\n                self.dex.name\n            )\n        }\n    }\n\n    /// Parses a `CollectProtocol` event from an RPC log.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the DEX does not have an RPC `CollectProtocol` event parser defined or if parsing fails.\n    pub fn parse_fee_protocol_collect_event_rpc(\n        &self,\n        log: &RpcLog,\n    ) -> anyhow::Result<FeeProtocolCollectEvent> {\n        if let Some(parse_fn) = &self.parse_fee_protocol_collect_event_rpc_fn {\n            parse_fn(self.dex.clone(), log)\n        } else {\n            anyhow::bail!(\n                \"RPC parsing of CollectProtocol event is not defined in this dex: {}:{}\",\n                self.dex.chain,\n                self.dex.name\n            )\n        }\n    }\n\n    /// Checks if this DEX requires pool initialization events.\n    #[must_use]\n    pub fn needs_initialization(&self) -> bool {\n        self.dex.initialize_event.is_some()\n    }\n\n    /// Returns `true` if this DEX can discover pools from HyperSync `PoolCreated` logs.\n    ///\n    /// `sync-dex` streams `PoolCreated` logs to populate the pool set, so a DEX without this\n    /// parser cannot be synced.\n    #[must_use]","sourceCodeStart":565,"sourceCodeEnd":601,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/extended.rs#L565-L601","documentation":"Raised by `DexExtended::parse_fee_protocol_collect_event_rpc` when the DEX has no RPC parser registered for the CollectProtocol event (`parse_fee_protocol_collect_event_rpc_fn` is `None`). Protocol-fee collection events are specific to certain V3-fork DEXes; adapters that don't implement an RPC log parser for them bail with the chain and DEX name so callers know the capability gap.","triggerScenarios":"Calling `dex.parse_fee_protocol_collect_event_rpc(&log)` on a `DexExtended` constructed without `parse_fee_protocol_collect_event_rpc_fn` — typically when dispatching CollectProtocol logs from an RPC source to an adapter that only registered other event parsers.","commonSituations":"Indexing protocol-fee revenue across multiple V3-fork DEXes where only some adapters implement CollectProtocol parsing; an adapter version that predates fee-protocol support; wiring the update parser but forgetting the collect parser.","solutions":["Register the parser: `parse_fee_protocol_collect_event_rpc_fn: Some(parsing::pancakeswap_v3::fee_protocol_update::parse_fee_protocol_collect_event_rpc)` at DEX construction.","Gate the call on `parse_fee_protocol_collect_event_rpc_fn.is_some()` and skip/log unsupported DEXes.","Filter CollectProtocol topic0 from your log stream for DEXes without support.","Audit the full set of optional parser fns (`parse_*_rpc_fn`) during startup and fail fast if any required ones are missing for your chains."],"exampleFix":"// before\nlet ev = dex.parse_fee_protocol_collect_event_rpc(&log)?;\n// after\nlet ev = match dex.parse_fee_protocol_collect_event_rpc(&log) {\n    Ok(ev) => Some(ev),\n    Err(e) if e.to_string().contains(\"not defined in this dex\") => None,\n    Err(e) => return Err(e),\n};","handlingStrategy":"validation","validationCode":"if dex.parse_fee_protocol_collect_event_rpc_fn.is_none()\n    || log.topics.first().map(String::as_str) != Some(COLLECT_PROTOCOL_TOPIC)\n{\n    return Ok(()); // skip unsupported\n}","typeGuard":"fn supports_fee_protocol_collect_rpc(dex: &DexExtended) -> bool {\n    dex.parse_fee_protocol_collect_event_rpc_fn.is_some()\n}","tryCatchPattern":"match dex.parse_fee_protocol_collect_event_rpc(&log) {\n    Ok(ev) => handle(ev),\n    Err(e) if e.to_string().contains(\"not defined in this dex\") => Ok(()),\n    Err(e) => Err(e),\n}","preventionTips":["Register both fee-protocol parsers (update and collect) together so one is never missing.","Audit all optional parser fns on each DexExtended at construction time.","Filter CollectProtocol topic0 out of streams for DEXes without support.","When forking an adapter, copy the complete parser registry, not a subset."],"tags":["rust","anyhow","rpc","dex","event-parsing","unimplemented","pancakeswap-v3"],"backgroundTag":"method-not-implemented","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}