mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
fixed compute algorithm pool price value (#553)
This commit is contained in:
parent
1f9f22cbc1
commit
369b075aa9
@ -58,6 +58,7 @@ const poolQuery = gql`
|
|||||||
query AlgorithmPoolPrice($datatoken: String) {
|
query AlgorithmPoolPrice($datatoken: String) {
|
||||||
pools(where: { datatokenAddress: $datatoken }) {
|
pools(where: { datatokenAddress: $datatoken }) {
|
||||||
spotPrice
|
spotPrice
|
||||||
|
consumePrice
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`
|
`
|
||||||
@ -234,7 +235,10 @@ export default function Compute({
|
|||||||
return
|
return
|
||||||
setAlgorithmPrice((prevState) => ({
|
setAlgorithmPrice((prevState) => ({
|
||||||
...prevState,
|
...prevState,
|
||||||
value: poolPrice.pools[0].spotPrice
|
value:
|
||||||
|
poolPrice.pools[0].consumePrice === '-1'
|
||||||
|
? poolPrice.pools[0].spotPrice
|
||||||
|
: poolPrice.pools[0].consumePrice
|
||||||
}))
|
}))
|
||||||
}, [poolPrice])
|
}, [poolPrice])
|
||||||
|
|
||||||
|
@ -24,6 +24,7 @@ const poolQuery = gql`
|
|||||||
query AssetPoolPrice($datatokenAddress_in: [String!]) {
|
query AssetPoolPrice($datatokenAddress_in: [String!]) {
|
||||||
pools(where: { datatokenAddress_in: $datatokenAddress_in }) {
|
pools(where: { datatokenAddress_in: $datatokenAddress_in }) {
|
||||||
spotPrice
|
spotPrice
|
||||||
|
consumePrice
|
||||||
id
|
id
|
||||||
datatokenAddress
|
datatokenAddress
|
||||||
}
|
}
|
||||||
@ -106,7 +107,10 @@ export async function getAssetPrices(assets: DDO[]): Promise<PriceList> {
|
|||||||
}
|
}
|
||||||
const poolPriceResponse: any = await fetchData(poolQuery, poolVariables)
|
const poolPriceResponse: any = await fetchData(poolQuery, poolVariables)
|
||||||
for (const poolPrice of poolPriceResponse.data?.pools) {
|
for (const poolPrice of poolPriceResponse.data?.pools) {
|
||||||
priceList[didDTMap[poolPrice.datatokenAddress]] = poolPrice.spotPrice
|
priceList[didDTMap[poolPrice.datatokenAddress]] =
|
||||||
|
poolPrice.consumePrice === '-1'
|
||||||
|
? poolPrice.spotPrice
|
||||||
|
: poolPrice.consumePrice
|
||||||
}
|
}
|
||||||
const frePriceResponse: any = await fetchData(freQuery, freVariables)
|
const frePriceResponse: any = await fetchData(freQuery, freVariables)
|
||||||
for (const frePrice of frePriceResponse.data?.fixedRateExchanges) {
|
for (const frePrice of frePriceResponse.data?.fixedRateExchanges) {
|
||||||
|
Loading…
Reference in New Issue
Block a user