Skip to content

Commit

Permalink
M-01
Browse files Browse the repository at this point in the history
  • Loading branch information
Picodes committed Jul 14, 2023
1 parent 864c1c4 commit 5f7635c
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion contracts/transmuter/libraries/LibHelpers.sol
Expand Up @@ -73,7 +73,8 @@ library LibHelpers {
/// @dev The values in the `xArray` must be increasing
function piecewiseLinear(uint64 x, uint64[] memory xArray, int64[] memory yArray) internal pure returns (int64) {
uint256 indexLowerBound = findLowerBound(true, xArray, 1, x);
if (indexLowerBound == xArray.length - 1) return yArray[xArray.length - 1];
if (indexLowerBound == 0 && x < xArray[0]) return yArray[0];
else if (indexLowerBound == xArray.length - 1) return yArray[xArray.length - 1];
return
yArray[indexLowerBound] +
((yArray[indexLowerBound + 1] - yArray[indexLowerBound]) * int64(x - xArray[indexLowerBound])) /
Expand Down

0 comments on commit 5f7635c

Please sign in to comment.