This subgraph sources events from the DAO Collective Governance contracts. It indexes on-chain events of the DAO Collective and allows us to track the status of proposals, including the proposer, the voters, and the number of votes.
Here are example queries demonstrating the capabilities of the subgraph:
Get the newest proposals
{
proposals(first: 5, orderDirection: desc, orderBy: createdAt) {
proposalId
proposer {
id
}
targets
state
voteEnd
voteStart
values
votesAbstains
votesAgainst
votesFor
description
createdAt
events {
... on ProposalCanceled {
id
}
... on ProposalCreated {
id
}
... on ProposalExecuted {
id
transactionHash
}
... on ProposalQueued {
id
}
}
}
}
Get the executed proposals
{
proposals(
first: 5
orderDirection: desc
orderBy: createdAt
where: {state: Executed}
) {
proposalId
proposer {
id
}
targets
state
voteEnd
voteStart
values
votesAbstains
votesAgainst
votesFor
description
createdAt
events {
... on ProposalCanceled {
id
}
... on ProposalCreated {
id
}
... on ProposalExecuted {
id
transactionHash
}
... on ProposalQueued {
id
}
}
}
}
Retrieve the most voted proposal
{
proposals(orderDirection: desc, orderBy: votesFor, where: {}, first: 1) {
proposalId
proposer {
id
}
targets
state
voteEnd
voteStart
values
votesAbstains
votesAgainst
votesFor
description
createdAt
events {
... on ProposalCanceled {
id
}
... on ProposalCreated {
id
}
... on ProposalExecuted {
id
transactionHash
}
... on ProposalQueued {
id
}
}
}
}
Get the proposer of the proposal
{
proposals(first: 1, where: {proposalId: "PROPOSAL_ID"}) {
proposalId
description
proposer {
id
}
}
}
Get a list of all voters for a proposal
{
proposals(first: 1, where: {proposalId: "PROPOSAL_ID"}) {
proposalId
votes {
voter {
id
}
}
}
}
Retrieve proposals by account (Proposers)
{
accounts(where: {Proposals_: {description_not: "null"}}) {
id
Proposals {
proposalId
}
}
}
Retrieve the votes by account
{
accounts {
id
VoteCasts {
proposal {
proposalId
}
}
}
}