Omniscia DAFI Audit

RebaseEngine Code Style Findings

RebaseEngine Code Style Findings

REE-01C: Inexistent Visibility Specifiers

Description:

The linked variables contain no visibility specifier explicitly set.

Example:

contracts/rebase
11INetworkDemand networkDemand;
12StakingDatabase database;

Recommendation:

We advise one to be set for each variable as currently the compiler assigns a visibility specifier automatically which can cause compilation discrepancies should the default visibility change.

Alleviation:

Visibility specifiers were introduced for both of the linked variables, however, newly linked variables possess no visibility specifiers.

REE-02C: Redundant Getter Invocation

Description:

The getEightDecimals function yields the value of 1e8.

Example:

contracts/rebase
63//Neutralizing the demand factor which was multiplied to fees deposited while calculating the rewards
64uint feesDeposited = database.getFeesDeposited() == 0 || pool.lastDemandFactor == 0 ? 0
65: (database.getFeesDeposited() * database.getEightDecimals()) / pool.lastDemandFactor;

Recommendation:

We advise the value to be directly incorporated within the contract to avoid a redundant external call.

Alleviation:

The EIGHT_DECIMALS constant value was declared in the codebase thus rendering the external calls redundant.

REE-03C: Redundant Return Value

Description:

The rebase, _rebasePool and _rebaseStake functions yield a bool that will always be true as no execution path yields false.

Example:

contracts/rebase
37function rebase(address user) external override onlyWhitelist returns (bool) {
38 _rebasePool();
39 _rebaseStake(user);
40
41 return true;
42}

Recommendation:

We advise the bool to be dropped entirely reducing their gas cost.

Alleviation:

All redundant bool returns were dropped from the codebase.