It is necessary to ensure that the decimal places are 18, as all calculations in the Ajna protocol are based on 18 decimal places. Otherwise, it may cause the entire protocol to crash.
Proof of Concept
The calculations in the Maths.sol library are all based on 18 decimal places, and it is very important to ensure this.
Tools Used
VsCode
Recommended Mitigation Steps
constructor(address ajnaToken_, IPositionManager positionManager_) {
if (ajnaToken_ == address(0)) revert DeployWithZeroAddress();
//@audit
require(IERC20(ajnaToken_).decimals() == 18, 'Ajna token must have 18 decimals');
ajnaToken = ajnaToken_;
positionManager = positionManager_;
}
Lines of code
https://github.com/code-423n4/2023-05-ajna/blob/main/ajna-core/src/RewardsManager.sol#L95-L100 https://github.com/code-423n4/2023-05-ajna/blob/main/ajna-core/src/libraries/internal/Maths.sol#L11
Vulnerability details
Impact
It is necessary to ensure that the decimal places are 18, as all calculations in the Ajna protocol are based on 18 decimal places. Otherwise, it may cause the entire protocol to crash.
Proof of Concept
The calculations in the Maths.sol library are all based on 18 decimal places, and it is very important to ensure this.
Tools Used
VsCode
Recommended Mitigation Steps
Assessed type
Decimal