-
Notifications
You must be signed in to change notification settings - Fork 0
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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]) { |
There was a problem hiding this comment.
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;
}
}
...
There was a problem hiding this comment.
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.
No description provided.