diff --git a/src/mappings/handlers/loansHandlers.ts b/src/mappings/handlers/loansHandlers.ts index beec41c4..9117d133 100644 --- a/src/mappings/handlers/loansHandlers.ts +++ b/src/mappings/handlers/loansHandlers.ts @@ -146,7 +146,10 @@ async function _handleLoanBorrowed(event: SubstrateEvent): Pr if (borrowAmount.isExternal) { // Prices were based on the settlement prices only until spec version 1025 - if (specVersion < 1025) await asset.updateCurrentPrice(borrowAmount.asExternal.settlementPrice.toBigInt()) + if (specVersion < 1025) { + await asset.updateCurrentPrice(borrowAmount.asExternal.settlementPrice.toBigInt()) + await asset.save() + } await asset.increaseQuantity(borrowAmount.asExternal.quantity.toBigInt()) await AssetPositionService.buy( @@ -225,7 +228,10 @@ async function _handleLoanRepaid(event: SubstrateEvent) { const { quantity, settlementPrice } = principal.asExternal // Prices were based on the settlement prices only until spec version 1025 - if (specVersion < 1025) await asset.updateCurrentPrice(settlementPrice.toBigInt()) + if (specVersion < 1025) { + await asset.updateCurrentPrice(settlementPrice.toBigInt()) + await asset.save() + } await asset.decreaseQuantity(quantity.toBigInt()) realizedProfitFifo = await AssetPositionService.sellFifo( @@ -346,7 +352,10 @@ async function _handleLoanDebtTransferred(event: SubstrateEvent