-
Notifications
You must be signed in to change notification settings - Fork 8
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: Move lqty allocation checks #77
Conversation
As value now encodes timestamp, it would never be zero, we need to decode and then check.
src/BribeInitiative.sol
Outdated
&& (totalLQTYAllocation.next > _epoch || totalLQTYAllocation.next == 0), | ||
"BribeInitiative: invalid-prev-total-lqty-allocation-epoch" | ||
); | ||
|
||
(uint88 totalLQTY, uint120 totalAverageTimestamp) = _decodeLQTYAllocation(totalLQTYAllocation.value); | ||
require(totalLQTY > 0, "BribeInitiative: invalid-prev-total-lqty"); |
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 would rephrase the error message. The variable being checked stands for the total LQTY allocated to the initiative in the epoch from which the bribes are being claimed from. Thus, I guess a better message would be: invalid-total-lqty-allocation
or total-lqty-allocation-zero
.
src/BribeInitiative.sol
Outdated
@@ -113,6 +113,7 @@ contract BribeInitiative is IInitiative, IBribeInitiative { | |||
uint240 totalVotes = governance.lqtyToVotes(totalLQTY, scaledEpochEnd, totalAverageTimestamp); | |||
if (totalVotes != 0) { | |||
(uint88 lqty, uint120 averageTimestamp) = _decodeLQTYAllocation(lqtyAllocation.value); | |||
require(lqty > 0, "BribeInitiative: invalid-prev-lqty"); |
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.
Same as above.
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.
Looks good, but I suggest we tweak the revert messages!
As value now encodes timestamp, it would never be zero, we need to decode and then check.