Updating Docs Initiative

The ZOS <2.0.0> Docs is formatted with mostly tutorial-style examples which no longer work ‘out of the box.’ This seems to me to be due to breaking changes within Solidity-v0.5.0 and web3-v1.0.0. I’d like to begin updating the docs so that the tutorials work consistently across these breaking changes with an appropriate present-state snapshot. I’ve considered a few requirements and invite suggestions on how to proceed.

  1. Upgrade the contracts to Solidity 0.5.0

npm install zos-lib@2.1.0-rc.0 --global

  1. Include .methods and call() to the test commands required by web3-v1

truffle(local)> myContract = MyContract.at('<your-contract-address>')
truffle(local)> myContract.methods.x().toString().call()
42
truffle(local)> myContract.methods.s().call()
"hitchhiker"

2 Likes

Hey Jeff! Thank you for starting this initiative :slight_smile:

Hopefully other members see this and begin contributing as well.

I’ll go ahead and tag @spalladino and @ajsantander to see what they think of this.

1 Like

Hey Jeff, thanks so much for this!! We have recently updated (though haven’t published yet) the smart contracts code in the docs to work with Solidity 0.5. As for the changes for web3 1.0, I understand that truffle-contracts 5 still keeps all methods at the top level of the contract, meaning that there is no need to add the .methods and .call()/.send() required by web3 1.0; that said, it’s very likely that there are still some changes required in the docs for zos 2.1.0, Solidity 0.5, truffle 5, and web3 1.0. If you have recently gone through the docs, is there something else in particular that caught your attention? A fresh set of eyes is invaluable for these kind of reviews!

It doesn’t seem to work for me that way. I’m using Truffle@5.0.2. Each time I get to a point in the docs using truffle console to interact with a contract it does not work. Instead I do the following:

connect
let abi = require("./build/contracts/<MyContract.json>").abi;
let myContract = new web3.eth.Contract(abi, “”);

get
myContract.methods.().call();

set
myContract.methods.("").send({ from: “” });

Could you clarify what kind of error do you get? A common issue moving from truffle 4 to 5 is that Contract.at returns a promise in 5, requiring an await to get the instance?