Skip to content

Commit

Permalink
chore: more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
hieronx committed Jun 11, 2024
1 parent 83d4d44 commit c86f1bb
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/mappings/handlers/blockHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async function _handleBlock(block: SubstrateBlock): Promise<void> {
pool.resetUnrealizedProfit()
for (const loanId in activeLoanData) {
const asset = await AssetService.getById(pool.id, loanId)
const previousUnrealizedProfitByPeriod = asset.unrealizedProfitByPeriod
const previousUnrealizedProfitByPeriod = asset.unrealizedProfitByPeriod.toBigInt()
await asset.updateActiveAssetData(activeLoanData[loanId])

const unrealizedProfitAtMarketPrice = await AssetPositionService.computeUnrealizedProfitAtPrice(
Expand All @@ -78,6 +78,7 @@ async function _handleBlock(block: SubstrateBlock): Promise<void> {
)
logger.info(`byPeriod for ${asset.id} = ${unrealizedProfitAtMarketPrice} - ${previousUnrealizedProfitByPeriod}`)
const unrealizedProfitByPeriod = unrealizedProfitAtMarketPrice - previousUnrealizedProfitByPeriod
logger.info(`byPeriod for ${asset.id} = ${unrealizedProfitByPeriod}`)
await asset.updateUnrealizedProfit(
unrealizedProfitAtMarketPrice,
unrealizedProfitAtNotional,
Expand Down

0 comments on commit c86f1bb

Please sign in to comment.