Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subgraph: which delegates represent which nouns doesn't account for token vote snapshots #700

Open
eladmallel opened this issue Mar 30, 2023 · 2 comments
Labels
subgraph related to the nouns-subgraph package

Comments

@eladmallel
Copy link
Collaborator

A concerte example:

  1. proposal 250 was created
  2. noun 652 was born
  3. address 0xbc3ed6b537f2980e66f396fe14210a56ba3f72c4 got delegated noun 652
  4. 0xbc3ed6b537f2980e66f396fe14210a56ba3f72c4 voted on prop 250
  5. under votes, id "0xbc3ed6b537f2980e66f396fe14210a56ba3f72c4-250" you can see noun 652, when it should not be there
@eladmallel eladmallel added the subgraph related to the nouns-subgraph package label Mar 30, 2023
@wilsoncusack
Copy link

in handleCastVote, vote.nouns is set to voter.nounsRepresented https://github.com/nounsDAO/nouns-monorepo/blob/master/packages/nouns-subgraph/src/nouns-dao.ts#L168

nounsRepresented is changed at the time of Noun transfer or delegation change https://github.com/nounsDAO/nouns-monorepo/blob/master/packages/nouns-subgraph/src/nouns-erc-721.ts

As voting power is frozen at the block a proposal was put up, but nounsRepresented is not, vote.nouns will be misleading.

@solimander
Copy link
Collaborator

For now, please use the following workaround, which requires two queries:

{
  proposal(id: ${proposalId}) {
    createdBlock
    votes {
      voter {
        id
      }
      # whatever else you need...
    }
  }
}
{
  delegates(where: { id_in: ${JSON.stringify(voterIds)} }, block: { number: ${createdBlock} }) {
    id
    nounsRepresented {
      id
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
subgraph related to the nouns-subgraph package
Projects
None yet
Development

No branches or pull requests

3 participants