AlphaOptionHandler.sol

AlphaOptionHandler

executeOrder(orderId) external Direct NonTrustedAccessible

This function gets a custom order using a orderId, this will revert if the sender is not the authorised buyer of the order. First the spot price will be checked against the customOrderBounds to make sure there hasnt been a big spot price move. If the order falls outside any of the allowed bounds then the transaction will revert. If all conditions are met then the option will be minted to the buyer. At the end of the transaction the order is invalidated.

executeBuyBackOrder(orderId) external Direct NonTrustedAccessible

This function gets a custom order using a orderId, this will revert if the sender is not the authorised buyer of the order. First the spot price will be checked against the customOrderBounds to make sure there hasnt been a big spot price move. If the order falls outside any of the allowed bounds then the transaction will revert. If all conditions are met then the option will be burned and usdc will be returned to the buyer. At the end of the transaction the order is invalidated.

executeStrangle(orderId1, orderId2) external Direct NonTrustedAccessible

This function executes two order executions and is intended for use with a strangle.

createOrder() external onlyRole

This function creates a custom option order receipt which contains the option series, the amount, the price at which the order is settled at, the time after which the custom order expires and the authorised buyer of the custom order. This is managed by a manager and governance and is used for large market orders with participants such as market makers. This returns an orderId which is used by the market participant to access their custom order in executeOrder. Create order also requires passing in whether the order is a buyback or not.

createStrangle() external onlyRole

This function creates two custom orders, one put order and one call order. This is so delta neutral positions can be sold to certain market participants.

Contract used for all user facing options interactions

Interacts with liquidityPool to write options and quote their prices.

liquidityPool

contract ILiquidityPool liquidityPool

immutable variables ///

protocol

contract Protocol protocol

strikeAsset

address strikeAsset

underlyingAsset

address underlyingAsset

collateralAsset

address collateralAsset

orderIdCounter

uint256 orderIdCounter

dynamic variables ///

orderStores

mapping(uint256 => struct Types.Order) orderStores

customOrderBounds

struct AlphaOptionHandler.CustomOrderBounds customOrderBounds

governance settable variables ///

MAX_BPS

uint256 MAX_BPS

constant variables ///

maxOrderExpiry

uint256 maxOrderExpiry

CustomOrderBounds

struct CustomOrderBounds {
  uint128 callMinDelta;
  uint128 callMaxDelta;
  int128 putMinDelta;
  int128 putMaxDelta;
  uint256 maxPriceRange;
}

OrderCreated

event OrderCreated(uint256 orderId)

OrderExecuted

event OrderExecuted(uint256 orderId)

constructor

constructor(address _authority, address _protocol, address _liquidityPool) public

setCustomOrderBounds

function setCustomOrderBounds(uint128 _callMinDelta, uint128 _callMaxDelta, int128 _putMinDelta, int128 _putMaxDelta, uint32 _maxPriceRange) external

set new custom order parameters

createOrder

function createOrder(struct Types.OptionSeries _optionSeries, uint256 _amount, uint256 _price, uint256 _orderExpiry, address _buyerAddress, bool _isBuyBack, uint256[2] _spotMovementRange) public returns (uint256)

creates an order for a number of options from the pool to a specified user. The function is intended to be used to issue options to market makers/ OTC market participants in order to have flexibility and customisability on option issuance and market participant UX.

createStrangle

function createStrangle(struct Types.OptionSeries _optionSeriesCall, struct Types.OptionSeries _optionSeriesPut, uint256 _amountCall, uint256 _amountPut, uint256 _priceCall, uint256 _pricePut, uint256 _orderExpiry, address _buyerAddress, uint256[2] _callSpotMovementRange, uint256[2] _putSpotMovementRange) external returns (uint256, uint256)

creates a strangle order. One custom put and one custom call order to be executed simultaneously.

executeOrder

function executeOrder(uint256 _orderId) public

fulfills an order for a number of options from the pool to a specified user. The function is intended to be used to issue options to market makers/ OTC market participants in order to have flexibility and customisability on option issuance and market participant UX.

executeBuyBackOrder

function executeBuyBackOrder(uint256 _orderId) public

fulfills a buyback order for a number of options from the pool to a specified user. The function is intended to be used to issue options to market makers/ OTC market participants in order to have flexibility and customisability on option issuance and market participant UX.

executeStrangle

function executeStrangle(uint256 _orderId1, uint256 _orderId2) external

fulfills a stored strangle order consisting of a stores call and a stored put. This is intended to be called by market makers/OTC market participants.

getOptionRegistry

function getOptionRegistry() internal view returns (contract IOptionRegistry)

get the option registry used for storing and managing the options

getPortfolioValuesFeed

function getPortfolioValuesFeed() internal view returns (contract IPortfolioValuesFeed)

get the portfolio values feed used by the liquidity pool

_getUnderlyingPrice

function _getUnderlyingPrice(address underlying, address _strikeAsset) internal view returns (uint256)

get the underlying price with just the underlying asset and strike asset

Last updated