Omniscia fetchai Audit
InterestCalculator Static Analysis Findings
InterestCalculator Static Analysis Findings
ICO-01S: Inexistent Visibility Specifiers
| Type | Severity | Location |
|---|---|---|
| Code Style | Informational | InterestCalculator.sol:L22-L27 |
Description:
The linked variables contain no visibility specifiers explicitly set.
Example:
22uint256 constant A0 = 10**DECIMALS;23uint256 constant A1 = A0 / 2;24uint256 constant A2 = A0 / 9;25uint256 constant A3 = A0 / 72;26uint256 constant A4 = A0 / 1008;27uint256 constant A5 = A0 / 30240;Recommendation:
We advise them to be set explicitly as currently the compiler automatically assigns visibility specifiers to them which may cause compilation discrepancies between versions.
Alleviation:
The private visibility specifier was added to all linked variables properly.
ICO-02S: Redundant Visibility Specifiers
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | InterestCalculator.sol:L13-L15, L60 |
Description:
The linked variables are meant to be system constants yet are exposed publicly via the public visibility specifier.
Example:
13uint256 public constant SECS_PER_YEAR = 60 * 60 * 24 * 365.25;14uint256 public constant DECIMALS = 18;15uint256 public constant ONE_UNIT = 10**DECIMALS;Recommendation:
We advise them to be set as internal greatly reducing the generated bytecode of the contract.
Alleviation:
The Atomix team has stated that they wish the DECIMALS member to remain exposed to conduct proper checks in future upgrades of the protocol, however, the other variables have been set to internal properly.
ICO-03S: Tautology Evaluation
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | InterestCalculator.sol:L138 |
Description:
The getBorrowerLnAPRRate function performs a require check that ensures the smoothIndex variable, a uint256, is greater-than-or-equal-to (>=) zero, a trait that will always be satisfied.
Example:
136tion getBorrowerLnAPRRate(uint256 smoothIndex) public view returns (uint256) {137require(138 smoothIndex >= 0 && smoothIndex <= ONE_UNIT,139 "InterestCalculator: smoothIndex must be between 0 and 1"140);Recommendation:
We advise the tautology to be omitted from the codebase.
Alleviation:
The tautology member of the comparison has been safely omitted.