I'm struggling with transferring my own ERC20 Token.
I got following code:
contract AccountingToken is ERC20, ERC20Detailed {
constructor () public ERC20Detailed("AccountingToken", "MAC", 18) {
_mint(msg.sender, 10000 * (10 ** uint256(decimals())));
}
}
contract Accounting{
AccountingToken instance=AccountingToken(0x000...);
function get_balance()public view returns(uint){
uint balance;
balance=instance.balanceOf(msg.sender);
return balance;
}
function transfer_to_contract(uint tokens)public{
address receiver=0x..receiver_address;
instance.transfer(receiver,tokens);
}
}
Running the get_balance() function gives me the correct amount back.
But running the transfer() function always ends in a JSON-RPC error.
What am I doing wrong?
Thanks!
transfer()
? What's the error you get?