Skip to content

Commit

Permalink
Merge pull request #104 from primitivefinance/fix/ntoken-g3m-rounding
Browse files Browse the repository at this point in the history
fix: use muldiv in NTokenG3M math
  • Loading branch information
clemlak authored Apr 1, 2024
2 parents a31e2aa + 558b766 commit 9b840e8
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/NTokenGeometricMean/NTokenGeometricMeanMath.sol
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,15 @@ function computeDeltaGivenDeltaLRoundUp(
uint256 deltaLiquidity,
uint256 totalLiquidity
) pure returns (uint256) {
return reserve.mulWadUp(deltaLiquidity.divWadUp(totalLiquidity));
return reserve.mulDivUp(deltaLiquidity, totalLiquidity);
}

function computeDeltaGivenDeltaLRoundDown(
uint256 reserve,
uint256 deltaLiquidity,
uint256 totalLiquidity
) pure returns (uint256) {
return reserve.mulWadDown(deltaLiquidity.divWadDown(totalLiquidity));
return reserve.mulDivDown(deltaLiquidity, totalLiquidity);
}

function computeL(
Expand Down

0 comments on commit 9b840e8

Please sign in to comment.