Options
All
  • Public
  • Public/Protected
  • All
Menu

Class OracleService<T>

OracleService is the main pricing engine, used by all price calculations. It's implemented in the form of a contract that lives on all networks supported by yearn.

Type parameters

Hierarchy

  • ContractService<T>
    • OracleService

Index

Constructors

  • new OracleService<T>(chainId: T, ctx: Context, addressProvider: AddressProvider<T>): OracleService<T>
  • Type parameters

    • T: 1 | 10 | 250 | 1337 | 42161

    Parameters

    • chainId: T
    • ctx: Context
    • addressProvider: AddressProvider<T>

    Returns OracleService<T>

Properties

addressProvider: AddressProvider<T>
chainId: 1 | 10 | 250 | 1337 | 42161
ctx: Context
events: Emittery<Record<string, unknown>, Record<string, unknown> & OmnipresentEventData, never>
abi: string[] = OracleAbi
contractId: ContractAddressId = ContractAddressId.oracle

Accessors

  • get contract(): Promise<WrappedContract>

Methods

  • _getContract(abi: string[], contractId: ContractAddressId, ctx: Context): Promise<WrappedContract>
  • Parameters

    • abi: string[]
    • contractId: ContractAddressId
    • ctx: Context

    Returns Promise<WrappedContract>

  • getBasePrice(lpToken: string, overrides?: CallOverrides): Promise<string>
  • Get Usdc exchange rate of underlying token of the curve liquidity provider token's pool.

    Parameters

    • lpToken: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    Usdc exchange rate (6 decimals)

  • getCalculations(overrides?: CallOverrides): Promise<string[]>
  • Fetch all the active Oracle calculations.

    Parameters

    • overrides: CallOverrides = {}

    Returns Promise<string[]>

    list of calculations contract addresses

  • getCurvePriceUsdc(lpToken: string, overrides?: CallOverrides): Promise<string>
  • Get Usdc exchange rate for a curve liquidity provider token.

    Parameters

    • lpToken: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    Usdc exchange rate (6 decimals)

  • getCurveRegistryAddress(overrides?: CallOverrides): Promise<string>
  • Get the contract address that lens considers as Curve Registry.

    Parameters

    • overrides: CallOverrides = {}

    Returns Promise<string>

  • getIronBankMarketPriceUsdc(token: string, overrides?: CallOverrides): Promise<string>
  • Get Usdc exchange rate for an iron bank market token.

    Parameters

    • token: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    Usdc exchange rate (6 decimals)

  • getIronBankMarkets(overrides?: CallOverrides): Promise<string[]>
  • Get all the iron bank market addresses.

    Parameters

    • overrides: CallOverrides = {}

    Returns Promise<string[]>

    list of iron bank market addresses

  • getLpTokenPriceUsdc(token: string, overrides?: CallOverrides): Promise<string>
  • Get Usdc exchange rate for a sushiswap liquidity provider token.

    Parameters

    • token: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    Usdc exchange rate (6 decimals)

  • getLpTokenTotalLiquidityUsdc(token: string, overrides?: CallOverrides): Promise<string>
  • Get total liquidity for a liquidity provider token in Usdc

    Parameters

    • token: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    Usdc liquidity (6 decimals)

  • getNormalizedValueUsdc(token: string, amount: string, overrides?: CallOverrides): Promise<string>
  • Get the normalized Usdc value for the token and corresponding quantity.

    Parameters

    • token: string
    • amount: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    Usdc exchange rate (6 decimals)

  • getPriceFromRouter(token0: string, token1: string, overrides?: CallOverrides): Promise<string>
  • Get exchange rate between two tokens from the sushiswap router.

    Parameters

    • token0: string
    • token1: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    exchange rate

  • getPriceFromRouterUsdc(token: string, overrides?: CallOverrides): Promise<string>
  • Get Usdc exchange rate for a token.

    Parameters

    • token: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    Usdc exchange rate (6 decimals)

  • getPriceUsdc(token: string, overrides?: CallOverrides): Promise<string>
  • Get the suggested Usdc exchange rate for an token.

    Parameters

    • token: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    Usdc exchange rate (6 decimals)

  • getUsdcAddress(overrides?: CallOverrides): Promise<string>
  • Get the token address that lens considers Usdc.

    Parameters

    • overrides: CallOverrides = {}

    Returns Promise<string>

    address

  • getVirtualPrice(lpToken: string, overrides?: CallOverrides): Promise<string>
  • Get virtual price for a curve liquidity provider token.

    Parameters

    • lpToken: string
    • overrides: CallOverrides = {}

    Returns Promise<string>

    virtual price

  • isCurveLpToken(lpToken: string, overrides?: CallOverrides): Promise<boolean>
  • Test if a token address is a curve liquidity provider token.

    Parameters

    • lpToken: string
    • overrides: CallOverrides = {}

    Returns Promise<boolean>

    test result

  • isIronBankMarket(token: string, overrides?: CallOverrides): Promise<boolean>
  • Test if a token address is an iron bank market.

    Parameters

    • token: string
    • overrides: CallOverrides = {}

    Returns Promise<boolean>

    test result

  • isLpToken(token: string, overrides?: CallOverrides): Promise<boolean>
  • Test if a token address is a sushiswap liquidity provider token.

    Parameters

    • token: string
    • overrides: CallOverrides = {}

    Returns Promise<boolean>

    test result

Generated using TypeDoc