Wrong computation for tokens with decimals different than 18.
Proof of Concept
The contract FarmingPools assume that the stacking token has 18 decimals for the reward computation, it must be checked this decimals or the logic could be unpredictable.
The methods rewardPerToken and earned use 1e18 in order to remove or add the decimal values.
Affected source:
contracts\farming\FarmingPools.sol:82, 91
Tools Used
Manual review.
Recommended Mitigation Steps
Check that the contract has 18 decimals or change the logic
Handle
0x1f8b
Vulnerability details
Impact
Wrong computation for tokens with decimals different than 18.
Proof of Concept
The contract
FarmingPools
assume that the stacking token has 18 decimals for the reward computation, it must be checked this decimals or the logic could be unpredictable.The methods
rewardPerToken
andearned
use 1e18 in order to remove or add the decimal values.Affected source:
Tools Used
Manual review.
Recommended Mitigation Steps
Check that the contract has 18 decimals or change the logic