@@ -73,24 +73,32 @@ export const enrichAuctionWithPriceDrop = async function (auction: Auction): Pro
73
73
if ( ! auction . isActive || auction . isFinished ) {
74
74
return auction ;
75
75
}
76
- const params = await fetchCalcParametersByCollateralType ( auction . network , auction . collateralType ) ;
77
- const auctionWithParams = {
78
- ...auction ,
79
- secondsBetweenPriceDrops : params . secondsBetweenPriceDrops ,
80
- priceDropRatio : params . priceDropRatio ,
81
- } ;
82
- const currentDate = await getNetworkDate ( auction . network ) ;
83
- const secondsTillNextPriceDrop = calculateAuctionDropTime ( auctionWithParams , currentDate ) ;
84
- const approximateUnitPrice = calculateAuctionPrice ( auctionWithParams , currentDate ) ;
85
- const totalPrice = auction . collateralAmount . multipliedBy ( approximateUnitPrice ) ;
86
- const transactionGrossProfitDate = calculateTransactionGrossProfitDate ( auctionWithParams , currentDate ) ;
87
- return {
88
- ...auctionWithParams ,
89
- secondsTillNextPriceDrop,
90
- approximateUnitPrice,
91
- totalPrice,
92
- transactionGrossProfitDate,
93
- } ;
76
+ try {
77
+ const params = await fetchCalcParametersByCollateralType ( auction . network , auction . collateralType ) ;
78
+ const auctionWithParams = {
79
+ ...auction ,
80
+ secondsBetweenPriceDrops : params . secondsBetweenPriceDrops ,
81
+ priceDropRatio : params . priceDropRatio ,
82
+ } ;
83
+ const currentDate = await getNetworkDate ( auction . network ) ;
84
+ const secondsTillNextPriceDrop = calculateAuctionDropTime ( auctionWithParams , currentDate ) ;
85
+ const approximateUnitPrice = calculateAuctionPrice ( auctionWithParams , currentDate ) ;
86
+ const totalPrice = auction . collateralAmount . multipliedBy ( approximateUnitPrice ) ;
87
+ const transactionGrossProfitDate = calculateTransactionGrossProfitDate ( auctionWithParams , currentDate ) ;
88
+ return {
89
+ ...auctionWithParams ,
90
+ secondsTillNextPriceDrop,
91
+ approximateUnitPrice,
92
+ totalPrice,
93
+ transactionGrossProfitDate,
94
+ } ;
95
+ } catch ( error ) {
96
+ console . warn ( `auction price drop information is not available for auction "${ auction . id } "` ) ;
97
+ return {
98
+ ...auction ,
99
+ totalPrice : auction . collateralAmount . multipliedBy ( auction . unitPrice ) ,
100
+ } ;
101
+ }
94
102
} ;
95
103
96
104
export const enrichAuctionWithPriceDropAndMarketValue = async function (
0 commit comments