Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Create H2O voting strategy #517

Closed
idiom-bytes opened this issue Jul 4, 2022 · 5 comments · Fixed by snapshot-labs/snapshot-strategies#700
Closed

Create H2O voting strategy #517

idiom-bytes opened this issue Jul 4, 2022 · 5 comments · Fixed by snapshot-labs/snapshot-strategies#700
Assignees

Comments

@idiom-bytes
Copy link
Member

idiom-bytes commented Jul 4, 2022

Based on share made by Alex Coseru

query{
  safes(orderBy: collateral, orderDirection: desc) {
    collateralType {
      id
    }
    safeId
    owner {
      address
    }
    collateral
    debt
  }
}

using https://thegraph.com/hosted-service/subgraph/h2odata/h2o-mainnet?selected=playground

@MantisClone
Copy link

MantisClone commented Jul 6, 2022

Does it absolutely need to use the subgraph? Or would it be acceptable to use a Multicall?
Since subgraphs can only return the first 1000 results, I'd rather use a Multicall to call the contracts directly.

@idiom-bytes
Copy link
Member Author

Many strategies in snapshot use multicall, so as an improvement this seems fine.

As a note, many of our existing strategies are consuming from the subgraph. Potentially in the near future, we'll have to find a solution beyond 1000 records for our existing subgraph queries.

@MantisClone
Copy link

MantisClone commented Jul 6, 2022

Just in case I can't get the Multicall approach working, I optimized the subgraph query slightly.

It now lists all the safes associated with a given user (useful for users with multiple safes) and filters by "OCEAN-A" collateral.

{
  users {
    id
    safes {
      collateralType (where: {id: "OCEAN-A"}) {
        id
      }
      collateral
    }
  }
}

Playground: https://api.thegraph.com/subgraphs/name/h2odata/h2o-mainnet/graphql?query=%7B%0A++users+%7B%0A++++id%0A++++safes+%7B%0A++++++collateralType+%28where%3A+%7Bid%3A+%22OCEAN-A%22%7D%29+%7B%0A++++++++id%0A++++++%7D%0A++++++collateral%0A++++%7D%0A++%7D%0A%7D

@MantisClone
Copy link

MantisClone commented Jul 7, 2022

I finished implementing the strategy using the subgraph, submitted the PR to snapshot labs, and the PR was merged! 🎉 See for details: snapshot-labs/snapshot-strategies#700

@idiom-bytes idiom-bytes self-assigned this Jul 8, 2022
@idiom-bytes
Copy link
Member Author

idiom-bytes commented Jul 8, 2022

@MantisClone, great work.
I have assigned myself to this task so we can close it.

Based on our checks and verifications, I believe it's working as intended.
I believe we identify additional requirements, create new tasks, and tackle them accordingly.

Recommended order of priority and improvements:

  1. Improve H2O strategy to provide better coverage + unlock more OCEAN votes
  2. Improve other strategies (marketplace, marketplace-v4) so we can get 1000 largest pools, or other largest-values, while working within the constraints of GQL/Subgraph
  3. Expand strategies beyond the GQL/Subgraph limit of 1000

If you agree, please close the ticket, create new ones, and reference this task.
All the best!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants