Last active
August 28, 2017 12:22
-
-
Save ramvi/65e0a7a6a988ce9ce8f0d775155f3615 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import "browser/My1stToken.sol"; | |
pragma solidity ^0.4.16; | |
contract TokenFactorySolution { | |
mapping(address => address[]) public created; | |
mapping(address => bool) public isMy1stToken; //verify that given address is of this token type | |
function createToken(uint256 _initialAmount, string _name, uint8 _decimals, string _symbol) returns (address) { | |
My1stToken newToken = (new My1stToken(_initialAmount, _name, _decimals, _symbol)); | |
created[msg.sender].push(address(newToken)); | |
isMy1stToken[address(newToken)] = true; | |
newToken.transfer(msg.sender, _initialAmount); //the factory will own the created tokens. You must transfer them. | |
return address(newToken); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment