{"record":{"id":"ae037c0241120b59","repo":"affaan-m/ECC","slug":"single-tx-usd-amount-exceeds-max-max-single-t","errorCode":null,"errorMessage":"Single tx ${usd_amount} exceeds max ${MAX_SINGLE_TX_USD}","messagePattern":"Single tx (.+?) exceeds max (.+?)","errorType":"exception","errorClass":"SpendLimitError","httpStatus":null,"severity":"error","filePath":"skills/llm-trading-agent-security/SKILL.md","lineNumber":63,"sourceCode":"```\n\nDo not blindly inject token names, pair labels, webhooks, or social feeds into an execution-capable prompt.\n\n### Hard spend limits\n\n```python\nfrom decimal import Decimal\n\nMAX_SINGLE_TX_USD = Decimal(\"500\")\nMAX_DAILY_SPEND_USD = Decimal(\"2000\")\n\nclass SpendLimitError(Exception):\n    pass\n\nclass SpendLimitGuard:\n    def check_and_record(self, usd_amount: Decimal) -> None:\n        if usd_amount > MAX_SINGLE_TX_USD:\n            raise SpendLimitError(f\"Single tx ${usd_amount} exceeds max ${MAX_SINGLE_TX_USD}\")\n\n        daily = self._get_24h_spend()\n        if daily + usd_amount > MAX_DAILY_SPEND_USD:\n            raise SpendLimitError(f\"Daily limit: ${daily} + ${usd_amount} > ${MAX_DAILY_SPEND_USD}\")\n\n        self._record_spend(usd_amount)\n```\n\n### Simulate before sending\n\n```python\nclass SlippageError(Exception):\n    pass\n\nasync def safe_execute(self, tx: dict, expected_min_out: int | None = None) -> str:\n    sim_result = await self.w3.eth.call(tx)\n\n    if expected_min_out is None:","sourceCodeStart":45,"sourceCodeEnd":81,"githubUrl":"https://github.com/affaan-m/ECC/blob/d8409a4b0813771235555e32e3d8046a73988bfa/skills/llm-trading-agent-security/SKILL.md#L45-L81","documentation":"Illustrative hard-limit guard from the llm-trading-agent-security skill: SpendLimitGuard.check_and_record raises SpendLimitError when a single transaction's USD amount exceeds MAX_SINGLE_TX_USD. It fires before the daily-spend check and before any spend is recorded.","triggerScenarios":"Thrown at skills/llm-trading-agent-security/SKILL.md:63 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Split oversized intents into multiple sub-limit transactions or reject them","Require human approval for amounts near the cap","Set caps per environment and alert when they fire"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"d8409a4b0813771235555e32e3d8046a73988bfa","analyzedAt":"2026-08-26T12:15:34.022Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}