...by Daniel Szego
"Simplicity is the ultimate sophistication."
Leonardo da Vinci

Sunday, December 17, 2017

Solidity and Truffle Tips and Tricks - Reading public variable with console

At developing with Truffle and solidity sometimes it is needed to explicitly test the contract from the Truffle console and read out public properties. Well this is not as easy as it seems. The logical way: 


does not really work, instead an additional reference should be got to the token and the public variable has to be called as a function as it is actually a getter function.

var MyContract;

MyContract.deployed().then(function (a) {myToken = a;});