Skip to content
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

Split ERC20Votes and ERC20VotesComp #2706

Merged
merged 11 commits into from
Jun 4, 2021
Prev Previous commit
Apply suggestions from code review
Co-authored-by: Francisco Giordano <frangio.1@gmail.com>
  • Loading branch information
Amxx and frangio authored Jun 4, 2021
commit 33f12c81d3b24f88d7119ca602bdb45a8dc2a6b9
3 changes: 2 additions & 1 deletion contracts/utils/math/SafeCast.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ library SafeCast {
* - input must be greater than or equal to 0.
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= int256(type(uint256).min), "SafeCast: value must be positive");
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}

Expand Down Expand Up @@ -233,6 +233,7 @@ library SafeCast {
* - input must be less than or equal to maxInt256.
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
Amxx marked this conversation as resolved.
Show resolved Hide resolved
return int256(value);
}
Expand Down