0

I am making a smart contract with a Transfer function.

function transfer(address _to, uint256 _value) public returns(bool success) {
        //checking whether sender has enough number of tokens
        require(balanceOf[msg.sender] >= _value);

        //Transfer of Token ownership
        balanceOf[msg.sender] -= _value;
        balanceOf[_to]+=_value;

        emit Transfer(msg.sender,_to,_value);
        return true;
}

Error:

  //     Replacing 'DappToken'
  //    ---------------------
  // Error: Error: Error:  *** Deployment Failed ***

  // "DappToken" -- Invalid number of parameters for "Transfer". Got 1 expected 3!.

  //     at Object.run (C:\Users\rohit.mittal\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\truffle-migrate\index.js:84:1)
  //     at process._tickCallback (internal/process/next_tick.js:68:7)
  // Truffle v5.0.18 (core: 5.0.18)
  // Node v10.2.1
  • Check the number of parameters you are sending. Also if you can share your code it would be more helpful to understand your problem. – itsHarshad Jul 23 '19 at 9:25
0

It's very hard to understand your issue without having the piece of code where you call the Transfer function.

The error says that your Transfer function takes 3 inputs while you passed only 1 parameter thus it throw you that error.

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