Skip to main content

KpiOptionsFinancialProductLibrary

KpiOptionsFinancialProductLibrary#

Adds custom tranformation logic to modify the price and collateral requirement behavior of the expiring multi party contract. If a price request is made pre-expiry, the price should always be set to 2 and the collateral requirement should be set to 1. Post-expiry, the collateral requirement is left as 1 and the price is left unchanged.

Functions#

transformPrice(struct FixedPoint.Unsigned oraclePrice, uint256 requestTime) → struct FixedPoint.Unsigned (public)

Returns a transformed price for pre-expiry price requests.

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 that is set to be equivalent to 2 tokens pre-expiry.

_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (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.