Skip to content

Ownable2StepUpgradeable requires initializing OwnableUpgradeable #4690

@ericglau

Description

@ericglau

🧐 Motivation
Ownable2StepUpgradeable inherits OwnableUpgradeable.

Ownable2StepUpgradeable has initializer __Ownable2Step_init()
OwnableUpgradeable has initializer __Ownable_init(address initialOwner)

Currently contracts that inherit Ownable2StepUpgradeable need to call __Ownable_init(address initialOwner) to set the initial owner. This is not obvious because users who are just inheriting Ownable2StepUpgradeable directly may not know about this transitive requirement.

This differs from the non-upgradeable scenario which was discussed in #4368 (comment), because contracts that extend the non-upgradeable Ownable2Step would fail compilation if they did not call the Ownable constructor.

Next steps
Consider whether the initializer of Ownable2StepUpgradeable should also initialize the owner. This would occur if Ownable2Step calls its parent constructor, however there are some drawbacks to multiple inheritance mentioned in comment #4368 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions