Skip to main content

StructuredNoteFinancialProductLibrary

StructuredNoteFinancialProductLibrary#

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 that 1 WETH if, at expiry, ETHUSD is below a set strike. If ETHUSD is above that strike, the contract pays out a given dollar amount of ETH. Example: expiry is DEC 31. Strike is $400. Each token is backed by 1 WETH If ETHUSD < $400 at expiry, token is redeemed for 1 ETH. If ETHUSD >= $400 at expiry, token is redeemed for $400 worth of ETH, as determined by the DVM.

Functions#

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

Enables the deployer of the library to set the strike price for an associated financial product.

Note: a) Only the owner (deployer) of this library can set new strike prices 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) financialProduct must exposes an expirationTimestamp method.

Parameters:#

  • financialProduct: address of the financial product.
  • strikePrice: the strike price for the structured note 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 structured note payout structure.

Parameters:#

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

Returns a transformed collateral requirement by applying the structured note payout structure. If the price of the structured note is greater than the strike then the collateral requirement scales down accordingly.

Parameters:#

  • oraclePrice: price from the oracle to transform the collateral requirement.
  • collateralRequirement: financial products collateral requirement to be scaled according to price and strike.
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
constructor() (internal)

Initializes the contract setting the deployer as the initial owner.

owner() โ†’ address (public)

Returns the address of the current owner.

renounceOwnership() (public)

Leaves the contract without owner. It will not be possible to call onlyOwner functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.

transferOwnership(address newOwner) (public)

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

_transferOwnership(address newOwner) (internal)

Transfers ownership of the contract to a new account (newOwner). Internal function without access restriction.

_msgSender() โ†’ address (internal)
_msgData() โ†’ bytes (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.

Events#

OwnershipTransferred(address previousOwner, address newOwner)

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.

onlyOwner()

Throws if called by any account other than the owner.