Omniscia Tren Finance Audit
AdminContract Static Analysis Findings
AdminContract Static Analysis Findings
ACT-01S: Illegible Numeric Value Representation
Type | Severity | Location |
---|---|---|
Code Style | AdminContract.sol:L46 |
Description:
The linked representation of a numeric literal is sub-optimally represented decreasing the legibility of the codebase.
Example:
46uint256 public constant MIN_NET_DEBT_DEFAULT = 2000 ether;
Recommendation:
To properly illustrate the value's purpose, we advise the following guidelines to be followed.
For values meant to depict fractions with a base of 1e18
, we advise fractions to be utilized directly (i.e. 1e17
becomes 0.1e18
) as they are supported.
For values meant to represent a percentage base, we advise each value to utilize the underscore (_
) separator to discern the percentage decimal (i.e. 10000
becomes 100_00
, 300
becomes 3_00
and so on).
Finally, for large numeric values we simply advise the underscore character to be utilized again to represent them (i.e. 1000000
becomes 1_000_000
).
Alleviation (f6f1ad0b8f):
The Tren Finance team proceeded to adjust all literals in the AdminContract
to utilize 1e18
notation instead of ether
, however, these values are set via multiplications with 1e18
which is unnecessary.
We advise all values to simply subcede the literal with e18
notation (i.e. 0.005 * 1e18
to be set as 0.005e18
), and the MIN_NET_DEBT_DEFAULT
literal in particular to introduce an underscore per thousand (i.e. 2_000e18
).
Alleviation (73b9546eb9):
All literals were adjusted as advised, optimizing their legibility while retaining their original value assignment.
ACT-02S: Inexistent Event Emission
Type | Severity | Location |
---|---|---|
Language Specific | AdminContract.sol:L144-L146 |
Description:
The linked function adjusts a sensitive contract variable yet does not emit an event for it.
Example:
144function setSetupIsInitialized() external onlyTimelock {145 isSetupInitialized = true;146}
Recommendation:
We advise an event
to be declared and correspondingly emitted to ensure off-chain processes can properly react to this system adjustment.
Alleviation (f6f1ad0b8f):
While the SetupInitialized
event has been introduced in the IAdminContract
interface, it is not emitted by the AdminContract::setSetupIsInitialized
function rendering this exhibit partially addressed.
Alleviation (73b9546eb9):
An emit
statement for the SetupInitialized
event has been introduced in the AdminContract::setSetupIsInitialized
function thereby addressing this exhibit in full.
ACT-03S: Redundant Variable Assignment
Type | Severity | Location |
---|---|---|
Gas Optimization | AdminContract.sol:L80 |
Description:
The linked variable is assigned to redundantly to the default value of the relevant data type (i.e. uint256
assigned to 0
, address
assigned to address(0)
etc.).
Example:
80bool public routeToTRENStaking = false;
Recommendation:
We advise the assignment to be safely omitted optimizing the codebase.
Alleviation (f6f1ad0b8f24a96ade345db1dd05a1878eb0f761):
The redundant variable assignment has been safely omitted.