Omniscia Platypus Finance Audit
Whitelist Code Style Findings
Whitelist Code Style Findings
WHI-01C: Redundant User-Defined Getter
| Type | Severity | Location |
|---|---|---|
| Gas Optimization | Informational | Whitelist.sol:L9, L33-L38 |
Description:
The wallets contract level variable is declared as public yet has a dedicated check getter function.
Example:
contracts/Whitelist.sol
9mapping(address => bool) public wallets;10
11/// @notice events of approval and revoking wallets12event ApproveWallet(address);13event RevokeWallet(address);14
15constructor() {}16
17/// @notice approves wallet18/// @param _wallet the wallet to approve19function approveWallet(address _wallet) external onlyOwner {20 wallets[_wallet] = true;21
22 emit ApproveWallet(_wallet);23}24
25/// @notice revokes wallet26/// @param _wallet the wallet to revoke27function revokeWallet(address _wallet) external onlyOwner {28 wallets[_wallet] = false;29
30 emit RevokeWallet(_wallet);31}32
33/// @notice checks if _wallet is whitelisted34/// @param _wallet the wallet to check35/// @return true if wallet is whitelisted36function check(address _wallet) external view returns (bool) {37 return wallets[_wallet];38}Recommendation:
We advise either the mapping to be set as internal or the getter function to be omitted as in the current implementation two different getters for the same purpose are generated.
Alleviation:
The wallets mapping is now set as internal.
WHI-02C: Redundant constructor Implementation
| Type | Severity | Location |
|---|---|---|
| Code Style | Informational | Whitelist.sol:L15 |
Description:
The linked constructor is redundant as it contains no statements.
Example:
contracts/Whitelist.sol
15constructor() {}Recommendation:
We advise it to be safely omitted from the codebase.
Alleviation:
The constructor has been safely omitted from the codebase.