Skip to main content
Version: V4

Entities & Sample Queries

Governance - Entities

TokenHolder

FieldTypeDescription
idID!Token holder address
delegateDelegateDelegate address of the token holder which will participate in votings
tokenBalanceRawBigInt!Governance token balance of this address expressed in the smallest unit of the governance token
tokenBalanceBigDecimal!Governance token balance of this address expressed as a BigDecimal normalized value for the governance token
totalTokenHeldRawBigInt!Total amount of governance tokens ever held by this address expressed in the smallest unit of the governance token
totalTokensHeldBigDecimal!Total amount of governance token ever held by this address expressed as a BigDecimal normalized value for the governance token

Delegate

FieldTypeDescription
idID!Delegate address
delegatedVotesRawBigInt!Amount of votes delegated to this delegate to be used on proposal votings expressed in the smallest unit of the governance token
delegatedVotesBigDecimal!Amount of votes delegated to this delegate to be used on proposal votings expressed as a BigDecimal normalized value for the governance token
tokenHoldersRepresentedAmountInt!
tokenHoldersRepresented[TokenHolder!]!Token holders that this delegate represents
votes[Vote!]!Votes that a delegate has made in different proposals
proposals[Proposal!]!Proposals that the delegate has created

Proposal

FieldTypeDescription
idID!Internal proposal ID (autoincremental ID)
proposerDelegate!Delegate that proposed the change
targets[Bytes!]Targets data for the change
values[BigInt!]Values data for the change
signatures[String!]Signature data for the change
calldatas[Bytes!]Call data for the change
startBlockBigInt!Block number from where the voting starts
endBlockBigInt!Block number from where the voting ends
descriptionString!String description of the change
statusProposalStatus!Status of the proposal
executionETABigIntOnce the proposal is queued for execution it will have an ETA of the execution
votes[Vote!]!Votes associated to this proposal

Vote

FieldTypeDescription
idID!Delegate ID + Proposal ID
supportBoolean!Whether the vote is in favour or against the proposal
votesRawBigInt!Amount of votes in favour or against expressed in the smallest unit of the governance token
votesBigDecimal!Amount of votes in favour or against expressed as a BigDecimal normalized value for the governance token
voterDelegate!Delegate that emitted the vote

Governance

FieldTypeDescription
idID!Unique entity used to keep track of common aggregated data
proposalsBigInt!Number of proposals created
currentTokenHoldersBigInt!Total number of token holders currently
currentDelegatesBigInt!Total number of delegates participating on the governance currently
totalTokenHoldersBigInt!Total number of token holders
totalDelegatesBigInt!Total number of delegates that held delegated votes
delegatedVotesRawBigInt!Total number of votes delegated expressed in the smallest unit of the governance token
delegatedVotesBigDecimal!Total number of votes delegated expressed as a BigDecimal normalized value for the governance token
proposalsQueuedBigInt!Number of proposals currently queued for execution

Sample Queries

Below are some sample queries you can use to gather information from the Governance subgraph.

You can build your own queries using a GraphQL Explorer and enter your endpoint to limit the data to exactly what you need.

Delegated Votes

Description: This query filters token holders, tokens held by them, and their delegated votes.

{
tokenHolders(where: { delegate_not: "null" }) {
id
totalTokensHeld
delegate {
delegatedVotes
votes {
votes
}
}
}
}

Governance - Query

Description: This query fetches governance data aggregate.

{
governances {
id
proposals
proposalsQueued
delegatedVotes
currentTokenHolders
currentDelegates
totalDelegates
totalTokenHolders
}
}