{"record":{"id":"5197e7ca237a855a","repo":"nautechsystems/nautilus_trader","slug":"rpc-parsing-of-flash-event-is-not-defined-in-this","errorCode":null,"errorMessage":"RPC parsing of flash event is not defined in this dex: {}:{}","messagePattern":"RPC parsing of flash event is not defined in this dex: (.+?):(.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/exchanges/extended.rs","lineNumber":543,"sourceCode":"        } else {\n            anyhow::bail!(\n                \"RPC parsing of collect event is not defined in this dex: {}:{}\",\n                self.dex.chain,\n                self.dex.name\n            )\n        }\n    }\n\n    /// Parses a flash event from an RPC log.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the DEX does not have an RPC flash event parser defined or if parsing fails.\n    pub fn parse_flash_event_rpc(&self, log: &RpcLog) -> anyhow::Result<FlashEvent> {\n        if let Some(parse_fn) = &self.parse_flash_event_rpc_fn {\n            parse_fn(self.dex.clone(), log)\n        } else {\n            anyhow::bail!(\n                \"RPC parsing of flash event is not defined in this dex: {}:{}\",\n                self.dex.chain,\n                self.dex.name\n            )\n        }\n    }\n\n    /// Parses a `SetFeeProtocol` event from an RPC log.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if the DEX does not have an RPC `SetFeeProtocol` event parser defined or if parsing fails.\n    pub fn parse_fee_protocol_update_event_rpc(\n        &self,\n        log: &RpcLog,\n    ) -> anyhow::Result<FeeProtocolUpdateEvent> {\n        if let Some(parse_fn) = &self.parse_fee_protocol_update_event_rpc_fn {\n            parse_fn(self.dex.clone(), log)","sourceCodeStart":525,"sourceCodeEnd":561,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/extended.rs#L525-L561","documentation":"Raised by `DexExtended::parse_flash_event_rpc` when the DEX has no RPC flash-event parser registered (`parse_flash_event_rpc_fn` is `None`). Flash-loan callback events must be explicitly supported by each DEX adapter; when the optional parser function is unset, the method bails naming the chain and DEX.","triggerScenarios":"Calling `dex.parse_flash_event_rpc(&log)` on a `DexExtended` built without `parse_flash_event_rpc_fn` — e.g. feeding Flash event logs from an RPC provider into an adapter that only registered swap/mint/burn RPC parsers.","commonSituations":"Indexing flash-loan activity across many DEXes where only some adapters implement Flash parsing; a fork of an adapter (e.g. PancakeSwap V3) that dropped the flash parser; mismatch between the log topics you subscribe to and the parsers the adapter defines.","solutions":["Set `parse_flash_event_rpc_fn: Some(...)` when constructing the `DexExtended` for DEXes whose contracts emit Flash events.","Before calling, check `parse_flash_event_rpc_fn.is_some()` (or a capability method) and skip unsupported DEXes.","Exclude Flash topic0 from the RPC log filter for this DEX if flash events are irrelevant to your use case.","Align your subscription topics with the adapter's supported events instead of subscribing to all pool events."],"exampleFix":"// before\nlet ev = dex.parse_flash_event_rpc(&log)?; // panics out via bail on most DEXes\n// after\nif dex.parse_flash_event_rpc_fn.is_some() {\n    let ev = dex.parse_flash_event_rpc(&log)?;\n} else {\n    tracing::debug!(\"flash rpc parsing unsupported: {}:{}\", dex.dex.chain, dex.dex.name);\n}","handlingStrategy":"fallback","validationCode":"if dex.parse_flash_event_rpc_fn.is_none() {\n    tracing::debug!(\"flash rpc parsing unsupported\");\n    return Ok(());\n}","typeGuard":"fn supports_flash_rpc(dex: &DexExtended) -> bool {\n    dex.parse_flash_event_rpc_fn.is_some()\n}","tryCatchPattern":"match dex.parse_flash_event_rpc(&log) {\n    Ok(ev) => handle_flash(ev),\n    Err(e) if e.to_string().contains(\"not defined in this dex\") => Ok(()),\n    Err(e) => Err(e),\n}","preventionTips":["Register the flash RPC parser for every DEX whose pools emit Flash events.","Only subscribe to Flash topic0 for DEXes known to support it.","Fail fast at startup if a DEX marked flash-capable lacks the parser fn.","Verify adapter coverage after adding a new chain/DEX to your config."],"tags":["rust","anyhow","rpc","dex","event-parsing","unimplemented"],"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"}