-
Notifications
You must be signed in to change notification settings - Fork 2
Extend type converter to avoid duplication of file in different projects #49
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
base: main
Are you sure you want to change the base?
Conversation
Changes to gas cost
🧾 Summary (20% most significant diffs)
Full diff report 👇
|
LCOV of commit
|
| /// @notice Converts a uint256 to uint16, reverting if the value overflows. | ||
| /// @param value The uint256 value to convert. | ||
| /// @return The uint16 representation of the value. | ||
| function toUint16(uint256 value) internal pure returns (uint16) { |
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.
We should add unit tests for these new functions.
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 didn't notice it before but these functions are similar to the ones we have in UintMath.
Line 40 in e54273e
| function safe16(uint256 n) internal pure returns (uint16) { |
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.
+1
Extend the type converter to eliminate copy-paste in the portal-v2 project.
Additionally, review whether most of its methods are still needed, given the previously introduced
UintMath.