PreExpirationIdentifierTransformationFinancialProductLibrary
Pre-Expiration Identifier Transformation Financial Product Library
nonReentrant() modifier
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 make it call a
private function that does the actual work.
nonReentrantView() modifier
Designed to prevent a view-only method from being re-entered during a call to a nonReentrant() state-changing method.
setFinancialProductTransformedIdentifier(address financialProduct, bytes32 transformedIdentifier) public
Enables the deployer of the library to set the transformed identifier for an associated financial product.
Note: a) Any address can set identifier transformations b) The identifier can’t be set to blank. c) A transformed price can only be set once to prevent the deployer from changing it after the fact. d) financialProduct must expose an expirationTimestamp method.
Parameters:
-
financialProduct: address of the financial product. -
transformedIdentifier: the identifier for the financial product to be used if the contract is pre expiration.
getTransformedIdentifierForFinancialProduct(address financialProduct) → bytes32 public
Returns the transformed identifier associated with a given financial product address.
Parameters:
-
financialProduct: address of the financial product.
transformPriceIdentifier(bytes32 identifier, uint256 requestTime) → bytes32 public
Returns a transformed price identifier if the contract is pre-expiration and no transformation if post.
Parameters:
-
identifier: input price identifier to be transformed. -
requestTime: timestamp the identifier is to be used at.
transformPrice(struct FixedPoint.Unsigned oraclePrice, uint256 requestTime) → struct FixedPoint.Unsigned public
Transforms a given oracle price using the financial product libraries transformation logic.
Parameters:
-
oraclePrice: input price returned by the DVM to be transformed. -
requestTime: timestamp the oraclePrice was requested at.
transformCollateralRequirement(struct FixedPoint.Unsigned oraclePrice, struct FixedPoint.Unsigned collateralRequirement) → struct FixedPoint.Unsigned public
Transforms a given collateral requirement using the financial product libraries transformation logic.
Parameters:
-
oraclePrice: input price returned by DVM used to transform the collateral requirement. -
collateralRequirement: input collateral requirement to be transformed.