GivingThanks

First Flight #28
Beginner FriendlyFoundry
100 EXP
View results
Submission Details
Severity: low
Invalid

Missing Event in `changeAdmin` Function

Description
The changeAdmin function allows the current admin to change the admin address. However, there is currently no event emitted to log this change. Emitting an event is important for tracking changes to the admin address on the blockchain.

Code Snippet

function changeAdmin(address newAdmin) public {
require(msg.sender == admin, "Only admin can change admin");
admin = newAdmin;
}

Recommendation
Add an event declaration for admin changes and emit this event within the changeAdmin function after successfully changing the admin address. This will provide a clear log of admin changes on the blockchain.

Code Snippet

// Declare the AdminChanged event
event AdminChanged(address indexed oldAdmin, address indexed newAdmin);
function changeAdmin(address newAdmin) public {
require(msg.sender == admin, "Only admin can change admin");
address oldAdmin = admin; // Store the old admin address
admin = newAdmin;
emit AdminChanged(oldAdmin, newAdmin); // Emit the AdminChanged event
}
Updates

Lead Judging Commences

n0kto Lead Judge 12 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.