Hey @paulinablaszk! Have you run zos add NewContract
and zos push
on the corresponding network, so the App has registered the NewContract implementation? Does it work fine if you run zos create NewContract
directly? And if all of the above fails, can you upload your project somewhere, so we can help in troubleshooting it? Thanks!
Hi @spalladino. Thanks for your response. Yes, I’ve added and pushed NewContract. zos create NewContract
also works fine. I uploaded my project here https://github.com/paulinablaszk/zos-fact
Hey @paulinablaszk! The issue that is causing the REVERT is in https://github.com/paulinablaszk/zos-fact/blob/master/contracts/MyContract.sol#L14. There, App#create
is being called with 3 params (package name, contract name, and an admin address), which corresponds to the App interface in v2.2. However, in your project you have v2.1 as a dependency, where the App interface is slightly different. In 2.1, create
takes 3 params: package name, contract name, and the data
that will be forwarded to the contract upon initialization. The admin address you are supplying is actually being parsed as that data
, is sent to the contract, and thus fails.
TL;DR: You should either upgrade to zos and zos-lib v2.2 (recommended) or change the call to create
by removing the last 0x69E3a4A7Ff6C1AEff4B096E4A6CF4d094D195a5A
parameter.
Hope this helps! Cheers!
I have one more question connected with this topic. I upgraded my zos and zos-lib to 2.2 but now MyContract.sol does not compile because of the create
function. I am getting an error:
TypeError: Wrong argument count for the function call: 3 arguments given but expected 4.
Is it correct behavior when the 4th param data
is optional?
Update:
I tried to put as data
first 4 bytes of the Keccak hash of the signature initialize()
and function app.create()
has returned some address(?) but NewContract
wasn’t deployed to the network
truffle(ganache)> contract.methods.createNewContract("zos-fact", "NewContract", "0x69E3a4A7Ff6C1AEff4B096E4A6CF4d094D195a5A", "0x8129fc1c").call() '0xD6C3A17f91D873352E882315269c1183278a96Ae'
Thanks
Greetings @spalladino,
The following is the content of my zos.json
{
"zosversion": "2",
"name": "TheFaustFlick",
"version": "0.1.0",
"contracts": {},
"dependencies": {
"openzeppelin-eth": "^2.1.3"
}
}
Since I already initialized my project with zos init TheFaustFlick
, could you please point to me the documentation on how do I properly upgrade zos and zos.lib to the latest version?
g.a.
Hi @jaureguino, I’ve used
npm install zos@latest
and
npm install zos-lib@latest
Or you can choose any other from “Versions” tab here:
Thanks a lot @paulinablaszk,
I just used both commands and they worked perfectly. However, the content of my zos.json file remains the same, is that ok? I am new on this, hence my basic questions…
@jaureguino No problem, nice to help
In zos.json you have:
The documentation says: The field zosversion
indicates the major version of ZeppelinOS you are using
So it doesn't change because it can by only "1" or "2" (without detailed versions).
and "openzeppelin-eth": "^2.1.3"
is OpenZeppelin EVM package - it is not the same as zos-lib
. You should find info about zos-lib
version in your package.json file.
Thank you so much for making it all clear for me, you are very kind.
Cheers and keep on coding!
g.a.
How did you do that? After linking the openzeppelin-eth evm package, my app instance does not register the implementation addresses and thus i cannot use
app.create("openzeppelin-eth", "StandaloneERC20", msg.sender, abi.encode(...))
app.getImplementation("openzeppelin-eth", "StandaloneERC20")
returns '0x0000000000000000000000000000000000000000'
The documentation under https://docs.zeppelinos.org/docs/writing_contracts.html#creating-new-instances-from-your-contract-code states:
An advanced alternative, if you need to create upgradeable contracts on the fly, is to keep an instance of your ZeppelinOS
App
in your contracts.
But how? I'm out of ideas
Hi @imbenwolf, did you use:
zos push --deploy-dependencies
? (–deploy dependencies is needed when you use openzeppelin-eth on your local network)
and then zos publish
?
You can also check new example on zos github: Creating instances from solidity . It was very helpful for me when I was trying to create an upgradeable smart contract using factory
Hi @spalladino
Quick question: Is there a reason why most contracts in zos-lib only support solidity version 0.4.24?
And also, thank you for all the great work with zeppelinos!
Hey @imbenwolf, thanks for asking! Mind opening a new topic so other community members with the same question can easily find it?
Thanks
Hi @martriay
Here is the link to the new topic: Zos-lib solidity version 0.4.24
Let me know if I should create a feature request on Github aswell.
Thanks
Apparently there’s no need since it will be released by end of month, but for in the future you could create a feature (or pull ) request, definitely.