diff --git a/app/TopicDemocracy.jsx b/app/TopicDemocracy.jsx index bd8c271..dba6d2e 100644 --- a/app/TopicDemocracy.jsx +++ b/app/TopicDemocracy.jsx @@ -1,7 +1,7 @@ import React from 'react'; import ReactDOM from 'react-dom'; -import EmbarkJS from 'Embark/EmbarkJS'; -import Delegation from 'Embark/contracts/Delegation'; +import EmbarkJS from '../embarkArtifacts/embarkjs'; +import Delegation from '../embarkArtifacts/contracts/Delegation'; import { HashRouter, Route, Redirect, Link } from "react-router-dom"; import './TopicDemocracy.css'; @@ -34,7 +34,8 @@ class TopicDemocracy extends React.Component { this.state = { error: null, - defaultAccount: null + defaultAccount: null, + deployedAddress: null }; } @@ -43,6 +44,7 @@ class TopicDemocracy extends React.Component { if (err) { return this.setState({ error: err.message || err }); } + console.log(web3.eth.defaultAccount) this.setState({ defaultAccount: web3.eth.defaultAccount, blockchainEnabled: true }) }); @@ -50,7 +52,7 @@ class TopicDemocracy extends React.Component { render() { const { classes } = this.props; - const { blockchainEnabled, defaultAccount } = this.state; + const { blockchainEnabled, defaultAccount, deployedAddress } = this.state; if (!blockchainEnabled) { return (
Waiting for blockchain.
@@ -74,7 +76,7 @@ class TopicDemocracy extends React.Component {
( - + {this.setState({deployedAddress})} } /> )} /> ( diff --git a/app/actions/accounts.js b/app/actions/accounts.js index 6e5323a..2dfaf53 100644 --- a/app/actions/accounts.js +++ b/app/actions/accounts.js @@ -1,4 +1,4 @@ -import ERC20Token from 'Embark/contracts/ERC20Token'; +import ERC20Token from '../../embarkArtifacts/contracts/ERC20Token'; import { actions as accountActions } from '../reducers/accounts' const { receiveAccounts } = accountActions diff --git a/app/components/DelegationFactoryUI.jsx b/app/components/DelegationFactoryUI.jsx index 4987950..5031272 100644 --- a/app/components/DelegationFactoryUI.jsx +++ b/app/components/DelegationFactoryUI.jsx @@ -1,7 +1,8 @@ import React from 'react'; import PropTypes from 'prop-types'; +import { Redirect } from "react-router-dom"; import { withStyles } from '@material-ui/core/styles'; -import DelegationFactory from 'Embark/contracts/DelegationFactory'; +import DelegationFactory from '../../embarkArtifacts/contracts/DelegationFactory'; import EthAddress from './EthAddress'; import { FormLabel, Paper, Grid } from '@material-ui/core'; import TransactionSendButton from './TransactionSendButton'; @@ -30,30 +31,34 @@ class DelegationFactoryUI extends React.Component { constructor(props) { super(props); this.state = { - parent: null, controller: props.account, - defaultDelegate: null + parent: "0x0000000000000000000000000000000000000000", + defaultDelegate: "0x0000000000000000000000000000000000000000", + deployedAddress: null }; } render() { const { classes, account } = this.props; - const { parent, controller, defaultDelegate } = this.state; + const { parent, controller, defaultDelegate, deployedAddress} = this.state; + if(deployedAddress) { + return () + } console.log(parent, controller, defaultDelegate); return ( Controller - this.setState({controller})} /> + this.setState({controller: e.target.value })} /> Default Delegate - this.setState({defaultDelegate})} /> + this.setState({defaultDelegate: e.target.value })} /> Parent Delegation - this.setState({parent})} /> + this.setState({parent: e.target.value })} /> {console.log("txHash",txHash)}} - onResult={(result) => {console.log("result",result.events)}} + onResult={(result) => {this.setState({deployedAddress: result.events.InstanceCreated.returnValues.instance})}} onReceipt={(receipt) => {console.log("receipt",receipt)}} onError={(error) => {console.log("error",error)}} /> diff --git a/app/components/DelegationUI.jsx b/app/components/DelegationUI.jsx index 655877a..1309bbf 100644 --- a/app/components/DelegationUI.jsx +++ b/app/components/DelegationUI.jsx @@ -55,7 +55,7 @@ class DelegationUI extends React.Component { editDelegationOf(delegate) { const editDelegation = this.state.editDelegation; - if(!delegateChain.includes(delegate)){ + if(!editDelegation.includes(delegate)){ editDelegation.push(delegate); this.setState({editDelegation}); this.props.Delegation.methods.delegatedTo(delegate).call().then((delegatedTo) => { @@ -77,7 +77,7 @@ class DelegationUI extends React.Component {

Delegation:

- +
Delegate Chain: @@ -91,7 +91,8 @@ class DelegationUI extends React.Component {

Delegate Set

- { + { + let editDelegate = e.target.value; this.setState({editDelegate}); if(editDelegate != delegateChain[0]) { this.setState({editDelegation : []}); @@ -102,8 +103,8 @@ class DelegationUI extends React.Component { {editDelegation.length > 0 && { - editDelegation.map((value) => { - return + editDelegation.map((value, i) => { + return }) } diff --git a/app/components/EthAddress.jsx b/app/components/EthAddress.jsx index 8b95ac5..189abe5 100644 --- a/app/components/EthAddress.jsx +++ b/app/components/EthAddress.jsx @@ -1,3 +1,4 @@ +import EmbarkJS from '../../embarkArtifacts/embarkjs'; import React from 'react'; import PropTypes from 'prop-types'; import Blockies from 'react-blockies'; @@ -86,6 +87,9 @@ class EthAddress extends React.Component { setValue(value){ + if(!value) { + value = "" + } value = value.trim(); const validAddress = /^(0x)?[0-9a-f]{40}$/i.test(value); const acceptedOutput = validAddress && (this.props.allowZero || value != nullAddress); diff --git a/app/index.html b/app/index.html index 9bfe95d..16e93e6 100644 --- a/app/index.html +++ b/app/index.html @@ -1,12 +1,12 @@ - Status Network - Test Demo + µTopic Democracy
- + diff --git a/app/models/DelegationModel.js b/app/models/DelegationModel.js index 441e4de..5a0f5ff 100644 --- a/app/models/DelegationModel.js +++ b/app/models/DelegationModel.js @@ -1,6 +1,6 @@ -import EmbarkJS from './embarkArtifacts/EmbarkJS'; -import Delegation from './embarkArtifacts/contracts/Delegation'; -import DelegationFactory from './embarkArtifacts/contracts/DelegationFactory'; +import EmbarkJS from '../../embarkArtifacts/embarkjs'; +import Delegation from '../../embarkArtifacts/contracts/Delegation'; +import DelegationFactory from '../../embarkArtifacts/contracts/DelegationFactory'; class DelegationModel { diff --git a/app/store/init.js b/app/store/init.js index b7fabd0..929f6f4 100644 --- a/app/store/init.js +++ b/app/store/init.js @@ -1,5 +1,3 @@ -import web3 from "Embark/web3" -import EmbarkJS from 'Embark/EmbarkJS' import store from './configureStore' import { fetchAndDispatchAccountsWithBalances } from '../actions/accounts' diff --git a/config/communication.js b/config/communication.js index 28d7609..6f6a286 100644 --- a/config/communication.js +++ b/config/communication.js @@ -1,6 +1,6 @@ module.exports = { default: { - enabled: true, + enabled: false, provider: "whisper", available_providers: ["whisper"], }, diff --git a/config/contracts.js b/config/contracts.js index eb49288..b00c4a1 100644 --- a/config/contracts.js +++ b/config/contracts.js @@ -40,7 +40,14 @@ module.exports = { } }, - + development:{ + dappConnection: [ + "$EMBARK", + "$WEB3", + "ws://localhost:8546", + "http://localhost:8545" + ] + }, testnet: { contracts: { MiniMeTokenFactory: { diff --git a/config/storage.js b/config/storage.js index 1f43e20..20f3991 100644 --- a/config/storage.js +++ b/config/storage.js @@ -1,6 +1,6 @@ module.exports = { default: { - enabled: true, + enabled: false, ipfs_bin: "ipfs", available_providers: ["ipfs"], upload: { @@ -18,7 +18,6 @@ module.exports = { ] }, development: { - enabled: true, upload: { provider: "ipfs", host: "localhost", diff --git a/contracts/democracy/Democracy.sol b/contracts/democracy/Democracy.sol index ddfe114..1f4eceb 100644 --- a/contracts/democracy/Democracy.sol +++ b/contracts/democracy/Democracy.sol @@ -6,7 +6,7 @@ import "./delegation/DelegationFactory.sol"; import "./proposal/ProposalFactory.sol"; /** - * @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) + * @author Ricardo Guilherme Schmidt (Status Research & Development GmbH) */ contract Democracy {