4

I am not sure why I am being told my function is not a function.

I am doing calls as I always do from the Truffle console.

pragma solidity >=0.4.22 <0.6.0;

contract store {
    string public storage_;

    function store_it(string memory s) public {
        storage_=s;
    }
}

stor = store.at(store.address)

stor.store_it("string")

TypeError: stor.store_it is not a function

What is going wrong?

0TTT0
  • 672
  • 2
  • 10
  • 20
  • My guess is some breaking changes in a Truffle update, check https://github.com/trufflesuite/truffle/releases/tag/v5.0.0#user-content-what-s-new-in-truffle-v5-truffle-migrate-async-migrations – Lauri Peltonen Jan 20 '19 at 19:26

2 Answers2

7

It seems you are using truffle v5. In that version you have to use await to obtain the result of .at

stor = await store.at(store.address)
stor.store_it("string")
Ismael
  • 30,570
  • 21
  • 53
  • 96
1

In truffle version 5.0, you have to use await to obtain the result of contract.

let contract = await ContractName.deployed()
let result = await contract.functionName()
David Yu
  • 111
  • 1
  • 4