From 6600ee5ccf12c8591299bb3ffdf4355ac54dae21 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Thu, 26 Apr 2018 01:03:55 -0300 Subject: [PATCH 1/9] add basic ethereum signing message methods --- contracts/common/MessageSigned.sol | 77 ++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 contracts/common/MessageSigned.sol diff --git a/contracts/common/MessageSigned.sol b/contracts/common/MessageSigned.sol new file mode 100644 index 0000000..5a5a262 --- /dev/null +++ b/contracts/common/MessageSigned.sol @@ -0,0 +1,77 @@ +pragma solidity ^0.4.21; + +/** + * @notice Uses ethereum signed messages + */ +contract MessageSigned { + + constructor() internal { + + } + + /** + * @notice recovers address who signed the message + * @param _signHash operation ethereum signed message hash + * @param _messageSignature message `_signHash` signature + */ + function recoverAddress( + bytes32 _signHash, + bytes _messageSignature + ) + pure + internal + returns(address) + { + uint8 v; + bytes32 r; + bytes32 s; + (v,r,s) = signatureSplit(_messageSignature); + return ecrecover( + _signHash, + v, + r, + s + ); + } + + /** + * @notice Hash a hash with `"\x19Ethereum Signed Message:\n32"` + * @param _hash Sign to hash. + * @return signHash Hash to be signed. + */ + function getSignHash( + bytes32 _hash + ) + pure + internal + returns (bytes32 signHash) + { + signHash = keccak256("\x19Ethereum Signed Message:\n32", _hash); + } + + /** + * @dev divides bytes signature into `uint8 v, bytes32 r, bytes32 s` + */ + function signatureSplit(bytes _signature) + pure + internal + returns (uint8 v, bytes32 r, bytes32 s) + { + // The signature format is a compact form of: + // {bytes32 r}{bytes32 s}{uint8 v} + // Compact means, uint8 is not padded to 32 bytes. + assembly { + r := mload(add(_signature, 32)) + s := mload(add(_signature, 64)) + // Here we are loading the last 32 bytes, including 31 bytes + // of 's'. There is no 'mload8' to do this. + // + // 'byte' is not working due to the Solidity parser, so lets + // use the second best option, 'and' + v := and(mload(add(_signature, 65)), 0xff) + } + + require(v == 27 || v == 28); + } + +} \ No newline at end of file From bc3933b1f56f8d17ee74f59bf84dc94c69e284da Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Mon, 7 May 2018 23:37:45 -0300 Subject: [PATCH 2/9] change ERC20Token to interface --- contracts/token/ERC20Token.sol | 30 +++++++++++------------------ contracts/token/StandardToken.sol | 32 +++++++++++++++++++++++++------ 2 files changed, 37 insertions(+), 25 deletions(-) diff --git a/contracts/token/ERC20Token.sol b/contracts/token/ERC20Token.sol index c210342..63678ea 100644 --- a/contracts/token/ERC20Token.sol +++ b/contracts/token/ERC20Token.sol @@ -1,48 +1,40 @@ -pragma solidity ^0.4.17; +pragma solidity ^0.4.23; // Abstract contract for the full ERC 20 Token standard // https://github.com/ethereum/EIPs/issues/20 -contract ERC20Token { - /* This is a slight change to the ERC20 base standard. - function totalSupply() constant returns (uint256 supply); - is replaced with: - uint256 public totalSupply; - This automatically creates a getter function for the totalSupply. - This is moved to the base contract since public getter functions are not - currently recognised as an implementation of the matching abstract - function by the compiler. - */ - /// total amount of tokens - uint256 public totalSupply; - +interface ERC20Token { + /// @notice send `_value` token to `_to` from `msg.sender` /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not - function transfer(address _to, uint256 _value) public returns (bool success); + function transfer(address _to, uint256 _value) external returns (bool success); /// @notice `msg.sender` approves `_spender` to spend `_value` tokens /// @param _spender The address of the account able to transfer the tokens /// @param _value The amount of tokens to be approved for transfer /// @return Whether the approval was successful or not - function approve(address _spender, uint256 _value) public returns (bool success); + function approve(address _spender, uint256 _value) external returns (bool success); /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` /// @param _from The address of the sender /// @param _to The address of the recipient /// @param _value The amount of token to be transferred /// @return Whether the transfer was successful or not - function transferFrom(address _from, address _to, uint256 _value) public returns (bool success); + function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); /// @param _owner The address from which the balance will be retrieved /// @return The balance - function balanceOf(address _owner) public view returns (uint256 balance); + function balanceOf(address _owner) external view returns (uint256 balance); /// @param _owner The address of the account owning tokens /// @param _spender The address of the account able to transfer the tokens /// @return Amount of remaining tokens allowed to spent - function allowance(address _owner, address _spender) public view returns (uint256 remaining); + function allowance(address _owner, address _spender) external view returns (uint256 remaining); + + /// total amount of tokens + function totalSupply() external view returns (uint256 supply); event Transfer(address indexed _from, address indexed _to, uint256 _value); event Approval(address indexed _owner, address indexed _spender, uint256 _value); diff --git a/contracts/token/StandardToken.sol b/contracts/token/StandardToken.sol index 10ca74a..d42852c 100644 --- a/contracts/token/StandardToken.sol +++ b/contracts/token/StandardToken.sol @@ -4,23 +4,24 @@ import "./ERC20Token.sol"; contract StandardToken is ERC20Token { + uint256 private supply; mapping (address => uint256) balances; mapping (address => mapping (address => uint256)) allowed; constructor() internal { } - + function transfer( address _to, uint256 _value ) - public + external returns (bool success) { return transfer(msg.sender, _to, _value); } function approve(address _spender, uint256 _value) - public + external returns (bool success) { allowed[msg.sender][_spender] = _value; @@ -33,7 +34,7 @@ contract StandardToken is ERC20Token { address _to, uint256 _value ) - public + external returns (bool success) { if (balances[_from] >= _value && @@ -47,7 +48,7 @@ contract StandardToken is ERC20Token { } function allowance(address _owner, address _spender) - public + external view returns (uint256 remaining) { @@ -55,12 +56,31 @@ contract StandardToken is ERC20Token { } function balanceOf(address _owner) - public + external view returns (uint256 balance) { return balances[_owner]; } + + function totalSupply() + external + view + returns(uint256 supply) + { + return supply; + } + + function mint( + address _to, + uint256 _amount + ) + internal + { + balances[_to] += _amount; + supply += _amount; + emit Transfer(0x0, _to, _amount); + } function transfer( address _from, From 9067b7a21c3b700cd5c5ee953e89e403e65830f3 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Mon, 7 May 2018 23:38:01 -0300 Subject: [PATCH 3/9] Implement TestToken --- contracts/token/TestToken.sol | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 contracts/token/TestToken.sol diff --git a/contracts/token/TestToken.sol b/contracts/token/TestToken.sol new file mode 100644 index 0000000..2afff21 --- /dev/null +++ b/contracts/token/TestToken.sol @@ -0,0 +1,19 @@ +pragma solidity ^0.4.23; + +import "./StandardToken.sol"; + +/** + * @notice ERC20Token for test scripts, can be minted by anyone. + */ +contract TestToken is StandardToken { + + constructor() public { } + + /** + * @notice any caller can mint any `_amount` + * @param _amount how much to be minted + */ + function mint(uint256 _amount) public { + mint(msg.sender, _amount); + } +} From 7b798620057bd5683c13c5516f1fdd539bc85849 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Mon, 7 May 2018 23:38:54 -0300 Subject: [PATCH 4/9] make constructors internal of abstract contracts --- contracts/common/Controlled.sol | 2 +- contracts/common/Owned.sol | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/common/Controlled.sol b/contracts/common/Controlled.sol index d2773f3..7b615b6 100644 --- a/contracts/common/Controlled.sol +++ b/contracts/common/Controlled.sol @@ -10,7 +10,7 @@ contract Controlled { address public controller; - constructor() public { + constructor() internal { controller = msg.sender; } diff --git a/contracts/common/Owned.sol b/contracts/common/Owned.sol index 177bf0f..18f03e7 100644 --- a/contracts/common/Owned.sol +++ b/contracts/common/Owned.sol @@ -14,7 +14,7 @@ contract Owned { address public owner; /// @notice The Constructor assigns the message sender to be `owner` - constructor() public { + constructor() internal { owner = msg.sender; } From a597410b660b0c3f1e7f5f8579c0ce17b8ff4d59 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Tue, 8 May 2018 00:53:51 -0300 Subject: [PATCH 5/9] fix comment blocks --- contracts/token/ERC20Token.sol | 52 +++++++++++++++++++++------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/contracts/token/ERC20Token.sol b/contracts/token/ERC20Token.sol index 63678ea..ff8de15 100644 --- a/contracts/token/ERC20Token.sol +++ b/contracts/token/ERC20Token.sol @@ -4,36 +4,48 @@ pragma solidity ^0.4.23; // https://github.com/ethereum/EIPs/issues/20 interface ERC20Token { - - /// @notice send `_value` token to `_to` from `msg.sender` - /// @param _to The address of the recipient - /// @param _value The amount of token to be transferred - /// @return Whether the transfer was successful or not + + /** + * @notice send `_value` token to `_to` from `msg.sender` + * @param _to The address of the recipient + * @param _value The amount of token to be transferred + * @return Whether the transfer was successful or not + */ function transfer(address _to, uint256 _value) external returns (bool success); - /// @notice `msg.sender` approves `_spender` to spend `_value` tokens - /// @param _spender The address of the account able to transfer the tokens - /// @param _value The amount of tokens to be approved for transfer - /// @return Whether the approval was successful or not + /** + * @notice `msg.sender` approves `_spender` to spend `_value` tokens + * @param _spender The address of the account able to transfer the tokens + * @param _value The amount of tokens to be approved for transfer + * @return Whether the approval was successful or not + */ function approve(address _spender, uint256 _value) external returns (bool success); - /// @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` - /// @param _from The address of the sender - /// @param _to The address of the recipient - /// @param _value The amount of token to be transferred - /// @return Whether the transfer was successful or not + /** + * @notice send `_value` token to `_to` from `_from` on the condition it is approved by `_from` + * @param _from The address of the sender + * @param _to The address of the recipient + * @param _value The amount of token to be transferred + * @return Whether the transfer was successful or not + */ function transferFrom(address _from, address _to, uint256 _value) external returns (bool success); - /// @param _owner The address from which the balance will be retrieved - /// @return The balance + /** + * @param _owner The address from which the balance will be retrieved + * @return The balance + */ function balanceOf(address _owner) external view returns (uint256 balance); - /// @param _owner The address of the account owning tokens - /// @param _spender The address of the account able to transfer the tokens - /// @return Amount of remaining tokens allowed to spent + /** + * @param _owner The address of the account owning tokens + * @param _spender The address of the account able to transfer the tokens + * @return Amount of remaining tokens allowed to spent + */ function allowance(address _owner, address _spender) external view returns (uint256 remaining); - /// total amount of tokens + /** + * @notice return total supply of tokens + */ function totalSupply() external view returns (uint256 supply); event Transfer(address indexed _from, address indexed _to, uint256 _value); From 0a1cbb5fffc5e1d34fd03bd9faf27b1f046ee4e8 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Sat, 12 May 2018 21:16:18 -0300 Subject: [PATCH 6/9] test script for testtoken and erc20token --- config/blockchain.json | 4 +- config/development/genesis.json | 4 +- contracts/token/StandardToken.sol | 2 +- embark.json | 13 ++++-- package.json | 12 ++---- test/erc20token.js | 66 +++++++++++++++++++++++++++++++ test/testtoken.js | 34 ++++++++++++++++ 7 files changed, 119 insertions(+), 16 deletions(-) create mode 100644 test/erc20token.js create mode 100644 test/testtoken.js diff --git a/config/blockchain.json b/config/blockchain.json index 9dccb92..638c816 100644 --- a/config/blockchain.json +++ b/config/blockchain.json @@ -9,12 +9,12 @@ "maxpeers": 0, "rpcHost": "localhost", "rpcPort": 8545, - "rpcCorsDomain": "http://localhost:8000", + "rpcCorsDomain": "auto", "account": { "password": "config/development/password" }, "targetGasLimit": 8000000, - "wsOrigins": "http://localhost:8000", + "wsOrigins": "auto", "wsRPC": true, "wsHost": "localhost", "wsPort": 8546, diff --git a/config/development/genesis.json b/config/development/genesis.json index 4b6ce0d..1a9501b 100644 --- a/config/development/genesis.json +++ b/config/development/genesis.json @@ -1,6 +1,8 @@ { "config": { - "homesteadBlock": 1 + "homesteadBlock": 1, + "byzantiumBlock": 1, + "daoForkSupport": true }, "nonce": "0x0000000000000042", "difficulty": "0x0", diff --git a/contracts/token/StandardToken.sol b/contracts/token/StandardToken.sol index d42852c..46b961e 100644 --- a/contracts/token/StandardToken.sol +++ b/contracts/token/StandardToken.sol @@ -66,7 +66,7 @@ contract StandardToken is ERC20Token { function totalSupply() external view - returns(uint256 supply) + returns(uint256 totalSupply) { return supply; } diff --git a/embark.json b/embark.json index ba742a4..7bd3d48 100644 --- a/embark.json +++ b/embark.json @@ -1,10 +1,17 @@ { "contracts": ["contracts/**"], + "app": { + "js/dapp.js": ["app/dapp.js"], + "index.html": "app/index.html", + "images/": ["app/images/**"] + }, "buildDir": "dist/", "config": "config/", - "plugins": { - }, "versions": { - "solc": "0.4.23" + "web3": "1.0.0-beta", + "solc": "0.4.23", + "ipfs-api": "17.2.4" + }, + "plugins": { } } diff --git a/package.json b/package.json index 7cf6084..e188c49 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,7 @@ { "name": "status-contracts", - "version": "1.0.0", + "version": "0.0.1", + "description": "", "scripts": { "solidity-coverage": "./node_modules/.bin/solidity-coverage", "test": "embark test" @@ -15,13 +16,6 @@ "url": "https://github.com/status-im/contracts/issues" }, "homepage": "https://github.com/status-im/contracts#readme", - "devDependencies": { - "solidity-coverage": "^0.5.0", - "elliptic": "^6.4.0" - }, - "dependencies": { - "embark": "^2.7.0", - "elliptic-curve": "^0.1.0", - "ethereumjs-util": "^5.1.5" + "dependencies": { } } diff --git a/test/erc20token.js b/test/erc20token.js new file mode 100644 index 0000000..075ddeb --- /dev/null +++ b/test/erc20token.js @@ -0,0 +1,66 @@ +describe("ERC20Token", async function() { + this.timeout(0); + var ERC20Token; + var accountsArr; + before(function(done) { + this.timeout(0); + var contractsConfig = { + "TestToken": { + } + }; + EmbarkSpec.deployAll(contractsConfig, async function(accounts) { + ERC20Token = TestToken; + accountsArr = accounts; + for(i=0;i { accountsArr = accounts; done() }); + }); + + + it("should start totalSupply 0", async function() { + let result = await TestToken.methods.totalSupply().call(); + assert.equal(result, 0); + }); + + it("should increase totalSupply in mint", async function() { + let initialSupply = await TestToken.methods.balanceOf(accountsArr[0]).call(); + await TestToken.methods.mint(100).send({from: accountsArr[0]}); + let result = await TestToken.methods.totalSupply().call(); + assert.equal(result, 100); + }); + + it("should increase accountBalance in mint", async function() { + let initialBalance = await TestToken.methods.balanceOf(accountsArr[0]).call(); + await TestToken.methods.mint(100).send({from: accountsArr[0]}); + let result = await TestToken.methods.totalSupply().call(); + assert.equal(result, +initialBalance+100); + }); + + +}); From 611649fbd733700c004432db6fb0c29ae1043c8b Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Sun, 13 May 2018 01:28:15 -0300 Subject: [PATCH 7/9] rename return value --- contracts/token/StandardToken.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/token/StandardToken.sol b/contracts/token/StandardToken.sol index 46b961e..b80c513 100644 --- a/contracts/token/StandardToken.sol +++ b/contracts/token/StandardToken.sol @@ -66,7 +66,7 @@ contract StandardToken is ERC20Token { function totalSupply() external view - returns(uint256 totalSupply) + returns(uint256 currentTotalSupply) { return supply; } From 62bf93868cb389d8d12c9aa2ec691a70ce534170 Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Sun, 13 May 2018 01:31:01 -0300 Subject: [PATCH 8/9] simple token UI --- app/components/erc20token.js | 131 +++++++++++++++++++++++++++++++++++ app/components/testtoken.js | 89 ++++++++++++++++++++++++ app/dapp.css | 53 ++++++++++++++ app/dapp.js | 48 +++++++++++++ app/index.html | 12 ++++ 5 files changed, 333 insertions(+) create mode 100644 app/components/erc20token.js create mode 100644 app/components/testtoken.js create mode 100644 app/dapp.css create mode 100644 app/dapp.js create mode 100644 app/index.html diff --git a/app/components/erc20token.js b/app/components/erc20token.js new file mode 100644 index 0000000..6695adf --- /dev/null +++ b/app/components/erc20token.js @@ -0,0 +1,131 @@ +import EmbarkJS from 'Embark/EmbarkJS'; +import ERC20Token from 'Embark/contracts/ERC20Token'; +import React from 'react'; +import { Form, FormGroup, FormControl, HelpBlock, Button } from 'react-bootstrap'; + +class ERC20TokenUI extends React.Component { + + constructor(props) { + super(props); + this.state = { + + balanceOf: 0, + transferTo: "", + transferAmount: 0, + logs: [] + } + } + + contractAddress(e){ + e.preventDefault(); + var tokenAddress = e.target.value; + ERC20Token.options.address = tokenAddress; + } + + update_transferTo(e){ + this.setState({transferTo: e.target.value}); + } + + update_transferAmount(e){ + this.setState({transferAmount: e.target.value}); + } + + transfer(e){ + var to = this.state.transferTo; + var amount = this.state.transferAmount; + var tx = ERC20Token.methods.transfer(to, amount).send({from: web3.eth.defaultAccount}); + this._addToLog(ERC20Token.options.address+".transfer(" + to + ", "+amount+")"); + } + + approve(e){ + var to = this.state.transferTo; + var amount = this.state.transferAmount; + var tx = ERC20Token.methods.approve(to, amount).send({from: web3.eth.defaultAccount}); + this._addToLog(ERC20Token.options.address+".approve(" + to + ", "+amount+")"); + } + + balanceOf(e){ + e.preventDefault(); + var who = e.target.value; + if (EmbarkJS.isNewWeb3()) { + ERC20Token.methods.balanceOf(who).call() + .then(_value => this.setState({balanceOf: _value})) + + } else { + ERC20Token.balanceOf(who) + .then(_value => this.x({balanceOf: _value})); + } + this._addToLog(ERC20Token.options.address+".balanceOf(" + who + ")"); + } + + + _addToLog(txt){ + this.state.logs.push(txt); + this.setState({logs: this.state.logs}); + } + + render(){ + return ( + +

Set token contract address

+
+ + this.contractAddress(e)} /> + +
+ + +

Read account token balance

+
+ + + + + +
+ +

Transfer/Approve token balance

+
+ + + + + + +
+ +

Contract Calls

+

Javascript calls being made:

+
+ { + this.state.logs.map((item, i) =>

{item}

) + } +
+
+ ); + } + } + + export default ERC20TokenUI; \ No newline at end of file diff --git a/app/components/testtoken.js b/app/components/testtoken.js new file mode 100644 index 0000000..24aa605 --- /dev/null +++ b/app/components/testtoken.js @@ -0,0 +1,89 @@ +import EmbarkJS from 'Embark/EmbarkJS'; +import TestToken from 'Embark/contracts/TestToken'; +import React from 'react'; +import { Form, FormGroup, FormControl, HelpBlock, Button } from 'react-bootstrap'; + +class TestTokenUI extends React.Component { + + constructor(props) { + super(props); + this.state = { + amountToMint: 100, + accountBalance: 0, + accountB: web3.eth.defaultAccount, + balanceOf: 0, + logs: [] + } + } + + handleMintAmountChange(e){ + this.setState({amountToMint: e.target.value}); + } + + mint(e){ + e.preventDefault(); + + var value = parseInt(this.state.amountToMint, 10); + + // If web3.js 1.0 is being used + if (EmbarkJS.isNewWeb3()) { + TestToken.methods.mint(value).send({from: web3.eth.defaultAccount}); + this._addToLog("TestToken.methods.mint("+value+").send({from: " + web3.eth.defaultAccount + "})"); + } else { + TestToken.mint(value); + this._addToLog("#blockchain", "TestToken.mint(" + value + ")"); + } + } + + getBalance(e){ + e.preventDefault(); + + if (EmbarkJS.isNewWeb3()) { + TestToken.methods.balanceOf(web3.eth.defaultAccount).call() + .then(_value => this.setState({accountBalance: _value})) + } else { + TestToken.balanceOf(web3.eth.defaultAccount) + .then(_value => this.x({valueGet: _value})) + } + this._addToLog(TestToken.options.address + ".balanceOf(" + web3.eth.defaultAccount + ")"); + } + + _addToLog(txt){ + this.state.logs.push(txt); + this.setState({logs: this.state.logs}); + } + + render(){ + return ( +

1. Mint Test Token

+
+ + this.handleMintAmountChange(e)} /> + + +
+ +

2. Read your account token balance

+
+ + Your test token balance is {this.state.accountBalance} + + +
+ +

3. Contract Calls

+

Javascript calls being made:

+
+ { + this.state.logs.map((item, i) =>

{item}

) + } +
+
+ ); + } + } + + export default TestTokenUI; \ No newline at end of file diff --git a/app/dapp.css b/app/dapp.css new file mode 100644 index 0000000..49f1976 --- /dev/null +++ b/app/dapp.css @@ -0,0 +1,53 @@ + +div { + margin: 15px; +} + +.logs { + background-color: black; + font-size: 14px; + color: white; + font-weight: bold; + padding: 10px; + border-radius: 8px; +} + +.tab-content { + border-left: 1px solid #ddd; + border-right: 1px solid #ddd; + border-bottom: 1px solid #ddd; + padding: 10px; + margin: 0px; +} + +.nav-tabs { + margin-bottom: 0; +} + +.status-offline { + vertical-align: middle; + margin-left: 5px; + margin-top: 4px; + width: 12px; + height: 12px; + background: red; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} + +.status-online { + vertical-align: middle; + margin-left: 5px; + margin-top: 4px; + width: 12px; + height: 12px; + background: mediumseagreen; + -moz-border-radius: 10px; + -webkit-border-radius: 10px; + border-radius: 10px; +} + +input.form-control { + margin: 5px; +} \ No newline at end of file diff --git a/app/dapp.js b/app/dapp.js new file mode 100644 index 0000000..6df03e3 --- /dev/null +++ b/app/dapp.js @@ -0,0 +1,48 @@ +import React from 'react'; +import ReactDOM from 'react-dom'; +import { Tabs, Tab } from 'react-bootstrap'; + +import EmbarkJS from 'Embark/EmbarkJS'; +import TestTokenUI from './components/testtoken'; +import ERC20TokenUI from './components/erc20token'; + +import './dapp.css'; + +class App extends React.Component { + + constructor(props) { + super(props); + + + } + + componentDidMount(){ + __embarkContext.execWhenReady(() => { + + }); + } + + + _renderStatus(title, available){ + let className = available ? 'pull-right status-online' : 'pull-right status-offline'; + return + {title} + + ; + } + + render(){ + return (

Status.im Contracts

+ + + + + + + + +
); + } +} + +ReactDOM.render(, document.getElementById('app')); diff --git a/app/index.html b/app/index.html new file mode 100644 index 0000000..1fb8607 --- /dev/null +++ b/app/index.html @@ -0,0 +1,12 @@ + + + Status.im - Contracts + + + + +
+
+ + + From a89d67f11a50d930907c7e8a208863ca79de2a7a Mon Sep 17 00:00:00 2001 From: Ricardo Guilherme Schmidt <3esmit@gmail.com> Date: Sun, 13 May 2018 01:40:56 -0300 Subject: [PATCH 9/9] fix in log --- app/components/testtoken.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/components/testtoken.js b/app/components/testtoken.js index 24aa605..3618caa 100644 --- a/app/components/testtoken.js +++ b/app/components/testtoken.js @@ -25,14 +25,13 @@ class TestTokenUI extends React.Component { var value = parseInt(this.state.amountToMint, 10); - // If web3.js 1.0 is being used if (EmbarkJS.isNewWeb3()) { TestToken.methods.mint(value).send({from: web3.eth.defaultAccount}); - this._addToLog("TestToken.methods.mint("+value+").send({from: " + web3.eth.defaultAccount + "})"); } else { TestToken.mint(value); this._addToLog("#blockchain", "TestToken.mint(" + value + ")"); } + this._addToLog(TestToken.options.address +".mint("+value+").send({from: " + web3.eth.defaultAccount + "})"); } getBalance(e){