20,000 USDC
View results
Submission Details
Severity: gas
Valid

Calling conditions that would always be true

Summary

Calling conditions that would always be true

Vulnerability Details

Conditions on L67 and L69 of the staking contract will always be true not withstanding

65. if (_balance > balance) {
66. uint256 _diff = _balance - balance;
67. if (_diff > 0) {
68. uint256 _ratio = _diff * 1e18 / totalSupply;
69. if (_ratio > 0) {
70. index = index + _ratio;
71. balance = _balance;
72. }
73. }
74. }

if (_balance > balance) is true then _diff will definitely be atleast 1 and the condition on L67 will always be irrelevant. Same thing applies to the next condition at L69 _ratio will always be greater than zero since _diff can never be zero

Impact

This could affect the main intention of the Developer for having those conditions there since the conditions are now irrelevant

Tools Used

solidity, manual review

Recommendations

Necessary Adjustment is needed to ensure the conditions do what they are suppose to do depending on developers intention

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.