Skip to content

Commit

Permalink
fix: upper value
Browse files Browse the repository at this point in the history
  • Loading branch information
MathisGD committed Nov 14, 2023
1 parent 447a232 commit a345815
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/libraries/MathLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ library MathLib {

/// @dev Above this bound, `wExp` is clipped to avoid overflowing when multiplied with 1 ether.
/// @dev This upper bound corresponds to: ln(type(int256).max / 1e36) (scaled by WAD, floored).
int256 internal constant WEXP_UPPER_BOUND = 94.552614875560354586 ether;
int256 internal constant WEXP_UPPER_BOUND = 93.859467695000404319 ether;

/// @dev The value of wExp(`WEXP_UPPER_BOUND`).
int256 internal constant WEXP_UPPER_VALUE = 115432178323118442717551238386899909037872.77663603861225472 ether;
int256 internal constant WEXP_UPPER_VALUE = 57716089161558943862588783571184261698504.523000224082296832 ether;

/// @dev Returns an approximation of exp.
function wExp(int256 x) internal pure returns (int256) {
Expand Down
4 changes: 1 addition & 3 deletions test/SpeedJumpIrmTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -253,9 +253,7 @@ contract AdaptativeCurveIrmTest is Test {
function _curve(int256 rateAtTarget, int256 err) internal pure returns (uint256) {
// Safe "unchecked" cast because err >= -1 (in WAD).
if (err < 0) {
return uint256(((WAD - WAD.wDivDown(CURVE_STEEPNESS)).wMulDown(err) + WAD).wMulDown(
rateAtTarget
));
return uint256(((WAD - WAD.wDivDown(CURVE_STEEPNESS)).wMulDown(err) + WAD).wMulDown(rateAtTarget));
} else {
return uint256(((CURVE_STEEPNESS - WAD).wMulDown(err) + WAD).wMulDown(rateAtTarget));
}
Expand Down

0 comments on commit a345815

Please sign in to comment.