Update to Embark 3.2.1 (pt1)

This commit is contained in:
Richard Ramos 2018-09-27 19:37:13 -04:00
parent 50d4f9b98f
commit cc9c965f9c
33 changed files with 1050 additions and 1314 deletions

View File

@ -1,4 +1,24 @@
{
"plugins": ["transform-object-rest-spread"],
"presets": ["stage-2"]
}
"plugins": [
"@babel/plugin-proposal-object-rest-spread",
"@babel/plugin-syntax-dynamic-import",
"@babel/plugin-syntax-import-meta",
"@babel/plugin-proposal-class-properties",
"@babel/plugin-proposal-json-strings",
[
"@babel/plugin-proposal-decorators",
{
"legacy": true
}
],
"@babel/plugin-proposal-function-sent",
"@babel/plugin-proposal-export-namespace-from",
"@babel/plugin-proposal-numeric-separator",
"@babel/plugin-proposal-throw-expressions"
],
"presets": [],
"ignore": [
"config/",
"node_modules"
]
}

View File

@ -5,8 +5,6 @@ import { Tabs, Tab } from 'react-bootstrap';
import TopNavbar from './topnavbar';
import TestTokenUI from './testtoken';
import ERC20TokenUI from './erc20token';
import ProposalManager from './proposal-manager/proposal-manager'
import VotingDapp from './voting-dapp/voting-dapp';
import SNTUI from './snt-ui';
export default ({ setAccount }) => {
@ -15,11 +13,8 @@ export default ({ setAccount }) => {
<TopNavbar accountUpdateHandler={(e) => setAccount(e)} />
<Tabs defaultActiveKey={0} id="uncontrolled-tab-example">
<Tab eventKey={0} title="VotingDapp">
<VotingDapp />
</Tab>
<Tab eventKey={1} title="ProposalManager">
<ProposalManager />
</Tab>
<Tab eventKey={2} title="SNT Token">
<SNTUI />
</Tab>

View File

@ -16,7 +16,7 @@ class AccList extends React.Component {
addresses: [],
balances: []
}
__embarkContext.execWhenReady(() => {
EmbarkJS.onReady(() => {
this.load()
});
}

View File

@ -1,186 +0,0 @@
import EmbarkJS from 'Embark/EmbarkJS';
import ERC20Token from 'Embark/contracts/ERC20Token';
import ProposalCuration from 'Embark/contracts/ProposalCuration';
import SNT from 'Embark/contracts/SNT';
import React, { PureComponent, Fragment } from 'react';
import { Form, FormGroup, FormControl, HelpBlock, Button, Alert } from 'react-bootstrap';
import web3 from "Embark/web3";
import { withFormik } from 'formik';
import FieldGroup from '../standard/FieldGroup';
import TokenPermissions from '../standard/TokenPermission'
const { setSubmitPrice } = ProposalCuration.methods;
class InnerForm extends PureComponent {
constructor(props) {
super(props);
this.state = {
submitPrice: "Loading...",
canSubmit: true
};
}
componentDidMount(){
this._loadPrice();
}
componentWillReceiveProps(){
this._loadPrice();
}
_loadPrice(){
__embarkContext.execWhenReady(async () => {
try {
let _b = await ProposalCuration.methods.getSubmitPrice(web3.eth.defaultAccount).call();
this.setState({
submitPrice: _b,
canSubmit: true
});
} catch(err){
this.setState({
canSubmit: false,
submitPrice: "-"
});
}
});
}
setPrice = (address = web3.eth.defaultAccount, allowed = true, stakeValue = 1) => {
setSubmitPrice(address, allowed, stakeValue)
.send()
.then(res => {
this.setState({ ...this.state, canSubmit: true });
console.log(res);
})
.catch(err => { console.log(err) })
}
render() {
const { values, errors, touched, handleChange, handleBlur, handleSubmit, isSubmitting, setFieldValue } = this.props;
const { canSubmit } = this.state;
return (
<Fragment>
{!canSubmit &&
<Alert bsStyle="warning">
Account not allowed to submit proposals <Button onClick={(e) => this.setPrice()}>Click to enable (Admin only)</Button>
</Alert>
}
<TokenPermissions methods={SNT.methods} spender={ProposalCuration._address} symbol='SNT' />
<hr/>
<h2>Add proposal</h2>
<h3>Price: {this.state.submitPrice}</h3>
<Form onSubmit={handleSubmit}>
<FieldGroup
id="title"
name="title"
type="text"
label="Title"
onChange={handleChange}
onBlur={handleBlur}
value={values.title}
/>
<FieldGroup
id="description"
name="description"
type="text"
label="Description"
onChange={handleChange}
onBlur={handleBlur}
value={values.description}
/>
<FieldGroup
id="url"
name="url"
type="text"
label="URL"
onChange={handleChange}
onBlur={handleBlur}
value={values.url}
/>
<FieldGroup
id="topic"
name="topic"
type="text"
label="Topic"
onChange={handleChange}
onBlur={handleBlur}
value={values.topic}
/>
<FieldGroup
id="to"
name="to"
type="text"
label="To"
onChange={handleChange}
onBlur={handleBlur}
value={values.to}
/>
<FieldGroup
id="data"
name="data"
type="text"
label="Data"
onChange={handleChange}
onBlur={handleBlur}
value={values.data}
/>
<FieldGroup
id="value"
name="value"
type="text"
label="Value"
onChange={handleChange}
onBlur={handleBlur}
value={values.value}
/>
<Button type="submit" disabled={!canSubmit || isSubmitting}>{isSubmitting ? 'Submission in progress' : 'Submit'}</Button>
</Form>
</Fragment>
)
}
}
const ProposalManager = withFormik({
mapPropsToValues: props => ({ title: '', description: '', url: '', data: '0x00', value: '0', topic: '0x00', to: '0x0000000000000000000000000000000000000000' }),
validate(values) {},
handleSubmit(values, { setSubmitting}){
let dataObj = {
title: values.title,
description: values.description,
url: values.url,
};
const { toHex } = web3.utils;
const { submitProposal } = ProposalCuration.methods;
EmbarkJS.Storage.saveText(JSON.stringify(dataObj))
.then(hash => {
const hexHash = toHex(hash);
//TODO create toggle for address approval
submitProposal(
values.topic,
values.to,
values.value,
values.data,
hexHash
)
.send({from: web3.eth.defaultAccount, gasLimit: 1000000})
.then(res => {
setSubmitting(false);
console.log(res);
})
.catch(err => {
setSubmitting(false);
//TODO show error
console.log('Storage saveText Error: ', err.message)
});
})
}
})(InnerForm)
export default ProposalManager;

View File

@ -214,25 +214,22 @@ const AddPoll = withFormik({
}
setSubmitting(true);
toSend.estimateGas()
.then(gasEstimated => {
console.log("addPoll gas estimated: "+ gasEstimated);
return toSend.send({gas: gasEstimated + 100000});
})
.then(res => {
console.log('sucess:', res);
resetForm();
props.getPolls();
setSubmitting(false);
props.togglePoll();
})
.catch(res => {
console.log('fail:', res);
setErrors({ 'description': res.message.split('Error:').pop().trim() });
})
.finally(() => {
setSubmitting(false);
});
try {
const gasEstimated = await toSend.estimateGas();
console.log("addPoll gas estimated: "+ gasEstimated);
const res = await toSend.send({gas: gasEstimated + 100000});
console.log('sucess:', res);
resetForm();
props.getPolls();
setSubmitting(false);
props.togglePoll();
} catch (err) {
console.log('fail:', err);
setErrors({ 'description': err.message.split('Error:').pop().trim() });
}
setSubmitting(false);
}
})(StyledForm)

View File

@ -19,7 +19,7 @@ class SNTUI extends React.Component {
}
componentDidMount(){
__embarkContext.execWhenReady(async () => {
EmbarkJS.onReady(async () => {
this.setState({address: web3.eth.defaultAccount});
});
}
@ -36,7 +36,7 @@ class SNTUI extends React.Component {
SNT.methods.controller().call()
.then((controller) => {
return SNT.methods.generateTokens(address, value)
return SNT.methods.generateTokens(address, value.toString())
.send({from: controller, gasLimit: 1000000});
})
.then(console.log);

View File

@ -1,25 +0,0 @@
import web3 from "Embark/web3"
import EmbarkJS from 'Embark/EmbarkJS';
import React, {Fragment} from 'react';
import {Button} from 'react-bootstrap';
const Paginator = props => {
let ln = Math.ceil(props.total / props.recordsByPage);
let btnArray = []
for(let i = 1; i <= ln; i++){
btnArray.push(<Button
bsStyle="link"
className={i == props.pageNum ? 'current' : ''}
onClick={(e) => props.pageHandler(e, i)}>{i}</Button>)
}
return <div>{
btnArray.map((component, index) => (
<Fragment key={index}>
{ component }
</Fragment>
))
}</div>;
};
export default Paginator;

View File

@ -1,67 +0,0 @@
import web3 from "Embark/web3"
import EmbarkJS from 'Embark/EmbarkJS';
import React, {Component, Fragment} from 'react';
import Proposal from './proposal';
import ProposalList from './proposal-list';
import Paginator from './paginator';
import ProposalManager from 'Embark/contracts/ProposalManager';
import ProposalCuration from 'Embark/contracts/ProposalCuration';
const pageLength = 4;
class ProposalContainer extends Component {
constructor(props) {
super(props);
this.state = {
proposals: [],
total: 0,
page: 1
};
window['ProposalCuration'] = ProposalCuration;
}
componentDidMount(){
__embarkContext.execWhenReady(async () => {
ProposalManager.options.address = await ProposalCuration.methods.proposalManager().call();
await this.getTotalProposals();
await this.getProposalsOnPage(this.state.page);
});
}
async getTotalProposals(){
let proposalCount = await ProposalManager.methods.getProposalCount().call();
this.setState({
total: parseInt(proposalCount)
});
}
async getProposalsOnPage(pageNum){
this.fetchProposals((pageNum - 1) * pageLength, pageLength,
_p => {
this.setState({
proposals: _p,
page: pageNum
});
});
}
async fetchProposals(from, qty, cb){
let proposalList = [];
for(let i = from; i < from + qty && i < this.state.total; i++){
let res = await ProposalCuration.methods.proposals(i).call();
res.id = i;
proposalList.push(res);
}
cb(proposalList);
}
render(){
return <Fragment>
<ProposalList proposals={this.state.proposals} />
<Paginator total={this.state.total} recordsByPage={pageLength} page={this.state.page} pageHandler={(e, pageNum) => this.getProposalsOnPage(pageNum) } />
</Fragment>;
}
}
export default ProposalContainer;

View File

@ -1,11 +0,0 @@
import React, {Fragment} from 'react';
import Proposal from './proposal';
const ProposalList = props =>
<Fragment>
{props.proposals.map((u, i) => (
<Proposal key={i} data={u} />
))}
</Fragment>
export default ProposalList;

View File

@ -1,68 +0,0 @@
import web3 from "Embark/web3"
import React from 'react';
import $ from 'jquery';
import { Button, Alert } from 'react-bootstrap';
import EmbarkJS from 'Embark/EmbarkJS';
import Voting from './voting';
class Proposal extends React.Component {
constructor(props) {
super(props);
this.state = {
url: null,
title: null,
description: null,
error: null
};
}
componentDidUpdate(prevProps, prevState, snapshot){
if(prevProps.data.description !== this.props.data.description)
this.getProposalData();
}
componentDidMount(){
__embarkContext.execWhenReady(() => {
this.getProposalData();
});
}
getProposalData(){
let hash = web3.utils.toAscii(this.props.data.description);
EmbarkJS.Storage.get(hash)
.then((content) => {
let jsonObj = JSON.parse(content);
this.setState({
url: jsonObj.url,
title: jsonObj.title,
description: jsonObj.description
})
})
.catch((err) => {
if(err){
console.log("Storage get Error => " + err.message);
}
});
}
render(){
return (<div>
{
this.state.error !== null ?
<Alert bsStyle="warning">
{ this.state.error }
</Alert>
: ''
}
<h3>{ this.state.title }</h3>
<p>{ this.state.description }</p>
<a href={ this.state.url } target="_blank">{ this.state.url }</a>
<Voting proposalId={this.props.data.id} />
</div>);
}
}
export default Proposal;

View File

@ -1,32 +0,0 @@
import web3 from "Embark/web3"
import EmbarkJS from 'Embark/EmbarkJS';
import React, {Component} from 'react';
import SNT from 'Embark/contracts/SNT'; // TODO change this to SNT
class StatusBar extends Component {
constructor(props) {
super(props);
this.state = {
balance: 0
};
}
componentWillReceiveProps(){
__embarkContext.execWhenReady(async () => {
let _b = await SNT.methods.balanceOf(web3.eth.defaultAccount).call();
this.setState({
balance: _b
});
});
}
render(){
return <div className="SNTBalance">
SNT Voting Balance: <span>{this.state.balance}</span>
</div>;
}
}
export default StatusBar;

View File

@ -1,13 +0,0 @@
import web3 from "Embark/web3"
import EmbarkJS from 'Embark/EmbarkJS';
import React from 'react';
import ProposalContainer from './proposal-container';
import StatusBar from './status-bar';
const VotingDapp = props =>
<div>
<StatusBar {...props} />
<ProposalContainer />
</div>;
export default VotingDapp;

View File

@ -1,159 +0,0 @@
import web3 from "Embark/web3"
import EmbarkJS from 'Embark/EmbarkJS';
import React, {Component, Fragment} from 'react';
import { Button } from 'react-bootstrap';
import ProposalManager from 'Embark/contracts/ProposalManager';
import ProposalCuration from 'Embark/contracts/ProposalCuration';
class Voting extends Component {
constructor(props) {
super(props);
this.state = {
decision: 0,
finalResult: null,
data: null,
tabulationAvailable: false,
votingAvailable: false
};
}
componentWillReceiveProps(){
__embarkContext.execWhenReady(async () => {
this._loadProposalData();
});
}
async _loadProposalData() {
ProposalManager.options.address = await ProposalCuration.methods.proposalManager().call();
const _votingInfo = await ProposalManager.methods.getVoteInfo(this.props.proposalId, web3.eth.defaultAccount).call();
const _blockNum = await web3.eth.getBlockNumber();
const _data = await ProposalManager.methods.proposals(this.props.proposalId).call();
const _votingAvailable = await ProposalManager.methods.isVotingAvailable(this.props.proposalId).call();
const _tabulationAvailable = await ProposalManager.methods.isTabulationAvailable(this.props.proposalId).call();
const _voteTabulated = await ProposalManager.methods.isDelegatorVoteTabulated(this.props.proposalId, web3.eth.defaultAccount).call();
const _canCalculateFinalResult = await ProposalManager.methods.canCalculateFinalResult(this.props.proposalId).call();
this.setState({
data: _data,
decision: _votingInfo.vote,
block: _blockNum,
finalResult: _data.result,
votingAvailable: _votingAvailable,
tabulationAvailable: _tabulationAvailable,
finalResultAvailable: _canCalculateFinalResult,
voteTabulated: _voteTabulated
});
}
async determineFinalResult(e){
e.preventDefault();
let receipt = await ProposalManager.methods.finalResult(this.props.proposalId)
.send({from: web3.eth.defaultAccount, gasLimit: 1000000});
if(receipt.status == '0x1'){
this.setState({
finalResult: receipt.events.ProposalResult.returnValues.finalResult,
finalResultAvailable: false
});
}
}
async tabulateVote(e){
e.preventDefault();
const receipt = await ProposalManager.methods.tabulateVote(this.props.proposalId, web3.eth.defaultAccount)
.send({from: web3.eth.defaultAccount, gasLimit: 1000000});
// TODO: handle error
this._loadProposalData();
}
async handleClick(e, vote){
e.preventDefault();
let choice = 0;
if(vote == 'APPROVE')
choice = 2;
else
choice = 1;
const proposal = this.props.proposalId;
const receipt = await ProposalManager.methods.voteProposal(this.props.proposalId, choice)
.send({from: web3.eth.defaultAccount});
const _votingAvailable = await ProposalManager.methods.isVotingAvailable(this.props.proposalId).call();
const _tabulationAvailable = await ProposalManager.methods.isTabulationAvailable(this.props.proposalId).call();
const _voteTabulated = await ProposalManager.methods.isDelegatorVoteTabulated(this.props.proposalId, web3.eth.defaultAccount).call();
const _canCalculateFinalResult = await ProposalManager.methods.canCalculateFinalResult(this.props.proposalId).call();
const blockNum = await web3.eth.getBlockNumber();
if(receipt.status == '0x1'){
this.setState({
decision: choice,
block: blockNum,
votingAvailable: _votingAvailable,
tabulationAvailable: _tabulationAvailable,
finalResultAvailable: _canCalculateFinalResult,
voteTabulated: _voteTabulated
});
}
// TODO: handle error
}
render(){
console.log(this.state);
return <div>
{
this.state.decision != 0 ?
<p>You voted for: <ResultChoice decision={this.state.decision} /></p>
: ''
}
{
this.state.data != null && this.state.votingAvailable ?
<Fragment>
<Button onClick={(e) => this.handleClick(e, 'APPROVE') }>Approve</Button>
<Button onClick={(e) => this.handleClick(e, 'REJECT') }>Reject</Button>
</Fragment>
: ''
}
{
this.state.data != null && this.state.tabulationAvailable && !this.state.voteTabulated ?
<Button onClick={(e) => this.tabulateVote(e) }>Tabulate your vote</Button>
: ''
}
{
this.state.finalResultAvailable ?
<Button onClick={(e) => this.determineFinalResult(e) }>Determine final result</Button>
: !this.state.tabulationAvailable && !this.state.voteTabulated ?
<p>Final results aren't available yet</p> : ''
}
{ this.state.data != null ?
<ul>
<li>Voting ends on block: {this.state.data.voteBlockEnd }</li>
<li>Current Block: { this.state.block }</li>
<li>Final Result: <ResultChoice decision={this.state.finalResult} /></li>
</ul>
: '' }
</div>;
}
}
const ResultChoice = props =>
<span>{props.decision.toString() == '1' ? 'REJECT' : props.decision.toString() == '2' ? 'APPROVE' : ''}</span>
export default Voting;

0
app/css/.gitkeep Normal file
View File

0
app/js/.gitkeep Normal file
View File

6
app/js/index.js Normal file
View File

@ -0,0 +1,6 @@
import EmbarkJS from 'Embark/EmbarkJS';
// import your contracts
// e.g if you have a contract named SimpleStorage:
//import SimpleStorage from 'Embark/contracts/SimpleStorage';

105
config/blockchain.js Normal file
View File

@ -0,0 +1,105 @@
module.exports = {
// applies to all environments
default: {
enabled: true,
rpcHost: "localhost", // HTTP-RPC server listening interface (default: "localhost")
rpcPort: 8545, // HTTP-RPC server listening port (default: 8545)
rpcCorsDomain: "auto", // Comma separated list of domains from which to accept cross origin requests (browser enforced)
// When set to "auto", Embark will automatically set the cors to the address of the webserver
wsRPC: true, // Enable the WS-RPC server
wsOrigins: "auto", // Origins from which to accept websockets requests
// When set to "auto", Embark will automatically set the cors to the address of the webserver
wsHost: "localhost", // WS-RPC server listening interface (default: "localhost")
wsPort: 8546 // WS-RPC server listening port (default: 8546)
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run` and `embark blockchain`
development: {
networkType: "custom", // Can be: testnet, rinkeby, livenet or custom, in which case, it will use the specified networkId
networkId: "1337", // Network id used when networkType is custom
isDev: true, // Uses and ephemeral proof-of-authority network with a pre-funded developer account, mining enabled
datadir: ".embark/development/datadir", // Data directory for the databases and keystore
mineWhenNeeded: true, // Uses our custom script (if isDev is false) to mine only when needed
nodiscover: true, // Disables the peer discovery mechanism (manual peer addition)
maxpeers: 0, // Maximum number of network peers (network disabled if set to 0) (default: 25)
proxy: false, // Proxy is used to present meaningful information about transactions
targetGasLimit: 8000000, // Target gas limit sets the artificial target gas floor for the blocks to mine
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm", // Mnemonic used by the simulator to generate a wallet
simulatorBlocktime: 0, // Specify blockTime in seconds for automatic mining. Default is 0 and no auto-mining.
account: {
// numAccounts: 3, // When specified, creates accounts for use in the dapp. This option only works in the development environment, and can be used as a quick start option that bypasses the need for MetaMask in development. These accounts are unlocked and funded with the below settings.
// password: "config/development/password", // Password for the created accounts (as specified in the `numAccounts` setting). If `mineWhenNeeded` is enabled (and isDev is not), this password is used to create a development account controlled by the node.
// balance: "5 ether" // Balance to be given to the created accounts (as specified in the `numAccounts` setting)
}
},
// merges with the settings in default
// used with "embark run privatenet" and/or "embark blockchain privatenet"
privatenet: {
networkType: "custom",
networkId: "1337",
isDev: false,
datadir: ".embark/privatenet/datadir",
// -- mineWhenNeeded --
// This options is only valid when isDev is false.
// Enabling this option uses our custom script to mine only when needed.
// Embark creates a development account for you (using `geth account new`) and funds the account. This account can be used for
// development (and even imported in to MetaMask). To enable correct usage, a password for this account must be specified
// in the `account > password` setting below.
// NOTE: once `mineWhenNeeded` is enabled, you must run an `embark reset` on your dApp before running
// `embark blockchain` or `embark run` for the first time.
mineWhenNeeded: true,
// -- genesisBlock --
// This option is only valid when mineWhenNeeded is true (which is only valid if isDev is false).
// When enabled, geth uses POW to mine transactions as it would normally, instead of using POA as it does in --dev mode.
// On the first `embark blockchain or embark run` after this option is enabled, geth will create a new chain with a
// genesis block, which can be configured using the `genesisBlock` configuration option below.
genesisBlock: "config/privatenet/genesis.json", // Genesis block to initiate on first creation of a development node
nodiscover: true,
maxpeers: 0,
proxy: true,
account: {
// "address": "", // When specified, uses that address instead of the default one for the network
password: "config/privatenet/password" // Password to unlock the account. If `mineWhenNeeded` is enabled (and isDev is not), this password is used to create a development account controlled by the node.
},
targetGasLimit: 8000000,
simulatorMnemonic: "example exile argue silk regular smile grass bomb merge arm assist farm",
simulatorBlocktime: 0
},
// merges with the settings in default
// used with "embark run testnet" and/or "embark blockchain testnet"
testnet: {
networkType: "testnet",
syncMode: "light",
account: {
password: "config/testnet/password"
}
},
testnet_devcoin: {
networkType: "testnet",
syncMode: "light",
account: {
password: "config/testnet/password"
}
},
// merges with the settings in default
// used with "embark run livenet" and/or "embark blockchain livenet"
livenet: {
networkType: "livenet",
syncMode: "light",
rpcCorsDomain: "http://localhost:8000",
wsOrigins: "http://localhost:8000",
account: {
password: "config/livenet/password"
}
}
// you can name an environment with specific settings and then specify with
// "embark run custom_name" or "embark blockchain custom_name"
//custom_name: {
//}
};

View File

@ -1,89 +0,0 @@
{
"development": {
"enabled": true,
"networkType": "custom",
"genesisBlock": "config/development/genesis.json",
"datadir": ".embark/development/datadir",
"mineWhenNeeded": true,
"nodiscover": true,
"maxpeers": 0,
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "auto",
"account": {
"password": "config/development/password"
},
"targetGasLimit": 8000000,
"wsOrigins": "auto",
"wsRPC": true,
"wsHost": "localhost",
"wsPort": 8546,
"simulatorMnemonic": "example exile argue silk regular smile grass bomb merge arm assist farm",
"simulatorBlocktime": 0
},
"testnet": {
"enabled": true,
"proxy": false,
"networkType": "testnet",
"syncMode": "light",
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/testnet/password"
}
},
"testnet_devcoin": {
"enabled": true,
"proxy": false,
"networkType": "testnet",
"syncMode": "light",
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/testnet/password"
}
},
"staging": {
"enabled": true,
"proxy": false,
"networkType": "livenet",
"syncMode": "light",
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/staging/password"
}
},
"livenet": {
"enabled": true,
"proxy": false,
"networkType": "livenet",
"syncMode": "light",
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"account": {
"password": "config/livenet/password"
}
},
"privatenet": {
"enabled": true,
"proxy": false,
"networkType": "custom",
"rpcHost": "localhost",
"rpcPort": 8545,
"rpcCorsDomain": "http://localhost:8000",
"datadir": "yourdatadir",
"networkId": "123",
"bootnodes": ""
}
}

40
config/communication.js Normal file
View File

@ -0,0 +1,40 @@
module.exports = {
// default applies to all environments
default: {
enabled: false,
provider: "whisper", // Communication provider. Currently, Embark only supports whisper
available_providers: ["whisper"], // Array of available providers
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run`
development: {
connection: {
host: "localhost", // Host of the blockchain node
port: 8546, // Port of the blockchain node
type: "ws" // Type of connection (ws or rpc)
}
},
// merges with the settings in default
// used with "embark run privatenet"
privatenet: {
},
// merges with the settings in default
// used with "embark run testnet"
testnet: {
},
// merges with the settings in default
// used with "embark run livenet"
livenet: {
},
// you can name an environment with specific settings and then specify with
// "embark run custom_name"
//custom_name: {
//}
};

View File

@ -1,12 +0,0 @@
{
"default": {
"enabled": true,
"provider": "whisper",
"available_providers": ["whisper", "orbit"],
"connection": {
"host": "localhost",
"port": 8546,
"type": "ws"
}
}
}

185
config/contracts.js Normal file
View File

@ -0,0 +1,185 @@
module.exports = {
// default applies to all environments
default: {
// Blockchain node to deploy the contracts
deployment: {
host: "localhost", // Host of the blockchain node
port: 8545, // Port of the blockchain node
type: "rpc" // Type of connection (ws or rpc),
// Accounts to use instead of the default account to populate your wallet
/*,accounts: [
{
privateKey: "your_private_key",
balance: "5 ether" // You can set the balance of the account in the dev environment
// Balances are in Wei, but you can specify the unit with its name
},
{
privateKeyFile: "path/to/file", // Either a keystore or a list of keys, separated by , or ;
password: "passwordForTheKeystore" // Needed to decrypt the keystore file
},
{
mnemonic: "12 word mnemonic",
addressIndex: "0", // Optionnal. The index to start getting the address
numAddresses: "1", // Optionnal. The number of addresses to get
hdpath: "m/44'/60'/0'/0/" // Optionnal. HD derivation path
}
]*/
},
// order of connections the dapp should connect to
dappConnection: [
"$WEB3", // uses pre existing web3 object if available (e.g in Mist)
"ws://localhost:8546",
"http://localhost:8545"
],
gas: "auto",
contracts: {
"ERC20Receiver": { "deploy": false },
"MiniMeToken": { "deploy": false },
"TestToken": {
},
"MiniMeTokenFactory": {
},
"SNT": {
"instanceOf": "MiniMeToken",
"args": [
"$MiniMeTokenFactory",
"0x0000000000000000000000000000000000000000",
0,
"TestMiniMeToken",
18,
"TST",
true
]
},
"PollManager": {
"args": ["$SNT"]
},
"RLPHelper": {
"deploy": false
},
"RLPReader": {
"deploy": false
}
}
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run`
development: {
dappConnection: [
"ws://localhost:8546",
"http://localhost:8545",
"$WEB3" // uses pre existing web3 object if available (e.g in Mist)
]
},
// merges with the settings in default
// used with "embark run privatenet"
privatenet: {
},
// merges with the settings in default
// used with "embark run testnet"
testnet: {
deployment: {
host: "localhost",
port: 8545,
type: "rpc",
accounts: [
{
privateKey: "0x00000...."
}
]
},
"contracts": {
"TestToken": { "deploy": false },
"MiniMeTokenFactory": {
"address": "0x6bfa86a71a7dbc68566d5c741f416e3009804279"
},
"SNT": {
"instanceOf": "MiniMeToken",
"address": "0xc55cf4b03948d7ebc8b9e8bad92643703811d162"
},
"PollManager": {
"args": ["$SNT"],
"gasPrice": 5000000000
}
}
},
"testnet_devcoin":{
deployment: {
host: "localhost",
port: 8545,
type: "rpc",
accounts: [
{
privateKey: "0x00000...."
}
]
},
"contracts": {
"TestToken": { "deploy": false },
"MiniMeTokenFactory": {
"gasPrice": 5000000000
},
"SNT": {
"instanceOf": "MiniMeToken",
"args": [
"$MiniMeTokenFactory",
"0x0000000000000000000000000000000000000000",
0,
"Status Core Dev Token (TEST)",
18,
"SCT",
true
],
"gasPrice": 5000000000
},
"PollManager": {
"args": ["$SNT"],
"gasPrice": 5000000000
}
}
},
"staging":{
"contracts": {
"TestToken": { "deploy": false },
"MiniMeTokenFactory": {
"address": "0xa1c957C0210397D2d0296341627B74411756d476"
},
"SNT": {
"instanceOf": "MiniMeToken",
"address": "0x744d70fdbe2ba4cf95131626614a1763df805b9e"
},
"PollManager": {
"address": "0x0e222932911b9a558104b4b4b2f330398561436f"
}
}
},
// merges with the settings in default
// used with "embark run livenet"
livenet: {
"contracts": {
"TestToken": { "deploy": false },
"MiniMeTokenFactory": {
"address": "0xa1c957C0210397D2d0296341627B74411756d476"
},
"SNT": {
"instanceOf": "MiniMeToken",
"address": "0x744d70fdbe2ba4cf95131626614a1763df805b9e"
},
"PollManager": {
"address": "0x0e222932911b9a558104b4b4b2f330398561436f"
}
}
},
// you can name an environment with specific settings and then specify with
// "embark run custom_name" or "embark blockchain custom_name"
//custom_name: {
//}
};

View File

@ -1,141 +0,0 @@
{
"default": {
"deployment": {
"host": "localhost",
"port": 8545,
"type": "rpc"
},
"dappConnection": [
"$WEB3",
"http://localhost:8545"
],
"gas": "auto",
"contracts": {
"ERC20Receiver": { "deploy": false },
"MiniMeToken": { "deploy": false },
"TestToken": {
},
"MiniMeTokenFactory": {
},
"SNT": {
"instanceOf": "MiniMeToken",
"args": [
"$MiniMeTokenFactory",
0,
0,
"TestMiniMeToken",
18,
"TST",
true
]
},
"PollManager": {
"args": ["$SNT"]
},
"RLPHelper": {
"deploy": false
},
"RLPReader": {
"deploy": false
}
}
},
"testnet":{
"deployment": {
"host": "localhost",
"port": 8545,
"type": "rpc",
"accounts": [
{
"privateKey": "0x00000"
}
]
},
"contracts": {
"TestToken": { "deploy": false },
"MiniMeTokenFactory": {
"address": "0x6bfa86a71a7dbc68566d5c741f416e3009804279"
},
"SNT": {
"instanceOf": "MiniMeToken",
"address": "0xc55cf4b03948d7ebc8b9e8bad92643703811d162"
},
"PollManager": {
"args": ["$SNT"],
"gasPrice": 5000000000
}
}
},
"testnet_devcoin":{
"deployment": {
"host": "localhost",
"port": 8545,
"type": "rpc",
"accounts": [
{
"privateKey": "0x00000"
}
]
},
"contracts": {
"TestToken": { "deploy": false },
"MiniMeTokenFactory": {
"gasPrice": 5000000000
},
"SNT": {
"instanceOf": "MiniMeToken",
"args": [
"$MiniMeTokenFactory",
0,
0,
"Status Core Dev Token (TEST)",
18,
"SCT",
true
],
"gasPrice": 5000000000
},
"PollManager": {
"args": ["$SNT"],
"gasPrice": 5000000000
}
}
},
"staging":{
"contracts": {
"TestToken": { "deploy": false },
"MiniMeTokenFactory": {
"address": "0xa1c957C0210397D2d0296341627B74411756d476"
},
"SNT": {
"instanceOf": "MiniMeToken",
"address": "0x744d70fdbe2ba4cf95131626614a1763df805b9e"
},
"PollManager": {
"address": "0x0e222932911b9a558104b4b4b2f330398561436f"
}
}
},
"livenet":{
"contracts": {
"TestToken": { "deploy": false },
"MiniMeTokenFactory": {
"address": "0xa1c957C0210397D2d0296341627B74411756d476"
},
"SNT": {
"instanceOf": "MiniMeToken",
"address": "0x744d70fdbe2ba4cf95131626614a1763df805b9e"
},
"PollManager": {
"address": "0x0e222932911b9a558104b4b4b2f330398561436f"
}
}
}
}

View File

@ -1,7 +1,39 @@
module.exports = {
// default applies to all environments
default: {
enabled: false,
available_providers: ["ens"],
provider: "ens"
}
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run`
development: {
register: {
rootDomain: "embark.eth",
subdomains: {
'status': '0x1a2f3b98e434c02363f3dac3174af93c1d690914'
}
}
},
// merges with the settings in default
// used with "embark run privatenet"
privatenet: {
},
// merges with the settings in default
// used with "embark run testnet"
testnet: {
},
// merges with the settings in default
// used with "embark run livenet"
livenet: {
},
// you can name an environment with specific settings and then specify with
// "embark run custom_name" or "embark blockchain custom_name"
//custom_name: {
//}
};

View File

@ -1,7 +1,7 @@
{
"config": {
"homesteadBlock": 1,
"byzantiumBlock": 1,
"homesteadBlock": 0,
"byzantiumBlock": 0,
"daoForkSupport": true
},
"nonce": "0x0000000000000042",

59
config/storage.js Normal file
View File

@ -0,0 +1,59 @@
module.exports = {
// default applies to all environments
default: {
enabled: true,
ipfs_bin: "ipfs",
provider: "ipfs",
available_providers: ["ipfs"],
upload: {
host: "localhost",
port: 5001
},
dappConnection: [
{
provider: "ipfs",
host: "localhost",
port: 5001,
getUrl: "http://localhost:8080/ipfs/"
}
]
// Configuration to start Swarm in the same terminal as `embark run`
/*,account: {
address: "YOUR_ACCOUNT_ADDRESS", // Address of account accessing Swarm
password: "PATH/TO/PASSWORD/FILE" // File containing the password of the account
},
swarmPath: "PATH/TO/SWARM/EXECUTABLE" // Path to swarm executable (default: swarm)*/
},
// default environment, merges with the settings in default
// assumed to be the intended environment by `embark run`
development: {
enabled: false,
provider: "ipfs",
upload: {
host: "localhost",
port: 5001,
getUrl: "http://localhost:8080/ipfs/"
}
},
// merges with the settings in default
// used with "embark run privatenet"
privatenet: {
},
// merges with the settings in default
// used with "embark run testnet"
testnet: {
},
// merges with the settings in default
// used with "embark run livenet"
livenet: {
},
// you can name an environment with specific settings and then specify with
// "embark run custom_name"
//custom_name: {
//}
};

View File

@ -1,20 +0,0 @@
{
"default": {
"versions": {
"ipfs-api": "17.2.4"
},
"enabled": false,
"ipfs_bin": "ipfs",
"provider": "ipfs",
"available_providers": ["ipfs"],
"host": "localhost",
"port": 5001
},
"development": {
"enabled": false,
"provider": "ipfs",
"host": "localhost",
"port": 5001,
"getUrl": "http://localhost:8080/ipfs/"
}
}

6
config/webserver.js Normal file
View File

@ -0,0 +1,6 @@
module.exports = {
enabled: true,
host: "localhost",
openBrowser: true,
port: 8000
};

View File

@ -1,5 +0,0 @@
{
"enabled": true,
"host": "localhost",
"port": 8000
}

0
contracts/.gitkeep Normal file
View File

View File

@ -2,18 +2,22 @@
"contracts": ["contracts/**"],
"app": {
"js/dapp.js": ["app/dapp.js"],
"js/migration.js": ["app/migration.js"],
"index.html": "app/index.html",
"migration.html": "app/migration.html",
"images/": ["app/images/**"]
},
"buildDir": "dist/",
"config": "config/",
"versions": {
"web3": "1.0.0-beta.34",
"solc": "0.4.24",
"solc": "0.4.25",
"ipfs-api": "17.2.4"
},
"plugins": {
},
"options": {
"solc": {
"optimize": true,
"optimize-runs": 200
}
}
}

987
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -16,22 +16,32 @@
"url": "https://github.com/status-im/contracts/issues"
},
"homepage": "https://github.com/status-im/contracts#readme",
"devDependencies": {
"@babel/plugin-proposal-class-properties": "^7.0.0",
"@babel/plugin-proposal-decorators": "^7.0.0",
"@babel/plugin-proposal-export-namespace-from": "^7.0.0",
"@babel/plugin-proposal-function-sent": "^7.0.0",
"@babel/plugin-proposal-json-strings": "^7.0.0",
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
"@babel/plugin-proposal-throw-expressions": "^7.0.0",
"@babel/plugin-syntax-dynamic-import": "^7.0.0",
"@babel/plugin-syntax-import-meta": "^7.0.0"
},
"dependencies": {
"@material-ui/core": "^1.3.0",
"@material-ui/icons": "^1.1.0",
"@material-ui/lab": "^1.0.0-alpha.5",
"@material-ui/core": "^3.0.0",
"@material-ui/icons": "^3.0.0",
"@material-ui/lab": "^1.0.0-alpha.12",
"axios": "^0.18.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-stage-2": "^6.24.1",
"lodash": "^4.17.10",
"bignumber.js": "^5.0.0",
"bootstrap": "^3.3.7",
"formik": "^0.11.11",
"jquery": "^3.3.1",
"lodash": "^4.17.10",
"react": "^16.3.2",
"react": "^16.4.2",
"react-blockies": "^1.3.0",
"react-bootstrap": "^0.32.1",
"react-dom": "^16.3.2",
"react-dom": "^16.4.2",
"react-toggle": "^4.0.2",
"rlp": "^2.1.0",
"typeface-roboto": "0.0.54"