Creating instances from solidity - Zweb3 error


I was trying to test new example Creating instances from solidity, but when I run a sample script I am getting an error:
Error: { Error: ZWeb3 must be initialized with a web3 provider

Do you know what the reason for this error may be?
I will be grateful for your help.


Hi again, reinstalling my dependencies helped, so the question above is out of date.

But I want to ask about the instance proxy created with function createInstance(), why address of the proxy doesn’t show up in the file? Is it possible to update this Instance contract using zos update?


Hey @paulinablaszk! Unfortunately it is not possible to do that currently: gets updated by the CLI when it creates a new proxy via zos create, but since in this case the proxy is being created out-of-band, the CLI has no way to track it and add it to the file.

You could handle that manually by scanning all ProxyCreated events emitted by the App and adding the proxy entry to the file.

Update: actually, what you want to do could be handled via the status --fix command, which will attempt to reconstruct your file based on events scanned from the network. However, that command is deprecated and may introduce potential issues. I’d suggest taking a look at it to see if works for your specific scenario, or borrowing some pieces of code from it.

We plan on having better support for the use case of creating on-chain proxies, but the integration from lib back to CLI is currently lacking, specially since there are a few cases that are rather difficult to handle.


@spalladino Thank you very much for the comprehensive explanation. I will check which solution will be the best in my case