Governance Subgraph

Subgraph of protocol Governance system (Proposals, Voters, Votes, etc.)

Proposal

Proposal schema:

type Proposal @entity {
  id: String!
  proposer: Bytes!
  targets: [Bytes!]!
  values: [BigInt!]!
  signatures: [String!]!
  callDatas: [Bytes!]!
  startBlock: BigInt!
  endBlock: BigInt!
  description: String!
  state: ProposalState!
  eta: BigInt!
  forVotes: BigInt!
  againstVotes: BigInt!
  createdBlockNumber: BigInt!
  createdBlockTimestamp: BigInt!
  createdTransactionHash: Bytes!
  queuedBlockNumber: BigInt
  queuedBlockTimestamp: BigInt
  queuedTransactionHash: Bytes
  executedBlockNumber: BigInt
  executedBlockTimestamp: BigInt
  executedTransactionHash: Bytes
  canceledBlockNumber: BigInt
  canceledBlockTimestamp: BigInt
  canceledTransactionHash: Bytes
}

enum ProposalState {
  pending
  canceled
  queued
  executed
}

Example of Proposal querying:

{
  proposals {
    id
    proposer
    targets
    values
    signatures
    callDatas
    startBlock
    endBlock
    description
    state
    eta
    forVotes
    againstVotes
    createdBlockNumber
    createdBlockTimestamp
    createdTransactionHash
    queuedBlockNumber
    queuedBlockTimestamp
    queuedTransactionHash
    executedBlockNumber
    executedBlockTimestamp
    executedTransactionHash
    canceledBlockNumber
    canceledBlockTimestamp
    canceledTransactionHash
  }
}

Proposal vote

ProposalVote schema:

type ProposalVote @entity(immutable: true) {
  id: Bytes!
  proposal: Proposal!
  address: Bytes!
  support: Boolean!
  votes: BigInt!
  blockNumber: BigInt!
  blockTimestamp: BigInt!
  transactionHash: Bytes!
}

Example of ProposalVote querying:

{
  proposalVotes {
    id
    proposal {
      id
    }
    address
    support
    votes
    blockNumber
    blockTimestamp
    transactionHash
  }
}

Proposal count

Used to get total count of proposals

ProposalCount schema:

type ProposalCount @entity {
  id: String!
  count: BigInt!
}

Example of ProposalCount querying:

{
  proposalCounts(where: { id: "0" }) {
    id
    count
  }
}

Last updated