SuccessTokenLongShortPairFinancialProductLibrary
SuccessTokenLongShortPairFinancialProductLibrary
#
Adds settlement logic to create success token LSPs. A success token pays out a fixed amount of collateral as a floor, with the remaining amount functioning like an embedded option. The embedded option in this case uses payout logic that resembles a covered call. I.e., the token expires to be worth basePercentage + (1 - basePercentage) * (expiryPrice - strikePrice).
#
FunctionssetLongShortPairParameters(address longShortPair, uint256 strikePrice, uint256 basePercentage) (public)
Enables any address to set the strike price for an associated LSP.
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) longShortPair must expose an expirationTimestamp method to validate it is correctly deployed.
#
Parameters:- longShortPair: address of the LSP.
- strikePrice: the strike price for the covered call for the associated LSP.
- basePercentage: the base percentage of collateral per pair paid out to long tokens, expressed with 1e18 decimals. E.g., a 50% base percentage should be expressed 500000000000000000, or 0.5 with 1e18 decimals. The base percentage cannot be set to 0.
percentageLongCollateralAtExpiry(int256 expiryPrice) → uint256 (public)
Returns a number between 0 and 1e18 to indicate how much collateral each long and short token are entitled to per collateralPerPair.
#
Parameters:- expiryPrice: price from the optimistic oracle for the LSP price identifier.
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)
_startReentrantGuardDisabled() (internal)
_endReentrantGuardDisabled() (internal)
#
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.