port app to embark4 and mint to statusroot

This commit is contained in:
Ricardo Guilherme Schmidt 2018-12-29 06:24:40 -02:00
parent 542e7bed86
commit 6559ff86ac
No known key found for this signature in database
GPG Key ID: 3F95A3AD0B607030
8 changed files with 31 additions and 25 deletions

View File

@ -1,4 +1,3 @@
{
"plugins": ["transform-object-rest-spread"],
"presets": ["stage-2"]
}
"presets": ["@babel/preset-env"]
}

View File

@ -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 {
</FormGroup>
</Form>
<ERC20TokenUI address={ TestToken.options.address } />
<ERC20TokenUI address={ MiniMeToken.options.address } />
</React.Fragment>
);

View File

@ -17,9 +17,7 @@ class App extends React.Component {
}
componentDidMount(){
__embarkContext.execWhenReady(() => {
});
}

View File

@ -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)
})
}

View File

@ -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 {

View File

@ -1,4 +1,4 @@
pragma solidity ^0.4.23;
pragma solidity >=0.5.0 <0.6.0;
import "./StandardToken.sol";

View File

@ -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": {

View File

@ -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"
}
}