-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add BinaryEligibilityOracleEarningPowerCalculator.sol
and tests
#24
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.
Seriously excellent work on this @garyghayrat, overall it's looking great. I left some comments on things we can address and/or pull into issues. But this is a really great start—you've gotten a ton done 🚀
e47e774
to
29fce43
Compare
29fce43
to
e7dff49
Compare
EarningPowerCalculator.sol
and testsBinaryEligibilityOracleEarningPowerCalculator.sol
and tests
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.
Lots of good stuff in here
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 will give some more suggestions for test names, but figures I should send over what I already have before tomorrow. In general I would recommend describing the scenario tested rather than the return and boolean checks.
) external view returns (uint256 _newEarningPower, bool _isQualifiedForUpdate) { | ||
// If the oracle has not been updated for more than the stale oracle window, return full earning | ||
// power and is qualified for update. | ||
if (block.timestamp - lastOracleUpdateTime > STALE_ORACLE_WINDOW) { |
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 think this could probably be enforced on when we set the eligibility delay.
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.
Looking great a few more nits and test name suggestions
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 this looks good, a couple small nits that can be handled in a followup pr
Make `delegateScoreEligibilityThreshold` updatable Add missing test and update comment Merge lockDelegateScore and unlockDelegateScore and update tests Rename delegate to delegatee Rename `_isEligibleForUpdate` to `_isQualifiedForUpdate` Rename `NotScoreOracle` to `Unauthorized` Rename `EarningPowerCalculator` to `BinaryEligibilityOracleEarningPowerCalculator` and inherit `IEarningPowerCalculator` Update comments around ScoreOracle, Karma, and reorder internal function Rename tests Add `lastDelegateeEligibilityChangeTime` and tests Use local vars to simplify checking change in eligibility
Make `getEarningPower` logic more readable Make `getNewEarningPower` more readable Use instead of modifiers and remove duplicate events and errors Add test case for when owner is set to address 0 Make `STALE_ORACLE_WINDOW` immutable Update error naming Use internal functions Simplify `getNewEarningPower` logic Update comments and test names Rename tests Update natspec and rename vars Change `lastDelegateeEligibilityChangeTime` to `timeOfIneligibility` Move tests and correct names Rename var and remove unused var Refactor a test
38a84df
to
7ea2e99
Compare
49bf69d
to
8669241
Compare
Coverage after merging earning-power-calculator into main will be
Coverage Report
|
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 to me! Make sure we squash all the commits into one with a clean message @garyghayrat.
closes #13