Omniscia MetaSoccer Audit
PlayersIdGenerator Code Style Findings
PlayersIdGenerator Code Style Findings
PIG-01C: Deprecated if-revert
Pattern
Type | Severity | Location |
---|---|---|
Code Style | PlayersIdGenerator.sol:L32-L36 |
Description:
The linked statements perform an if
clause that signals successful execution of the function and otherwise execute a revert
statement.
Example:
contracts/PlayersIdGenerator.sol
30///This is just a helper function to help with transparency31function typeName(uint256 _minterType) public pure returns(string memory) {32 if (_minterType == uint256(MinterTypes.Scouting)) {33 return "Scouting";34 }35
36 revert("Not existing");37}
Recommendation:
We advise the if-revert
structure to be changed to a single require
statement.
Alleviation:
The codebase now properly uses a single require
statement as advised.