Blockchain Options Protocol Development (Dopex Style)

We design and develop full-cycle blockchain solutions: from smart contract architecture to launching DeFi protocols, NFT marketplaces and crypto exchanges. Security audits, tokenomics, integration with existing infrastructure.
Showing 1 of 1 servicesAll 1306 services
Blockchain Options Protocol Development (Dopex Style)
Complex
from 2 weeks to 3 months
FAQ
Blockchain Development Services
Blockchain Development Stages
Latest works
  • image_website-b2b-advance_0.png
    B2B ADVANCE company website development
    1214
  • image_web-applications_feedme_466_0.webp
    Development of a web application for FEEDME
    1161
  • image_websites_belfingroup_462_0.webp
    Website development for BELFINGROUP
    852
  • image_ecommerce_furnoro_435_0.webp
    Development of an online store for the company FURNORO
    1041
  • image_logo-advance_0.png
    B2B Advance company logo design
    561
  • image_crm_enviok_479_0.webp
    Development of a web application for Enviok
    823

Development of Options Protocol (Dopex-style)

Decentralized options are one of the most technically complex segments of DeFi. Dopex built an architecture that solves the main problem of on-chain options: liquidity. Instead of an orderbook where buyer and seller must find each other, Dopex uses liquidity pools (SSOV — Single Staking Option Vault), where LP providers collectively act as the options seller. You can buy a call or put anytime as long as the pool has reserves. Building such a protocol from scratch is 6-16 weeks of work, depending on the depth of functionality.

SSOV Mechanics: How Options Pool Works

Epoch Structure and Strike Prices

SSOV works in epochs — fixed time periods (usually 1 month). At the start of an epoch, a set of strike prices is defined (for example, for ETH: $2000, $2200, $2400, $2600). LP providers deposit ETH into the vault — their funds become collateral for option contracts.

An option buyer pays a premium and gets the right to a payoff at expiration:

  • Call option: payoff = max(0, price_at_expiry - strike)
  • Put option: payoff = max(0, strike - price_at_expiry)

Premium calculation is the key engineering challenge. Dopex uses Black-Scholes with on-chain implementation. The problem: Black-Scholes requires ln() and e^x — functions that don't exist natively in the EVM. Implementation through Taylor series or fixed-point approximation tables.

Black-Scholes On-Chain: Where Precision is Lost

The classical Black-Scholes formula for a call option:

C = S·N(d1) - K·e^(-rT)·N(d2)
d1 = (ln(S/K) + (r + σ²/2)·T) / (σ·√T)
d2 = d1 - σ·√T

where S is spot price, K is strike, r is risk-free rate, σ is implied volatility, T is time to expiry.

On the EVM we work with fixed-point arithmetic (WAD, 1e18). The ln(x) function is implemented via PRBMath library or ABDKMathQuad. Precision is critical: a 0.1% error in premium calculation on $1M volume = $1000 discrepancy per transaction. It accumulates in favor of the attacker who knows about the discrepancy.

A real case from an audit: the protocol used the approximation ln(x) ≈ x - 1 for values close to 1.0 — this gave errors up to 2% at S/K in the 0.9-1.1 range (at-the-money options). That's exactly where trading volume is highest. LP loss was ~$80K in the first month before discovery.

Implied Volatility: Oracle or On-Chain Calculation

Implied volatility (IV) is a critical parameter on which the premium depends linearly. Options:

Chainlink IV feed — available for ETH, BTC. Reliable, but with latency up to 1 hour. During sharp market movements, IV may be underestimated — LPs sell options too cheap.

DVOL-style (Deribit Volatility Index) — off-chain calculation via TWAP implied volatility from orderbook. Requires its own oracle infrastructure or Chainlink Functions integration.

On-chain historical volatility — calculated from TWAP prices over the last N periods. Doesn't reflect forward-looking risk, but doesn't depend on external oracles. Downside: underpricing options before events (merge, ETF approval).

We build a hybrid system: Chainlink IV feed as primary source, on-chain historical volatility as fallback when staleness > 2 hours.

Protocol Architecture

Contract Structure

DopexStyleProtocol/
├── core/
│   ├── OptionMarket.sol          # Create/buy/expire options
│   ├── SSOV.sol                  # LP liquidity vault
│   ├── OptionPricing.sol         # Black-Scholes on-chain
│   └── EpochManager.sol          # Epoch management
├── oracles/
│   ├── VolatilityOracle.sol      # IV aggregator
│   └── PriceOracle.sol           # Chainlink wrapper
├── rewards/
│   ├── DPX.sol                   # Governance/reward token
│   └── StakingRewards.sol        # Emissions for LP
└── periphery/
    ├── Router.sol                 # User interface
    └── OptionToken.sol            # ERC-1155 option tokens

ERC-1155 for options — the right choice. Each combination (strike, expiry, type) = separate token ID. Users can hold options with different strikes in one wallet, transfer works like ordinary tokens — secondary market emerges automatically.

LP Vault Mechanics: Risks and Protections

LPs deposit ETH and collectively sell options. In case of massive in-the-money expiration (market moved against LPs) — vault pays out large payoffs. This is intrinsic risk that LPs accept.

Managed risks that we close contractually:

Max capacity per strike — cannot sell options on one strike exceeding N% of total vault. Otherwise concentrated expiration zeros out the vault.

Withdrawal lock — LPs cannot withdraw funds mid-epoch. Otherwise when price moves toward strike, LPs exit en masse, leaving the protocol without collateral for payouts.

Delta hedging pool — optional, for protocols with serious institutional LPs. Part of vault funds automatically hedged via perpetual contracts (GMX, Gains Network).

AtlasDEX Integration for Secondary Market

Option tokens ERC-1155 need somewhere to trade. Options:

  • Integration with OpenSea/Blur (they support ERC-1155)
  • Own AMM for options (complex, requires custom curve)
  • Integration with Lyra Protocol as secondary market layer

For MVP we recommend P2P trading via Seaport (OpenSea protocol) — it's free and requires no additional liquidity.

Security: Protocol-Specific Vulnerabilities

Oracle manipulation at expiration. The moment of truth for an option is the price at expiration. If using spot price oracle in a single block — flash loan attack manipulates price, creating artificial profit on options. Protection: TWAP over last 30 minutes as settlement price.

Epoch sandwich attack. Attacker buys large volume of options at epoch end (knowing upcoming market move), gets payoff, at start of next epoch LPs haven't replenished losses — vault is undercapitalized. Protection: cooldown between epochs with mandatory reconciliation period.

Grief via dust positions. Creating thousands of tiny option positions (gas griefing) for settlement function at expiration. Protection: minimum premium > dust threshold, fee on position creation.

Development Stack

Foundry as main tool — fuzz tests on Black-Scholes calculations are critical. Testing with vm.fuzz all boundary values: S/K from 0.1 to 10, T from 1 hour to 1 year, IV from 10% to 500%. PRBMath v4 for fixed-point arithmetic. Chainlink price feeds on mainnet fork for testing oracle logic.

Component Technology Complexity
Black-Scholes PRBMath + Solidity High
IV Oracle Chainlink Functions Medium
LP Vault ERC-4626 base Medium
Option Tokens ERC-1155 Low
Rewards Fork of Synthetix Staking Medium

Timeline and Process

Design (1-2 weeks). Contract architecture, economic modeling in Python (scenarios: normal market, crash -50%, pump +100%), vault parameters (max capacity, fees, epoch length).

Core development (3-5 weeks). OptionMarket, SSOV vault, Black-Scholes on-chain with accuracy tests, EpochManager, Oracle integration. Foundry fuzz + invariant tests.

Periphery development (2-3 weeks). Router, reward system, frontend (wagmi + viem), The Graph subgraph for historical data.

Audit (2-4 weeks). We recommend external audit for protocols with TVL above $500K. Internal audit is mandatory.

Deploy and monitoring. Phased launch: limited vault capacity at start, gradual increase after stability confirmation.

Basic SSOV for one asset — 6-8 weeks. Full multi-asset protocol with governance and secondary market — 10-16 weeks. Cost is calculated after detailed analysis of requirements and desired asset set.