Omniscia DAFI Protocol Audit

DAFITOKENETH Code Style Findings

DAFITOKENETH Code Style Findings

DAF-01C: Inexistent Error Messages

TypeSeverityLocation
Code StyleInformationalDAFITOKENETH.sol:L46, L47, L56

Description:

The linked require checks have no error messages explicitly defined.

Example:

contracts/DAFITOKENETH.sol
46require(_beneficiary != address(0));
47require(_value > 0);
48require((_value + _totalSupply) <= maxSupply, "Minting amount exceeding max limit");

Recommendation:

We advise them to be set so to aid in the validation of the require's condition as well as the legibility of the codebase.

Alleviation:

The DAFI Protocol team evaluated this exhibit but opted not to apply a remediation for it in the current iteration of the codebase.

DAF-02C: Inexistent Visibility Specifiers

TypeSeverityLocation
Code StyleInformationalDAFITOKENETH.sol:L34, L35, L36

Description:

The linked variables have no visibility specifier explicitly set.

Example:

contracts/DAFITOKENETH.sol
34string constant _name = "DAFI Token";
35string constant _symbol = "DAFI";
36uint256 constant _decimals = 18;
37
38uint256 public maxSupply;

Recommendation:

We advise one to be set so to avoid potential compilation discrepancies in the future as the current behaviour is for the compiler to assign one automatically which may deviate between pragma versions.

Alleviation:

The DAFI Protocol team evaluated this exhibit but opted not to apply a remediation for it in the current iteration of the codebase.

DAF-03C: Suboptimal Code

TypeSeverityLocation
Gas OptimizationInformationalDAFITOKENETH.sol:L50

Description:

The linked addition can be performed unsafely as it is guaranteed to not overflow due to the require check that subcedes it.

Example:

contracts/DAFITOKENETH.sol
45function mint(uint256 _value, address _beneficiary) external onlyOwner {
46 require(_beneficiary != address(0));
47 require(_value > 0);
48 require((_value + _totalSupply) <= maxSupply, "Minting amount exceeding max limit");
49 balances[_beneficiary] = balances[_beneficiary] + _value;
50 _totalSupply = _totalSupply + _value;
51
52 emit Transfer(address(0), _beneficiary, _value);
53}

Recommendation:

We advise it to be executed within an unchecked code block to optimize the code's gas cost.

Alleviation:

The DAFI Protocol team evaluated this exhibit but opted not to apply a remediation for it in the current iteration of the codebase.

DAF-04C: Variable Mutability Specifiers

TypeSeverityLocation
Gas OptimizationInformationalDAFITOKENETH.sol:L8, L13, L38, L42

Description:

The linked variables are assigned to only once during the contract's constructor.

Example:

contracts/DAFITOKENETH.sol
41constructor() Ownable2(msg.sender) {
42 maxSupply = 2250000000 * 10**_decimals;
43}

Recommendation:

We advise them to be set as immutable greatly optimizing the codebase.

Alleviation:

The DAFI Protocol team evaluated this exhibit but opted not to apply a remediation for it in the current iteration of the codebase.