Skip to main content

SimpleSuccessTokenLongShortPairFinancialProductLibrary

SimpleSuccessTokenLongShortPairFinancialProductLibrary#

Adds settlement logic to create success token LSPs. A success token pays out 50% of collateral as a floor, with the remaining 50% functioning like an embedded covered call. If the settlement is below the strike price then longs are worth 50% of collateral. If the settlement is above the strike then the payout is equal to: 0.5 + (0.5 * (expiryPrice - strikePrice) / expiryPrice) For example, consider a covered call option collateralized in SUSHI, with a strike a price of $20, and collateralPerPair of 2.

  • If the price is less than $20 then the each long is worth 0.5 collateralPerPair and each short is worth 0.5 collateralPerPair. i.e., each long is worth 1 SUSHI (calls expire worthless).
  • If the price is more than $20 then each long is worth 0.5 collateralPerPair plus 0.5 times the fraction of collateralPerPair that was in the money, and each short is worth the remaining collateralPerPair.
  • Say settlement price is $30. Then expiryPercentLong = 0.5 + (0.5 (30 - 20) / 30) = 0.6667. If the collateralPerPair is 2, that means the long payout is 0.66672 = 1.3333 $SUSHI, which at a settlement price of $30 is worth $40. This is equivalent to the value of 1 $SUSHI plus the value of the $20 strike embedded call.

Functions#

setLongShortPairParameters(address longShortPair, uint256 strikePrice) (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.
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)

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.