diff --git a/core/src/auctions.ts b/core/src/auctions.ts index 93c99bb53..4d2c3f21f 100644 --- a/core/src/auctions.ts +++ b/core/src/auctions.ts @@ -73,24 +73,32 @@ export const enrichAuctionWithPriceDrop = async function (auction: Auction): Pro if (!auction.isActive || auction.isFinished) { return auction; } - const params = await fetchCalcParametersByCollateralType(auction.network, auction.collateralType); - const auctionWithParams = { - ...auction, - secondsBetweenPriceDrops: params.secondsBetweenPriceDrops, - priceDropRatio: params.priceDropRatio, - }; - const currentDate = await getNetworkDate(auction.network); - const secondsTillNextPriceDrop = calculateAuctionDropTime(auctionWithParams, currentDate); - const approximateUnitPrice = calculateAuctionPrice(auctionWithParams, currentDate); - const totalPrice = auction.collateralAmount.multipliedBy(approximateUnitPrice); - const transactionGrossProfitDate = calculateTransactionGrossProfitDate(auctionWithParams, currentDate); - return { - ...auctionWithParams, - secondsTillNextPriceDrop, - approximateUnitPrice, - totalPrice, - transactionGrossProfitDate, - }; + try { + const params = await fetchCalcParametersByCollateralType(auction.network, auction.collateralType); + const auctionWithParams = { + ...auction, + secondsBetweenPriceDrops: params.secondsBetweenPriceDrops, + priceDropRatio: params.priceDropRatio, + }; + const currentDate = await getNetworkDate(auction.network); + const secondsTillNextPriceDrop = calculateAuctionDropTime(auctionWithParams, currentDate); + const approximateUnitPrice = calculateAuctionPrice(auctionWithParams, currentDate); + const totalPrice = auction.collateralAmount.multipliedBy(approximateUnitPrice); + const transactionGrossProfitDate = calculateTransactionGrossProfitDate(auctionWithParams, currentDate); + return { + ...auctionWithParams, + secondsTillNextPriceDrop, + approximateUnitPrice, + totalPrice, + transactionGrossProfitDate, + }; + } catch (error) { + console.warn(`auction price drop information is not available for auction "${auction.id}"`); + return { + ...auction, + totalPrice: auction.collateralAmount.multipliedBy(auction.unitPrice), + }; + } }; export const enrichAuctionWithPriceDropAndMarketValue = async function (