{"record":{"id":"e4efc47078d45a40","repo":"affaan-m/ECC","slug":"min-amount-out-is-required-before-send","errorCode":null,"errorMessage":"min_amount_out is required before send","messagePattern":"min_amount_out is required before send","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"skills/llm-trading-agent-security/SKILL.md","lineNumber":82,"sourceCode":"\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:\n        raise ValueError(\"min_amount_out is required before send\")\n\n    actual_out = decode_uint256(sim_result)\n    if actual_out < expected_min_out:\n        raise SlippageError(f\"Simulation: {actual_out} < {expected_min_out}\")\n\n    signed = self.account.sign_transaction(tx)\n    return await self.w3.eth.send_raw_transaction(signed.raw_transaction)\n```\n\n### Circuit breaker\n\n```python\nclass TradingCircuitBreaker:\n    MAX_CONSECUTIVE_LOSSES = 3\n    MAX_HOURLY_LOSS_PCT = 0.05\n\n    def check(self, portfolio_value: float) -> None:\n        if self.consecutive_losses >= self.MAX_CONSECUTIVE_LOSSES:","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/affaan-m/ECC/blob/d8409a4b0813771235555e32e3d8046a73988bfa/skills/llm-trading-agent-security/SKILL.md#L64-L100","documentation":"Illustrative pre-send guard from the llm-trading-agent-security skill: safe_execute simulated the transaction but expected_min_out is None, so slippage cannot be bounded and the send is refused. The unsigned transaction dict is missing its min_amount_out parameter.","triggerScenarios":"Thrown at skills/llm-trading-agent-security/SKILL.md:82 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Always compute min_amount_out from a fresh quote before building the tx","Reject any swap whose route cannot express a minimum output","Fail closed: never send without a slippage bound"],"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"}