Omniscia Impact Market Audit
DonationMinerImplementation Code Style Findings
DonationMinerImplementation Code Style Findings
DMI-01C: Event Emission Optimizations
Type | Severity | Location |
---|---|---|
Gas Optimization | DonationMinerImplementation.sol:L287-L302, L312-L315, L328-L331, L342-L345, L354-L357, L366-L369 |
Description:
The linked event emissions can be optimized rendering the local variables redundant.
Example:
contracts/donationMiner/DonationMinerImplementation.sol
305/**306 * @notice Updates claimDelay value307 *308 * @param _newClaimDelay Number of reward periods a donor has to wait after309 * a donation until he will be able to claim his reward310 */311function updateClaimDelay(uint256 _newClaimDelay) external override onlyOwner {312 uint256 _oldClaimDelay = claimDelay;313 claimDelay = _newClaimDelay;314
315 emit ClaimDelayUpdated(_oldClaimDelay, _newClaimDelay);316}
Recommendation:
We advise the event emissions to be performed prior to the variables being adjusted thus permitting the events to be emitted with the current state variables and input arguments no longer requiring local variables.
Alleviation:
The linked code has been updated to emit the events prior to the variables being adjusted thus eliminating the need for temporary local variables and optimizing the codebase.