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});
    }      
});
  • Which network you are connected to? – kaushik_pm Sep 7 '18 at 6:42
2

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

Try:

tokenContract.transfer(_transferTo...      
| 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.