Przeglądaj źródła

Refactored personal token template.

Simon de la Rouviere 8 lat temu
rodzic
commit
7c5d7e0e9d
34 zmienionych plików z 44852 dodań i 377 usunięć
  1. 1 0
      .gitignore
  2. 0 4
      templates/personal_token/.gitignore
  3. 7 9
      templates/personal_token/README.md
  4. 2 2
      templates/personal_token/contracts/Standard_Token.sol
  5. 5 0
      templates/personal_token/app/css/bootstrap.min.css
  6. 0 0
      templates/personal_token/app/css/index.css
  7. 0 0
      templates/personal_token/app/images/example_vinay.jpg
  8. 25 0
      templates/personal_token/app/index.html
  9. 7 0
      templates/personal_token/app/js/bootstrap.min.js
  10. 0 0
      templates/personal_token/app/js/header.jsx
  11. 4 0
      templates/personal_token/app/js/jquery-2.1.4.min.js
  12. 19602 0
      templates/personal_token/app/js/react-0.13.3.js
  13. 1 0
      templates/personal_token/app/js/reactor.js
  14. 47 0
      templates/personal_token/app/js/script.jsx
  15. 4 0
      templates/personal_token/app/personal_token_config.json
  16. 1 1
      templates/personal_token/reactor_config.json
  17. 0 8
      templates/personal_token/bower.json
  18. 12 0
      templates/personal_token/build/app.css
  19. 24933 0
      templates/personal_token/build/app.js
  20. 102 0
      templates/personal_token/build/contracts/Standard_Token.sol
  21. BIN
      templates/personal_token/build/images/example_vinay.jpg
  22. 27 0
      templates/personal_token/build/index.html
  23. 6 0
      templates/personal_token/build/personal_token_config.json
  24. 36 0
      templates/personal_token/build/reactor_config.json
  25. 0 4
      templates/personal_token/config.json
  26. 29 0
      templates/personal_token/config/app.json
  27. 1 0
      templates/personal_token/config/development/config.json
  28. 0 62
      templates/personal_token/index.html
  29. 0 33
      templates/personal_token/js/ContractWrapper.jsx
  30. 0 42
      templates/personal_token/js/DeployWrapper.jsx
  31. 0 53
      templates/personal_token/js/FunctionWrapper.jsx
  32. 0 14
      templates/personal_token/js/InputWrapper.jsx
  33. 0 54
      templates/personal_token/js/reactor.jsx
  34. 0 91
      templates/personal_token/js/script.jsx

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
 bower_components
 .DS_Store
 *.swp
+*.swo

+ 0 - 4
templates/personal_token/.gitignore

@@ -1,4 +0,0 @@
-bower_components
-.DS_Store
-*.swp
-reactor

Plik diff jest za duży
+ 7 - 9
templates/personal_token/README.md


+ 2 - 2
templates/personal_token/contracts/Standard_Token.sol

@@ -19,9 +19,9 @@ contract Coin {
     function isApprovedFor(address _target, address _proxy) constant returns (bool _r) {}
 }
 
-contract Token is Coin {
+contract Standard_Token is Coin {
     
-    function Token(uint _initialAmount) {
+    function Standard_Token(uint _initialAmount) {
         balances[msg.sender] = _initialAmount;
     }
     

Plik diff jest za duży
+ 5 - 0
templates/personal_token/app/css/bootstrap.min.css


templates/personal_token/static/index.css → templates/personal_token/app/css/index.css


templates/personal_token/static/example_vinay.jpg → templates/personal_token/app/images/example_vinay.jpg


+ 25 - 0
templates/personal_token/app/index.html

@@ -0,0 +1,25 @@
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Contract Reactor (for Ethereum)</title>
+    <link href="./app.css" rel='stylesheet' type='text/css'>
+    <script src="./app.js"></script>
+
+</head>
+
+<body>
+<div class="container">
+    <div id="top">
+    </div>
+    
+    <div id="contracts">
+    </div>
+
+</div>
+
+</body>
+
+</html>

Plik diff jest za duży
+ 7 - 0
templates/personal_token/app/js/bootstrap.min.js


templates/personal_token/js/header.jsx → templates/personal_token/app/js/header.jsx


Plik diff jest za duży
+ 4 - 0
templates/personal_token/app/js/jquery-2.1.4.min.js


Plik diff jest za duży
+ 19602 - 0
templates/personal_token/app/js/react-0.13.3.js


Plik diff jest za duży
+ 1 - 0
templates/personal_token/app/js/reactor.js


+ 47 - 0
templates/personal_token/app/js/script.jsx

@@ -0,0 +1,47 @@
+//EXAMPLE
+//helper function to get URL parameters.
+var urlParams;
+(window.onpopstate = function () {
+    var match,
+        pl     = /\+/g,  // Regex for replacing addition symbol with a space
+        search = /([^&=]+)=?([^&]*)/g,
+        decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
+        query  = window.location.search.substring(1);
+
+    urlParams = {};
+    while (match = search.exec(query))
+       urlParams[decode(match[1])] = decode(match[2]);
+})();
+/*------------------*/
+
+var config;
+if("config" in urlParams) {
+    config = urlParams['config'];
+} else {
+    var config = './reactor_config.json'; //default
+}
+
+$.ajax({
+    url: config,
+    dataType: 'json',
+    cache: false,
+    error: function(data) {
+        console.log(data);
+    },
+    success: function(data) {
+        //map through multiple contracts (this includes multiple ones in 1 file + different files).
+        console.log(data);
+        var reactor_config = parseConfig(data);
+
+        //fetch template specific config information
+        $.ajax({
+              url: "personal_token_config.json",
+                dataType: 'json',
+                cache: false,
+        })
+        .done(function(data) {
+            React.render(<Header data={data} />, document.getElementById('top'));
+            React.render(<ContainerHelper templates={reactor_config.templates} compiled={reactor_config.total_compiled} addresses={reactor_config.addresses} options={reactor_config.options}/>, document.getElementById('contracts'));
+        });
+    }
+});

+ 4 - 0
templates/personal_token/app/personal_token_config.json

@@ -0,0 +1,4 @@
+{
+    "token_name": "Vinay's Hexatokens",
+    "token_image": "images/example_vinay.jpg"
+} 

+ 1 - 1
templates/personal_token/reactor_config.json

@@ -1,6 +1,6 @@
 {
     "contracts": { 
-        "Token": {
+        "Standard_Token": {
             "address": "0xbc72cf3079e08295364510917f92a10d0d54f9d2",
             "path": "contracts/Standard_Token.sol",
             "template_overlay": false,

+ 0 - 8
templates/personal_token/bower.json

@@ -1,8 +0,0 @@
-{
-    "name": "vinay_coin",
-    "dependencies": {
-        "bootstrap": "~3.2.0",
-        "web3": "develop",
-        "react": "0.13.1"
-    }
-}

Plik diff jest za duży
+ 12 - 0
templates/personal_token/build/app.css


Plik diff jest za duży
+ 24933 - 0
templates/personal_token/build/app.js


+ 102 - 0
templates/personal_token/build/contracts/Standard_Token.sol

@@ -0,0 +1,102 @@
+/*Most, basic default, standardised Token contract.
+Allows the creation of a token with a finite issued amount to the creator.
+This can't be changed.
+
+Based on standardised APIs & slightly extended. https://github.com/ethereum/wiki/wiki/Standardized_Contract_APIs
+adds AddressApproval & AddressApprovalOnce events
+approve & approveOnce works on premise that approved always takes precedence.
+adds unapprove to basic coin interface.*/
+
+contract Coin {
+    function sendCoin(uint _value, address _to) returns (bool _success) {}
+    function sendCoinFrom(address _from, uint _value, address _to) returns (bool _success) {}
+    function coinBalance() constant returns (uint _r) {}
+    function coinBalanceOf(address _addr) constant returns (uint _r) {}
+    function approve(address _addr) {}
+    function approveOnce(address _addr, uint256 _maxValue) {}
+    function unapprove(address _addr) {}
+    function isApproved(address _proxy) constant returns (bool _r) {}
+    function isApprovedFor(address _target, address _proxy) constant returns (bool _r) {}
+}
+
+contract Standard_Token is Coin {
+    
+    function Standard_Token(uint _initialAmount) {
+        balances[msg.sender] = _initialAmount;
+    }
+    
+    event CoinTransfer(address indexed from, address indexed to, uint256 value);
+    event AddressApproval(address indexed from, address indexed to, bool result);
+    event AddressApprovalOnce(address indexed from, address indexed to, uint256 value);
+    
+    function sendCoin(uint _value, address _to) returns (bool _success) {
+        if (balances[msg.sender] >= _value) {
+            balances[msg.sender] -= _value;
+            balances[_to] += _value;
+            CoinTransfer(msg.sender, _to, _value);
+            return true;
+        } else { return false; }
+    }
+    
+    function sendCoinFrom(address _from, uint _value, address _to) returns (bool _success) {
+        if (balances[_from] >= _value) {
+            bool transfer = false;
+            if(approved[_from][msg.sender]) { 
+                transfer = true; 
+            } else {
+                if(_value < approved_once[_from][msg.sender]) { 
+                    transfer = true; 
+                    approved_once[_from][msg.sender] = 0; //reset
+                }
+            }
+            
+            if(transfer == true) {
+                balances[_from] -= _value;
+                balances[_to] += _value;
+                CoinTransfer(_from, _to, _value);
+                return true;
+            } else { return false; }
+        }
+    }
+    
+    function coinBalance() constant returns (uint _r) {
+        return balances[msg.sender];
+    }
+    
+    function coinBalanceOf(address _addr) constant returns (uint _r) {
+        return balances[_addr];
+    }
+    
+    function approve(address _addr) {
+        approved[msg.sender][_addr] = true;
+        AddressApproval(msg.sender, _addr, true);
+    }
+    
+    function approveOnce(address _addr, uint256 _maxValue) {
+        approved_once[msg.sender][_addr] = _maxValue;
+        AddressApprovalOnce(msg.sender, _addr, _maxValue);
+    }
+    
+    function unapprove(address _addr) {
+        approved[msg.sender][_addr] = false;
+        approved_once[msg.sender][_addr] = 0;
+        AddressApproval(msg.sender, _addr, false);
+        AddressApprovalOnce(msg.sender, _addr, 0);
+    }
+    
+    function isApproved(address _proxy) constant returns (bool _r) {
+        if(approved[msg.sender][_proxy] == true || approved_once[msg.sender][_proxy] > 0) {
+            return true;
+        }
+    }
+    
+    function isApprovedFor(address _target, address _proxy) constant returns (bool _r) {
+        if(approved[_target][_proxy] == true || approved_once[_target][_proxy] > 0) {
+            return true;
+        }
+    }
+    
+    mapping (address => uint) public balances;
+    mapping (address => mapping (address => bool)) public approved;
+    mapping (address => mapping (address => uint256)) public approved_once;
+}

BIN
templates/personal_token/build/images/example_vinay.jpg


+ 27 - 0
templates/personal_token/build/index.html

@@ -0,0 +1,27 @@
+
+
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width, initial-scale=1">
+    <title>Contract Reactor (for Ethereum)</title>
+    <link href="./app.css" rel='stylesheet' type='text/css'>
+    <script src="./app.js"></script>
+
+</head>
+
+<body>
+<div class="container">
+    <div id="top">
+    </div>
+    
+    <div id="contracts">
+    </div>
+
+</div>
+
+</body>
+
+</html>

+ 6 - 0
templates/personal_token/build/personal_token_config.json

@@ -0,0 +1,6 @@
+
+
+{
+    "token_name": "Vinay's Hexatokens",
+    "token_image": "images/example_vinay.jpg"
+} 

+ 36 - 0
templates/personal_token/build/reactor_config.json

@@ -0,0 +1,36 @@
+
+
+{
+    "contracts": { 
+        "Standard_Token": {
+            "address": "0xbc72cf3079e08295364510917f92a10d0d54f9d2",
+            "path": "contracts/Standard_Token.sol",
+            "template_overlay": false,
+            "deploy_overlay": false,
+            "template": {
+                "coinBalanceOf": {
+                    "button": "Check Balance",
+                    "inputs": {
+                        "_addr": {
+                            "label": "Address",
+                            "default_value": "eg 0xbc72cf3079e08295364510917f92a10d0d54f9d2"
+                        }
+                    }
+                },
+                "sendCoin": {
+                    "button": "Send Token",
+                    "inputs": {
+                        "_to": {
+                            "label": "Insert Address",
+                            "default_value": "eg 0xbc72cf3079e08295364510917f92a10d0d54f9d2"
+                        },
+                        "_value": {
+                            "label": "Amount to send",
+                            "default_value": "eg 12"
+                        }
+                    }
+                }
+            }
+        }
+    }
+} 

+ 0 - 4
templates/personal_token/config.json

@@ -1,4 +0,0 @@
-{
-    "token_name": "Vinay's Hexatokens",
-    "token_image": "static/example_vinay.jpg"
-} 

+ 29 - 0
templates/personal_token/config/app.json

@@ -0,0 +1,29 @@
+{
+    "build": {
+        "index.html": "index.html",
+        "app.js": [
+            "js/jquery-2.1.4.min.js",
+            "js/bootstrap.min.js",
+            "js/react-0.13.3.js",
+            "js/reactor.js",
+            "js/header.jsx",
+            "js/script.jsx"
+        ],
+        "app.css": [
+            "css/bootstrap.min.css",
+            "css/index.css"
+        ],
+        "reactor_config.json": "reactor_config.json",
+        "personal_token_config.json": "personal_token_config.json",
+        "images/": "images/",
+        "contracts/": "contracts/"
+    },
+    "deploy": [
+        "Standard_Token"
+    ],
+    "rpc": {
+        "host": "localhost",
+        "port": 8080
+    }
+}
+

+ 1 - 0
templates/personal_token/config/development/config.json

@@ -0,0 +1 @@
+{}

+ 0 - 62
templates/personal_token/index.html

@@ -1,62 +0,0 @@
-<!DOCTYPE html>
-<html lang="en">
-<head>
-    <meta charset="utf-8">
-    <meta http-equiv="X-UA-Compatible" content="IE=edge">
-    <meta name="viewport" content="width=device-width, initial-scale=1">
-    <title>Contract Reactor (for Ethereum)</title>
-    <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
-    <script src="bower_components/jquery/dist/jquery.min.js"></script>
-    <script src="bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
-    <script src="bower_components/bignumber.js/bignumber.min.js"></script>
-    <script src="bower_components/web3/dist/web3.js"></script><!--debugging-->
-    <script src="bower_components/react/react.js"></script><!--debugging-->
-    <script src="bower_components/react/JSXTransformer.js"></script>
-    <script>
-        if (typeof web3 === "undefined") {
-            web3 = require('web3');
-            window.web3 = web3;
-        }
-
-        //connect to either aleth/mist depending what is online. Prefer Mist as is supposed to be more usable one into the future.
-        //this looks ugly. There must be better convention.
-        try {
-            web3.setProvider(new web3.providers.HttpProvider('http://127.0.0.1:8545')); //mist port
-            console.log(web3.eth.blockNumber);
-            console.log("Connected to Mist/Ethereum on port 8545");
-        } catch(err) {
-            console.log("Mist's RPC port is not online, or the port has changed.");
-            try {
-                web3.setProvider(new web3.providers.HttpProvider('http://127.0.0.1:8080')); //cpp-port
-                console.log(web3.eth.blockNumber);
-                console.log("Connected to Aleth/cpp-eth on port 8080");
-            } catch(err) {
-                console.log("AlethZero's RPC port is not online, or the port has changed.");
-            }
-        }
-    </script>
-
-</head>
-
-<body>
-<div class="container">
-    <div id="top">
-    </div>
-    
-    <div id="contracts">
-    </div>
-
-</div>
-
-    <!-- Development Purposes. AlethZero is caching very aggressively -->
-    <!-- Run web root where reactor.jsx is. -->
-    <script>document.write('<script type="text/jsx" src="js/Header.jsx?dev=' + Math.floor(Math.random() * 1000) + '"\><\/script>');</script> 
-    <script>document.write('<script type="text/jsx" src="js/InputWrapper.jsx?dev=' + Math.floor(Math.random() * 1000) + '"\><\/script>');</script> 
-    <script>document.write('<script type="text/jsx" src="js/FunctionWrapper.jsx?dev=' + Math.floor(Math.random() * 1000) + '"\><\/script>');</script> 
-    <script>document.write('<script type="text/jsx" src="js/DeployWrapper.jsx?dev=' + Math.floor(Math.random() * 1000) + '"\><\/script>');</script> 
-    <script>document.write('<script type="text/jsx" src="js/ContractWrapper.jsx?dev=' + Math.floor(Math.random() * 1000) + '"\><\/script>');</script> 
-    <script>document.write('<script type="text/jsx" src="js/reactor.jsx?dev=' + Math.floor(Math.random() * 1000) + '"\><\/script>');</script> 
-    <script>document.write('<script type="text/jsx" src="js/script.jsx?dev=' + Math.floor(Math.random() * 1000) + '"\><\/script>');</script> 
-</body>
-
-</html>

+ 0 - 33
templates/personal_token/js/ContractWrapper.jsx

@@ -1,33 +0,0 @@
-//takes compiled code, instance and template.
-var ContractWrapper = React.createClass({
-    render: function() {
-        dep = "";
-        if(this.props.deploy == true) {
-            dep = <DeployWrapper compiled={this.props.compiled} name={this.props.name} instance={this.props.instance}/>
-        }
-
-        return (
-            <div>
-            {dep}
-            <ul>
-                {this.props.compiled.info.abiDefinition.map(function(result) {
-                    if(result.type == "function") { //TODO: Determine whether events can be called from outside, otherwise it should be included.
-                        //react key = unique function name for contract.
-                        var function_template = {};
-                        //TODO: Same name functions might cause an issue. Do similar to key down below or like msg.sg. function(uint,bytes32) etc
-                        if (this.props.contract_template.hasOwnProperty(result.name)) { //if a specific function has a template for it.
-                            function_template = this.props.contract_template[result.name];
-                        }
-                        var args = "";
-                        $.each(result.inputs, function(i, obj) {
-                            args += obj.type;
-                        });
-                        var key = result.name + args; //function()arg1typearg2type, etc
-                        return <FunctionWrapper function_template={function_template} instance={this.props.instance} key={key} data={result}/>;
-                    }
-                }, this)}
-            </ul>
-            </div>
-        );
-    }
-});

+ 0 - 42
templates/personal_token/js/DeployWrapper.jsx

@@ -1,42 +0,0 @@
-var DeployWrapper = React.createClass({
-    getInitialState: function() {
-        //check if contract exists
-        codeOnChain = web3.eth.getCode(this.props.instance.address);
-        var submitted = true;
-
-        /*
-        Currently, this check is a hack. Compiled code has a padded part in the front (that is supposedly the keccak hash of the bytecode).
-        However, haven't been able to understand or reproduce it from the yellow paper or the solidity compiler code.
-        The latter parts will match though. However, there could be scenarios where only parts of it matches and thus it could erroneously match.
-        At the very least, it should not be 0x.
-        */
-        if (this.props.compiled.code.indexOf(codeOnChain.substring(2)) == -1 || codeOnChain == "0x") {
-            submitted = false;
-            //console.log("Contract doesn't exist.");
-        }
-        return {
-           submitted : submitted,
-        }
-    },
-    deployContract: function() {
-        //use max gas for now.
-        var address = web3.eth.sendTransaction({gas: '3141592', from: web3.eth.accounts[0], data: this.props.compiled.code}); //TODO: change to include other accounts
-        console.log(address); //TODO: Add callback that cascades back and sets addresses for contracts.
-    },
-    render: function() {
-        if(this.state.submitted == true) {
-            return (
-                <div>
-                    Contract exists on the blockchain.   
-                </div>
-            );
-        } else {
-            return (
-                <div>
-                    Specified address of contract is {this.props.instance.address}.
-                    Contract does not exist on the blockchain. <button className={"btn btn-default"} onClick={this.deployContract}>Deploy Contract {this.props.name}</button>
-                </div>
-            );
-        }
-    }
-});

+ 0 - 53
templates/personal_token/js/FunctionWrapper.jsx

@@ -1,53 +0,0 @@
-//takes instance and its part of the ABI + its part of the template
-var FunctionWrapper = React.createClass({
-    executeFunction: function(type) {
-        args = {};
-        args_array = [];
-        //get inputs [replace with pure js as this requires jquery as a dependency]
-        $.each(this.refs, function(i, obj) {
-              args[obj.props.arg] = obj.state.value; //map inputs to a dictionary
-              args_array.push(obj.state.value);
-        });
-        var function_name = this.props.data.name.split("(")[0]; //seems very hacky to get only function name. It's written as 'function(args)' usually.
-        var from = web3.eth.defaultAccount == undefined ? web3.eth.accounts[0]: web3.eth.defaultAccount;
-        var data = {"from": from};
-        var callback = function(err, result) { console.log("internal callback"); console.log(err); console.log(result); }
-        args_array.push(data);
-        args_array.push(callback);
-        if(type == "call") {
-            this.props.instance[function_name].call.apply(this, args_array);
-        } else if(type == "transact") {
-            //result = this.props.instance[function_name].sendTransaction(args);
-            this.props.instance[function_name].sendTransaction.apply(this, args_array);
-        }
-    },
-    render: function() {
-        //use react refs to keep track of inputs to a function.
-        if(this.props.function_template.button != undefined) {
-            var button = <div><button className={"btn btn-default"} onClick={this.executeFunction.bind(this,"transact")}>{this.props.function_template.button}</button></div>;
-        } else {
-            var button = <div><button className={"btn btn-default"} onClick={this.executeFunction.bind(this,"call")}>Call() {this.props.data.name}</button> - <button className={"btn btn-default"} onClick={this.executeFunction.bind(this,"transact")}>Transact() {this.props.data.name}</button></div>;
-        }
-        return (
-        <div>
-            {this.props.data.inputs.map(function(result) {
-                var input_template = {};
-                var arg = result.name;
-                if("inputs" in this.props.function_template) {
-                    if (this.props.function_template.inputs.hasOwnProperty(result.name)) { //if a specific function has a template for it.
-                        input_template = this.props.function_template.inputs[result.name];
-                        arg = this.props.function_template.inputs[result.name].default_value;
-                    }
-                }
-
-                return <div key={result.name}><InputWrapper input_template={input_template} ref={result.name} arg={arg} /></div>
-            }, this)}
-            <br />
-
-            {button}
-            <br />
-        </div>
-        );
-            
-    }
-});

+ 0 - 14
templates/personal_token/js/InputWrapper.jsx

@@ -1,14 +0,0 @@
-//takes reference & name for arguments
-var InputWrapper = React.createClass({
-    getInitialState: function() {
-        return {
-            value: ""
-        }
-    },
-    handleChange: function(event) {
-        this.setState({value: event.target.value});
-    },
-    render: function() {
-        return <div> {this.props.input_template.label} <input className={"form-control"} type="text" value={this.state.value} placeholder={this.props.arg} onChange={this.handleChange}/> </div>
-    }
-});

+ 0 - 54
templates/personal_token/js/reactor.jsx

@@ -1,54 +0,0 @@
-//TODO: Add control panel. Starts mining & unlocks + result view (instead of JS console)
-//TODO: config.json doesn't feel 100% the best route to take... Potentially refactor into one, and allow rewriting of it (when addresses are created)
-//TODO: Templating should be derived from the .sol eventually.
-
-var Reactor = React.createClass({
-    render: function() {
-        return (
-        <div>
-            {Object.keys(this.props.compiled).map(function(result) { //iterate through multiple contracts based on keys
-                //console.log(this.props.compiled[result]);
-                //var abi = this.props.compiled[result].info.abiDefinition;
-                var contract = web3.eth.contract(this.props.compiled[result].info.abiDefinition);
-                var instance = contract.at(this.props.addresses[result]);
-                <hr/>
-                var contract_template = {};
-                var new_compiled = this.props.compiled;
-                var abi = this.props.compiled[result].info.abiDefinition;
-
-                if(this.props.templates.hasOwnProperty(result)) {
-                    if(this.props.templates[result] != undefined) {
-                        contract_template = this.props.templates[result]; //if a contract has a template.
-
-                        if(this.props.options[result]["template_overlay"] == false) {
-                            //remove parts of the ABI.
-                            $.each(abi, function(i, obj) {
-                                if(obj.name != undefined) {
-                                    //console.log(this.props.templates[result]);
-                                    if(this.props.templates[result].hasOwnProperty(obj.name) == false) {
-                                        console.log("deleting part of abi");
-                                        console.log(abi[i]);
-                                        delete abi[i];
-                                    }
-                                }
-                            }.bind(this));
-                            console.log("false");
-                        }
-                    }
-
-                     
-                    if (this.props.options[result].hasOwnProperty("deploy_overlay")) {
-                        console.log(this.props.options[result].deploy_overlay);
-                        deploy = this.props.options[result].deploy_overlay;
-                    } else {deploy = false;}
-                }
-                return  (
-                    <div key={result}>
-                    <ContractWrapper key={result} deploy={deploy} name={result} contract_template={contract_template} compiled={this.props.compiled[result]} instance={instance} />
-                    </div>
-                )
-            }, this)}
-        </div>
-        );
-    }
-});

+ 0 - 91
templates/personal_token/js/script.jsx

@@ -1,91 +0,0 @@
-//EXAMPLE
-//helper function to get URL parameters.
-var urlParams;
-(window.onpopstate = function () {
-    var match,
-        pl     = /\+/g,  // Regex for replacing addition symbol with a space
-        search = /([^&=]+)=?([^&]*)/g,
-        decode = function (s) { return decodeURIComponent(s.replace(pl, " ")); },
-        query  = window.location.search.substring(1);
-
-    urlParams = {};
-    while (match = search.exec(query))
-       urlParams[decode(match[1])] = decode(match[2]);
-})();
-/*------------------*/
-
-var config;
-if("config" in urlParams) {
-    config = urlParams['config'];
-} else {
-    var config = 'reactor_config.json'; //random default
-}
-
-$.ajax({
-    url: config,
-    dataType: 'json',
-    cache: false,
-    error: function(data) {
-        console.log(data);
-    },
-    success: function(data) {
-        //map through multiple contracts (this includes multiple ones in 1 file + different files).
-        console.log(data);
-        var total_compiled = {};
-        var addresses = {}; 
-        var templates = {};
-        var options = {};
-        Object.keys(data["contracts"]).map(function(contract_name) { //iterate through multiple contracts based on keys
-            $.ajax({
-                //fetch .sol and compile it, adding compiled result & its specified address to separate dictionaries
-                //3 parts: the compiled code from .sols. The address mapping. The templates.
-                url: data["contracts"][contract_name].path,
-                dataType: 'text',
-                cache: false,
-                async: false,
-                success: function(contract) {
-                    /*
-                    This is slightly "hacky". If one file has multiple contracts, it returns one dictionary.
-                    This concatenates them in the scenario where there are multiple files as well.
-                    */
-                    compiled = web3.eth.compile.solidity(contract);
-                    console.log(compiled);
-                    console.log(data["contracts"]);
-                    Object.keys(compiled).map(function(compiled_contract_name) {
-                        if(compiled_contract_name in data["contracts"]) {
-                            console.log("compiled name yes");
-                            if(total_compiled.hasOwnProperty(compiled_contract_name) == false) { //not yet inserted
-                                console.log("inserting");
-                                addresses[compiled_contract_name] = data["contracts"][compiled_contract_name].address; //not sure why I've been doing [] & . notation here.
-                                templates[compiled_contract_name] = data["contracts"][compiled_contract_name].template;
-                                options[compiled_contract_name] = {
-                                    "template_overlay": data["contracts"][compiled_contract_name].template_overlay,
-                                    "deploy_overlay": data["contracts"][compiled_contract_name].deploy_overlay
-                                };
-
-                                //feels like really nasty code. rewrite.
-                                var comp = {};
-                                comp[compiled_contract_name] = compiled[compiled_contract_name];
-                                $.extend(total_compiled, comp);
-                            }
-                        }
-                    });
-                }
-            });
-        });
-        console.log(total_compiled); 
-        console.log(addresses); 
-        console.log(templates); 
-        console.log(options); 
-        //fetch template specific config information
-        $.ajax({
-              url: "../config.json",
-                dataType: 'json',
-                cache: false,
-        })
-        .done(function(data) {
-            React.render(<Header data={data} />, document.getElementById('top'));
-            React.render(<Reactor templates={templates} compiled={total_compiled} addresses={addresses} options={options}/>, document.getElementById('contracts'));
-        });
-    }
-});