Omniscia Tren Finance Audit

FeeCollector Code Style Findings

FeeCollector Code Style Findings

FCR-01C: Inefficient Data Location

Description:

The data location specifier of the referenced variable is set as memory even though only one member of it is read.

Example:

contracts/FeeCollector.sol
160/// @inheritdoc IFeeCollector
161function liquidateDebt(
162 address _borrower,
163 address _asset
164)
165 external
166 override
167 onlyTrenBoxManager
168{
169 FeeRecord memory mRecord = feeRecords[_borrower][_asset];
170 if (mRecord.amount != 0) {
171 _closeExpiredOrLiquidatedFeeRecord(_borrower, _asset, mRecord.amount);
172 }
173}

Recommendation:

We advise the member to be read directly and stored to a local uint256 variable, significantly optimizing the gas cost of the function.

Alleviation (f6f1ad0b8f24a96ade345db1dd05a1878eb0f761):

The referenced code block has been optimized as advised utilizing a local uint256 variable instead of a full memory structure.

FCR-02C: Repetitive Value Literal

Description:

The linked value literal is repeated across the codebase multiple times.

Example:

contracts/FeeCollector.sol
97uint256 minFeeAmount = (MIN_FEE_FRACTION * _feeAmount) / 1 ether;

Recommendation:

We advise it to be set to a constant variable instead, optimizing the legibility of the codebase.

In case the constant has already been declared, we advise it to be properly re-used across the code.

Alleviation (f6f1ad0b8f24a96ade345db1dd05a1878eb0f761):

The referenced value literal 1 ether has been properly relocated to a contract-level constant declaration labelled DENOMINATOR, optimizing the code's legibility.