Skip to main content

LpTokenPriceTask

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"
]
}
}

See the LpTokenPriceTask typescript definition in @switchboard-xyz/common

Fields

NameTypeDescription
 mercurialPoolAddress

string

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

 saberPoolAddress

string

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

 orcaPoolAddress

string

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

 raydiumPoolAddress

string

The Raydium liquidity pool ammId. A full list can be found here: https://raydium.io/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

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

 useFairPrice

bool

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