Covered Calls Vault video demo

Covered Calls Vault

Covered Call Options Vault using 1inch Limit Order Protocol with ERC1155 Proxy extensions

Covered Calls Vault

Created At

Unite Defi

Project Description

A decentralized covered call options trading platform built on Gnosis Chain, featuring ERC-1155 option tokens and 1inch Limit Order Protocol v4 integration for trustless trading.

Features: Covered Call Options: Create and trade covered call options backed by GNO collateral ERC-1155 Option Tokens: Custom ERC1155 Proxy Implementation as Options are represented as tradeable ERC-1155 tokens 1inch Integration: Trustless orderbook using 1inch Limit Order Protocol v4 Oracle-Based Settlement: Chainlink oracle integration for fair option settlement Pro-Rata Exercise: Sophisticated exercise and reclaim mechanics with accurate PnL tracking Multi-Role Architecture: Separate interfaces for option makers, takers, and administrators

How it's Made

  1. Core Idea & Financial Primitive

At its heart, DeFi Moon Options is a covered call options platform on Gnosis Chain. Writers deposit GNO collateral, mint ERC-1155 option tokens (call options), and sell those via a trustless on-chain orderbook using 1inch Limit Order Protocol v4. Buyers pick up in-the-money (or speculative) positions, and settlement is driven by oracle price feeds with pro-rata exercise/reclaim logic to keep everything fair and permissionless.

  1. Technology Stack and Roles

Blockchain Layer • Gnosis Chain: Chosen for low-cost, performant execution. All core contracts (vault, option tokens, proxy, oracle adapter) live here. • Smart Contracts (Foundry): • OptionsVault.sol: Manages collateral, handles minting, tracks series, settles expired options, and enforces pro-rata logic. • CallToken.sol: ERC-1155 implementation representing option positions (call options) with metadata to encode strike, expiry, etc. • ERC1155Proxy.sol: Adaptation layer so ERC-1155 tokens can be used with 1inch limit order flow (mimicking ERC20-style interaction where needed). • ChainlinkPriceAdapter.sol: Normalizes and fetches on-chain settlement prices (e.g., GNO/WXDAI) used during expiry exercise windows. • Access Control / Pausable / Reentrancy Guards: Roles (like SERIES_ADMIN_ROLE), emergency pause, and OpenZeppelin primitives to harden the system. • Pro-Rata Settlement: On expiry, option writers reclaim unused collateral in proportion to their exposure, avoiding “winner takes all” edge cases.

Offchain / Integration Layer • 1inch Limit Order Protocol v4: Provides a decentralized orderbook for selling/buying option tokens. Integration involves: • EIP-712 Signed Orders: Limit order creation with structured typed data (domain includes name, version, chainId, verifyingContract), enabling trustless creator-signed orders. • Custom Extension for ERC-1155: Embedding option identity into order payloads; the ERC1155Proxy smooths over interface mismatches so the 1inch execution flow can handle the option assets. • Order Hashing & Active Checks: Functions like getOrderHash and isOrderActive ensure frontends reflect order validity and partial fills.

Frontend • Next.js 14 (App Router): Framework for structured, modern React routing. • TypeScript: Strict typing across contracts, order creation logic, and UI plumbing. • Tailwind CSS: Utility-first responsive styling. • HeroUI: Unified design system for components—used in building consistent CreateLimitOrder, Orderbook, admin panels, etc. • Wagmi + RainbowKit: Wallet connection and contract interaction hooks tailored for EVM. Provides account context, contract reads/writes, and signature flows. • Custom Integration Code (lib/oneInch.ts, lib/contracts.ts, etc.): • Encapsulates domain and order struct definitions. • Builds signed orders for ERC-1155 options. • Marshals on-chain reads (e.g., vault state, series definitions) to drive UX.

Infrastructure & Development • Foundry: Compile/test/deploy Solidity contracts; used for deterministic builds and local testing. • Local Forking (Anvil): Spin up Gnosis chain forks to simulate complex system interactions (e.g., order fills, expiry flows) safely during development and CI-style tests. • Type Checking / Linting: Strict TS config, ESLint, and build-time validation to avoid mismatches between expected on-chain shapes and frontend usage. • Rust (optional / adjacent): (If used in your broader work) for tasks like indexing on-chain activity to power analytics or vault monitoring, though core settled logic lives in Solidity.

  1. Application Structure & UX Separation • Maker Interface (/maker): Define series, supply collateral, mint options, and create limit orders. • Taker Interface (/taker): Browse orderbook, choose based on strike/expiry/premium, fill orders, and exercise options. • Admin Interface (/admin): Role management (granting SERIES_ADMIN_ROLE), pause/unpause, and series oversight. • Portfolio / Tracking: Users see their holdings, in-flight orders, and option statuses (expired, exercisable, etc.).

  1. Partner Tech & How It Helped • 1inch Protocol: Instead of building a centralized or bespoke matching layer, 1inch gave a battle-tested, composable, and permissionless limit order infrastructure, enabling sellers to post orders with cryptographic provenance and buyers to fill atomically.

Custom extension of Limit Order Protocol for trading ERC1155 tokens:

ERC-1155 ↔ 1inch Bridging: 1inch natively assumes ERC20-like flows. Building the ERC1155Proxy and crafting extension encoding for option identity so that the limit order protocol could treat complex option tokens as first-class tradable entities was a non-trivial adaptation—effectively bending a fungible-oriented orderbook into a semi-fungible options system.

background image mobile

Join the mailing list

Get the latest news and updates