before I start just wanted to say that I started a few time ago with solidity and I'm still noob, but I've been reading and researching about this and can't get it working.
I'm using ethereum wallet with ropsten network.
Let's say I have X tokens from a standar ERC20 token already deployed, I know its contract address. I want to create a contract to transfer that to another account. I want to do this so in the future I could send to multiple accounts at once, but wanted to go step by step.
Should something like this work?
pragma solidity ^0.4.18;
contract Token {
function totalSupply() constant public returns (uint256 supply);
function balanceOf(address _owner) constant public returns (uint256 balance);
function transfer(address _to, uint256 _value) public returns (bool success) ;
function transferFrom(address _from, address _to, uint256 _value) public returns (bool success) ;
function approve(address _spender, uint256 _value) public returns (bool success) ;
function allowance(address _owner, address _spender) constant public returns (uint256 remaining) ;
}
contract Envio{
function Envio() public{
Token miToken = Token(0x87458903eB3A37775A9CC097f80eb703D1cd0231); //Contract address
uint8 decimals = 18;
uint256 decimalFactor = 10 ** uint256(decimals);
miToken.transfer(0xD49E71da9b64088BA1Ea1535c97f2985F9D3B1Bb,5000*decimalFactor);
}
}
The result I'm getting after the transaction completes is: no tokens are transferred and it says gas used = 0. Also tried using transferFrom, same results.
I know that what I'm doing might be completely wrong, just looking for some guidance.