Omniscia WagmiDAO Audit
WagmiAutoStake Code Style Findings
WagmiAutoStake Code Style Findings
WAS-01C: Redundant Memory Declaration
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | WagmiAutoStake.sol:L76, L78 |
Description:
The linked statements perform a memory declaration of a storage value, write over it with an in-memory value and emit
an event right after with the value read from storage before the write and the input argument of the function.
Example:
75function _setOwner(address newOwner) private {76 address oldOwner = _owner;77 _owner = newOwner;78 emit OwnershipTransferred(oldOwner, newOwner);79}
Recommendation:
We advise the event
emission to be relocated before the storage
write to directly utilize the storage member and render the in-memory variable declaration redundant within the code.
Alleviation:
The statements were adjusted as per our recommendation.
WAS-02C: Redundant Visibility Specifiers
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | WagmiAutoStake.sol:L638-L641 |
Description:
The linked variables have a public
visibility specifier yet are meant to represent internally accessible constant
values.
Example:
638uint256 public constant MAX_PERFORMANCE_FEE = 500;639uint256 public constant MAX_CALL_FEE = 100;640uint256 public constant MAX_WITHDRAW_FEE = 100;641uint256 public constant MAX_WITHDRAW_FEE_PERIOD = 72 hours;
Recommendation:
We advise them to be set as private
or internal
greatly optimizing the deployment size and gas cost of the contract.
Alleviation:
All variables have now been set to internal
.
WAS-03C: Redundant constructor
Implementation
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | WagmiAutoStake.sol:L484-L486 |
Description:
The linked constructor
implementation is redundant as its statements assign storage values equivalent to the existing default ones.
Example:
479bool private _paused;480
481/**482 * @dev Initializes the contract in unpaused state.483 */484constructor() {485 _paused = false;486}
Recommendation:
We advise the constructor
implementation to be safely omitted optimizing the codebase's gas cost.
Alleviation:
The constructor
has been safely omitted.