Skip to content
Open
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
2 changes: 1 addition & 1 deletion schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type Protocol @entity {
pendingDeactivation: [Transcoder!]!
"Total number of delegators on the network"
delegatorsCount: BigInt!
"Broadcasters active within the current 90 day fee window"
"Broadcasters that paid tickets within the current 90 day fee window"
activeBroadcasters: [String!]!
}

Expand Down
7 changes: 7 additions & 0 deletions src/mappings/ticketBroker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,13 @@ export function winningTicketRedeemed(event: WinningTicketRedeemed): void {
protocol.totalVolumeETH = protocol.totalVolumeETH.plus(faceValue);
protocol.totalVolumeUSD = protocol.totalVolumeUSD.plus(faceValueUSD);

// Track active broadcasters based on ticket activity.
let activeBroadcasters = protocol.activeBroadcasters;
if (!activeBroadcasters.includes(broadcaster.id)) {
activeBroadcasters.push(broadcaster.id);
protocol.activeBroadcasters = activeBroadcasters;
}

protocol.winningTicketCount = protocol.winningTicketCount + 1;
protocol.save();

Expand Down
8 changes: 0 additions & 8 deletions utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,14 +194,6 @@ export function createOrLoadBroadcaster(id: string): Broadcaster {
broadcaster.save();
}

let protocol = createOrLoadProtocol();
let activeBroadcasters = protocol.activeBroadcasters;
if (!activeBroadcasters.includes(id)) {
activeBroadcasters.push(id);
protocol.activeBroadcasters = activeBroadcasters;
protocol.save();
}

return broadcaster;
}

Expand Down