diff --git a/src/mappings/bondingManager.ts b/src/mappings/bondingManager.ts index fa94260..327888a 100755 --- a/src/mappings/bondingManager.ts +++ b/src/mappings/bondingManager.ts @@ -496,6 +496,14 @@ export function reward(event: Reward): void { ); transcoder.lastRewardRound = round.id; + transcoder.totalRewardsClaimed = transcoder.totalRewardsClaimed.plus( + convertToDecimal(event.params.amount) + ); + + transcoder.totalRewardsDistributed = transcoder.totalRewardsDistributed.plus( + (transcoder.rewardCut / 10000) * convertToDecimal(event.params.amount) + ); + pool!.rewardTokens = convertToDecimal(event.params.amount); pool!.feeShare = transcoder.feeShare; pool!.rewardCut = transcoder.rewardCut; diff --git a/src/mappings/ticketBroker.ts b/src/mappings/ticketBroker.ts index ea433c7..ba2155f 100644 --- a/src/mappings/ticketBroker.ts +++ b/src/mappings/ticketBroker.ts @@ -86,6 +86,9 @@ export function winningTicketRedeemed(event: WinningTicketRedeemed): void { transcoder.totalVolumeUSD = transcoder.totalVolumeUSD.plus( faceValue.times(ethPrice) ); + transcoder.totalFeesDistributed = transcoder.totalFeesDistributed.plus( + (100 - transcoder.feeShare / 10000) * convertToDecimal(event.params.amount) + ); // Update total protocol fee volume protocol.totalVolumeETH = protocol.totalVolumeETH.plus(faceValue); diff --git a/utils/helpers.ts b/utils/helpers.ts index 84c30d5..61c9c4b 100644 --- a/utils/helpers.ts +++ b/utils/helpers.ts @@ -224,6 +224,9 @@ export function createOrLoadTranscoder(id: string, timestamp: i32): Transcoder { transcoder.thirtyDayVolumeETH = ZERO_BD; transcoder.sixtyDayVolumeETH = ZERO_BD; transcoder.ninetyDayVolumeETH = ZERO_BD; + transcoder.totalRewardsClaimed = ZERO_BD; + transcoder.totalRewardsDistributed = ZERO_BD; + transcoder.totalFeesDistributed = ZERO_BD; transcoder.transcoderDays = []; transcoder.save(); }