0

I created HelloWorld Smart contract using truffle. Then I complied and migrated, artificats are generated without any issues. Then I was able to query HelloWorld.deployed() in truffle console.

Now I have assigned it to a variable.

truffle(development)> var helloWorld = HelloWorld.deployed()

Problem started after executing the below command and I am unable to proceed. **

truffle(development)> helloWorld.balance.call()
TypeError: Cannot read property 'call' of undefined

**

Looking for your comments to solve and proceed further. Thanks for your help.

HelloWorld Smart Contract: naga@naga-VirtualBox:~/ethereum/contracts$ cat HelloWorld.sol

pragma solidity ^0.4.4;


contract HelloWorld {
uint public balance;

function HelloWorld() {
    // constructor
    balance=1000;
  }
}

Regards, Naga

| improve this question | | | | |
1

HelloWorld.deployed() does not give you your smart contract instance.

You can use helloWorld=HelloWorld.at(HelloWorld.address) or HelloWorld.deployed().then(instance => helloWorld=instance)

| improve this answer | | | | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.