-
Notifications
You must be signed in to change notification settings - Fork 200
oz deploy should support --init and --args, same as oz create in 2.7 #1568
Comments
Hi @pash7ka ! I’m sorry that you had this issue. Thanks so much for reporting it! The project owner will review and triage this issue as soon as they can. In the meantime, you can try the following workaround: Continue to use |
Thank you! That's the workaround I'm currently using. |
unfortunately, the workaround does not work for me. is there any public example for non-interactive scripted use of oz cli? below is output from first trying non-interactive (fails) and then interactive (succeeds): (cpy382_1) oberstet@intel-nuci7:~/scm/crossbario/xbr-protocol$ npx oz create --no-interactive --network ganache --init initialize XBRToken
The create command is deprecated. Use deploy instead.
✓ Compiling contracts with Truffle, using settings from truffle.js file
Truffle output:
Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/XBRCatalog.sol
> Compiling ./contracts/XBRChannel.sol
> Compiling ./contracts/XBRDomain.sol
> Compiling ./contracts/XBRMaintained.sol
> Compiling ./contracts/XBRMarket.sol
> Compiling ./contracts/XBRNetwork.sol
> Compiling ./contracts/XBRNetworkProxy.sol
> Compiling ./contracts/XBRTest.sol
> Compiling ./contracts/XBRToken.sol
> Compiling ./contracts/XBRTypes.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/Initializable.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/cryptography/ECDSA.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/utils/EnumerableSet.sol
> Artifacts written to /home/oberstet/scm/crossbario/xbr-protocol/build/contracts
> Compiled successfully using:
- solc: 0.6.2+commit.bacdbe57.Emscripten.clang
Contract XBRToken is not deployed to dev-5777.
(cpy382_1) oberstet@intel-nuci7:~/scm/crossbario/xbr-protocol$ npx oz create --network ganache XBRToken
The create command is deprecated. Use deploy instead.
✓ Compiling contracts with Truffle, using settings from truffle.js file
Truffle output:
Compiling your contracts...
===========================
> Compiling ./contracts/Migrations.sol
> Compiling ./contracts/XBRCatalog.sol
> Compiling ./contracts/XBRChannel.sol
> Compiling ./contracts/XBRDomain.sol
> Compiling ./contracts/XBRMaintained.sol
> Compiling ./contracts/XBRMarket.sol
> Compiling ./contracts/XBRNetwork.sol
> Compiling ./contracts/XBRNetworkProxy.sol
> Compiling ./contracts/XBRTest.sol
> Compiling ./contracts/XBRToken.sol
> Compiling ./contracts/XBRTypes.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/Initializable.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/access/AccessControl.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/cryptography/ECDSA.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/math/SafeMath.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/token/ERC20/IERC20.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/utils/Address.sol
> Compiling @openzeppelin/contracts-ethereum-package/contracts/utils/EnumerableSet.sol
> Artifacts written to /home/oberstet/scm/crossbario/xbr-protocol/build/contracts
> Compiled successfully using:
- solc: 0.6.2+commit.bacdbe57.Emscripten.clang
✓ XBRTypes library uploaded
✓ Contract XBRToken deployed
All implementations have been deployed
? Call a function to initialize the instance after creating it? Yes
? Select which function * initialize()
✓ Setting everything up to create contract instances
✓ Instance created at 0x254dffcd3277C0b1660F6d42EFbB754edaBAbC2B
To upgrade this instance run 'oz upgrade'
0x254dffcd3277C0b1660F6d42EFbB754edaBAbC2B
(cpy382_1) oberstet@intel-nuci7:~/scm/crossbario/xbr-protocol$ |
Hi @oberstet
This way it does not ask any interactive questions. |
fantastic! thanks, that works for me=)
may I ask 1 more Q? only slightly related .. but related to "how to deploy using non-interactive scripting". as in: how do I get rid of the hard-coded addresses in ^ (forwarding addresses of deployed contracts as constructor arguments in subsequent contract deployments) IOW: how do you manage dependencies between multiple contracts using os cli? in truffle, I am using
to establish dependencies, and also to await dependent contracts so that their addresses can be used as constructor arguments |
@oberstet You can read the address from stdout of the |
@frangio thanks! yeah, I've found out about the truffle plugin stuff in the meantime - and it works, including links=) const { deployProxy } = require('@openzeppelin/truffle-upgrades');
// ...
await deployer.link(XBRTypes, XBRToken);
const token_instance = await deployProxy(XBRToken, [],
{ deployer, unsafeAllowCustomTypes: true });
await deployer.link(XBRTypes, XBRNetwork);
const network_instance = await deployProxy(XBRNetwork, [token_instance.address, organization],
{ deployer, unsafeAllowCustomTypes: true }); |
@oberstet Note that since your Contracts which require linking an external library are not yet supported by the plugins, but we're working in that direction. See OpenZeppelin/openzeppelin-upgrades#144 and OpenZeppelin/openzeppelin-upgrades#52. |
With upgrade to 2.8
create
command is replaced withdeploy
. But the latter does not support--init
abd--args
arguments, so it's impossible to specify initializer from command line.The text was updated successfully, but these errors were encountered: