Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ type Transcoder @entity {
feeShareUpdateTimestamp: Int!
"Total tokens delegated toward a transcoder (including their own)"
totalStake: BigDecimal!
"Pending bonded stake for the transcoder since last claiming rewards"
pendingStake: BigDecimal!
"Total fees generated by the transcoder in ETH (before distribution to delegators)"
totalVolumeETH: BigDecimal!
"Total fees generated by the transcoder in ETH (before distribution and in past 30 days)"
Expand Down Expand Up @@ -129,6 +131,8 @@ type Pool @entity {
rewardTokens: BigDecimal
"Transcoder's total stake during the earnings pool's round"
totalStake: BigDecimal!
"Pending bonded stake for the transcoder since last claiming rewards"
pendingStake: BigDecimal!
"Transcoder's reward cut during the earnings pool's round"
rewardCut: BigInt!
"Transcoder's fee share during the earnings pool's round"
Expand Down
13 changes: 12 additions & 1 deletion src/mappings/bondingManager.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { store } from "@graphprotocol/graph-ts";
import { Address, store } from "@graphprotocol/graph-ts";
import {
convertToDecimal,
createOrLoadDelegator,
Expand All @@ -8,6 +8,7 @@ import {
createOrLoadTranscoder,
EMPTY_ADDRESS,
getBlockNum,
integerFromString,
makeEventId,
makePoolId,
makeUnbondingLockId,
Expand Down Expand Up @@ -500,6 +501,16 @@ export function reward(event: Reward): void {
pool!.feeShare = transcoder.feeShare;
pool!.rewardCut = transcoder.rewardCut;

let bondingManager = BondingManager.bind(event.address);
let pendingStake = convertToDecimal(
bondingManager.pendingStake(
Address.fromString(transcoder.id),
integerFromString(round.id)
)
);
transcoder.pendingStake = pendingStake;
pool.pendingStake = pendingStake;

transcoder.save();
delegate.save();
pool!.save();
Expand Down
Loading