diff --git a/schema.graphql b/schema.graphql index a900dabe..a17d911a 100644 --- a/schema.graphql +++ b/schema.graphql @@ -277,13 +277,14 @@ type TrancheBalance @entity { pool: Pool! @index tranche: Tranche! @index - sumInvestOrderedAmount: BigInt! - sumInvestUncollectedAmount: BigInt! - sumInvestCollectedAmount: BigInt! + pendingInvestCurrency: BigInt! + claimableTrancheTokens: BigInt! - sumRedeemOrderedAmount: BigInt! - sumRedeemUncollectedAmount: BigInt! - sumRedeemCollectedAmount: BigInt! + pendingRedeemTrancheTokens: BigInt! + claimableCurrency: BigInt! + + sumClaimedTrancheTokens: BigInt! + sumClaimedCurrency: BigInt! } enum LoanStatus { diff --git a/src/mappings/services/trancheBalanceService.ts b/src/mappings/services/trancheBalanceService.ts index 78dc048a..288b8e4b 100644 --- a/src/mappings/services/trancheBalanceService.ts +++ b/src/mappings/services/trancheBalanceService.ts @@ -33,30 +33,30 @@ export class TrancheBalanceService extends TrancheBalance { } public investOrder(currencyAmount: bigint) { - this.sumInvestOrderedAmount += currencyAmount + this.pendingInvestCurrency = currencyAmount } public redeemOrder(tokenAmount: bigint) { - this.sumRedeemOrderedAmount += tokenAmount + this.pendingRedeemTrancheTokens = tokenAmount } public investExecute(currencyAmount: bigint, tokenAmount: bigint) { - this.sumInvestOrderedAmount -= currencyAmount - this.sumInvestUncollectedAmount += tokenAmount + this.pendingInvestCurrency -= currencyAmount + this.claimableTrancheTokens += tokenAmount } public redeemExecute(tokenAmount: bigint, currencyAmount: bigint) { - this.sumRedeemOrderedAmount -= tokenAmount - this.sumRedeemUncollectedAmount += currencyAmount + this.pendingRedeemTrancheTokens -= tokenAmount + this.claimableCurrency += currencyAmount } public investCollect(tokenAmount: bigint) { - this.sumInvestUncollectedAmount -= tokenAmount - this.sumInvestCollectedAmount += tokenAmount + this.claimableTrancheTokens -= tokenAmount + this.sumClaimedTrancheTokens += tokenAmount } public redeemCollect(currencyAmount: bigint) { - this.sumRedeemUncollectedAmount -= currencyAmount - this.sumRedeemCollectedAmount += currencyAmount + this.claimableCurrency -= currencyAmount + this.sumClaimedCurrency += currencyAmount } }