build/contracts/HelloWorld.json
line 890:
"source": "// SPDX-License-Identifier: MIT\r\npragma solidity 0.8.7;\r\n\r\ncontract HelloWorld{\r\n function hello() public pure returns(string memory){\r\n return 'hello world';\r\n }\r\n}",
I wrote that code at start, in contracts/HelloWorld.sol ,than i changed it:
HelloWorld.sol
// SPDX-License-Identifier: MIT
pragma solidity 0.8.7;
contract HelloWorld{
string public message;
constructor(string memory _message){
message = _message;
}
function hello() public view returns(string memory){
return message;
}
function setMessage(string memory _message) public{
message = _message;
}
}
migrations/2_hello_world_migration.js
const HelloWorld = artifacts.require("HelloWorld");
module.exports = function (deployer) {
deployer.deploy(HelloWorld,"Hello world constructor");
};
when im typing
- truffle compile
- truffle develop
- migrate
- let instance = await HelloWorld.deployed()
- instance.hello() -> returning me 'hello world', from first build/migration
- instance.message() -> Uncaught TypeError: instance.message is not a function
- instance.setMessage('blah') -> Uncaught TypeError: instance.setMessage is not a function
Everything is up to date, there is nothing to compilemessage - Taimoor