diff --git a/src/utils/dtUtils.ts b/src/utils/dtUtils.ts index 858c26e..625c46d 100644 --- a/src/utils/dtUtils.ts +++ b/src/utils/dtUtils.ts @@ -10,6 +10,12 @@ export async function getCheapestPool( dataTokenAddress ) Logger.log('DT Pool found', tokenPools) + if (tokenPools === undefined || tokenPools.length === 0) { + return { + poolAddress: '', + poolPrice: '' + } + } let cheapestPoolAddress let cheapestPoolPrice = new Decimal(999999999999) @@ -21,7 +27,7 @@ export async function getCheapestPool( '1' ) const decimalPoolPrice = new Decimal(poolPrice) - Logger.log('Pool price ', tokenPools[i], poolPrice) + Logger.log('Pool price ', tokenPools[i], decimalPoolPrice.toString()) if (decimalPoolPrice < cheapestPoolPrice) { cheapestPoolPrice = decimalPoolPrice cheapestPoolAddress = tokenPools[i]