diff --git a/schema.graphql b/schema.graphql index 15338313..a53ef54b 100644 --- a/schema.graphql +++ b/schema.graphql @@ -1059,11 +1059,15 @@ type Epoch @entity { signalledTokens: BigInt! "Stake deposited during this epoch" stakeDeposited: BigInt! - "Amount of query fees collected by all indexers during this epoch" + "Total amount of query fees generated during this epoch (Includes everything)" + totalQueryFees: BigInt! + "Amount of query fees generated that were burnt by the 1% protocol tax during this epoch" + taxedQueryFees: BigInt! + "Amount of query fees generated that are going to the rebate pool for indexers during this epoch" queryFeesCollected: BigInt! "Amount of query fees generated that are going to curators during this epoch" curatorQueryFees: BigInt! - "Rebate amount claimed from the protocol through cobbs douglas" + "Rebate amount claimed from the protocol through cobbs douglas during this epoch (Doesn't correlate to the queryFeesCollected for this epoch since there's a 7 day period before claiming)" queryFeeRebates: BigInt! "Total indexing rewards earned in this epoch. Includes both delegator and indexer rewards" totalRewards: BigInt! diff --git a/src/mappings/staking.ts b/src/mappings/staking.ts index e1aa6f0d..3e808e0c 100644 --- a/src/mappings/staking.ts +++ b/src/mappings/staking.ts @@ -392,8 +392,14 @@ export function handleAllocationCollected(event: AllocationCollected): void { allocation.curatorRewards = allocation.curatorRewards.plus(event.params.curationFees) allocation.save() + // since we don't get the protocol tax explicitly, we will use tokens - (curation + rebate) to calculate it + // This could also be calculated by doing: protocolPercentage * event.params.tokens + let taxedFees = event.params.tokens.minus(event.params.rebateFees.plus(event.params.curationFees)) + // Update epoch let epoch = createOrLoadEpoch(event.block.number) + epoch.totalQueryFees = epoch.totalQueryFees.plus(event.params.tokens) + epoch.taxedQueryFees = epoch.taxedQueryFees.plus(taxedFees) epoch.queryFeesCollected = epoch.queryFeesCollected.plus(event.params.rebateFees) epoch.curatorQueryFees = epoch.curatorQueryFees.plus(event.params.curationFees) epoch.save() @@ -421,9 +427,6 @@ export function handleAllocationCollected(event: AllocationCollected): void { batchUpdateSubgraphSignalledTokens(deployment as SubgraphDeployment) - // since we don't get the protocol tax explicitly, we will use tokens - (curation + rebate) to calculate it - // This could also be calculated by doing: protocolPercentage * event.params.tokens - let taxedFees = event.params.tokens.minus(event.params.rebateFees.plus(event.params.curationFees)) // update graph network let graphNetwork = GraphNetwork.load('1')!