Skip to content

Commit

Permalink
Merge pull request #216 from PaulRBerg/build/update-deps
Browse files Browse the repository at this point in the history
refactor: change visibility for "bound"
  • Loading branch information
PaulRBerg authored Dec 17, 2023
2 parents db46408 + 5aa88e7 commit a65e3c2
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 30 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"url": "https://github.com/PaulRBerg/prb-math/issues"
},
"devDependencies": {
"@prb/test": "0.6.4",
"forge-std": "github:foundry-rs/forge-std#e8a047e3f40f13fa37af6fe14e6e06283d9a060e",
"prettier": "^2.8.7",
"@prb/test": "0.6.5",
"forge-std": "github:foundry-rs/forge-std#v1.7.4",
"prettier": "^3.1.1",
"solhint": "^4.0.0"
},
"files": [
Expand Down
30 changes: 19 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions test/utils/Utils.sol
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ contract PRBMathUtils is StdUtils {
//////////////////////////////////////////////////////////////////////////*/

/// @dev Helper function to bound an SD1x18 number, which console logs the bounded result.
function bound(SD1x18 x, SD1x18 min, SD1x18 max) internal view returns (SD1x18) {
function bound(SD1x18 x, SD1x18 min, SD1x18 max) internal pure returns (SD1x18) {
return SD1x18.wrap(int64(bound(int256(x.unwrap()), int256(min.unwrap()), int256(max.unwrap()))));
}

Expand All @@ -24,7 +24,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound an SD1x18 number, which console logs the bounded result.
function bound(SD1x18 x, int64 min, SD1x18 max) internal view returns (SD1x18) {
function bound(SD1x18 x, int64 min, SD1x18 max) internal pure returns (SD1x18) {
return SD1x18.wrap(int64(bound(int256(x.unwrap()), int256(min), int256(max.unwrap()))));
}

Expand All @@ -34,7 +34,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound an SD1x18 number, which console logs the bounded result.
function bound(SD1x18 x, SD1x18 min, int64 max) internal view returns (SD1x18) {
function bound(SD1x18 x, SD1x18 min, int64 max) internal pure returns (SD1x18) {
return SD1x18.wrap(int64(bound(int256(x.unwrap()), int256(min.unwrap()), int256(max))));
}

Expand All @@ -44,7 +44,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound an SD1x18 number, which console logs the bounded result.
function bound(SD1x18 x, int64 min, int64 max) internal view returns (SD1x18) {
function bound(SD1x18 x, int64 min, int64 max) internal pure returns (SD1x18) {
return SD1x18.wrap(int64(bound(int256(x.unwrap()), int256(min), int256(max))));
}

Expand All @@ -58,7 +58,7 @@ contract PRBMathUtils is StdUtils {
//////////////////////////////////////////////////////////////////////////*/

/// @dev Helper function to bound an SD59x18 number, which console logs the bounded result.
function bound(SD59x18 x, SD59x18 min, SD59x18 max) internal view returns (SD59x18) {
function bound(SD59x18 x, SD59x18 min, SD59x18 max) internal pure returns (SD59x18) {
return SD59x18.wrap(bound(x.unwrap(), min.unwrap(), max.unwrap()));
}

Expand All @@ -68,7 +68,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound an SD59x18 number, which console logs the bounded result.
function bound(SD59x18 x, int256 min, SD59x18 max) internal view returns (SD59x18) {
function bound(SD59x18 x, int256 min, SD59x18 max) internal pure returns (SD59x18) {
return SD59x18.wrap(bound(x.unwrap(), min, max.unwrap()));
}

Expand All @@ -78,7 +78,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound an SD59x18 number, which console logs the bounded result.
function bound(SD59x18 x, SD59x18 min, int256 max) internal view returns (SD59x18) {
function bound(SD59x18 x, SD59x18 min, int256 max) internal pure returns (SD59x18) {
return SD59x18.wrap(bound(x.unwrap(), min.unwrap(), max));
}

Expand All @@ -88,7 +88,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound an SD59x18 number, which console logs the bounded result.
function bound(SD59x18 x, int256 min, int256 max) internal view returns (SD59x18) {
function bound(SD59x18 x, int256 min, int256 max) internal pure returns (SD59x18) {
return SD59x18.wrap(bound(x.unwrap(), min, max));
}

Expand All @@ -102,7 +102,7 @@ contract PRBMathUtils is StdUtils {
//////////////////////////////////////////////////////////////////////////*/

/// @dev Helper function to bound a UD2x18 number, which console logs the bounded result.
function bound(UD2x18 x, UD2x18 min, UD2x18 max) internal view returns (UD2x18) {
function bound(UD2x18 x, UD2x18 min, UD2x18 max) internal pure returns (UD2x18) {
return UD2x18.wrap(uint64(bound(uint256(x.unwrap()), uint256(min.unwrap()), uint256(max.unwrap()))));
}

Expand All @@ -112,7 +112,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound a UD2x18 number, which console logs the bounded result.
function bound(UD2x18 x, uint64 min, UD2x18 max) internal view returns (UD2x18) {
function bound(UD2x18 x, uint64 min, UD2x18 max) internal pure returns (UD2x18) {
return UD2x18.wrap(uint64(bound(uint256(x.unwrap()), uint256(min), uint256(max.unwrap()))));
}

Expand All @@ -122,7 +122,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound a UD2x18 number, which console logs the bounded result.
function bound(UD2x18 x, UD2x18 min, uint64 max) internal view returns (UD2x18) {
function bound(UD2x18 x, UD2x18 min, uint64 max) internal pure returns (UD2x18) {
return UD2x18.wrap(uint64(bound(uint256(x.unwrap()), uint256(min.unwrap()), uint256(max))));
}

Expand All @@ -132,7 +132,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound a UD2x18 number, which console logs the bounded result.
function bound(UD2x18 x, uint64 min, uint64 max) internal view returns (UD2x18) {
function bound(UD2x18 x, uint64 min, uint64 max) internal pure returns (UD2x18) {
return UD2x18.wrap(uint64(bound(uint256(x.unwrap()), uint256(min), uint256(max))));
}

Expand All @@ -146,7 +146,7 @@ contract PRBMathUtils is StdUtils {
//////////////////////////////////////////////////////////////////////////*/

/// @dev Helper function to bound a UD60x18 number, which console logs the bounded result.
function bound(UD60x18 x, UD60x18 min, UD60x18 max) internal view returns (UD60x18) {
function bound(UD60x18 x, UD60x18 min, UD60x18 max) internal pure returns (UD60x18) {
return UD60x18.wrap(bound(x.unwrap(), min.unwrap(), max.unwrap()));
}

Expand All @@ -156,7 +156,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound a UD60x18 number, which console logs the bounded result.
function bound(UD60x18 x, uint256 min, UD60x18 max) internal view returns (UD60x18) {
function bound(UD60x18 x, uint256 min, UD60x18 max) internal pure returns (UD60x18) {
return UD60x18.wrap(bound(x.unwrap(), min, max.unwrap()));
}

Expand All @@ -166,7 +166,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound a UD60x18 number, which console logs the bounded result.
function bound(UD60x18 x, UD60x18 min, uint256 max) internal view returns (UD60x18) {
function bound(UD60x18 x, UD60x18 min, uint256 max) internal pure returns (UD60x18) {
return UD60x18.wrap(bound(x.unwrap(), min.unwrap(), max));
}

Expand All @@ -176,7 +176,7 @@ contract PRBMathUtils is StdUtils {
}

/// @dev Helper function to bound a UD60x18 number, which console logs the bounded result.
function bound(UD60x18 x, uint256 min, uint256 max) internal view returns (UD60x18) {
function bound(UD60x18 x, uint256 min, uint256 max) internal pure returns (UD60x18) {
return UD60x18.wrap(bound(x.unwrap(), min, max));
}

Expand Down

0 comments on commit a65e3c2

Please sign in to comment.