Open code423n4 opened 2 years ago
withholdRatio
currentWithheldETH
0
frxETHMinter.sol#L63-L64:
withholdRatio = 0; // No ETH is withheld initially currentWithheldETH = 0;
withholdRatio and currentWithheldETH are already 0
numValidators()
validators.length
Save gas avoiding calling a view function on: OperatorRegistry.sol#L136 OperatorRegistry.sol#L182
!= 0
>0
On: frxETHMinter.sol#L79 frxETHMinter.sol#L126
++i
i++
On:
unchecked{++i}
unchecked{i++}
On;
Use this pattern;
for (uint256 i = 0; i < numDeposits;) { ... code unchecked{ ++i; } }
withholdRatio
andcurrentWithheldETH
are already 0, avoid to set variables with0
frxETHMinter.sol#L63-L64:
withholdRatio
andcurrentWithheldETH
are already 0Instead of
numValidators()
usevalidators.length
Save gas avoiding calling a view function on: OperatorRegistry.sol#L136 OperatorRegistry.sol#L182
Use
!= 0
on requires instead of>0
to save gasOn: frxETHMinter.sol#L79 frxETHMinter.sol#L126
Use
++i
instead ofi++
,++i
costs less gas thani++
On:
Instead of
++i
/i++
you should useunchecked{++i}
/unchecked{i++}
(when its safe)On;
Use this pattern;