-
Notifications
You must be signed in to change notification settings - Fork 195
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: get rid of double division on shares to eth conversion #913
Conversation
Hardhat Unit Tests Coverage Summary
Diff against master
Results for commit: 5ee67ae Minimum allowed coverage is ♻️ This comment has been updated with latest results |
.mul(_getTotalShares()) | ||
.div(_getTotalPooledEther()); | ||
.mul(_getShareRateDenominator()) // denominator in shares | ||
.div(_getShareRateNumerator()); // numerator in ether |
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.
This naming pattern with numerator/denominator is confusing because here _getShareRateNumerator
is used as a denominator
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.
See no real alternative. And, btw, it's still a numerator for share rate here.
External shares concept introduce double division during the shares to eth conversion calculations and vise versa.
The suggested way to fix it is to use internal ether and internal shares for conversion in
getPooledEthForShares()
andgetSharesForPoooledEther()