Skip to main content

BinaryOptionLongShortPairFinancialProductLibrary

BinaryOptionLongShortPairFinancialProductLibrary#

Adds settlement logic to binary option LSPs. Binary options settle with all collateral allocated to either the long or short side, depending on the settlement price. They can be used to make prediction markets or any kind of binary bet. Settlement is defined using a strike price which informs which side of the bet was correct. If settlement price is greater or equal to the strike then all value is sent to the long side. Otherwise, all value is sent to the short side. The settlement price could be a scalar (like the price of ETH) or a binary bet with settlement being 0 or 1 depending on the outcome.

Functions#

setLongShortPairParameters(address longShortPair, int256 strikePrice) (public)

Enables any address to set the strike price for an associated binary option.

Note: a) Any address can set the initial strike price b) A strike can be 0. c) A strike price can only be set once to prevent the deployer from changing the strike after the fact. d) For safety, a strike price should be set before depositing any synthetic tokens in a liquidity pool. e) longShortPair must expose an expirationTimestamp method to validate it is correctly deployed.

Parameters:#

  • longShortPair: address of the LSP.
  • strikePrice: the strike price for the binary option.
percentageLongCollateralAtExpiry(int256 expiryPrice) → uint256 (public)

Returns a number between 0 and 1e18 to indicate how much collateral each long and short token are entitled to per collateralPerPair.

Parameters:#

  • expiryPrice: price from the optimistic oracle for the LSP price identifier.
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)

Modifiers#

nonReentrant()

Prevents a contract from calling itself, directly or indirectly. Calling a nonReentrant function from another nonReentrant function is not supported. It is possible to prevent this from happening by making the nonReentrant function external, and making it call a private function that does the actual state modification.

nonReentrantView()

Designed to prevent a view-only method from being re-entered during a call to a nonReentrant() state-changing method.