Omniscia WagmiDAO Audit
FamilyToken Code Style Findings
FamilyToken Code Style Findings
FTN-01C: Redundant Memory Declaration
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | FamilyToken.sol:L80, L82, L589, L591 |
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:
75/**76 * @dev Transfers ownership of the contract to a new account (`newOwner`).77 * Internal function without access restriction.78 */79function _transferOwnership(address newOwner) internal virtual {80 address oldOwner = _owner;81 _owner = newOwner;82 emit OwnershipTransferred(oldOwner, newOwner);83}
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.
FTN-02C: Redundant User-Defined Getter
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | FamilyToken.sol:L549, L563-L565 |
Description:
The linked private
variable has a user-defined getter function with the same name sans the underscore (_
) prefix.
Example:
560/**561 * @dev Returns the address of the current minter.562 */563function minter() public view virtual returns (address) {564 return _minter;565}
Recommendation:
We advise the user-defined getter function to be omitted and the variable to be renamed omitting the underscore and setting it as public
, thereby using the compiler-generated getter function instead.
Alleviation:
The WagmiDAO team opted to not apply this adjustment to the codebase.