DeFiFoundry
20,000 USDC
View results
Submission Details
Severity: low
Invalid

Ownership Transfer Process (2-step)

Summary

The contract allows direct transfer of ownership without a confirmation step, which is risky as it might be changed accidentally or maliciously.

Impact

Implement a 2-step ownership transfer process where the current owner nominates a new owner, and the new owner must accept the nomination. This ensures that ownership cannot be transferred without the new owner's consent.

Recommendations

address public pendingOwner;
function transferOwnership(address _newOwner) external onlyOwner {
if (_newOwner == address(0)) revert InvalidAddress();
pendingOwner = _newOwner;
}
function acceptOwnership() external {
if (msg.sender != pendingOwner) revert NotOwner();
owner = pendingOwner;
pendingOwner = address(0);
emit OwnershipTransferred(owner); // Emit an event to record the transfer
}
event OwnershipTransferred(address indexed newOwner);
Updates

Lead Judging Commences

inallhonesty Lead Judge about 1 year ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

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