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

Deploying with deployProxy doesn't set deployer as owner #898

Closed
veljkoTNFT opened this issue Oct 17, 2023 · 3 comments
Closed

Deploying with deployProxy doesn't set deployer as owner #898

veljkoTNFT opened this issue Oct 17, 2023 · 3 comments

Comments

@veljkoTNFT
Copy link

veljkoTNFT commented Oct 17, 2023

I have this piece of code in my tests

//deploy factory
const Factory = await ethers.getContractFactory("Factory");
factoryContract = await upgrades.deployProxy(Factory, [token.target, someAddress]);
await factoryContract.waitForDeployment();

console.log("owner factory: " + await factoryContract.owner());

This prints out 0 address. I wanted to move to latest OZ v5 contracts and I have this issue in my tests. This same code works with 2.2.3 upgrades plugin and v4 of OpenZeppelin contracts. I'm using hardhat. Does anyone have this issue? Did something change in plugin, do I need to pass something more?

@ericglau
Copy link
Member

OpenZeppelin Contracts 5.0 requires an initialOwner as an initializer argument for Ownable.

In your initializer, you need to call

__Ownable_init(initialOwner);

See https://wizard.openzeppelin.com/ and select Ownable and enable Upgradeability for an example.

@ericglau ericglau closed this as not planned Won't fix, can't repro, duplicate, stale Oct 17, 2023
@veljkoTNFT
Copy link
Author

It's completely unintuitive that you are inheriting Ownable2StepUpgraadeable and you don't call init of that contract, but you call it on contract that is one step further in inheritance line.

@ericglau
Copy link
Member

@veljkoTNFT Thanks for the feedback. I've opened OpenZeppelin/openzeppelin-contracts#4690 for further consideration, feel free to continue the discussion there.

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

No branches or pull requests

2 participants