mirror of
https://github.com/status-im/contracts.git
synced 2025-02-22 19:48:44 +00:00
port app to embark4 and mint to statusroot
This commit is contained in:
parent
542e7bed86
commit
6559ff86ac
5
.babelrc
5
.babelrc
@ -1,4 +1,3 @@
|
||||
{
|
||||
"plugins": ["transform-object-rest-spread"],
|
||||
"presets": ["stage-2"]
|
||||
}
|
||||
"presets": ["@babel/preset-env"]
|
||||
}
|
@ -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>
|
||||
);
|
||||
|
@ -17,9 +17,7 @@ class App extends React.Component {
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
__embarkContext.execWhenReady(() => {
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)
|
||||
})
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -1,4 +1,4 @@
|
||||
pragma solidity ^0.4.23;
|
||||
pragma solidity >=0.5.0 <0.6.0;
|
||||
|
||||
import "./StandardToken.sol";
|
||||
|
||||
|
@ -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": {
|
||||
|
12
package.json
12
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"
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user