VaderMath's library calculateLiquidityUnits, calculateLoss, calculateSwap and calculateSwapReverse functions are public, but being calculation facade are called only from outside contracts and can be made external to reduce calling costs. Inheritance is unlikely here as next generation logic is better be formulated afresh for clarity.
Handle
hyh
Vulnerability details
Proof of Concept
VaderMath's library calculateLiquidityUnits, calculateLoss, calculateSwap and calculateSwapReverse functions are public, but being calculation facade are called only from outside contracts and can be made external to reduce calling costs. Inheritance is unlikely here as next generation logic is better be formulated afresh for clarity.
https://github.com/code-423n4/2021-11-vader/blob/main/contracts/dex/math/VaderMath.sol#L19 https://github.com/code-423n4/2021-11-vader/blob/main/contracts/dex/math/VaderMath.sol#L73 https://github.com/code-423n4/2021-11-vader/blob/main/contracts/dex/math/VaderMath.sol#L99 https://github.com/code-423n4/2021-11-vader/blob/main/contracts/dex/math/VaderMath.sol#L117
Recommended Mitigation Steps
Substitute public visibility with external.