Omniscia DAFI Audit
RebaseEngine Code Style Findings
RebaseEngine Code Style Findings
REE-01C: Inexistent Visibility Specifiers
Type | Severity | Location |
---|---|---|
Code Style | Informational | [RebaseEngine.sol:L11](https://github.com/DAFIProtocol/dDAFI/blob/d08c795cdf3455616f403d1468e02ec234ab01ef/contracts/rebase engine/RebaseEngine.sol#L11), [L12](https://github.com/DAFIProtocol/dDAFI/blob/d08c795cdf3455616f403d1468e02ec234ab01ef/contracts/rebase engine/RebaseEngine.sol#L12) |
Description:
The linked variables contain no visibility specifier explicitly set.
Example:
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
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | [RebaseEngine.sol:L65](https://github.com/DAFIProtocol/dDAFI/blob/d08c795cdf3455616f403d1468e02ec234ab01ef/contracts/rebase engine/RebaseEngine.sol#L65), [L94](https://github.com/DAFIProtocol/dDAFI/blob/d08c795cdf3455616f403d1468e02ec234ab01ef/contracts/rebase engine/RebaseEngine.sol#L94) |
Description:
The getEightDecimals
function yields the value of 1e8
.
Example:
63//Neutralizing the demand factor which was multiplied to fees deposited while calculating the rewards64uint feesDeposited = database.getFeesDeposited() == 0 || pool.lastDemandFactor == 0 ? 065: (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
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | [RebaseEngine.sol:L41](https://github.com/DAFIProtocol/dDAFI/blob/d08c795cdf3455616f403d1468e02ec234ab01ef/contracts/rebase engine/RebaseEngine.sol#L41), [L81](https://github.com/DAFIProtocol/dDAFI/blob/d08c795cdf3455616f403d1468e02ec234ab01ef/contracts/rebase engine/RebaseEngine.sol#L81), [L98](https://github.com/DAFIProtocol/dDAFI/blob/d08c795cdf3455616f403d1468e02ec234ab01ef/contracts/rebase engine/RebaseEngine.sol#L98) |
Description:
The rebase
, _rebasePool
and _rebaseStake
functions yield a bool
that will always be true
as no execution path yields false
.
Example:
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.