Skip to content

Commit

Permalink
fix: Remove redundant functions in WadRayMath lib
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelmtzinf committed Dec 27, 2021
1 parent 843331f commit 5f0f035
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
6 changes: 3 additions & 3 deletions contracts/mocks/tests/WadRayMathWrapper.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@ import {WadRayMath} from '../../protocol/libraries/math/WadRayMath.sol';

contract WadRayMathWrapper {
function wad() public pure returns (uint256) {
return WadRayMath.wad();
return WadRayMath.WAD;
}

function ray() public pure returns (uint256) {
return WadRayMath.RAY;
}

function halfRay() public pure returns (uint256) {
return WadRayMath.halfRay();
return WadRayMath.HALF_RAY;
}

function halfWad() public pure returns (uint256) {
return WadRayMath.halfWad();
return WadRayMath.HALF_WAD;
}

function wadMul(uint256 a, uint256 b) public pure returns (uint256) {
Expand Down
24 changes: 1 addition & 23 deletions contracts/protocol/libraries/math/WadRayMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,11 @@ library WadRayMath {
uint256 internal constant WAD = 1e18;
uint256 internal constant HALF_WAD = 0.5e18;

uint256 public constant RAY = 1e27;
uint256 internal constant RAY = 1e27;
uint256 internal constant HALF_RAY = 0.5e27;

uint256 internal constant WAD_RAY_RATIO = 1e9;

/**
* @return One wad, 1e18
**/

function wad() internal pure returns (uint256) {
return WAD;
}

/**
* @return Half ray, 1e27/2
**/
function halfRay() internal pure returns (uint256) {
return HALF_RAY;
}

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

/**
* @dev Multiplies two wad, rounding half up to the nearest wad
* @dev assembly optimized for improved gas savings, see https://twitter.com/transmissions11/status/1451131036377571328
Expand Down

0 comments on commit 5f0f035

Please sign in to comment.