diff --git a/src/lib/NonlinearDutchDecayLib.sol b/src/lib/NonlinearDutchDecayLib.sol index e018c152..3b6cb321 100644 --- a/src/lib/NonlinearDutchDecayLib.sol +++ b/src/lib/NonlinearDutchDecayLib.sol @@ -46,7 +46,7 @@ library NonlinearDutchDecayLib { int256 curveDelta; curveDelta = v3LinearInputDecay(startPoint, endPoint, blockDelta, relStartAmount, relEndAmount); - + return startAmount.boundedSub(curveDelta, minAmount, maxAmount); } @@ -178,7 +178,7 @@ library NonlinearDutchDecayLib { uint256 elapsed = currentPoint - startPoint; uint256 duration = endPoint - startPoint; int256 delta; - + // Because startAmount + delta is subtracted from the original amount, // we want to maximize startAmount + delta to favor the swapper if (endAmount < startAmount) { @@ -190,7 +190,8 @@ library NonlinearDutchDecayLib { return startAmount + delta; } - function v3LinearOutputDecay( uint256 startPoint, + function v3LinearOutputDecay( + uint256 startPoint, uint256 endPoint, uint256 currentPoint, int256 startAmount, @@ -212,6 +213,4 @@ library NonlinearDutchDecayLib { return startAmount + delta; } - - } diff --git a/test/lib/NonLinearDutchDecayLib.t.sol b/test/lib/NonLinearDutchDecayLib.t.sol index 587bf1e4..5552a469 100644 --- a/test/lib/NonLinearDutchDecayLib.t.sol +++ b/test/lib/NonLinearDutchDecayLib.t.sol @@ -24,11 +24,11 @@ contract MockNonlinearDutchDecayLibContract { } function decayOutput( - NonlinearDutchDecay memory curve, - uint256 startAmount, - uint256 decayStartBlock, - uint256 minAmount, - uint256 maxAmount + NonlinearDutchDecay memory curve, + uint256 startAmount, + uint256 decayStartBlock, + uint256 minAmount, + uint256 maxAmount ) public view { NonlinearDutchDecayLib.decayOutput(curve, startAmount, decayStartBlock, minAmount, maxAmount); }