Commit f6767d1a authored by Simon de la Rouviere's avatar Simon de la Rouviere

Update code. Removed uport for now due to issues.

parent dc376ba6
## Token Factory ## Token Factory
A dapp that allows for token issuance & management. The purpose for this at this point in time is to be nerdy & decentralized for MVP. Thus should be able to be run locally & remote or just through contracts. The Token Factory allows simple creation of a standard ERC20 token on Ethereum. It requires an injected web3 (Mist or Metamask) to function. It also has uPort support.
Contracts & Tests are borrowed from Tokens repo. Using Truffle (with Webpack). Tested with Truffle 48bd90d06fef9a90ec058159f01e192ea8c36e51. It does not use an on-chain factory at this point in time.
Disclaimer: This was app was built in part so that I can learn React as well. It's not the neatest code, so keep that in mind. If you want to help clean it up and maybe help move it to Redux (which I want to do), you are welcome to help.
Contracts & Tests are borrowed from Tokens repo. Using Truffle (with Webpack). Tested with Truffle@beta (v3.0.0-3).
## Developing
```npm install``` ```npm install```
```truffle serve``` ```truffle serve```
This code is licensed under MIT. ## Contributing
There's still some outstanding issues related to UX/Design that needs to be finished. Please submit bugs & pull requests!
**This code is licensed under MIT.**
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
......
...@@ -21,12 +21,15 @@ var FrontPage = React.createClass({ ...@@ -21,12 +21,15 @@ var FrontPage = React.createClass({
location.reload(); //refresh location.reload(); //refresh
}, },
render: function() { render: function() {
/*
<h3 style={{textAlign: "center"}}>OR</h3>
<button style={{textAlign: "center"}} className="btn btn-default center-block" onClick={this.activateUPort}>Activate uPort</button></p>
*/
if(window.offline) { if(window.offline) {
var offline_msg = <p style={{textAlign: "center"}}>You are currently OFFLINE. <br /><br /> var offline_msg = <p style={{textAlign: "center"}}>You are currently OFFLINE. <br /><br />
In order to use the Token Factory, you need to: <br /> In order to use the Token Factory, you need to: <br />
<a style={{textAlign: "center"}} href="https://metamask.io"><img width="200px" className="logo img-responsive center-block" src="./images/mm.png"></img></a> <a style={{textAlign: "center"}} href="https://metamask.io"><img width="200px" className="logo img-responsive center-block" src="./images/mm.png"></img></a>
<h3 style={{textAlign: "center"}}>OR</h3> </p>
<button style={{textAlign: "center"}} className="btn btn-default center-block" onClick={this.activateUPort}>Activate uPort</button></p>
} }
return ( return (
......
//for Mist & Metamask support //for Mist & Metamask support
var Web3 = require("web3"); var Web3 = require("web3");
var Pudding = require("ether-pudding"); var Pudding = require("ether-pudding");
var uportLib = require('uport-lib'); //var uportLib = require('uport-lib');
var exported_web3 = null; var exported_web3 = null;
window.offline = true; //default is there is no web3 available. window.offline = true; //default is there is no web3 available.
...@@ -19,10 +19,10 @@ if (typeof web3 !== 'undefined') { ...@@ -19,10 +19,10 @@ if (typeof web3 !== 'undefined') {
} else { } else {
//If not available, check if the user has set to use uPort (localstorage). //If not available, check if the user has set to use uPort (localstorage).
if(localStorage["provider"] == "uport") { if(localStorage["provider"] == "uport") {
var uport = new uportLib("Token Factory"); /*var uport = new uportLib("Token Factory");
var uportProvider = uport.getUportProvider(); var uportProvider = uport.getUportProvider();
exported_web3 = new Web3(uportProvider); exported_web3 = new Web3(uportProvider);
window.offline = false; window.offline = false;*/
} else { } else {
//redirect to front-page? //redirect to front-page?
console.log("A web3 provider is NOT present. Telling user to get one."); console.log("A web3 provider is NOT present. Telling user to get one.");
......
...@@ -10,8 +10,9 @@ Machine-based, rapid creation of many tokens would not necessarily need these ex ...@@ -10,8 +10,9 @@ Machine-based, rapid creation of many tokens would not necessarily need these ex
3) Optional approveAndCall() functionality to notify a contract if an approval() has occurred. 3) Optional approveAndCall() functionality to notify a contract if an approval() has occurred.
.*/ .*/
pragma solidity ^0.4.4;
import "StandardToken.sol"; import "./StandardToken.sol";
contract HumanStandardToken is StandardToken { contract HumanStandardToken is StandardToken {
......
...@@ -7,7 +7,9 @@ If you deploy this, you won't have anything useful. ...@@ -7,7 +7,9 @@ If you deploy this, you won't have anything useful.
Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20 Implements ERC 20 Token standard: https://github.com/ethereum/EIPs/issues/20
.*/ .*/
import "Token.sol"; pragma solidity ^0.4.4;
import "./Token.sol";
contract StandardToken is Token { contract StandardToken is Token {
......
pragma solidity ^0.4.4;
contract Token { contract Token {
/// @return total amount of tokens /// @return total amount of tokens
......
...@@ -28,12 +28,13 @@ ...@@ -28,12 +28,13 @@
"reflux-tx": "0.2.4", "reflux-tx": "0.2.4",
"sass-loader": "^3.1.2", "sass-loader": "^3.1.2",
"style-loader": "^0.13.0", "style-loader": "^0.13.0",
"uport-lib": "git+ssh://[email protected]:ConsenSys/uport-lib.git", "uport-lib": "^1.3.1",
"web3": "0.16.0", "web3": "0.16.0",
"webpack": "^1.12.12" "webpack": "^1.12.12"
}, },
"devDependencies": { "devDependencies": {
"async": "*", "async": "*",
"babel-preset-es2015": "^6.18.0",
"babel-runtime": "^6.3.19", "babel-runtime": "^6.3.19",
"bluebird": "*", "bluebird": "*",
"file-loader": "^0.8.5", "file-loader": "^0.8.5",
......
...@@ -36,12 +36,9 @@ module.exports = { ...@@ -36,12 +36,9 @@ module.exports = {
loaders: [ loaders: [
//{ test: /\.(js|jsx|es6)$/, exclude: /node_modules/, include: [/reflux-tx/], loader: "babel-loader"}, //{ test: /\.(js|jsx|es6)$/, exclude: /node_modules/, include: [/reflux-tx/], loader: "babel-loader"},
{ test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery' }, { test: /bootstrap\/js\//, loader: 'imports?jQuery=jquery' },
{ test: /\.(js|jsx|es6)$/, exclude: /node_modules/, loader: "babel-loader"}, { test: /\.(js|jsx|es6)$/, exclude: /node_modules(?!\/uport-lib)/, loader: "babel-loader"},
//localforage excluded due to "loose" option in babelrc being changed in babel 6. //localforage excluded due to "loose" option in babelrc being changed in babel 6.
//https://github.com/mozilla/localForage/issues/496 //https://github.com/mozilla/localForage/issues/496
//{ test: /\.(js|jsx|es6)$/, exclude: [/localforage/, /ipfs-api\/node_modules/, /lodash/], loader: "babel-loader"},
//{ test: /\.(js|jsx|es6)$/, exclude: [/localforage/, /lodash/, /web3/], loader: "babel-loader"},
//{ test: /\.(js|jsx|es6)$/, exclude: [path.resolve(__dirname, "node_modules/reflux-tx/node_modules/localforaghh"), path.resolve(__dirname, "node_modules/react-account-badge/node_modules/ipfs-api"), /lodash/], loader: "babel-loader"},
//{ test: /\.(jsx|es6)$/, loader: "babel-loader"}, //{ test: /\.(jsx|es6)$/, loader: "babel-loader"},
//{ test: /\.(js|jsx|es6)$/, loader: "babel-loader"}, //{ test: /\.(js|jsx|es6)$/, loader: "babel-loader"},
//{ test: /localforage\/dist\/localforage\.js/, loader: 'exports?localforage'}, //{ test: /localforage\/dist\/localforage\.js/, loader: 'exports?localforage'},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment