Skip to content

Commit

Permalink
fix: Fix convention naming for constants
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmtzinf committed Oct 1, 2021
1 parent e037467 commit 193e3ab
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions contracts/protocol/libraries/math/WadRayMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import {Errors} from '../helpers/Errors.sol';
**/
library WadRayMath {
uint256 internal constant WAD = 1e18;
uint256 internal constant halfWAD = WAD / 2;
uint256 internal constant HALF_WAD = WAD / 2;

uint256 public constant RAY = 1e27;
uint256 internal constant halfRAY = RAY / 2;
uint256 internal constant HALF_RAY = RAY / 2;

uint256 internal constant WAD_RAY_RATIO = 1e9;

Expand All @@ -30,14 +30,14 @@ library WadRayMath {
* @return Half ray, 1e27/2
**/
function halfRay() internal pure returns (uint256) {
return halfRAY;
return HALF_RAY;
}

/**
* @return Half ray, 1e18/2
**/
function halfWad() internal pure returns (uint256) {
return halfWAD;
return HALF_WAD;
}

/**
Expand All @@ -52,9 +52,9 @@ library WadRayMath {
return 0;
}

require(a <= (type(uint256).max - halfWAD) / b, Errors.MATH_MULTIPLICATION_OVERFLOW);
require(a <= (type(uint256).max - HALF_WAD) / b, Errors.MATH_MULTIPLICATION_OVERFLOW);

return (a * b + halfWAD) / WAD;
return (a * b + HALF_WAD) / WAD;
}
}

Expand Down Expand Up @@ -86,9 +86,9 @@ library WadRayMath {
return 0;
}

require(a <= (type(uint256).max - halfRAY) / b, Errors.MATH_MULTIPLICATION_OVERFLOW);
require(a <= (type(uint256).max - HALF_RAY) / b, Errors.MATH_MULTIPLICATION_OVERFLOW);

return (a * b + halfRAY) / RAY;
return (a * b + HALF_RAY) / RAY;
}
}

Expand Down

0 comments on commit 193e3ab

Please sign in to comment.