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, Vignesh Karthikeyan, Luiz Soares Jun 27 '18 at 18:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 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

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