Reputation: 1
I'm studying solidity.
TT3 token generation on test net is no problem, but TT3Token_Test failed. (TT3Token and TT3Token_Test have been deployed to the same wallet address)
https://ropsten.etherscan.io/tx/0x4099019ecc47640dc7d3ceb3de3d50759f4e5ebc6d730410cda992c97d78ea10
I do not know why not.
(I deployed it to ropsten using remix)
pragma solidity ^0.4.23;
import "./StandardToken.sol"; // openzeppelin
contract TT3Token is StandardToken {
string public constant name = "TT3Token";
string public constant symbol = "TT3";
uint8 public constant decimals = 18;
uint256 public constant INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));
constructor() public {
totalSupply_ = INITIAL_SUPPLY;
balances[msg.sender] = INITIAL_SUPPLY;
emit Transfer(0x0, msg.sender, INITIAL_SUPPLY);
}
function sendTest(address _to, uint256 _value) public {
transfer(_to, _value);
}
}
contract TT3Token_Test {
constructor() public {
address r = 0xEcA254594c5bBCCEBc321e9252cc886cE37Be914;
TT3Token token = TT3Token(msg.sender);
token.sendTest(r, 99 * (10 ** uint256(18)));
}
}
Upvotes: 0
Views: 132
Reputation: 10971
TT3Token token = TT3Token(msg.sender)
doesn't make sense unless it's the TT3Token
contract itself that is creating a new TT3Token_Test
deployment (which is not shown in your code). msg.sender
is the address from which the transaction was initiated from (an EOA account). It should be the address of your deployed TT3Token
contract.
Also, the tokens are owned by the address that deployed the TT3Token
contract. You need to transfer tokens from that same account to the TT3Token_Test
address in order for the call to sendTest
to succeed.
Upvotes: 1