Burning options
he exchange keeps track of all option writers and holders. Option writers are addresses that create option tokens. Option holders in turn are addresses to whom option tokens are transferred to. On calling the writeOptions
exchange function an address becomes both writer and holder of the newly issued option tokens, until it decides to transfer them to a third-party.
In order to burn options, for instance to close a position before maturity and release allocated collateral, writers can call the burn
function from the option token contract:
The calling address must be both writer and holder of the specified volume of options that are to be burned, otherwise the function will revert. If the calling address happens to be short biased (written volume > held volume) it will have to purchase option tokens in the market up to the volume it wishes to burn.
Underlying feeds
Both the calcCollateral
and the writeOptions
exchange functions receive the address of the option underlying price feed contract as a parameter. The feed contract implements the following interface:
The exchange depends on these functions to calculate options intrinsic value, collateral requirements and to liquidate positions.
The
symbol
function is used to create option token contracts identifiers, such asETH/USD-EC-13e20-1611964800
which represents an ETH european call option with strike price US$ 1300 and maturity at timestamp1611964800
.The
getLatestPrice
function retrieves the latest quote for the option underlying, for calculating its intrinsic value.The
getPrice
function on the other hand retrieves the first price for the underlying registered in the blockchain after a specific timestamp position, and is used to liquidate the option token contract at maturity.The
getDailyVolatility
function is used to calculate collateral requirements as described in the collateral allocation section.The
calcLowerVolatility
andcalcUpperVolatility
apply, respectively, the klower and kupper constants to the volatility passed as a parameter, also used for calculating collateral requirements, and for liquidating positions as well.
This repository provides a Chainlink based implementation of the UnderlyingFeed
interface which allows any Chainlink USD fiat paired currency (ex: ETH, BTC, LINK, EUR) to be used as underlying for issuing options:
Notice that this implementation provides prefetching functions (prefetchSample
, prefetchDailyPrice
and prefetchDailyVolatility
) which should be called periodically and are used to lock-in underlying prices for liquidation and to optimize gas usage while performing volatility calculations.
Last updated