code-423n4 / 2022-02-tribe-turbo-findings

1 stars 0 forks source link

Gas Optimizations #61

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

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);

GalloDaSballo commented 2 years ago

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