When I depoly the contract, I get the following error:
truffle(develop)> compile
Compiling your contracts...
===========================
> Compiling ./contracts/helloworld.sol
project:/contracts/helloworld.sol:4:35: TypeError: Data location must be "memory" for return parameter in function, but none was given.
function test() public returns (string) {
^----^
Compilation failed. See above.
The error is simple, and has been display in the prompt. Just add "memory" after "string". Then, the following messags appear:
Compiling your contracts...
===========================
> Compiling ./contracts/helloworld.sol
> Compilation warnings encountered:
project:/contracts/helloworld.sol:4:3: Warning: Function state mutability can be restricted to pure
function test() public returns (string memory) {
^ (Relevant source part starts here and spans across multiple lines).
> Artifacts written to /Users/zhujiangwen/Desktop/ipfs-pro/build/contracts
> Compiled successfully using:
- solc: 0.5.16+commit.9c3226ce.Emscripten.clang