1

I am using Truffle and my contract is migrated fine and I am able to invoke necessary call from truffle console

The issue I have is how do I see the failure when a require condition is not met. I have this check: require(msg.sender == creator);

When making a call that fails the check how do I see a failure in the response? (the addr2 here is not the creator)

truffle(development)> instance.fundEscrow({from:addr2,value:web3.toWei(1,"ether")})
{ tx: '0x51e10...',
  receipt: 
   { transactionHash: '0x51e10f9a...',
     transactionIndex: 0,
     blockHash: '0x9cd03...',
     blockNumber: 83,
     gasUsed: 21972,
     cumulativeGasUsed: 21972,
     contractAddress: null,
     logs: [],
     status: '0x00',
     logsBloom: '0x0000000000...' },
  logs: [] 
}
1

In your output status: '0x00' indicates failure.

The instance you deal with is an instance of truffle contract, documented here https://github.com/trufflesuite/truffle-contract.

Your call to fundEscrow() returns a promise, which you can resolve as following:

instance.fundEscrow({from:addr2,value:web3.toWei(1,"ether")}).then(txObj => console.log(txObj.receipt.status)); }

| 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.