Nucleus
  • Overview
    • Welcome to Nucleus
    • Official Links
    • FAQ
  • Nucleus Architecture
    • Overview
    • Vault Framework
    • Cross-chain Infrastructure
    • Withdrawals
    • Revenue Strategies
      • Market-agnostic Lending
      • Cross-chain Intents
      • Ownership by Default
    • Reward Distribution
    • Nucleus Points
    • Deployed Assets
    • Smart Contracts
      • README
      • CONTRACTS
        • contents
        • atomic-queue
          • Contents
          • AtomicQueue
          • AtomicSolver
          • AtomicSolverV2
          • AtomicSolverV3
          • IAtomicSolver
        • base
          • Boring Vault
            • BoringVault
          • Decoders and Sanitizers
            • Contents
            • IonPoolDecoderAndSanitizer
          • Roles
            • Contents
            • Cross Chain
              • Cross Chain OP Teller With Multi Asset Support
                • CrossChainOPTellerWithMultiAssetSupport
                • ICrossDomainMessenger
              • Cross Chain Teller Base
                • BridgeData
                • CrossChainTellerBase
              • MultiChainLayerZeroTellerWithMultiAssetSupport
              • Multi Chain Teller Base
                • Chain
                • MultiChainTellerBase
                • MultiChainTellerBase_GasLimitExceeded
                • MultiChainTellerBase_GasTooLow
                • MultiChainTellerBase_MessagesNotAllowedFrom
                • MultiChainTellerBase_MessagesNotAllowedFromSender
                • MultiChainTellerBase_MessagesNotAllowedTo
                • MultiChainTellerBase_ZeroMessageGasLimit
              • OAppAuth
                • Contents
                • OAppAuth
                • OAppAuthCore
                • OAppAuthReceiver
                • OAppAuthSender
            • AccountantWithRateProviders
            • ManagerWithMerkleVerification
            • TellerWithMultiAssetSupport
        • helper
          • Contents
          • Constants
          • ArcticArchitectureLens
          • Deployer
          • GenericRateProvider
        • interfaces
          • BalancerVault
          • AggregationRouterV5
          • BeforeTransferHook
          • DecoderCustomTypes
          • ICreateX
          • IPriceFeed
          • PriceRouter
          • IRateProvider
          • INonFungiblePositionManager
          • Contents
          • IStaking
            • ILiquidityPool
            • ILRTDepositPool
            • IRestakeManager
            • IStaderConfig
            • IStakePoolManager
            • ISTETH
            • ISWETH
            • IUNSTETH
            • IUserWithdrawManager
            • IWEETH
            • IWithdrawRequestNft
            • IWSTETH
          • IUniswap v3 Router
            • IUniswapV3Router
            • IUniswapV3SwapCallback
        • micro-managers
          • Contents
          • DexSwapperUManager
          • DexAggregatorUManager
          • UManager
        • migration
          • Contents
          • CellarMigrationAdaptor
        • oracles
          • EthPerTokenRateProvider
          • Contents
          • EthPerWstEthRateProvider
  • Security
    • Audits
Powered by GitBook
On this page
  • State Variables
  • PRICE_FEED_TYPE
  • DESCRIPTION
  • PRICE_FEED
  • MAX_TIME_FROM_LAST_UPDATE
  • RATE_DECIMALS
  • DECIMALS_OFFSET
  • Functions
  • constructor
  • getRate
  • _validityCheck
  • _isEqual
  • _isEqual
  • Errors
  • MaxTimeFromLastUpdatePassed
  • InvalidPriceFeedDecimals
  • InvalidDescription
  • InvalidPriceFeedType
  • Enums
  • PriceFeedType

Was this helpful?

  1. Nucleus Architecture
  2. Smart Contracts
  3. CONTRACTS
  4. oracles

EthPerTokenRateProvider

PreviousoraclesNextContents

Was this helpful?

Inherits: IRateProvider

Reports the price of a token in terms of ETH. The underlying price feed must be compatible with the Chainlink interface.

State Variables

PRICE_FEED_TYPE

The type of price feed providers.

PriceFeedType public immutable PRICE_FEED_TYPE;

DESCRIPTION

The asset pair the rate provider queries.

string public DESCRIPTION;

PRICE_FEED

The underlying price feed that this rate provider reads from.

IPriceFeed public immutable PRICE_FEED;

MAX_TIME_FROM_LAST_UPDATE

Number of seconds since last update to determine whether the price feed is stale.

uint256 public immutable MAX_TIME_FROM_LAST_UPDATE;

RATE_DECIMALS

The preicision of the rate returned by this contract.

uint8 public immutable RATE_DECIMALS;

DECIMALS_OFFSET

The offset between the intended return decimals and the price feed decimals.

Based on the PriceFeedType, the price feed's asset pair label is retrieved differently.

uint8 public immutable DECIMALS_OFFSET;

Functions

constructor

constructor(
    string memory _description,
    IPriceFeed _priceFeed,
    uint256 _maxTimeFromLastUpdate,
    uint8 _rateDecimals,
    PriceFeedType _priceFeedType
);

Parameters

Name
Type
Description

_description

string

The asset pair. ex) stETH/ETH

_priceFeed

IPriceFeed

_maxTimeFromLastUpdate

uint256

_rateDecimals

uint8

_priceFeedType

PriceFeedType

getRate

Gets the price of token in terms of ETH.

function getRate() public view returns (uint256 ethPerToken);

Returns

Name
Type
Description

ethPerToken

uint256

price of token in ETH.

_validityCheck

To revert upon custom checks such as sequencer liveness.

function _validityCheck() internal view virtual;

_isEqual

function _isEqual(string memory a, string memory b) internal pure returns (bool);

_isEqual

function _isEqual(string memory a, bytes32 b) internal pure returns (bool);

Errors

MaxTimeFromLastUpdatePassed

error MaxTimeFromLastUpdatePassed(uint256 blockTimestamp, uint256 lastUpdated);

InvalidPriceFeedDecimals

error InvalidPriceFeedDecimals(uint8 rateDecimals, uint8 priceFeedDecimals);

InvalidDescription

error InvalidDescription();

InvalidPriceFeedType

error InvalidPriceFeedType();

Enums

PriceFeedType

enum PriceFeedType {
    CHAINLINK,
    REDSTONE
}
Git Source