Spectra Developer Docs
  • Developers Documentation
  • Getting Started
  • Guides
    • Tokenizing Yield
    • Providing Liquidity
    • Deploy PT and Curve Pool
    • Routing
    • IBT Additional Rewards
    • Locking APW for veAPW
    • Voting and Earning Rewards
  • Technical Reference
    • Deployed Contracts
    • Contract Functions
      • Principal Token
      • Yield Token
      • Registry
      • RateOracle
      • Factory
      • Access Manager
      • RouterUtil
      • Router
      • GovernanceRegistry
      • Voter
      • VotingReward
        • BribeVotingReward
        • FeesVotingReward
      • FeeDistributor
      • Spectra4626Wrapper
    • Yield Calculations
    • Spectra's Automated Market Makers
      • Rate Adjusted StableSwap pools
  • Glossary
  • INTEGRATION REFERENCE
    • Spectra Oracles
      • TWAP Oracles
      • Deterministic Oracles
        • Linear APR model
        • Linear Discount Model
        • Zero Coupon Bond Model
        • Comparison
      • Oracle Deployment
        • Deterministic Oracles Deployment
        • TWAP Oracles Deployment
Powered by GitBook
On this page
  • Overview
  • Deployment
  • Example
  1. INTEGRATION REFERENCE
  2. Spectra Oracles
  3. Oracle Deployment

Deterministic Oracles Deployment

Overview

Deployment of deterministic oracles, both according to the linear discount model and the zero-coupon bond model, is done through the SpectraPriceOracleFactory .

Deployment

One deploys a deterministic oracle through the method

/**
* @dev Deploys a new `SpectraOracle` for a given PT.
* @param _pt The address of the Principal Token (PT).
* @param _discountModel The discount model address.
* @return oracle The address of the newly deployed Oracle.
*/
function createOracle(
   address _pt,
   address _discountModel,
   uint256 initialImpliedAPY,
   address initOwner
) external returns (address oracle)

The _discountModel address corresponds to the address of either the LinearDiscountModel , LinearAPRModel or ZeroCouponDiscountModel , depending on the pricing model one wants to use.

The initialImpliedAPY field is the implied APY according to which we want to discount the PT over the term. The initialImpliedAPY field is in 18 decimals precision, 10 ** 18 representing a 100% implied APY.

The owner of the oracle contract can change the discount model used in the oracle by calling setDiscountModel() .

Example

For example, to deploy an oracle with a 30% implied APY over the term, one does


createOracle(
   address(0) // PT address,
   address(0) // Discount Model Contract address,
   0.3 * 10 ** 17, // 30% implied APY
   address(0) // Address of the owner
) external returns (address oracle)
PreviousOracle DeploymentNextTWAP Oracles Deployment

Last updated 2 days ago