Hello Everyone,
I have a question on the usage of contracts-upgradable. I moved my contracts to @openzeppelin/contracts-upgradeable@solc-0.7. I adjusted my import statements as well as moved my constructor code to initialize. I am having problem with the ownership of the contracts during deployment. Here is the general structure of one contract. There is no constructor so I did not add any initialize function using the Initialiazable.
contract ThisContract is OwnableUpgradeable {
OtherContract otherContract ;
// no constructor
// no initialize
....
function setOtherContract(OtherContract _otherContract) public onlyOwner {
otherContract = _otherContract;
}
...
}
After ThisContract is deployed I placed a console.log for its owner() in the deployment script. It shows zero-address. Therefore, thisContract.setOtherContract(otherContract) fails with ownership error as well.
How do you assign the initial ownership during deployment? Is it not automatically getting it as it is doing in the non-upgradable version? Also, once this is set properly the deploymentAccount could just call transferOwnership for the final owner. Am I correct?
By the way, although I am using upgradable contracts I am still using my normal deployment script for now. So, there is no proxy as of now? Can these upgradable contracts be deployed as such? Maybe this is my problem.
Thank you.
Regards,
Nihat