issues
search
code-423n4
/
2022-08-fiatdao-findings
2
stars
1
forks
source link
Gas Optimizations
#208
Open
code423n4
opened
2 years ago
code423n4
commented
2 years ago
Use
unchecked {++i;}
instead of i++ in for loop.
https://github.com/code-423n4/2022-08-fiatdao/blob/main/contracts/VotingEscrow.sol#L309
Use newLocked.delegated -=locked_.amount instead of casting.
https://github.com/code-423n4/2022-08-fiatdao/blob/main/contracts/VotingEscrow.sol#L642
Don’t do one more check if (_addr != address(0)) here
https://github.com/code-423n4/2022-08-fiatdao/blob/main/contracts/VotingEscrow.sol#L374
. Move code to the block above
https://github.com/code-423n4/2022-08-fiatdao/blob/main/contracts/VotingEscrow.sol#L368
unchecked {++i;}
instead of i++ in for loop. https://github.com/code-423n4/2022-08-fiatdao/blob/main/contracts/VotingEscrow.sol#L309