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
  1. INTEGRATION REFERENCE
  2. Spectra Oracles
  3. Oracle Deployment

TWAP Oracles Deployment

Overview

To deploy a standard TWAP Oracle, you can use the TwapOracleFactoryNG and TwapOracleFactorySNG , depending on whether your underlyiong market usestwocrypto-ng or stableswap-ng AMMs.

Deployment

Deployment of Spectra TWAP oracles is done through the deployOracle() method

    /**
     * @notice Deploys an oracle for a given principal token, pool, and oracle type
     * @param _pt The address of the principal token
     * @param _pool The address of the pool
     * @param _oracleType The type of oracle
     * @param _initialOwner The address of the initial owner of the oracle
     * @return oracleAddress The address of the deployed oracle
     */
    function deployOracle(
        address _pt,
        address _pool,
        OracleType _oracleType,
        address _initialOwner
    ) external returns (address oracleAddress);

It deploys an oracle of _oracleType for a market composed of a PT of address _pt and of market address _pool . The OracleType _oracleType field allows you to choose the type of oracle you want to deploy. The possible types are

enum OracleType {
        PTIBT,
        PTUND,
        YTIBT,
        YTUND,
        LPIBT,
        LPUND
    }

The possible types specify the base asset (PT, YT, LP) followed by the quote asset (IBT, Underlying).

Setting yourself as the _initialOwner allows you to upgrade the oracle implementation.

Deployment can be done through the common interface ITwapOracleFactory , since both TwapOracleFactoryNG and TwapOracleFactorySNG both implement it.

PreviousDeterministic Oracles Deployment

Last updated 3 days ago