Omniscia Platypus Finance Audit
Asset Code Style Findings
Asset Code Style Findings
ASS-01C: Redundant In-Memory Declarations
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | Asset.sol:L103, L122 |
Description:
The linked setter functions redundantly declare an in-memory variable that is then emitted in the function's event
.
Example:
98/**99 * @notice Changes asset max supply. Can only be set by the contract owner.100 * @param maxSupply_ the new asset's max supply101 */102function setMaxSupply(uint256 maxSupply_) external onlyOwner {103 uint256 oldMaxSupply = _maxSupply;104 _maxSupply = maxSupply_;105 emit MaxSupplyUpdated(oldMaxSupply, maxSupply_);106}
Recommendation:
We advise the event
to be emitted prior to the value being written to storage thus rendering the in-memory variable redundant.
Alleviation:
The event
emission statements have been optimised accordingly.
ASS-02C: Redundant User-Defined Getters
Type | Severity | Location |
---|---|---|
Code Style | Informational | Asset.sol:L90-L96, L108-L114, L136-L142, L144-L150, L201-L206, L228-L233 |
Description:
The linked functions are meant to return private
variables of the same name that contain the underscore (_
) prefix.
Example:
108/**109 * @notice Gets current Pool address110 * @return The current Pool address for Asset111 */112function pool() external view returns (address) {113 return _pool;114}
Recommendation:
We advise the functions to be omitted from the codebase, the variables to be renamed sans the underscore and them to be set as public
thereby ensuring the compiler generates a getter function for them automatically. In general, compiler-generated getter functions are preferable over user-defined ones as the latter are prone to human error such as improper maintenance.
Alleviation:
The Platypus team considered this exhibit but opted not to apply a remediation for it.
ASS-03C: Redundant Variable Declarations
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | Asset.sol:L29-L32 |
Description:
The _name
and _symbol
variables are redundantly declared as equivalent variables sans the underscore (_
) prefix already exist and contain the same value in the ERC20Upgradeable
implementation.
Example:
29/// @notice Name of the asset30string public _name;31/// @notice Symbol of the asset32string public _symbol;
Recommendation:
We advise them to be safely omitted from the codebase.
Alleviation:
They have been safely omitted from the codebase.