Skip to main content



Adds settlement logic to create linear LSPs. The contract will payout a scaled amount of collateral depending on where the settlement price lands within a price range between an upperBound and a lowerBound. If settlement price is within the price range then the expiryPercentLong is defined by (expiryPrice - lowerBound) / (upperBound - lowerBound). This number represent the amount of collateral from the collateralPerPair that will be sent to the long and short side. If the price is higher than the upperBound then expiryPercentLong = 1. if the price is lower than the lower bound then expiryPercentLong = 0. For example, consider a linear LSP on the price of ETH collateralized in USDC with an upperBound = 4000 and lowerBound = 2000 with a collateralPerPair of 1000 (i.e each pair of long and shorts is worth 1000 USDC). At settlement the expiryPercentLong would equal 1 (each long worth 1000 and short worth 0) if ETH price was > 4000 and it would equal 0 if < 2000 (each long is worthless and each short is worth 1000). If between the two (say 3500) then expiryPercentLong = (3500 - 2000) / (4000 - 2000) = 0.75. Therefore each long is worth 750 and each short is worth 250.


setLongShortPairParameters(address longShortPair, int256 upperBound, int256 lowerBound) (public)

Enables any address to set the parameters for an associated financial product.

Note: a) Any address can set these parameters b) existing LSP parameters for address not set. c) upperBound > lowerBound. d) parameters can only be set once to prevent the deployer from changing the parameters after the fact. e) For safety, parameters should be set before depositing any synthetic tokens in a liquidity pool. f) longShortPair must expose an expirationTimestamp method to validate it is correctly deployed.


  • longShortPair: address of the LSP contract.
  • upperBound: the upper price that the linear LSP will operate within.
  • lowerBound: the lower price that the linear LSP will operate within.
percentageLongCollateralAtExpiry(int256 expiryPrice) → uint256 (public)

Returns a number between 0 and 1e18 to indicate how much collateral each long and short token is entitled to per collateralPerPair.


  • expiryPrice: price from the optimistic oracle for the LSP price identifier.
_preEntranceCheck() (internal)
_preEntranceSet() (internal)
_postEntranceReset() (internal)



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.


Designed to prevent a view-only method from being re-entered during a call to a nonReentrant() state-changing method.