Omniscia AmpleSense Audit

AMPLRebaser Code Style Findings

AMPLRebaser Code Style Findings

AMP-01C: Inexistent Variable Visibility Specifiers

TypeSeverityLocation
Code StyleInformationalAMPLRebaser.sol:L15, L17

Description:

The linked variables have no visibility specifiers explicitly set.

Example:

contracts/AMPLRebaser.sol
13uint256 public last_ampl_supply;
14
15uint256 last_rebase_call;
16
17IERC20 _ampl_token;

Recommendation:

We advise them to be set so to avoid potential compilation discrepancies in the future as the current behaviour is for the compiler to assign one automatically.

Alleviation:

Both variables had a visibility specifier explicitly set.

AMP-02C: Redundant Function Block

TypeSeverityLocation
Code StyleInformationalAMPLRebaser.sol:L36-L37

Description:

The _rebase function is a virtual function that is meant to be overridden by derivative implementations.

Example:

contracts/AMPLRebaser.sol
36function _rebase(uint256 old_supply, uint256 new_supply) internal virtual {
37}

Recommendation:

We advise the contract to be set as abstract and the function's code block to be omitted ({}) to enforce proper inheritance via code.

Alleviation:

The function block was properly removed from the codebase.

AMP-03C: Variable Mutability Specifier

TypeSeverityLocation
Gas OptimizationInformationalAMPLRebaser.sol:L17, L21

Description:

The linked variable is assigned to only once during the contract's constructor.

Example:

contracts/AMPLRebaser.sol
19constructor(IERC20 ampl_token) {
20 require(address(ampl_token) != address(0), "AMPLRebaser: Invalid ampl token address");
21 _ampl_token = ampl_token;
22 last_ampl_supply = _ampl_token.totalSupply();
23 last_rebase_call = block.timestamp;
24}

Recommendation:

We advise it to be set as immutable greatly optimizing its read access gas cost.

Alleviation:

The ampl_token is now properly declared as an immutable variable optimizing the codebase.