project screenshot 1
project screenshot 2
project screenshot 3

Surety

1inch Protected Options: Option-like strategies with built-in stop-loss on 1inch LOP.

Surety

Created At

Unite Defi

Project Description

What it is: A hybrid DeFi system that creates "protected options" - financial instruments that mimic traditional call/put option payoffs but with built-in stop-loss protection to automatically limit losses. How it works: Users create option-like positions (bet on price going up/down) with customizable parameters: strike price, premium, expiration, and crucially - a stop-loss trigger. If the market moves against them beyond a threshold, the position automatically closes to prevent larger losses. 1inch Integration: Built on the 1inch Limit Order Protocol using custom predicates and amount getters. This enables decentralized execution where anyone can fill orders, while leveraging 1inch's gas-efficient infrastructure. Technical Stack: Smart Contracts: 4 core contracts (OptionsCalculator, StopLossProtection, ProtectedOptionManager, 1inch Integration) Frontend: React UI with Web3 wallet connection, real-time balance tracking, and error handling Oracles: Chainlink price feeds for accurate option pricing and stop-loss triggers Key Innovation: Combines option strategies with automated risk management, making derivatives trading safer for DeFi users while maintaining decentralized execution through 1inch's orderbook.

How it's Made

Built with Solidity 0.8.24 using Hardhat. Four interconnected contracts: OptionsCalculator handles payoff math, StopLossProtection manages risk triggers, ProtectedOptionManager orchestrates everything, and OneinchProtectedOptionsIntegration bridges to 1inch. 1inch Integration: Implemented IAmountGetter interface for custom amount calculations and predicate functions for conditional execution. This was the trickiest part - encoding option data into 1inch's extraData format and creating predicates that check both option profitability AND stop-loss conditions simultaneously. Frontend Stack: React with Wagmi/RainbowKit for Web3 integration. Had to solve several gnarly problems: proper ERC20 ABI handling for real Polygon tokens (vs mocks), one-click WETH approvals, and circuit breaker protection with auto-retry logic. Notable Hacks: Multi-RPC fallbacks with exponential backoff to handle Polygon congestion Smart error classification - different retry strategies for circuit breakers vs user rejections Real-time balance validation with throttled logging to prevent rate limits Dynamic decimal handling (WETH=18, USDC=6) across the entire stack Partner Tech Benefits: Chainlink oracles provide tamper-proof pricing, 1inch LOP enables gas-efficient decentralized execution, Polygon keeps costs at $0.01/tx vs $100+ on Ethereum.

background image mobile

Join the mailing list

Get the latest news and updates