Skip to content

Commit

Permalink
fix: cash value using calls
Browse files Browse the repository at this point in the history
  • Loading branch information
hieronx committed Jun 1, 2024
1 parent 46a95d4 commit 319788b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/mappings/services/poolService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,14 +176,14 @@ export class PoolService extends Pool {
private async updateNAVQuery() {
logger.info(`Updating portfolio valuation for pool: ${this.id} (state)`)
const navResponse = await api.query.loans.portfolioValuation<NavDetails>(this.id)
const newPortfolioValuation = navResponse.value.toBigInt()
const newPortfolioValuation = navResponse.value.toBigInt() - this.offchainCashValue

this.deltaPortfolioValuationByPeriod = newPortfolioValuation - this.portfolioValuation
this.portfolioValuation = newPortfolioValuation

// The query was only used before either offchain cash assets or fees were introduced,
// so NAV == portfolioValuation + totalReserve
this.netAssetValue = newPortfolioValuation + this.totalReserve
this.netAssetValue = newPortfolioValuation + this.offchainCashValue + this.totalReserve

logger.info(
`portfolio valuation: ${this.portfolioValuation.toString(10)} delta: ${this.deltaPortfolioValuationByPeriod}`
Expand Down

0 comments on commit 319788b

Please sign in to comment.