Omniscia Keyko Audit
DonationMinerImplementation Code Style Findings
DonationMinerImplementation Code Style Findings
DMI-01C: Inefficient Event Storage Read
Type | Severity | Location |
---|---|---|
Gas Optimization | Informational | DonationMinerImplementation.sol:L357, L359 |
Description:
The linked event emit
s the values of variables in storage that were written to by the function itself with in-memory values.
Example:
contracts/token/DonationMinerImplementation.sol
350/**351 * @notice Updates Treasury address352 *353 * @param newTreasury_ address of new treasury_ contract354 */355function updateTreasury(ITreasury newTreasury_) external override onlyOwner {356 address oldTreasuryAddress = address(_treasury);357 _treasury = newTreasury_;358
359 emit TreasuryUpdated(oldTreasuryAddress, address(_treasury));360}
Recommendation:
We advise the in-memory values from the function arguments to be utilized directly significantly reducing the gas cost of those functions.
Alleviation:
The event
emission statements have been optimised accordingly.
DMI-02C: Redundant User-Defined Getter Functions
Type | Severity | Location |
---|---|---|
Code Style | Informational | DonationMinerImplementation.sol:L151-L234, L252-L267, L285-L318 |
Description:
All linked functions can be omitted from the codebase by declaring the corresponding variables returned as public
and renaming them.
Example:
contracts/token/DonationMinerImplementation.sol
151/**152 * @notice Returns the cUSD contract address153 */154function cUSD() external view override returns (IERC20) {155 return _cUSD;156}157
158/**159 * @notice Returns the IPCT contract address160 */161function IPCT() external view override returns (IERC20) {162 return _IPCT;163}164
165/**166 * @notice Returns the Treasury contract address167 */168function treasury() external view override returns (ITreasury) {169 return _treasury;170}
Recommendation:
We advise this to be done so to significantly reduce the code size of the contract and ensure ease-of-maintenance of the codebase.
Alleviation:
The variables were renamed and adjusted as advised.