Skip to content
Merged
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
24 changes: 13 additions & 11 deletions packages/indexer-agent/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ export class Network {
id
ipfsHash
stakedTokens
signalAmount
signalledTokens
queryFeesAmount
indexerAllocations {
indexer {
Expand Down Expand Up @@ -678,7 +678,9 @@ export class Network {

if (deploymentRule) {
const stakedTokens = BigNumber.from(deployment.stakedTokens)
const signalAmount = BigNumber.from(deployment.signalAmount)
const signalledTokens = BigNumber.from(
deployment.signalledTokens,
)
const avgQueryFees = BigNumber.from(
deployment.queryFeesAmount,
).div(
Expand All @@ -691,7 +693,7 @@ export class Network {
deployment: {
id: deployment.id,
stakedTokens: stakedTokens.toString(),
signalAmount: signalAmount.toString(),
signalledTokens: signalledTokens.toString(),
avgQueryFees: avgQueryFees.toString(),
},
indexingRule: {
Expand Down Expand Up @@ -731,9 +733,9 @@ export class Network {
stakedTokens.gte(deploymentRule.minStake)) ||
// signal >= minSignal && signal <= maxSignal?
(deploymentRule.minSignal &&
signalAmount.gte(deploymentRule.minSignal)) ||
signalledTokens.gte(deploymentRule.minSignal)) ||
(deploymentRule.maxSignal &&
signalAmount.lte(deploymentRule.maxSignal)) ||
signalledTokens.lte(deploymentRule.maxSignal)) ||
// avgQueryFees >= minAvgQueryFees?
(deploymentRule.minAverageQueryFees &&
avgQueryFees.gte(deploymentRule.minAverageQueryFees))
Expand Down Expand Up @@ -799,7 +801,7 @@ export class Network {
subgraphDeployment {
id
stakedTokens
signalAmount
signalledTokens
}
}
}
Expand Down Expand Up @@ -856,7 +858,7 @@ export class Network {
subgraphDeployment {
id
stakedTokens
signalAmount
signalledTokens
}
}
}
Expand Down Expand Up @@ -913,7 +915,7 @@ export class Network {
subgraphDeployment {
id
stakedTokens
signalAmount
signalledTokens
}
}
}
Expand Down Expand Up @@ -1032,7 +1034,7 @@ export class Network {
subgraphDeployment {
id
stakedTokens
signalAmount
signalledTokens
}
}
}
Expand Down Expand Up @@ -1381,7 +1383,7 @@ export class Network {
subgraphDeployment: {
id: deployment,
stakedTokens: BigNumber.from(0),
signalAmount: BigNumber.from(0),
signalledTokens: BigNumber.from(0),
},
allocatedTokens: BigNumber.from(eventInputs.tokens),
createdAtBlockHash: '0x0',
Expand Down Expand Up @@ -1739,7 +1741,7 @@ export class Network {
subgraphDeployment: {
id: deployment,
stakedTokens: BigNumber.from(0),
signalAmount: BigNumber.from(0),
signalledTokens: BigNumber.from(0),
},
allocatedTokens: BigNumber.from(eventInputs.tokens),
createdAtBlockHash: receipt.blockHash,
Expand Down
6 changes: 3 additions & 3 deletions packages/indexer-cli/src/allocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface IndexerAllocation {
createdAtEpoch: number
closedAtEpoch: number | null
subgraphDeployment: string
signalAmount: BigNumber
signalledTokens: BigNumber
stakedTokens: BigNumber
}

Expand All @@ -26,7 +26,7 @@ const ALLOCATION_CONVERTERS_FROM_GRAPHQL: Record<
allocatedTokens: nullPassThrough((x: string) => BigNumber.from(x)),
createdAtEpoch: nullPassThrough((x: string) => parseInt(x)),
closedAtEpoch: nullPassThrough((x: string) => parseInt(x)),
signalAmount: nullPassThrough((x: string) => BigNumber.from(x)),
signalledTokens: nullPassThrough((x: string) => BigNumber.from(x)),
stakedTokens: nullPassThrough((x: string) => BigNumber.from(x)),
}

Expand All @@ -40,7 +40,7 @@ const ALLOCATION_FORMATTERS: Record<
allocatedTokens: x => utils.commify(formatGRT(x)),
createdAtEpoch: x => x,
closedAtEpoch: x => x,
signalAmount: x => utils.commify(formatGRT(x)),
signalledTokens: x => utils.commify(formatGRT(x)),
stakedTokens: x => utils.commify(formatGRT(x)),
}

Expand Down
4 changes: 2 additions & 2 deletions packages/indexer-cli/src/commands/indexer/status.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module.exports = {
createdAtEpoch
closedAtEpoch
subgraphDeployment
signalAmount
signalledTokens
stakedTokens
}

Expand Down Expand Up @@ -282,7 +282,7 @@ module.exports = {
'subgraphDeployment',
'allocatedTokens',
'createdAtEpoch',
'signalAmount',
'signalledTokens',
'stakedTokens',
])
}
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer-common/src/allocations/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { BigNumber } from 'ethers'
export interface SubgraphDeployment {
id: SubgraphDeploymentID
stakedTokens: BigNumber
signalAmount: BigNumber
signalledTokens: BigNumber
}

export interface Allocation {
Expand Down Expand Up @@ -39,7 +39,7 @@ export const parseGraphQLAllocation = (allocation: any): Allocation => ({
subgraphDeployment: {
id: new SubgraphDeploymentID(allocation.subgraphDeployment.id),
stakedTokens: BigNumber.from(allocation.subgraphDeployment.stakedTokens),
signalAmount: BigNumber.from(allocation.subgraphDeployment.signalAmount),
signalledTokens: BigNumber.from(allocation.subgraphDeployment.signalledTokens),
},
indexer: toAddress(allocation.indexer.id),
allocatedTokens: BigNumber.from(allocation.allocatedTokens),
Expand Down
2 changes: 1 addition & 1 deletion packages/indexer-common/src/indexer-management/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ const SCHEMA_SDL = gql`
createdAtEpoch: Int!
closedAtEpoch: Int
subgraphDeployment: String!
signalAmount: BigInt!
signalledTokens: BigInt!
stakedTokens: BigInt!
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export default {
subgraphDeployment {
id
stakedTokens
signalAmount
signalledTokens
}
}
}
Expand All @@ -128,7 +128,7 @@ export default {
...allocation,
subgraphDeployment: new SubgraphDeploymentID(allocation.subgraphDeployment.id)
.ipfsHash,
signalAmount: allocation.subgraphDeployment.signalAmount,
signalledTokens: allocation.subgraphDeployment.signalledTokens,
stakedTokens: allocation.subgraphDeployment.stakedTokens,
}))
} catch (error) {
Expand Down
4 changes: 2 additions & 2 deletions packages/indexer-service/src/allocations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const monitorEligibleAllocations = ({
subgraphDeployment {
id
stakedTokens
signalAmount
signalledTokens
}
}
recentlyClosedAllocations: totalAllocations(
Expand All @@ -98,7 +98,7 @@ export const monitorEligibleAllocations = ({
subgraphDeployment {
id
stakedTokens
signalAmount
signalledTokens
}
}
}
Expand Down