From 6559ff86ac6c06047b2cb5fe82a5645ce75ce8a7 Mon Sep 17 00:00:00 2001
From: Ricardo Guilherme Schmidt <3esmit@gmail.com>
Date: Sat, 29 Dec 2018 06:24:40 -0200
Subject: [PATCH] port app to embark4 and mint to statusroot
---
.babelrc | 5 ++---
app/components/testtoken.js | 18 +++++++-----------
app/dapp.js | 4 +---
app/store/init.js | 2 +-
contracts/token/StandardToken.sol | 6 +-----
contracts/token/TestToken.sol | 2 +-
embark.json | 7 ++++++-
package.json | 12 ++++++++++++
8 files changed, 31 insertions(+), 25 deletions(-)
diff --git a/.babelrc b/.babelrc
index 577b026..8aa924d 100644
--- a/.babelrc
+++ b/.babelrc
@@ -1,4 +1,3 @@
{
- "plugins": ["transform-object-rest-spread"],
- "presets": ["stage-2"]
-}
+ "presets": ["@babel/preset-env"]
+}
\ No newline at end of file
diff --git a/app/components/testtoken.js b/app/components/testtoken.js
index 0670abc..4d8545a 100644
--- a/app/components/testtoken.js
+++ b/app/components/testtoken.js
@@ -1,5 +1,6 @@
import EmbarkJS from 'Embark/EmbarkJS';
-import TestToken from 'Embark/contracts/TestToken';
+import StatusRoot from 'Embark/contracts/StatusRoot';
+import MiniMeToken from 'Embark/contracts/MiniMeToken';
import React from 'react';
import { Form, FormGroup, FormControl, HelpBlock, Button } from 'react-bootstrap';
import ERC20TokenUI from './erc20token';
@@ -24,15 +25,10 @@ class TestTokenUI extends React.Component {
e.preventDefault();
var value = parseInt(this.state.amountToMint, 10);
-
- if (EmbarkJS.isNewWeb3()) {
- TestToken.methods.mint(value).send({from: web3.eth.defaultAccount})
- .then(r => { addToBalance(value) });
- } else {
- TestToken.mint(value).send({from: web3.eth.defaultAccount})
- .then(r => { addToBalance(value) });
- }
- console.log(TestToken.options.address +".mint("+value+").send({from: " + web3.eth.defaultAccount + "})");
+ StatusRoot.methods.mint(value).send({from: web3.eth.defaultAccount})
+ .then(r => { addToBalance(value) });
+
+ console.log(StatusRoot.options.address +".mint("+value+").send({from: " + web3.eth.defaultAccount + "})");
}
render(){
@@ -48,7 +44,7 @@ class TestTokenUI extends React.Component {
-
+
);
diff --git a/app/dapp.js b/app/dapp.js
index ca9825c..2b6b608 100644
--- a/app/dapp.js
+++ b/app/dapp.js
@@ -17,9 +17,7 @@ class App extends React.Component {
}
componentDidMount(){
- __embarkContext.execWhenReady(() => {
-
- });
+
}
diff --git a/app/store/init.js b/app/store/init.js
index b7fabd0..6e907fc 100644
--- a/app/store/init.js
+++ b/app/store/init.js
@@ -6,7 +6,7 @@ import { fetchAndDispatchAccountsWithBalances } from '../actions/accounts'
const dispatch = action => store.dispatch(action)
export default () => {
- __embarkContext.execWhenReady(async () => {
+ EmbarkJS.onReady((err) => {
fetchAndDispatchAccountsWithBalances(web3, dispatch)
})
}
diff --git a/contracts/token/StandardToken.sol b/contracts/token/StandardToken.sol
index 91ca055..484f5a8 100644
--- a/contracts/token/StandardToken.sol
+++ b/contracts/token/StandardToken.sol
@@ -84,11 +84,7 @@ contract StandardToken is ERC20Token {
{
if (balances[_from] >= _value && _value > 0) {
balances[_from] -= _value;
- if(_to == address(0)) {
- supply -= _value;
- } else {
- balances[_to] += _value;
- }
+ balances[_to] += _value;
emit Transfer(_from, _to, _value);
return true;
} else {
diff --git a/contracts/token/TestToken.sol b/contracts/token/TestToken.sol
index 2afff21..6107bfd 100644
--- a/contracts/token/TestToken.sol
+++ b/contracts/token/TestToken.sol
@@ -1,4 +1,4 @@
-pragma solidity ^0.4.23;
+pragma solidity >=0.5.0 <0.6.0;
import "./StandardToken.sol";
diff --git a/embark.json b/embark.json
index de2b76a..b0ce865 100644
--- a/embark.json
+++ b/embark.json
@@ -1,6 +1,11 @@
{
"contracts": ["contracts/**"],
- "app": {},
+ "app": {
+ "js/dapp.js": ["app/dapp.js"],
+ "js/index.js": ["app/index.js"],
+ "index.html": "app/index.html",
+ "images/": ["app/images/**"]
+},
"buildDir": "dist/",
"config": "config/",
"versions": {
diff --git a/package.json b/package.json
index 9aad4f3..05d3f91 100644
--- a/package.json
+++ b/package.json
@@ -17,9 +17,21 @@
"url": "https://github.com/status-im/contracts/issues"
},
"homepage": "https://github.com/status-im/contracts#readme",
+ "devDependencies": {
+ "@babel/core": "^7.0.0",
+ "@babel/preset-env": "^7.2.3"
+ },
"dependencies": {
"elliptic-curve": "^0.1.0",
"ethereumjs-util": "^5.1.5",
+ "react": "^16.3.2",
+ "react-blockies": "^1.4.0",
+ "react-bootstrap": "0.32.1",
+ "react-dom": "^16.3.2",
+ "react-redux": "^6.0.0",
+ "redux": "^4.0.1",
+ "redux-action-creator": "^3.0.0",
+ "redux-thunk": "^2.3.0",
"web3": "^1.0.0-beta.34"
}
}