Trying to test my token contract using truffle console + ganache, lets say I have a payable function someFunc(string _string, uint256 _int), how would I call it with arguments "hello", 100 and msg.value = 2 eth?

As a side q, where does the gas eth come from? is it taken from msg.value?

2 Answers 2



myContract.someFunc("hello",100,{value: 2000000000000000000}).then(...

Hope it helps.

  • 1
    he asks for msg.value=2eth not 100 weis.
    – Badr Bellaj
    Commented Jul 14, 2018 at 8:11

From what I understand, the eth gas comes from the sender, separate from the amount sent in the transaction value. Hope that can help you 2 years later :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.