Omniscia Tren Finance Audit

AdminContract Code Style Findings

AdminContract Code Style Findings

ACT-01C: Inefficient Imposition of Access Control

Description:

The AdminContract::setCollateralParameters function will trigger the AdminContract::onlyTimelock modifier 7 times redundantly.

Example:

contracts/AdminContract.sol
186function setCollateralParameters(
187 address _collateral,
188 uint256 _borrowingFee,
189 uint256 _ccr,
190 uint256 _mcr,
191 uint256 _minNetDebt,
192 uint256 _mintCap,
193 uint256 _percentDivisor,
194 uint256 _redemptionFeeFloor
195)
196 external
197 override
198 onlyTimelock
199{
200 collateralParams[_collateral].active = true;
201 setBorrowingFee(_collateral, _borrowingFee);
202 setCCR(_collateral, _ccr);
203 setMCR(_collateral, _mcr);
204 setMinNetDebt(_collateral, _minNetDebt);
205 setMintCap(_collateral, _mintCap);
206 setPercentDivisor(_collateral, _percentDivisor);
207 setRedemptionFeeFloor(_collateral, _redemptionFeeFloor);
208}

Recommendation:

We advise the statements of each dedicated setter function to be relocated to an internal counterpart without the application of the modifier that is in turn invoked by the AdminContract::setCollateralParameters function, optimizing the function's gas cost significantly.

Alleviation (f6f1ad0b8f24a96ade345db1dd05a1878eb0f761):

The code was optimized per our recommendation, ensuring the AdminContract::onlyTimelock modifier is applied at most once per setter function invocation.

ACT-02C: Redundant Parenthesis Statement

Description:

The referenced statement is redundantly wrapped in parenthesis (()).

Example:

contracts/AdminContract.sol
398return (collateralParams[_collateral].index);

Recommendation:

We advise them to be safely omitted, increasing the legibility of the codebase.

Alleviation (f6f1ad0b8f24a96ade345db1dd05a1878eb0f761):

The redundant parenthesis in the referenced statement have been safely omitted.