Omniscia Tren Finance Audit
TrenBoxManagerOperations Code Style Findings
TrenBoxManagerOperations Code Style Findings
TBO-01C: Redundant Code Branches
Type | Severity | Location |
---|---|---|
Gas Optimization | TrenBoxManagerOperations.sol:L688-L696, L966-L986 |
Description:
The referenced if-else
blocks will evaluate a bool
variable and set a different bool
literal argument to each call contained within.
Example:
688if (_fullRedistribution) {689 singleLiquidation = _liquidateNormalMode(690 _asset, vars.user, vars.remainingDebtTokenInStabPool, true691 );692} else {693 singleLiquidation = _liquidateNormalMode(694 _asset, vars.user, vars.remainingDebtTokenInStabPool, false695 );696}
Recommendation:
We advise each call to be performed directly and its last argument to be set as the _fullRedistribution
variable directly, optimizing the code's gas cost.
Alleviation (f6f1ad0b8f24a96ade345db1dd05a1878eb0f761):
The code was refactored as advised, optimizing its gas cost by performing a single statement with a dynamic bool
argument.
TBO-02C: Redundant Parenthesis Statements
Type | Severity | Location |
---|---|---|
Code Style | TrenBoxManagerOperations.sol:L850, L851, L884, L885 |
Description:
The referenced statements are redundantly wrapped in parenthesis' (()
).
Example:
850(_ICR > IAdminContract(adminContract)._100pct())
Recommendation:
We advise them to be safely omitted, increasing the legibility of the codebase.
Alleviation (f6f1ad0b8f):
All but the final parenthesis statements have been omitted, rendering this exhibit partially addressed.
Alleviation (73b9546eb9):
The redundant parenthesis from the last statement has been omitted as well, addressing this exhibit in full.