Skip to main content

CappedYieldDollarLongShortPairFinancialProductLibrary

CappedYieldDollarLongShortPairFinancialProductLibrary#

Adds settlement logic to create Yield Dollar LSPs. A range bond is the combination of a Yield dollar and short put option enabling the token sponsor to issue structured products to unlock DeFi treasuries. This library is like a Range Bond, but with no embedded call option. A Capped Yield Dollar is defined as = Yield Dollar - Put Option. In order for the Capped Yield Dollar to be fully collateralized and non-liquidatable, there is a low price for the collateral token below which the Capped Yield Dollar will be worth < $1. Numerically this is found using: N = Notional of bond P = price of token T = number of tokens R1 = low price range C = collateral per pair, should be N/R1 T = min(1,(R1/P)*C) If you want a yield dollar denominated as N = $1, you should set C to 1/R1. In that case, T = min(1,1/P).

  • 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 equal to or above R1 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. 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.

Functions#

setLongShortPairParameters(address longShortPair, uint256 lowPriceRange) (public)

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

above the 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) low price range can only be set once to prevent the deployer from changing the parameters after the fact. d) For safety, a low price range 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 contract.
  • 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.

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.