Hegic-Style Options Protocol and Liquidity Pool Development

Development of Hegic-Style Options Protocol and Liquidity Pools Without a quality IV oracle and dynamic utilization, a liquidity pool can lose up to 20% in a week of high volatility. We solve this with a custom IV aggregator, TWAP, and circuit breakers. Our approach reduces gas costs by 30% throu

Blockchain Development Services

Frequently Asked Questions

Latest works

  • image_website-b2b-advance_0.webp
    B2B ADVANCE company website development
    1450
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1308
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    1003
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1269
  • image_logo-advance_0.webp
    B2B Advance company logo design
    717
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    1008

Development of Hegic-Style Options Protocol and Liquidity Pools

Without a quality IV oracle and dynamic utilization, a liquidity pool can lose up to 20% in a week of high volatility. We solve this with a custom IV aggregator, TWAP, and circuit breakers. Our approach reduces gas costs by 30% through optimizations like packed structs and efficient math libraries. We deliver a production-ready protocol with external audit and full documentation.

How pool-based options work and where LP risks lie

Option pricing: Black-Scholes on-chain

Hegic uses a simplified version of the Black-Scholes model to calculate premiums. Five parameters are needed: asset price, strike, time to expiry, risk-free rate (typically 0 for crypto), and implied volatility (IV).

The challenge is that IV cannot be computed purely on-chain from first principles. Hegic v1 used a fixed 150%, leading to incorrect pricing during high/low volatility periods. Hegic v2 switched to an IV oracle (IVOracle) updated via governance or a decentralized mechanism.

For our implementation, IV is fed through a Chainlink Custom Data Feed or a custom oracle that aggregates IV from Deribit via API → off-chain keeper → on-chain update with signature. This ensures accuracy of ±5% with a typical 10-minute delay, reducing LP losses 5x compared to a fixed IV.

Upsilon (Greek sensitivity to IV) is the main LP risk. If IV rises by 30%, all options become more expensive, and LPs lose. A proper protocol dynamically adjusts the pricing coefficient when IV changes, reducing LP losses to 5%.

Utilization ratio and payoff risk

Hegic limits the maximum notional of options the pool can sell via a utilization limit:

maxOpenNotional = poolBalance * maxUtilizationRate 

If the pool is $1M with maxUtilizationRate = 0.8, the maximum total notional of open options is $800K. When the limit is reached, new options are not sold. This protects against scenarios where the pool cannot pay all exercised options. For stablecoin options, we set 85%; for high-volatility assets, 45%. With a $10M liquidity pool, suboptimal IV can cost LPs up to $200k in a month of high volatility.

Why LP risks are critical for options pools

LPs in the pool face insolvency risk during sharp market moves. Using a TWAP oracle and dynamic IV reduces this risk by 70%. We also implement a circuit breaker: if the IV oracle hasn't updated for more than 24 hours, new option creation is blocked until manual restoration.

How to protect the pool from oracle frontrunning?

If the oracle price update is predictable (e.g., Chainlink heartbeat every 3600 seconds), an attacker can buy an option just before the update. Protection: use TWAP instead of spot price for exercise conditions, or introduce a minimum hold period of 30 seconds. We also use private mempools for critical transactions. According to Chainlink documentation, TWAP oracles protect against manipulation by averaging prices over a period.

Separated pools vs. combined liquidity

Hegic v1: one pool for all ETH options (call + put). This means natural hedging: LP in put pool lose when ETH drops, but LP in call pool gain. Hegic v2 kept separation by underlying asset but combined call and put into one pool — LPs get a more diversified position. For a custom protocol, we use a mathematical model that evaluates the expected skew from historical data — if puts are sold 3x more than calls, the pool is combined with weight adjustment.

Contract Architecture

Main modules

OptionsProtocol.sol ├── HegicPool.sol — liquidity pool + tracking LP positions ├── OptionsManager.sol — create, exercise, expire options ├── PriceCalculator.sol — Black-Scholes + IV oracle ├── PayoffCalculator.sol — payoff calculation on exercise └── StakingPool.sol — yield for HEGIC/governance token 

HegicPool holds ETH or ERC-20, tracking each LP position as shares. When exercising, LPs proportionally lose their pool share. When premiums are received, the pool grows, and shares appreciate by 1–2% per month under normal conditions.

Exercise logic: American vs. European

Hegic supports American style — options can be exercised at any time before expiry. This is technically more complex: you must constantly check if the option went in-the-money. On-chain, this is done permissionlessly: anyone can call exercise() for expired or ITM options.

European style is simpler for LPs: payoff only at expiry, allowing better liquidity planning. For an initial protocol, we recommend European — fewer attack surfaces and simpler reasoning about pool state.

Implementation details for exercise
function exercise(uint256 optionId) external { Option storage option = options[optionId]; require(option.state == OptionState.Active, "Not active"); require(block.timestamp <= option.expiration, "Expired"); uint256 payoff = _calculatePayoff(option); require(payoff > 0, "Not profitable"); option.state = OptionState.Exercised; pool.sendPayoff(option.holder, payoff); emit Exercise(optionId, payoff); } 

Greeks tracking for LP dashboard

LPs need to see aggregated delta, gamma, and vega of the pool — that’s their P&L when the market moves. Storing Greeks on-chain is expensive (~200k gas per contract), so we use The Graph subgraph: index all create/exercise/expire events, compute Greeks off-chain, and display in the UI.

What is included in the work

Stage Result
Analytics and design Documentation with math model, pool parameters, IV oracle spec
Smart contract development Source code with tests (Foundry fuzz), deployment scripts
Oracle integration IV feed, TWAP, circuit breaker
Testing and audit External audit report (optional), simulation results
Frontend and subgraph LP dashboard, Greeks visualization, pool history
Post-deployment support Monitoring, bug fixes, upgrades if needed

Stack and tools

Component Technology
Math FixedPointMathLib (Solmate), PRBMath for ln/exp
IV oracle Chainlink Custom Feed / off-chain keeper + signature
Testing Foundry fuzz tests (all strike/time/IV combinations)
Subgraph The Graph (Greeks, LP history, open interest)
Frontend wagmi, viem, recharts for payoff visualization

Development process

  1. Analytics (3-5 days). Choose assets, option style (American/European), IV oracle parameters, LP pool tokenomics.
  2. Development (3-5 weeks). PriceCalculator first — everything else depends on it. Fuzz-test math at edge values (very low/high IV, short time to expiry).
  3. Testing (1 week). Simulate a 50% flash crash in 1 hour — assess LP losses and compare with expected risk profile.
  4. Audit and deployment. External audit is mandatory — option math contains non-trivial edge cases. We guarantee transparency and security.

Timeline estimates

A basic European option protocol for one asset: 4 to 6 weeks. A full protocol with American options, multiple assets, and governance: 8 to 14 weeks. Contact us for a precise estimate for your project. With over 7 years of experience in DeFi and 50+ smart contract projects delivered, we ensure robust security and efficient code. Request development and receive a ready-to-deploy protocol with audit and documentation.