Picking No when prompted to call method after deployment results in error

Originally posted here

When using the StandaloneERC20 as per the guide if you pick “No” when asked to call a function after deployment, an error is produced.

? Pick a contract to instantiate @openzeppelin/contracts-ethereum-package/StandaloneERC20
? Pick a network development
√ Deploying @openzeppelin/contracts-ethereum-package dependency to network dev-1564745320775
All contracts are up to date
? Do you want to call a function on the instance after creating it? No
Possible initialization method (initialize) found in contract. Make sure you initialize your instance.
Invalid JSON RPC response: ""

Reproduce by following above flow.

Recommended fix: remove Yes/No option from contracts that can’t be deployed without those an init function being called.

:computer: Environment

  • Windows 10 + Cmder
  • contracts-ethereum-package@2.2.1
  • openzeppelin-cli 2.5.1
1 Like

Hi @Swader

I think that there is potential to improve the prompt message to mention initialization.

Do you want to call a function on the instance after creating it?

I get a warning selecting No to initialize.

Possible initialization method (initialize) found in contract. Make sure you initialize your instance.

I don’t get the RPC error. Did ganache-cli stop running and / or produce an error?
What version of ganache-cli are you running?

$ npx openzeppelin create
No contracts found to compile.
? Pick a contract to instantiate @openzeppelin/contracts-ethereum-package/StandaloneERC20
? Pick a network development
✓ Deploying @openzeppelin/contracts-ethereum-package dependency to network dev-1565060842511
All contracts are up to date
? Do you want to call a function on the instance after creating it? No
Possible initialization method (initialize) found in contract. Make sure you initialize your instance.
✓ Setting everything up to create contract instances
✓ Instance created at 0xba5b7E64bae1f953816B9f3a7de6B5b5378F9Fb8
0xba5b7E64bae1f953816B9f3a7de6B5b5378F9Fb8

Hi @Swader

I have created an issue to improve the wording of the prompt. https://github.com/OpenZeppelin/openzeppelin-sdk/issues/1197

Are you still getting the RPC error? If you are, I would appreciate any more details you can provide so that I can try to reproduce the issue.

Hey, I’ll look into it again as soon as time permits and give detailed feedback!

1 Like