affaan-m/ECC · error · SlippageError

Simulation: <

Error message

Simulation: {actual_out} < {expected_min_out}

What it means

Illustrative slippage guard from the llm-trading-agent-security skill: the eth.call simulation returned an output amount below expected_min_out, so the price moved beyond the accepted slippage and the transaction is not signed or sent.

Solutions

  1. Re-quote and rebuild the transaction with a fresh min_amount_out
  2. Cap acceptable slippage per pair based on liquidity
  3. Retry a bounded number of times before surfacing to the operator
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at skills/llm-trading-agent-security/SKILL.md:86 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@d8409a4b08 (2026-08-26). Data as JSON: /api/errors/806f47205ef9899d. Report an issue: GitHub.

Appendix: source

Thrown at skills/llm-trading-agent-security/SKILL.md:86

        self._record_spend(usd_amount)
```

### Simulate before sending

```python
class SlippageError(Exception):
    pass

async def safe_execute(self, tx: dict, expected_min_out: int | None = None) -> str:
    sim_result = await self.w3.eth.call(tx)

    if expected_min_out is None:
        raise ValueError("min_amount_out is required before send")

    actual_out = decode_uint256(sim_result)
    if actual_out < expected_min_out:
        raise SlippageError(f"Simulation: {actual_out} < {expected_min_out}")

    signed = self.account.sign_transaction(tx)
    return await self.w3.eth.send_raw_transaction(signed.raw_transaction)
```

### Circuit breaker

```python
class TradingCircuitBreaker:
    MAX_CONSECUTIVE_LOSSES = 3
    MAX_HOURLY_LOSS_PCT = 0.05

    def check(self, portfolio_value: float) -> None:
        if self.consecutive_losses >= self.MAX_CONSECUTIVE_LOSSES:
            self.halt("Too many consecutive losses")

        if self.hour_start_value <= 0:
            self.halt("Invalid hour_start_value")

View on GitHub (pinned to d8409a4b08)