Closed code423n4 closed 2 years ago
In TurboSafe.sol, 9 gas can be saved by storing type(uint256).max in a variable: uint256 max = type(uint256).max;
type(uint256).max
uint256 max = type(uint256).max;
Line 89 can then be made more gas efficient using this variable: asset.safeApprove(address(assetTurboCToken), max);
asset.safeApprove(address(assetTurboCToken), max);
And on line 92 fei.safeApprove(address(feiTurboCToken), max);
fei.safeApprove(address(feiTurboCToken), max);
Disagree with the findings here, type(uint256).max is already a constant that is inlined by the compiler, if anything assigning it has the extra cost of the assignment
In TurboSafe.sol, 9 gas can be saved by storing
type(uint256).max
in a variable:uint256 max = type(uint256).max;
Line 89 can then be made more gas efficient using this variable:
asset.safeApprove(address(assetTurboCToken), max);
And on line 92
fei.safeApprove(address(feiTurboCToken), max);