> For the complete documentation index, see [llms.txt](https://delpho.gitbook.io/delpho-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://delpho.gitbook.io/delpho-docs/how-delpho-works/corewriter-and-atomic-hedge-management.md).

# CoreWriter and atomic hedge management

CoreWriter is Delpho's structural edge. It is the Hyperliquid primitive that lets onchain smart contracts read from and act on the exchange directly, in the same transaction.

Delpho's hedge runs on HyperCore. The smart-contract logic that issues USDV, manages sUSDV, and orchestrates the hedge runs on HyperEVM. The two environments need to communicate without latency, without bridge risk, and without leaving the user's position exposed during routine rebalancing. CoreWriter is what makes that possible.

## What CoreWriter does

CoreWriter is a HyperCore precompile callable from HyperEVM. It lets a HyperEVM contract read HyperCore state (margin balances, position sizes, prices) and submit HyperCore instructions (open or close perpetual positions, shift margin between accounts) within a single atomic transaction.

For Delpho, this means:

* The hedge can be adjusted in the same transaction that issues USDV.
* Liquidations and redemptions can shift margin internally rather than coordinating across separate systems.
* A rebalance is either completed or it does not execute. There is no half-completed state where the protocol is unhedged.

## Why this matters for the protocol

A continuously hedged stablecoin needs the hedge to stay continuous. The dominant operational risk in synthetic-dollar designs is the loss of the hedge during a fast market: the spot side moves, the perp side cannot be opened or closed in time, and the protocol is exposed to directional movement on what was supposed to be a flat structure.

Delpho's rebalancing logic is built around internal margin movement between the profitable and weaker side of the structure, rather than repeatedly closing and reopening positions across separate systems. Same-chain execution removes the cross-venue race condition that this kind of rebalance loop normally has to solve for. **This is not a pattern that can be replicated on a chain without native contract access to a high-performance order book.**

## What this is not

Same-chain execution does not remove market risk. Some CoreWriter actions are intentionally delayed onchain by a few seconds. The protocol can still be exposed to slippage in a fast market, especially during ADL events. CoreWriter reduces coordination risk materially. It does not reduce the underlying market risk of running a hedged position.

## Reference

* For Delpho's HyperEVM / HyperCore split in more depth, see [Architecture](/delpho-docs/for-developers/architecture.md).
* Hyperliquid CoreWriter documentation: <https://hyperliquid.gitbook.io/hyperliquid-docs>.
