Skip to main content



Adds settlement logic to create range bond LSPs. A range bond is the combination of a Yield dollar, short put option and long call option enabling the token sponsor to issue structured products to unlock DeFi treasuries. A range bond is defined as = Yield Dollar - Put Option + Call option. Numerically this is found using: N = Notional of bond P = price of token T = number of tokens R1 = low price range R2 = high price range T = min(N/P,N/R1) + max((N/R2*(P-R2))/P,0)

  • At any price below the low price range (R1) the long side effectively holds a fixed number of collateral equal to collateralPerPair from the LSP with the value of expiryPercentLong = 1. This is the max payout in collateral.
  • Any price between R1 and R2 gives a payout equivalent to a yield dollar (bond) of notional N. In this range the expiryPercentLong shifts to keep the payout in dollar terms equal to the bond notional.
  • At any price above R2 the long holders are entitled to a fixed, minimum number of collateral equal to N/R2 with a expiryPercentLong=(N/R2)/collateralPerPair. The expression for the number of tokens paid out to the long side (T above) can be algebraically simplified, transformed to remove the notional and reframed to express the expiryPercentLong as [min(max(1/R2,1/P),1/R1)]/(1/R1) With this equation, the contract deployer does not need to specify the bond notional N. The notional can be calculated by taking R1*collateralPerPair from the LSP.


setLongShortPairParameters(address longShortPair, uint256 highPriceRange, uint256 lowPriceRange) (public)

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

between highPriceRange and lowPriceRange the contract will payout a fixed amount of lowPriceRange*collateralPerPair (i.e the "notional" of the yield dollar). Note: a) Any address can set these parameters b) existing LSP parameters for address not set. c) highPriceRange > lowPriceRange. d) parameters price can only be set once to prevent the deployer from changing the parameters after the fact. e) For safety, a 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.
  • highPriceRange: high price range after which the payout transforms from a yield dollar to a call option.
  • lowPriceRange: low price range below which the payout transforms from a yield dollar to a short put option.
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.


  • 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.