Omniscia Native Audit

PoolFactory Code Style Findings

PoolFactory Code Style Findings

PFY-01C: Deprecated Conditional Revert Pattern

TypeSeverityLocation
Code StylePoolFactory.sol:L32-L34, L40-L42

Description:

The referenced statements implement an if-revert pattern that is ill-advised.

Example:

contracts/PoolFactory.sol
31function addPoolCreator(address _poolcreator) external onlyOwner whenNotPaused {
32 if (isPoolCreator[_poolcreator]) {
33 revert("PoolCreator is already added");
34 }
35 isPoolCreator[_poolcreator] = true;
36 emit AddPoolCreator(_poolcreator);
37}
38
39function removePoolCreator(address _poolcreator) external onlyOwner whenNotPaused {
40 if (!isPoolCreator[_poolcreator]) {
41 revert("PoolCreator has not added");
42 }
43 isPoolCreator[_poolcreator] = false;
44 emit RemovePoolCreator(_poolcreator);
45}

Recommendation:

We advise either specialized error declarations to be made on the contract that the revert statements yield or them to be replaced by require checks either of which we consider an adequate remediation to this exhibit.

Alleviation:

Both if-revert patterns were replaced by require checks as advised.

PFY-02C: Generic Typographic Mistakes

TypeSeverityLocation
Code StylePoolFactory.sol:L27, L31, L39

Description:

The referenced lines contain typographical mistakes (i.e. private variable without an underscore prefix) or generic documentational errors (i.e. copy-paste) that should be corrected.

Example:

contracts/PoolFactory.sol
27function checkPoolCreator(address _poolcreator) public view returns (bool) {

Recommendation:

We advise them to be corrected enhancing the legibility of the codebase.

Alleviation:

The referenced typographic mistakes remain in the codebase. To note, in this particular case they referred to the poolcreator variable not conforming to the camelCase format.

PFY-03C: Inexistent Error Message

TypeSeverityLocation
Code StylePoolFactory.sol:L93

Description:

The linked require check has no error message explicitly defined.

Example:

contracts/PoolFactory.sol
93require(registry == address(0));

Recommendation:

We advise one to be set so to increase the legibility of the codebase and aid in validating the require check's condition.

Alleviation:

An error message was properly introduced for the referenced require check.

PFY-04C: Redundant Parenthesis Statements

TypeSeverityLocation
Code StylePoolFactory.sol:L98, L102

Description:

The referenced statements are wrapped in parenthesis (()) redundantly as they do not affect the order of operations.

Example:

contracts/PoolFactory.sol
97function getPool(address treasuryAddress) public view override returns (address) {
98 return (treasuryToPool[treasuryAddress]);
99}

Recommendation:

We advise the parenthesis to be safely omitted, optimizing the legibility of the codebase.

Alleviation:

The redundant parenthesis have been removed from all referenced statements.