Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Ownable2Step.acceptOwnership virtual #3960

Merged
merged 2 commits into from Jan 18, 2023

Conversation

Amxx
Copy link
Collaborator

@Amxx Amxx commented Jan 16, 2023

Ownable2Step.acceptOwnership is currently external non virtual. This prevents overriding the function.

IMO there are usecases where overriding this function is necessary. For example:

    uint256 public deadline;

    function transferOwnership(address newOwner) public virtual override {
        super.transferOwnership(newOwner); // this is onlyOwner
        deadline = block.timestamp + 2 days;
    }

    function acceptOwnership() public virtual override {
        require(deadline <= block.timestamp);
        delete deadline;
        super.acceptOwnership();
    }

PR Checklist

  • Changelog entry

@Amxx Amxx requested a review from frangio January 17, 2023 09:21
frangio
frangio previously approved these changes Jan 17, 2023
Copy link
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@frangio
Copy link
Contributor

frangio commented Jan 17, 2023

👇 Missing changelog.

@frangio frangio merged commit c9bc4f8 into OpenZeppelin:master Jan 18, 2023
@Amxx Amxx deleted the refactor/acceptOwnership-virtual branch January 18, 2023 10:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants