mirror of
https://github.com/oceanprotocol/react.git
synced 2025-02-14 21:10:38 +01:00
Merge pull request #72 from oceanprotocol/feature/getPrice
Feature/get price
This commit is contained in:
commit
4bff015c5d
@ -10,6 +10,12 @@ export async function getCheapestPool(
|
|||||||
dataTokenAddress
|
dataTokenAddress
|
||||||
)
|
)
|
||||||
Logger.log('DT Pool found', tokenPools)
|
Logger.log('DT Pool found', tokenPools)
|
||||||
|
if (tokenPools === undefined || tokenPools.length === 0) {
|
||||||
|
return {
|
||||||
|
poolAddress: '',
|
||||||
|
poolPrice: ''
|
||||||
|
}
|
||||||
|
}
|
||||||
let cheapestPoolAddress
|
let cheapestPoolAddress
|
||||||
let cheapestPoolPrice = new Decimal(999999999999)
|
let cheapestPoolPrice = new Decimal(999999999999)
|
||||||
|
|
||||||
@ -21,7 +27,7 @@ export async function getCheapestPool(
|
|||||||
'1'
|
'1'
|
||||||
)
|
)
|
||||||
const decimalPoolPrice = new Decimal(poolPrice)
|
const decimalPoolPrice = new Decimal(poolPrice)
|
||||||
Logger.log('Pool price ', tokenPools[i], poolPrice)
|
Logger.log('Pool price ', tokenPools[i], decimalPoolPrice.toString())
|
||||||
if (decimalPoolPrice < cheapestPoolPrice) {
|
if (decimalPoolPrice < cheapestPoolPrice) {
|
||||||
cheapestPoolPrice = decimalPoolPrice
|
cheapestPoolPrice = decimalPoolPrice
|
||||||
cheapestPoolAddress = tokenPools[i]
|
cheapestPoolAddress = tokenPools[i]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user