Omniscia Tren Finance Audit

FlashLoan Code Style Findings

FlashLoan Code Style Findings

FLN-01C: Ineffectual Usage of Safe Arithmetics

Description:

The linked mathematical operation is guaranteed to be performed safely by logical inference, such as surrounding conditionals evaluated in require checks or if-else constructs.

Example:

contracts/FlashLoan.sol
219if (amountIn < _collAmountIn) {
220 IERC20(_tokenIn).approve(address(swapRouter), 0);
221 IERC20(_tokenIn).transfer(msg.sender, _collAmountIn - amountIn);
222}

Recommendation:

Given that safe arithmetics are toggled on by default in pragma versions of 0.8.X, we advise the linked statement to be wrapped in an unchecked code block thereby optimizing its execution cost.

Alleviation (f6f1ad0b8f24a96ade345db1dd05a1878eb0f761):

The Tren Finance team evaluated this exhibit but opted to acknowledge it in the current iteration of the codebase.