Skip to content

Implement cross-key arbitrage protection with price impact circuit breaker #996

Description

@Chucks1093

Summary

Add a circuit breaker to the bonding curve contract that pauses trading when a single transaction's price impact exceeds a configurable threshold, preventing large manipulative trades.

Scope

  • max_price_impact_bps configured per key by creator
  • Impact computed as percentage price change from pre- to post-trade price
  • Trade rejected with CircuitBreakerTripped error when impact exceeds threshold
  • set_circuit_breaker(key_id, max_bps) — creator-only config
  • CircuitBreakerTripped event emitted with actual impact bps

Acceptance Criteria

  • Trade blocked when single-transaction impact exceeds max_bps
  • Trade succeeds when impact is within threshold
  • set_circuit_breaker restricted to creator wallet
  • CircuitBreakerTripped event includes correct actual_bps
  • Threshold of 0 disables circuit breaker (default)

ETA

24 hours

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions