{"record":{"id":"876fa7d5a1696104","repo":"nautechsystems/nautilus_trader","slug":"router-reports-an-unexpected-wrapped-native-con","errorCode":null,"errorMessage":"Router {} reports an unexpected wrapped native contract","messagePattern":"Router (.+?) reports an unexpected wrapped native contract","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":5066,"sourceCode":"\n    let weth_call = UniswapV3RouterState::WETH9Call.abi_encode();\n    let router_weth = required_verification(\n        executor\n            .verification\n            .verify_decoded_call(\n                None,\n                &plan.router,\n                U256::ZERO,\n                &weth_call,\n                block,\n                |result| {\n                    UniswapV3RouterState::WETH9Call::abi_decode_returns(result).map_err(Into::into)\n                },\n            )\n            .await,\n        \"swap router wrapped native\",\n    )?;\n    anyhow::ensure!(\n        router_weth.value == plan.weth,\n        \"Router {} reports an unexpected wrapped native contract\",\n        plan.router,\n    );\n    decisions.push(verification_decision(\n        &router_weth,\n        Some(block),\n        Some(block),\n    ));\n\n    let pool_call = UniswapV3Factory::getPoolCall {\n        tokenA: plan.token_in,\n        tokenB: plan.token_out,\n        fee: plan.fee,\n    }\n    .abi_encode();\n    let registered_pool = required_verification(\n        executor","sourceCodeStart":5048,"sourceCodeEnd":5084,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L5048-L5084","documentation":"Raised during pre-trade router verification when the router's WETH9() call returns a wrapped-native token address different from plan.weth. This ensures the router's wrapped native token matches the plan before quoting or swapping. A mismatch means the plan's wrapped-native assumption is wrong for this deployment.","triggerScenarios":"Executing a swap plan where on-chain router.WETH9() != plan.weth, typically when the plan references a WETH/WBNB/WMATIC address from a different chain or deployment.","commonSituations":"Plan built on Ethereum mainnet and replayed on an L2 or sidechain with different wrapped-native addresses, weth address typo'd in the plan config, or stale plan after network migration.","solutions":["Rebuild the execution plan so plan.weth matches the router's current WETH9() return value","Verify plan.weth is the wrapped-native contract for the target chain (e.g. WETH on mainnet, WETH on Arbitrum)","Check the plan was generated for the same chain ID the trade is executing on","Use canonical per-chain wrapped-native addresses from the deployment manifest"],"exampleFix":"// before\nplan.weth = \"0x4200000000000000000000000000000000000006\"; // base WETH\n// after\nplan.weth = \"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2\"; // mainnet WETH matching router.WETH9()","handlingStrategy":"validation","validationCode":"async fn check_router_weth(router: Address, plan_weth: Address) -> Result<(), String> {\n    let actual: Address = call_router_weth9(router).await?;\n    if actual != plan_weth { return Err(format!(\"router {router} weth mismatch: {actual} != {plan_weth}\")); }\n    Ok(())\n}","typeGuard":"fn weth_matches(plan_weth: Address, actual: Address) -> bool { plan_weth == actual }","tryCatchPattern":null,"preventionTips":["Use canonical wrapped-native addresses per chain, keyed by chain ID","Regenerate plans on network change instead of reusing them","Cross-check plan.weth against chainlist/official token registries","Log chain ID alongside plan metadata to catch cross-chain replays"],"tags":["blockchain","verification","uniswap-v3","contract-mismatch"],"backgroundTag":"unexpected-api-response-shape","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"}