This question already has an answer here:

Let's say I have this function is a contract, that should enable users to deposit ETH into the contract, and have the contract manage their deposits

function deposit() payable public {
    balances[msg.sender] = balances[msg.sender].add(msg.value);

Now that I have the contract deployed, how do I call this function from the truffle console? That is, with ETH attached.

marked as duplicate by niksmac, Achala Dissanayake, Ismael, Meshugah, Luiz Soares Jun 27 '18 at 18:17


  • 1
    No, because this is not the fallback function, it's a specific named payable function. – shaharsol Jun 24 '18 at 10:48

Apparently this is the syntax:

YourContractName.at('some address').deposit({from:'some address',value:100})
  • 1
    That is what specified in the answer I've flagged you for duplicate content. – niksmac Jun 25 '18 at 4:30
