MiniMeTokenFactory.sol
1 pragma solidity ^0.5.2; 2 3 import "./TokenFactory.sol"; 4 import "./MiniMeToken.sol"; 5 6 7 /** 8 * @dev This contract is used to generate clone contracts from a contract. 9 * In solidity this is the way to create a contract from a contract of the 10 * same class 11 */ 12 contract MiniMeTokenFactory is TokenFactory { 13 14 /** 15 * @notice Update the DApp by creating a new token with new functionalities 16 * the msg.sender becomes the controller of this clone token 17 * @param _parentToken Address of the token being cloned 18 * @param _snapshotBlock Block of the parent token that will 19 * determine the initial distribution of the clone token 20 * @param _tokenName Name of the new token 21 * @param _decimalUnits Number of decimals of the new token 22 * @param _tokenSymbol Token Symbol for the new token 23 * @param _transfersEnabled If true, tokens will be able to be transferred 24 * @return The address of the new token contract 25 */ 26 function createCloneToken( 27 address _parentToken, 28 uint _snapshotBlock, 29 string calldata _tokenName, 30 uint8 _decimalUnits, 31 string calldata _tokenSymbol, 32 bool _transfersEnabled 33 ) external returns (address payable) 34 { 35 MiniMeToken newToken = new MiniMeToken( 36 address(this), 37 _parentToken, 38 _snapshotBlock, 39 _tokenName, 40 _decimalUnits, 41 _tokenSymbol, 42 _transfersEnabled 43 ); 44 45 newToken.changeController(msg.sender); 46 return address(newToken); 47 } 48 }