Litepaper

Abstract

Haptic allows the creation of a binary-option market for any risky/stable token pair traded on Uniswap V3. Markets are created by liquidity providers (LPs) who deposit LP shares and use them as collateral for selling European-style binary options. By accurately choosing their strategies, LPs can express directional bias without the need for extra capital and earn a premium from their positions. Option buyers pay a premium using stablecoin collateral for the right to exercise the contract. This document describes how Haptic works at a high level.

Introduction

Since its introduction with Uniswap [Ada18], the automated market maker (AMM) imposed itself as the de-facto technology for building decentralized exchanges. By design, all types of AMM models function by keeping reserves in sync with an exogenous market price through the action of arbitrageurs. This fact leads to a slight under-performance of the LPs’ profitability when compared to a traditional market maker [?]. In addition, adding liquidity to any type of AMM comes with the standard delta and gamma risk exposure [CAE21] [Cla21] which is not compensated fairly by trading fees alone. This means that, in order to obtain fair risk-adjusted returns, LPs need additional ways to monetize their positions.

Concentrated liquidity

The concentrated liquidity constant function market maker (CFMM) was introduced in 2021 [Ada+21] as the third iteration of the original Uniswap protocol. Uniswap V3 is the most general and capital efficient type of AMM [Dan21]. From the perspective of a LP, it allows them to select the price range at which they are willing to participate with funds, instead of imposing the full range. As such, it delivers higher capital efficiency and, since it allows LPs to pick arbitrary ranges, it can accurately replicate the original behavior. Using Uniswap v3 LPs can choose to deploy funds within an arbitrary narrow range. Once the position leaves the chosen range, it is converted entirely to one of the assets it contains: e.g. a DAI/ETH position deployed with a range of $[1000, 1200]$ DAI per ETH will be converted entirely to ETH if the price drops below 1000 and entirely to DAI if the price crosses the 1200 mark.

Trustless Binary Options

A binary option is a type of financial contract in which the outcome depends on the outcome of a “yes or no” proposition. There are two main types of binary options:

  1. Asset-or-nothing
  2. Cash-or-nothing

Typically, an asset-or-nothing binary option involves settlement with the underlying asset, while a cash-or-nothing option delivers a fixed cash payout. In traditional markets, these contracts are sold as both put and call options. The terms of the contract are set by the broker: e.g., the option direction (call or put), the strike price, the payout and the duration or time to expiration. The premium for the option is calculated using a pricing model such as Black-Scholes. At expiration, the price of the underlying asset must be on the correct side of the strike price (based on the trade direction) for the trader to turn a profit. This type of contract is automatically exercised, meaning that it requires no action at expiration - the buyer of a binary option will either receive a payout or nothing. On the other hand, the seller of the option will either retain the premium and his collateral, or be required to delivery the payout.

Haptic allows Uniswap v3 LPs to sell binary options that are guaranteed to transfer a payout to the option’s holder when it expires “in the money” (ITM). Haptic binary option contracts are characterized as follows:

  • Option premium: The amount paid by an option buyer when acquiring a contract.
  • Payout amount: The amount of payout sent to the option buyer if the contract expires ITM.
  • Payout token: Payouts can be in any ERC20 token.
  • Strike price: The price at which the contract is ITM.
  • Expiry: The duration of the contract. Options are automatically exercised at expiration date.
  • Direction: Can be either “PUT” (ITM below the strike price) or “CALL” (ITM above the strike price).

In order to ensure that contracts can be correctly settled, i.e. the protocol is able to transfer the payout if a contract expires in the money, option sellers are required to lock collateral on Haptic smart contracts. This collateral will take the form of a Uniswap v3 LP share. A LP share is characterized by a token pair ($token0$, $token1$), an amount of liquidity and a price range. For a given price, it’s always possible to calculate the exact reserves available for withdrawal in the LP share. This allows Haptic to guarantee a lower bound of payout token reserves available past a given strike price - in other words, there will be sufficient payout tokens to cover the payout when the option expires in the money. This is done by enforcing the following rule at protocol level:

$Payout\:amount <= min(Payout\:token\:reserves\:at\:strike\:price)$

This is another way of saying that the payout must be guaranteed to be available in the LP share for the whole ITM price range, e.g. [0, strike] or [strike, Inf] depending on the option’s direction (PUT/CALL). For details of the calculations see the Appendix.

Haptic Ecosystem

There are three distinct roles in the Haptic ecosystem:

  1. Option Seller: creates markets and provides liquidity by depositing LP shares and writing options for sale.
  2. Option Buyer: acquires contracts from the market and has a right to exercise them at expiration.
  3. Keeper: triggers settlement of ITM options and receives incentives.

Option Seller

Option sellers can write options collateralized by funds in their LP share. This allows them to express extra directional biases on without the need for extra collateral and earn from the premium. In addition, LPs will receive incentives designed to offset the risk associated with selling options.

Option Buyer

Option buyers deposit stablecoin and pay the premium to the seller for the contract. At expiration, the buyer receives the payout if the option expires ITM. If the option expires out-the-money (OTM), they receive nothing and the premium goes to the option seller. Under some circumstances the protocol will distribute trading incentives to returning option buyers with the goal of partially offsetting the risk of losing the premium, similarly to "cash back" rewards seen in traditional binary options markets.

Keeper

In-time settlement of ITM options is crucial for the protocol to function correctly. For this reason, the protocol incentivizes Keepers to trigger settlement of ITM options. When an option is created, the seller is required to transfer an amount of ETH calculated based on a rough estimation of the cost of exercising the contract plus a premium. The ETH and a fraction of the protocol fees are transferred to the Keeper that exercises the option. Typically, keepers are bot operators and miner-extractable value (MEV) hunters.

Permissionless Markets

The factory contract can deploy an option engine for any risky/stable pair (e.g. ETH/DAI) traded on Uniswap V3 in a permissionless fashion. This requires a trusted price source for the risky token to be available without intervention. To this end, Haptic relies on the Uniswap V3 time-weighted average price (TWAP) oracle.

TWAP

TWAP is calculated by sampling the cumulative price of an ERC20 token pair at the beginning and at the end of the desired interval and taking their difference divided by the length of the interval. This helps reducing the impact of short-term price fluctuations and their impact on the option's settlement. In addition, the mechanism is resistant to attacks: since TWAP is calculated relative to a time interval, in order to successfully manipulate it, the attack should be maintained over some period of time related to the TWAP interval. This factor alone would likely make it very expensive and impractical in most scenarios. The TWAP interval parameter can be updated through government proposals.

Tokenized Positions

Options sold are represented with the ERC1155 token standard. Buyers can choose to buy multiple contracts within the same transaction which results in a composite position with more than one leg. This will facilitate the deployment of vaults with specific strategies and defined payoff structures.

Governance

The protocol will be managed collectively by holders of the Haptic network token (HAP). HAP tokens will represent voting power on proposals inherent to the protocol management, e.g. changing system parameters or implementing new features. Holders with enough HAP tokens will also be able to create formal proposals and submit them to the community for voting. Examples of parameters that can be changed:

  • Protocol fees
  • Maximum payoff factor for options sold
  • TWAP time interval for assets traded on Haptic markets
  • Liquidity and trading incentives
  • Governance mechanism

Protocol fees

Initially, the protocol will charge a 10 basis point fee on each transaction. Fees accrued will be distributed across governance token holders. This parameter can be changed through the governance mechanism.

Bibliography

Appendix

Notation

SymbolWhitepaperUniswap code
Price$P$sqrtRatioX96
Lower bound of a price range$p_{a}$sqrtAx96
Upper bound of a price range$p_{b}$sqrtBx96
First asset$X$token0
Second asset$Y$token1
Amount of first asset$x$amount0
Amount of second asset$y$amount1
Virtual liquidity$L$liquidity amount

Liquidity & assets in a concentrated liquidity position

Equation 2.2 in [Ada+21] describes the real reserves of a position through the following curve:

$(x_{real} + \frac{L}{\sqrt{P}})(y_{real} + L\sqrt{p_{a}}) = L^2$

Outside the price range the liquidity is fully provided by a single asset, either X or Y depending on which side of the price range the current price is. We have three options:

  1. For $P \le p_{a}$ position is fully in X so $y = 0$ and:

    $(x + {\frac{L}{\sqrt{p_{b}}}})L\sqrt{p_{a}}=L^2$

    $x\sqrt{p_{a}} + L{\frac{\sqrt{p_{a}}}{\sqrt{p_{b}}}} = L$

    $x = {\frac{L}{\sqrt{p_{a}}}} - {\frac{L}{\sqrt{p_{b}}}}$

    $x = L\frac{\sqrt{p_{b}} - \sqrt{p_{a}}}{\sqrt{p_{a}} \cdot \sqrt{p_{b}}}$ and $L_{x} = x{\frac{\sqrt{p_{a}}\cdot\sqrt{p_{b}}}{\sqrt{p_{b}}-\sqrt{p_{a}}}}$

  2. For $P \ge p_{b}$, position is fully in Y so $x = 0$ and:

    $\frac{L}{\sqrt{p_{b}}}(y + L\sqrt{p_{a}}) = L^{2}$

    $\frac{y}{\sqrt{p_{b}}} + L\frac{\sqrt{p_{a}}}{\sqrt{p_{b}}} = L$

    $y = L_{y}(\sqrt{P} - \sqrt{p_{a}})$ and $L_{y} = {\frac{y}{\sqrt{p_{b}}-{\sqrt{p_{a}}}}}$

  1. For $p_{a} < P < p_{b}$ the position is composed of both assets X and Y with $L = min(L_{x}, L_{y})$ and $x$ and $y$ can be calculated respectively as:

    $x = L\frac{\sqrt{p_{b}} - \sqrt{P}}{\sqrt{P} \cdot \sqrt{p_{b}}}$

    $y = L(\sqrt{P}-\sqrt{p_{a}})$

Binary options

A liquidity provider deposits a LP share with $x = 2$ ETH $y = 5076.10$ DAI and price range $p_{a} = 1500$, $p_{b} = 2500$ DAI. The initial price is $P = 2000$ DAI.

Using this position the LP can sell a binary put for any strike $K < P$ and a binary call for any strike $K > P$.

If $K \in [p_{a}, p_{b}]$ the option can be both a asset-or-nothing or cash-or-nothing.

If $K < p_{a}$ or $K > p_{b}$ the option can be only an asset-or-nothing or a cash-or-nothing respectively.

Let's illustrate how the mechanism works. First calculate the initial liquidity of the position:

$L_{x} = x{\frac{\sqrt{P}\cdot{\sqrt{p_{b}}}}{\sqrt{p_{b}} - {\sqrt{P}}}}\approx847.21359$

$L_{y} = \frac{y}{\sqrt{P}-\sqrt{p_{a}}}\approx847.21320$

Example 1: PUT

Asset-or-nothing

The LP wants to sell an asset-or-nothing put with strike $K = 1600$ DAI per ETH, what's the maximum payout of this type of option?

Using the previously calculated values, pick $L = min(L_{x}, L_{y})$ and set $P = 1600$ to obtain the new value for $x$ :

$x = L{\frac{\sqrt{p_{b}}-\sqrt{P}}{\sqrt{P}\cdot\sqrt{p_{b}}}}\approx4.23\ \text{ETH}$

Answer: The maximum payout of this contract is 4.23 ETH.

Cash-or-nothing

The LP wants to sell a Cash-or-nothing put with strike $K = 1600$ DAI per ETH, what's the maximum payout of this type of option?

Using the previous value for $L$ and setting P = 1600 we obtain the new value for $y$:

$y = L({\sqrt{P}}-\sqrt{P_{a}})\approx1076.10\,\text{DAI}$

Answer: The maximum payout of this contract is 1076.10 DAI.

Example 2: CALL

Asset-or-nothing

The LP wants to sell an asset-or-nothing and a cash-or-nothing call with strike $K = 2400$ DAI per ETH, what's the maximum payout for these options?

Using the previously calculated values, pick $L = min(L_{x}, L_{y})$ and set $P = 2400$ to obtain the new value for $x$ :

$x = L{\frac{\sqrt{p_{b}}-\sqrt{P}}{\sqrt{P}\cdot\sqrt{p_{b}}}}\approx0.34\ \text{ETH}$

Answer: The maximum payout of this contract is 0.34 ETH.

Cash-or-nothing

Using the previous value for $L$ and setting P = 2400 we obtain the new value for $y$:

$y = L({\sqrt{P}}-\sqrt{P_{a}})\approx8692.37\,\text{DAI}$

Answer: The maximum payout of this contract is 8692.37 DAI.

Website / Medium / Twitter / Discord / Github