Closed osnwt closed 4 years ago
This is an issue about the OpenZeppelin CLI, I'm transferring it to the SDK repo.
Hi @osnwt. Can you share some more details about the contract you're trying to deploy? Does it have an initializer function with arguments?
It doesn't matter. I tried simplest test contract which does not have/use the initialize
function. I can deploy it interactively as both regular and upgradeable. From script using '--no-interactive' I have an error (see logs below). The only difference with interactive deployment is that it asks about Init function (do I want to run it and which one if yes). There is no command line equivalent to this question in deploy command. So if I want to run initializer (and which one), or don't want, I have no way to specify this in the script.
Interactive deployment:
+ yarn -s run oz:deploy --network development --kind regular DocumentManager
Nothing to compile, all contracts are up to date.
✓ Deployed instance of DocumentManager
0xa8CCc62837Fc861c4c0a10264f7191871F8dad07
+ yarn -s run oz:deploy --network development --kind upgradeable DocumentManager
Nothing to compile, all contracts are up to date.
✓ Contract DocumentManager deployed
All implementations have been deployed
? Call a function to initialize the instance after creating it? No
✓ Setting everything up to create contract instances
✓ Instance created at 0x2D2EcEEB9cb1dE1A7E5a853159f0F48fF0D3ca86
To upgrade this instance run 'oz upgrade'
0x2D2EcEEB9cb1dE1A7E5a853159f0F48fF0D3ca86
Non-interactive deployment:
+ yarn -s run oz:deploy --no-interactive --network development --kind regular DocumentManager
Nothing to compile, all contracts are up to date.
✓ Deployed instance of DocumentManager
0x587c8347892386e8cbF58F16e7559aBB021429F0
+ yarn -s run oz:deploy --no-interactive --network development --kind upgradeable DocumentManager
Nothing to compile, all contracts are up to date.
Contract DocumentManager is not deployed to dev-1337.
I think you should provide some options to deploy command like:
--init-function fn
--init-args ...
If no --init-function
specified, it does not run. If it's given, then it uses optional --init-args
as arguments.
Unforunately this is a different issue that has nothing to do with --init
. Please see https://github.com/OpenZeppelin/openzeppelin-sdk/issues/1518#issuecomment-608036695 for the explanation and workaround.
deploy
is able to call initialize
on an upgradeable contract. The syntax is the same as that for constructor arguments on regular deploys. You should include the initializer arguments as extra arguments to oz deploy
, after the contract name. There is no need for an --args
flag. As for --init-function
, deploy
currently will assume that the function is called initialize
as this is the case in general, and it's not possible to customize it at the moment. If you have an initializer function with a different name please open an issue requesting the feature!
Closing this issue in favor of #1518.
This works:
This doesn't:
The question about init has no command-line option:
? Call a function to initialize the instance after creating it? (Y/n)
In addition, -k option has broken help (see below).
How to deploy upgradeable contract from script?