small fixes

This commit is contained in:
Ricardo Guilherme Schmidt 2019-02-13 01:04:02 -02:00
parent eebb8b352b
commit f8662ebc54
No known key found for this signature in database
GPG Key ID: BFB3F5C8ED618A94
5 changed files with 28 additions and 23 deletions

View File

@ -1,5 +1,5 @@
import EmbarkJS from 'Embark/EmbarkJS';
import TestStatusNetwork from 'Embark/contracts/TestStatusNetwork';
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';
@ -22,9 +22,9 @@ class TestTokenUI extends React.Component {
e.preventDefault();
await EmbarkJS.enableEthereum();
var value = parseInt(this.state.amountToMint, 10);
TestStatusNetwork.methods.mint(value).send({ gas: 1000000 })
StatusRoot.methods.mint(value).send({ gas: 1000000 })
console.log(TestStatusNetwork.options.address +".mint("+value+").send({from: " + web3.eth.defaultAccount + "})");
console.log(StatusRoot.options.address +".mint("+value+").send({from: " + web3.eth.defaultAccount + "})");
}
render(){

View File

@ -28,29 +28,34 @@ class ERC20TokenUI extends React.Component {
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+")");
this._addToLog(ERC20Token.options.address+".methods.transfer(" + to + ", "+amount+").send({from: " + web3.eth.defaultAccount + "})");
var tx = ERC20Token.methods.transfer(to, amount);
tx.estimateGas().then((r) => {
tx.send({gas: r, from: web3.eth.defaultAccount});
});
}
approve(e){
var to = this.state.transferTo;
var amount = this.state.transferAmount;
this._addToLog(ERC20Token.options.address+".methods.approve(" + to + ", "+amount+").send({from: " + web3.eth.defaultAccount + "})");
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;
this._addToLog(ERC20Token.options.address+".methods.balanceOf(" + who + ").call()");
ERC20Token.methods.balanceOf(who).call()
.then(_value => this.setState({balanceOf: _value}))
this._addToLog(ERC20Token.options.address+".balanceOf(" + who + ")");
}
getDefaultAccountBalance(){
this._addToLog(ERC20Token.options.address + ".methods.balanceOf(" + web3.eth.defaultAccount + ").call()");
ERC20Token.methods.balanceOf(web3.eth.defaultAccount).call()
.then(_value => this.setState({accountBalance: _value}))
this._addToLog(ERC20Token.options.address + ".balanceOf(" + web3.eth.defaultAccount + ")");
}
_addToLog(txt){
@ -103,7 +108,7 @@ class ERC20TokenUI extends React.Component {
</React.Fragment>
);
}
}
}
export default ERC20TokenUI;

View File

@ -1,7 +1,7 @@
import React from 'react';
import { Tabs, Tab } from 'react-bootstrap';
import EmbarkJS from 'Embark/EmbarkJS';
import TestTokenUI from './components/TestStatusNetwork';
import TestStatusNetworkUI from './components/TestStatusNetwork';
import './dapp.css';
@ -31,8 +31,8 @@ class DApp extends React.Component {
<div>
<Tabs defaultActiveKey={1} id="uncontrolled-tab-example">
<Tab eventKey={1} title="TestToken">
<TestTokenUI />
<Tab eventKey={1} title="TestStatusNetwork">
<TestStatusNetworkUI />
</Tab>
</Tabs>
</div>);

View File

@ -14,22 +14,22 @@ module.exports = {
"http://localhost:8545"
],
gas: "auto",
contracts: {
"ERC20Receiver": {"deploy": false},
"SafeMath": {"deploy": false},
"MiniMeTokenFactory": {},
strategy: "explicit",
contracts: {
"MiniMeTokenFactory": {
"deploy": true
},
"MiniMeToken": {
"deploy": true,
"args":["$MiniMeTokenFactory", "0x0", "0x0", "Status Test Token", 18, "STT", true],
},
"StatusNetwork": {"deploy": false},
"TestStatusNetwork": {
"StatusRoot": {
"instanceOf": "TestStatusNetwork",
"deploy": true,
"args": ["0x0", "$MiniMeToken"],
"onDeploy": [
"await MiniMeToken.methods.changeController(TestStatusNetwork.address).send()",
"await TestStatusNetwork.methods.setOpen(true).send()",
"await MiniMeToken.methods.changeController(StatusRoot.address).send()",
"await StatusRoot.methods.setOpen(true).send()",
]
}
}

View File

@ -10,7 +10,7 @@
"config": "config/",
"versions": {
"web3": "1.0.0-beta",
"solc": "0.5.0",
"solc": "0.5.4",
"ipfs-api": "17.2.4",
"p-iteration": "1.1.7"
},