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

fix: snapshot DAOs are relative majority #72

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

deep-quality-dev
Copy link
Contributor

No description provided.

Copy link
Collaborator

@JamesEarle JamesEarle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch to using utils given by Ethers instead of writing your own, when possible. Otherwise LGTM

🚢

// Assume score[0] is the score for Approval or Yes
// If Approval > Deny in score, can execute
for (const score of this.scores) {
if (score > this.scores[0]) {
Copy link
Collaborator

@JamesEarle JamesEarle Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure I understand this loop?

We iterate this.scores
Then, we check if the iteration is greater than this.scores[0], which will be the same value of the first iteration, and X > X is always false, and so this loop always hits return true below?

Trying to interpret the above comment, is this.scores[0] the score required for approval? and so when it is false on the first iteration that doesn't matter, and going forward it works? If this is correct please consider putting the required approval score in its own appropriately named variable.

// The minimum score required for approval
const approvalRequired = <some value>;

...
for (const score of this.scores) {
  if (score > approvalScore) {
    return false;
  }
}
...

Copy link
Contributor Author

@deep-quality-dev deep-quality-dev Mar 7, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just want to check if the first score is the largest score in this.scores.
So I can skip first score by removing = in if condition and if found any value is greater than first score, then returns false.

const scores = [20, 15, 30, 19];
  for (const score of scores) {
    if (score > scores[0]) {
      return false;
    }
  }

In this example, 20 is less than 30, so returns false, but assume if first score is 30, then that is the largest value, returns true.
Please correct me if wrong.

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

Successfully merging this pull request may close these issues.

3 participants