Rinkeby Factory Instance
A factory instance deployed to Rinkeby test net is available here — you need to have Metamask installed and need to be connected to Rinkeby network.
The UI is very simple:
Metamask injects Web3 and the account you are using is displayed. The form accepts two parameters: your Token Name and your Token Symbol. For simplicity the total supply is hard-coded to be:
uint8 public constant decimals = 18;
INITIAL_SUPPLY = 10000 * (10 ** uint256(decimals));
After typing your token name and symbol hit the button and Metamask will ask for confirmation:
After you confirm your transaction it will be submitted, mined, and then the UI will update:
The dapp shows a message indicating the transaction was successfully submitted and it updates the footer with your token contract address and the transaction hash, you can verify this using Etherscan:
Now simply use your token contract address to add your token to your Metamask:
That’s it! You can now send your new token to anyone!
The token contract is a simple modification of Zeppelin-Solidity’s erc20 standard token:
For simplicity purposes the
INITIAL_SUPPLY is set to be a fixed value but you could simply pass it as an extra constructor parameter if you like. The constructor takes the
_symbol variables and allocates them, finally the total supply is sent to the
The token factory contract is given by:
The constructor creates a new
MyToken instance and sets the appropriate parameters.
MyTokenFactory inherits methods from
Thank you very much for reading this post! If you found this post useful please clap on this article and make sure to follow me for more regular content, also check out my Github as I regularly post sample code and projects. If you have any questions feel free to reply below this post or shoot me an email.