Fetch LP token price info from a number of supported exchanges.

See our blog post on Fair LP Token Oracles

NOTE*: This is not the swap price but the price of the underlying LP token.

Input: None

Returns: The price of an LP token for a given AMM pool.

Example: Fetch the Orca LP token price of the SOL/USDC pool

{ "lpTokenPriceTask": { "orcaPoolAddress": "APDFRM3HMr8CAGXwKHiu2f5ePSpaiEJhaURwhsRrUUt9" } }

Example: Fetch the fair price Orca LP token price of the SOL/USDC pool

{ "lpTokenPriceTask": { "orcaPoolAddress": "APDFRM3HMr8CAGXwKHiu2f5ePSpaiEJhaURwhsRrUUt9", "useFairPrice": true, "priceFeedAddresses": [ "GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR", "BjUgj6YCnFBZ49wF54ddBVA9qu8TeqkFtkbqmZcee8uW" ] } }

Example: Fetch the fair price Raydium LP token price of the SOL/USDC pool

{ "lpTokenPriceTask": { "raydiumPoolAddress": "58oQChx4yWmvKdwLLZzBi4ChoCc2fqCUWBkwMihLYQo2", "useFairPrice": true,"priceFeedAddresses": ["GvDMxPzN1sCj7L26YDK2HnMRXEQmQ2aemov8YBtPS7vR","BjUgj6YCnFBZ49wF54ddBVA9qu8TeqkFtkbqmZcee8uW" ] } }

Implements

Constructors

Properties

PoolAddress?: "mercurialPoolAddress" | "saberPoolAddress" | "orcaPoolAddress" | "raydiumPoolAddress"

LpTokenPriceTask PoolAddress.

mercurialPoolAddress?: string

Mercurial finance pool address. A full list can be found here: https://github.com/mercurial-finance/stable-swap-n-pool-js

orcaPoolAddress?: string

Orca pool address. A full list can be found here: https://www.orca.so/pools

priceFeedAddresses: string[]

A list of Switchboard aggregator accounts used to calculate the fair LP price. This ensures the price is based on the previous round to mitigate flash loan price manipulation.

priceFeedJobs: IOracleJob[]

A list of OracleJobs to execute in order to yield the price feed jobs to use for the fair price formula.

raydiumPoolAddress?: string

The Raydium liquidity pool ammId. A full list can be found here: https://raydium.io/pools

saberPoolAddress?: string

Saber pool address. A full list can be found here: https://github.com/saber-hq/saber-registry-dist

useFairPrice: boolean

If enabled and price_feed_addresses provided, the oracle will calculate the fair LP price based on the liquidity pool reserves. See our blog post for more information: https://switchboardxyz.medium.com/fair-lp-token-oracles-94a457c50239

Methods

  • Converts this LpTokenPriceTask to JSON.

    Returns {
        [k: string]: any;
    }

    JSON object

    • [k: string]: any
  • Creates a new LpTokenPriceTask instance using the specified properties.

    Parameters

    Returns LpTokenPriceTask

    LpTokenPriceTask instance

  • Decodes a LpTokenPriceTask message from the specified reader or buffer.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    • Optional length: number

      Message length if known beforehand

    Returns LpTokenPriceTask

    LpTokenPriceTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Decodes a LpTokenPriceTask message from the specified reader or buffer, length delimited.

    Parameters

    • reader: Uint8Array | Reader

      Reader or buffer to decode from

    Returns LpTokenPriceTask

    LpTokenPriceTask

    Throws

    If the payload is not a reader or valid buffer

    Throws

    If required fields are missing

  • Encodes the specified LpTokenPriceTask message. Does not implicitly verify messages.

    Parameters

    • message: ILpTokenPriceTask

      LpTokenPriceTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Encodes the specified LpTokenPriceTask message, length delimited. Does not implicitly verify messages.

    Parameters

    • message: ILpTokenPriceTask

      LpTokenPriceTask message or plain object to encode

    • Optional writer: Writer

      Writer to encode to

    Returns Writer

    Writer

  • Creates a LpTokenPriceTask message from a plain object. Also converts values to their respective internal types.

    Parameters

    • object: {
          [k: string]: any;
      }

      Plain object

      • [k: string]: any

    Returns LpTokenPriceTask

    LpTokenPriceTask

  • Gets the default type url for LpTokenPriceTask

    Parameters

    • Optional typeUrlPrefix: string

      your custom typeUrlPrefix(default "type.googleapis.com")

    Returns string

    The default type url

  • Creates a plain object from a LpTokenPriceTask message. Also converts values to other types if specified.

    Parameters

    • message: LpTokenPriceTask

      LpTokenPriceTask

    • Optional options: IConversionOptions

      Conversion options

    Returns {
        [k: string]: any;
    }

    Plain object

    • [k: string]: any
  • Verifies a LpTokenPriceTask message.

    Parameters

    • message: {
          [k: string]: any;
      }

      Plain object to verify

      • [k: string]: any

    Returns string

    null if valid, otherwise the reason why it is not

Generated using TypeDoc