PreExpirationIdentifierTransformationFinancialProductLibrary
PreExpirationIdentifierTransformationFinancialProductLibrary
#
Adds custom identifier transformation to enable a financial contract to use two different identifiers, depending on when a price request is made. If the request is made before expiration then a transformation is made to the identifier & if it is at or after expiration then the original identifier is returned. This library enables self referential TWAP identifier to be used on synthetics pre-expiration, in conjunction with a separate identifier at expiration.
#
FunctionssetFinancialProductTransformedIdentifier(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.
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
transformPrice(struct FixedPoint.Unsigned oraclePrice, uint256) โ 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.
transformCollateralRequirement(struct FixedPoint.Unsigned, struct FixedPoint.Unsigned collateralRequirement) โ struct FixedPoint.Unsigned (public)
Transforms a given collateral requirement using the financial product libraries transformation logic.
#
Parameters:- collateralRequirement: input collateral requirement to be transformed.
#
ModifiersnonReentrant()
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.