Omniscia Platypus Finance Audit

Whitelist Code Style Findings

Whitelist Code Style Findings

WHI-01C: Redundant User-Defined Getter

TypeSeverityLocation
Gas OptimizationInformationalWhitelist.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 wallets
12event ApproveWallet(address);
13event RevokeWallet(address);
14
15constructor() {}
16
17/// @notice approves wallet
18/// @param _wallet the wallet to approve
19function approveWallet(address _wallet) external onlyOwner {
20 wallets[_wallet] = true;
21
22 emit ApproveWallet(_wallet);
23}
24
25/// @notice revokes wallet
26/// @param _wallet the wallet to revoke
27function revokeWallet(address _wallet) external onlyOwner {
28 wallets[_wallet] = false;
29
30 emit RevokeWallet(_wallet);
31}
32
33/// @notice checks if _wallet is whitelisted
34/// @param _wallet the wallet to check
35/// @return true if wallet is whitelisted
36function 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

TypeSeverityLocation
Code StyleInformationalWhitelist.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.