Hello again,
I am having a problem trying to test a contract which is inheriting from the Pausable contract in ‘openzeppelin-eth’. I am writing a test such as below:
await testContract.methods.pause().call({ from: pauserAccount });
let pauseStatus = await testContract.methods.paused().call();
assert.equal(pauseStatus, true);
But for some reason the pauseStatus is always set to false even though there is no revert or other exception in this code… From the truffle console I can call this function:
st.pause({ from: pauserAccount })
{ tx: '0x68358f21ebe3fbd01569921448ad45c52884afc2a75c7af31e659c1e4a9c19e3',
receipt:
{ transactionHash: '0x68358f21ebe3fbd01569921448ad45c52884afc2a75c7af31e659c1e4a9c19e3',
transactionIndex: 0,
With the truffle call to the function I have no issues at all… Any ideas on what could be happening here?
Cheers
Rick
1 Like
Oops, sorry, I think I just managed to fix this by changing call() to send()…
Just in case anyone else is having an issue with this, here is a stackoverflow answer which helped me to resolve:
2 Likes
Hi @roy.batty Awesome that you solved your own problem.
For Truffle, you don't even need to use send()
or call()
, have a look at the Truffle documentation below:
https://truffleframework.com/docs/truffle/reference/contract-abstractions#making-a-transaction-via-a-contract-function
When we call setValue()
, this creates a transaction.
https://truffleframework.com/docs/truffle/reference/contract-abstractions#calling-getters
Even more helpful, however is we don't even need to use .call
when a function is marked as constant
, because truffle-contract
will automatically know that that function can only be interacted with via a call:
I have moved this topic to the #support:zeppelinos category so we know it's a support question. It also means that we can tag the reply as the answer, and show the question is solved.
2 Likes