# Raga Delta Neutral Vault

Raga Finance’s **Delta-Neutral Vaults** are built natively on **Hyperliquid’s HyperEVM**, leveraging the full performance of the **HyperCore** order-book engine through **CoreWriter** integration.\
This architecture allows Raga to execute complex hedging strategies in a fully on-chain, transparent, and non-custodial manner, without relying on centralized market makers or opaque execution layers.

### Why We Built on HyperEVM?

When Hyperliquid launched **HyperEVM** on top of **HyperCore**, it unlocked a new design space for DeFi automation.\
Traditional delta-neutral platforms such as Ethena, Liminal, or HarmonixFi face three persistent limitations:

1. **Centralized dependencies** – execution or hedging handled by off-chain systems.
2. **Opaque risk management** – users can’t verify real-time hedging activity.
3. **Fragmented yields** – no efficient cross-chain method to optimize yield differentials.

HyperEVM and CoreWriter solve these issues by combining **HyperCore’s on-chain liquidity** with **EVM composability**, allowing Raga to:

* Execute hedged positions directly on HyperCore.
* Read and verify real-time vault state transparently on-chain.
* Deploy vaults that autonomously rebalance exposure across multiple ecosystems like Berachain or Hemi, while shorting on Hyperliquid.

### How Raga Leverage Corewriter?

Raga’s delta-neutral vaults combine long and short exposures to eliminate market risk while capturing yield differentials:

1. **User deposits stablecoins** into the vault.
2. The vault splits the capital:
   * **Long leg:** Buys or stakes the target asset (e.g., HYPE, BTC, or BERA) to earn staking yield.
   * **Short leg:** Opens an equal short perpetual position on **Hyperliquid** to hedge price exposure.
3. **CoreWriter** executes these actions programmatically on HyperCore, ensuring atomic, on-chain transparency.
4. The vault continuously monitors funding rates, staking yields, and collateral efficiency to maximize **neutral yield**.

Example:

Backtesting the data for HYPE:

* HYPE staking yield ≈ 2 % APR
* Short funding rate ≈ 25 % APR\
  → Net neutral yield ≈ 13.5 % APR (without taking directional risk).

### CoreWriter Integration

The **CoreWriter** precompiled contract (address `0x3333333333333333333333333333333333333333`) is the bridge between **HyperEVM logic** and **HyperCore execution**.\
Every vault action like opening a short, transferring collateral, or closing a position is encoded and sent through CoreWriter to be executed by HyperCore validators.

**Action Encoding Format:**

```
abi.encodePacked(
  bytes1(0x01),      // Encoding version
  bytes3(actionId),  // Action type identifier
  abi.encode(data)   // ABI-encoded payload
)
```

Example: Sending funds from HyperEVM to HyperCore:

```
abi.encodePacked(bytes1(0x01), bytes3(6), abi.encode(destination, tokenId, weiAmt))
```

Each transaction:

* Emits an **event** that validators read and execute in the next Core block.
* Takes at least one small block (\~1 sec) to relay.
* Requires state verification to ensure success (Raga runs a lightweight oracle to confirm execution).

This system design keeps execution **transparent**, **verifiable**, and **non-custodial**.

#### What We Learned

* **Latency awareness** – CoreWriter calls are not atomic, requiring careful queue management.
* **Cross-chain consistency** – when transferring assets between HyperEVM and HyperCore, the balance momentarily disappears (\~1 sec). The vault’s state machine accounts for this.
* **Resilience** – occasional CoreWriter failures require off-chain watchers and retry logic for robustness.

Despite these challenges, HyperEVM’s unified consensus, dual-block system, and direct Core access make it the most suitable environment for **high-frequency, liquidity-intensive DeFi strategies**.
