{"record":{"id":"b4aca5ef8baf3809","repo":"nautechsystems/nautilus_trader","slug":"erc-20-approve-simulation-reverted-for-token-toke","errorCode":null,"errorMessage":"ERC-20 approve simulation reverted for token {token}","messagePattern":"ERC-20 approve simulation reverted for token (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/execution/client.rs","lineNumber":2668,"sourceCode":"                                if result.is_empty() {\n                                    Ok(true)\n                                } else {\n                                    ERC20::approveCall::abi_decode_returns_validate(result)\n                                        .map_err(Into::into)\n                                }\n                            },\n                        )\n                        .await,\n                    \"pre-sign approval simulation\",\n                )?;\n\n                match &simulation.value {\n                    VerifiedSimulation::Succeeded(true) => {}\n                    VerifiedSimulation::Succeeded(false) => {\n                        anyhow::bail!(\"ERC-20 approve returned false for token {token}\")\n                    }\n                    VerifiedSimulation::Denied => {\n                        anyhow::bail!(\"ERC-20 approve simulation reverted for token {token}\")\n                    }\n                }\n                Ok(vec![\n                    verification_decision(&allowance, Some(block), Some(block)),\n                    verification_decision(&simulation, Some(block), Some(block)),\n                ])\n            }\n        }\n    }\n\n    async fn verify_swap_anchors_before_sign(\n        &self,\n        anchors: &SwapQuoteAnchors,\n    ) -> anyhow::Result<Vec<ExecutionVerificationDecision>> {\n        let checkpoint = required_verification(\n            self.verification.verify_checkpoint().await,\n            \"pre-sign checkpoint reread\",\n        )?;","sourceCodeStart":2650,"sourceCodeEnd":2686,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/execution/client.rs#L2650-L2686","documentation":"During the pre-sign approval flow, the simulation of the ERC-20 approve call reverted (VerifiedSimulation::Denied). This means executing approve on current state would revert on-chain, so the client refuses to sign and spend gas on a doomed transaction.","triggerScenarios":"Pre-sign approval simulation returns VerifiedSimulation::Denied — the approve call would revert, e.g. because the token is paused, the owner lacks balance/roles, or the token contract enforces conditions that fail at simulation time.","commonSituations":"Token contract paused or frozen; approval amount violates contract rules (e.g. some tokens cap max approval); simulation fork state diverges from mainnet; spender address blacklisted by the token.","solutions":["Inspect the simulation revert reason to find the failing condition","Check token pause/freeze/blacklist status before approving","Retry after the token state changes (unpause) or use a different spender","Re-run simulation against a current, correctly configured fork/RPC state"],"exampleFix":"// before\ntoken.approve(spender, amount).send().await?; // reverts on-chain, gas lost\n// after\nmatch client.simulate_approve(token, spender, amount).await {\n    Ok(_) => token.approve(spender, amount).send().await?,\n    Err(e) => log::error(\"approve would revert: {e}\"),\n}","handlingStrategy":"validation","validationCode":"// Simulate the approve before sending; bail if it would revert\nlet sim = client.simulate_approve(&token, spender, amount).await?;\nanyhow::ensure!(sim.succeeded(), \"approve would revert: {:?}\", sim.reason);","typeGuard":null,"tryCatchPattern":"match res {\n    Err(e) if e.to_string().contains(\"approve simulation reverted\") => {\n        let reason = client.last_simulation_revert_reason().await?;\n        // check paused/blacklist state, then decide\n    }\n    r => r?,\n}","preventionTips":["Always run pre-sign simulation for approvals","Check token pause/freeze status before approving","Inspect revert reasons and record them for token diagnostics","Avoid extreme approval amounts on tokens with custom limits"],"tags":["erc20","approve","revert","simulation"],"backgroundTag":"invalid-argument-value","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"}