Skip to main content

CoveredCallFinancialProductLibrary

CoveredCallFinancialProductLibrary#

Adds custom price transformation logic to modify the behavior of the expiring multi party contract. The contract holds say 1 WETH in collateral and pays out a portion of that, at expiry, if ETHUSD is above a set strike. If ETHUSD is below that strike, the contract pays out 0. The fraction paid out if above the strike is defined by (oraclePrice - strikePrice) / oraclePrice; Example: expiry is DEC 31. Strike is $400. Each token is backed by 1 WETH. If ETHUSD = $600 at expiry, the call is $200 in the money, and the contract pays out 0.333 WETH (worth $200). If ETHUSD = $800 at expiry, the call is $400 in the money, and the contract pays out 0.5 WETH (worth $400). If ETHUSD =< $400 at expiry, the call is out of the money, and the contract pays out 0 WETH.

Functions#

setFinancialProductStrike(address financialProduct, struct FixedPoint.Unsigned strikePrice) (public)

Enables any address to set the strike price for an associated financial product.

Note: a) Any address can set the initial strike price b) A strike price cannot 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) financialProduct must expose an expirationTimestamp method.

Parameters:#

  • financialProduct: address of the financial product.
  • strikePrice: the strike price for the covered call to be applied to the financial product.
getStrikeForFinancialProduct(address financialProduct) โ†’ struct FixedPoint.Unsigned (public)

Returns the strike price associated with a given financial product address.

Parameters:#

  • financialProduct: address of the financial product.
transformPrice(struct FixedPoint.Unsigned oraclePrice, uint256 requestTime) โ†’ struct FixedPoint.Unsigned (public)

Returns a transformed price by applying the call option payout structure.

Parameters:#

  • oraclePrice: price from the oracle to be transformed.
  • requestTime: timestamp the oraclePrice was requested at.
transformCollateralRequirement(struct FixedPoint.Unsigned, struct FixedPoint.Unsigned) โ†’ struct FixedPoint.Unsigned (public)

Returns a transformed collateral requirement by applying the covered call payout structure.

_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
_startReentrantGuardDisabled() (internal)
_endReentrantGuardDisabled() (internal)
transformPriceIdentifier(bytes32 priceIdentifier, uint256) โ†’ bytes32 (public)

Transforms a given price identifier using the financial product libraries transformation logic.

Parameters:#

  • priceIdentifier: input price identifier defined for the financial contract.

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.