1

I have the following simple transfer method in my contract to transfer my erc20 token to another account:

function transfer(address to, uint tokens) public returns (bool success) {
    balances[msg.sender] = safeSub(balances[msg.sender], tokens);
    balances[to] = safeAdd(balances[to], tokens);
    Transfer(msg.sender, to, tokens);
    return true;
}

When I call this from angular through web3 doing the following it returns true as the result but nothing seems to be updated on the ropsten network. Is there anything that im missing here.

 tokenContract.transfer.call(_transferTo, window.web3.toWei(_amount),{ from: _transferFrom }, function(err, status){                                
    if(status) {
      return resolve({status:true});
    }      
});
1
  • Which network you are connected to?
    – kaushik_pm
    Commented Sep 7, 2018 at 6:42

1 Answer 1

2

Web3's call is for making read-only calls to your local node.

Try:

tokenContract.transfer(_transferTo...      

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.