> For the complete documentation index, see [llms.txt](https://docs.goosefx.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.goosefx.io/goosefx-amm/clmm/risk-and-arbitrage-protections.md).

# Risk & Arbitrage Protections

Under-the-hood improvements focused on performance, pricing accuracy, and protection from toxic flow.

**Smarter Fee & Flow Logic**

* **1-min Volatility Windows**: Price volatility is tracked in rolling 1-minute windows directly on-chain.
* **Oracle-Based Pricing**: Fees is calculated using oracle-driven price changes instead of just swap deltas.
* **Unified Swap Direction Handling**: Swap direction logic (A→B & B→A) is evaluated together using shared price and volatility context.

<figure><img src="https://1148958930-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MbptMooYJCi00Kcv1gI%2Fuploads%2FqeHGzyDWnxzyruV1KxyK%2Fimage.png?alt=media&amp;token=e3d08733-2f18-4097-a7f7-02426dc47a2e" alt=""><figcaption></figcaption></figure>

**Reliable Execution During Congestion**

* **Compute-Aware Batching**: Large transactions are split into smaller compute-efficient instructions.
* **Adaptive Priority Fees**: GAMMA adjusts priority fees in real time to increase success during network congestion.

These changes reduce missed updates on volatile pairs and improve swap reliability.

**Improved Oracle Management**

* **Slot-Based Staleness Checks**: Price freshness is now tracked by Solana slot height instead of wall-clock time, improving consistency.
* **Smarter CEX Routing**: Off-chain price polling is routed via the most liquid CEX book, not just aggregator feeds.

**Toxic Flow Resistance**

* **Directional Fees Optimization**: LP protection mechanisms now handle fee symmetry more efficiently, reducing arbitrage exposure.

\
These measures help GAMMA deliver better pricing, reduce arb risk, and grow yield for LPs.
