this can be deleted to saving more gas since it unnecessary and it can be bug if can be burn amount more than msg.sender had.
Tool Used
Manual Review & Remix
using ++i than i++ for saving more gas
Using i++ instead ++i for all the loops, the variable i is incremented using i++. It is known that implementation by using ++i costs less gas per iteration than i++.
this implementation can be saving more gas, since if caching the array length is more gas efficient.
This is because access to a local variable in solidity is more efficient.
>
instead of!=
for saving more gashttps://github.com/code-423n4/2022-04-jpegd/blob/e72861a9ccb707ced9015166fbded5c97c6991b6/contracts/farming/LPFarming.sol#L193
using
>
can be saving more gasTool Used
Remix
Recommendation Mitigation
Change it into
!=
https://github.com/code-423n4/2022-04-jpegd/blob/e72861a9ccb707ced9015166fbded5c97c6991b6/contracts/staking/JPEGStaking.sol#L50
this can be deleted to saving more gas since it unnecessary and it can be bug if can be burn
amount
more thanmsg.sender
had.Tool Used
Manual Review & Remix
Using i++ instead ++i for all the loops, the variable i is incremented using i++. It is known that implementation by using ++i costs less gas per iteration than i++.
Tools Used
Remix
Occurances
uint256 i = 0
intouint i
for saving more gasthis implementation can saving more gas for each loops.
Tool Used
Manual Review & Remix
Recommended Mitigation
Change it
Occurances
this implementation can be saving more gas, since if caching the array length is more gas efficient. This is because access to a local variable in solidity is more efficient.
Tool Used
Manual Review
Occurances
= 0
If a variable was not set/initialized, it is assumed to have default value to 0 this implementation was used for saving more gas by removing
= 0
POC
https://blog.polymath.network/solidity-tips-and-tricks-to-save-gas-and-reduce-bytecode-size-c44580b218e6
TOOLS USED
Remix, Manual Review
Mitigation Step
Remove
= 0
Occurances