Omniscia DAFI Protocol Audit
dToken Code Style Findings
dToken Code Style Findings
DTO-01C: Codebase Optimization
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | dToken.sol:L65-L77 |
Description:
The enable and disable prefixed functions toggle the state of the same variable.
Example:
65function enableTransfer() public onlyOwner {66
67 require(!transferAllowance,"Already Enabled");68
69 transferAllowance = true;70}71
72function disableTransfer() public onlyOwner {73
74 require(transferAllowance,"Already Disabled");75
76 transferAllowance = false;77}Recommendation:
We advise them to be combined into a single function that either directly sets it or toggles it to optimize the bytecode of the contract.The development team has acknowledged this exhibit but decided to not apply its remediation in the current version of the codebase citing time constraints.
Alleviation:
The development team has acknowledged this exhibit but decided to not apply its remediation in the current version of the codebase citing time constraints.
DTO-02C: Redundant Assignment
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | dToken.sol:L28 |
Description:
All values in Solidity are initiated to a default value which is equivalent to 0 in the respective data type.
Example:
24constructor(string memory _name, string memory _symbol) public Ownable(msg.sender){ 25 26 name = _name;27 symbol = _symbol;28 _totalSupply = 0;29
30}Recommendation:
We advise the assignment of 0 to be removed from the constructor as it is consequently redundant.The development team has acknowledged this exhibit but decided to not apply its remediation in the current version of the codebase citing time constraints.
Alleviation:
The development team has acknowledged this exhibit but decided to not apply its remediation in the current version of the codebase citing time constraints.
DTO-03C: Redundant Check
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | dToken.sol:L47 |
Description:
The require check imposed within burn is redundant as it is indirectly evaluated by the sub invocation on the balances.
Example:
46function burn(uint256 _value, address _beneficiary) external onlyOwner {47 require(balanceCheck(_beneficiary) >= _value,"User does not have sufficient synths to burn");48 uint256 _value1 = (_value.mul(1 ether)).div(demandFactor);49 _totalSupply = _totalSupply.sub(_value1);50 balances[_beneficiary] = balances[_beneficiary].sub(_value1);51 52 emit Transfer(_beneficiary, address(0), _value);53}Recommendation:
We advise it to be safely omitted from the codebase.The development team has acknowledged this exhibit but decided to not apply its remediation in the current version of the codebase citing time constraints.
Alleviation:
The development team has acknowledged this exhibit but decided to not apply its remediation in the current version of the codebase citing time constraints.