Root Cause: Implementation of changeOwner when transferOwnership is already available from OpenZeppelin's Ownable
Impact: Code bloat and potential confusion about which function to use
https://github.com/Cyfrin/2024-10-trick-or-treat/blob/main/src/TrickOrTreat.sol#L156-L158
The contract implements a custom changeOwner function:
This is redundant because:
The contract inherits from OpenZeppelin's Ownable: contract SpookySwap is ERC721URIStorage, Ownable(msg.sender), ReentrancyGuard
Ownable already provides a transferOwnership function with the same functionality
The custom function adds no additional features or checks
It merely wraps the existing transferOwnership function
Code bloat
Potential confusion about which function should be used
Unnecessary gas costs for deployment
Manual Review
Remove the redundant changeOwner function and use OpenZeppelin's transferOwnership directly:
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.