diff --git a/app/components/proposal-manager/proposal-manager.js b/app/components/proposal-manager/proposal-manager.js
index ea71b7c..618ce82 100644
--- a/app/components/proposal-manager/proposal-manager.js
+++ b/app/components/proposal-manager/proposal-manager.js
@@ -1,8 +1,9 @@
import EmbarkJS from 'Embark/EmbarkJS';
import ERC20Token from 'Embark/contracts/ERC20Token';
-import ProposalCuration from 'Embark/contracts/ProposalCuration'
+import ProposalCuration from 'Embark/contracts/ProposalCuration';
+import SNT from 'Embark/contracts/SNT';
import React, { Fragment } from 'react';
-import { Form, FormGroup, FormControl, HelpBlock, Button } from 'react-bootstrap';
+import { Form, FormGroup, FormControl, HelpBlock, Button, Alert } from 'react-bootstrap';
import web3 from "Embark/web3"
class ProposalManager extends React.Component {
@@ -11,13 +12,11 @@ class ProposalManager extends React.Component {
super(props);
this.state = {
submitPrice: "Loading...",
- to: "",
- value: "",
- data: "",
+ url: "",
+ title: "",
description: "",
- topic: "0x00"
+ canSubmit: true
};
- window['ProposalCuration'] = ProposalCuration;
}
componentDidMount(){
@@ -33,67 +32,96 @@ class ProposalManager extends React.Component {
try {
let _b = await ProposalCuration.methods.getSubmitPrice(web3.eth.defaultAccount).call();
this.setState({
- balance: _b
+ submitPrice: _b,
+ canSubmit: true
});
} catch(err){
- console.log("Couldn't get submit price")
+ this.setState({
+ canSubmit: false,
+ submitPrice: "-"
+ });
}
});
}
+ async handleClick(){
+ let description = {
+ "url": this.state.url,
+ "title": this.state.title,
+ "description": this.state.description
+ };
+
+ let hexDescription = web3.utils.toHex(JSON.stringify(description));
+
+ let receipt = await SNT.methods.approve(
+ ProposalCuration.options.address,
+ this.state.submitPrice)
+ .send({from: web3.eth.defaultAccount, gasLimit: 1000000});
+
+ console.log(receipt);
+
+ receipt = await ProposalCuration.methods.submitProposal(
+ "0x00",
+ "0x0000000000000000000000000000000000000000",
+ 0,
+ "0x00",
+ hexDescription
+ )
+ .send({from: web3.eth.defaultAccount, gasLimit: 1000000});
+
+ console.log(receipt);
+ }
+
+
render(){
return (
Add
- Price for submitting proposals: {this.state.submitPrice}
+ {
+ !this.state.canSubmit ?
+ Add proposal
+ Price: {this.state.submitPrice}
-
{ this.state.description }
{ this.state.url } diff --git a/app/components/voting-dapp/voting-dapp.js b/app/components/voting-dapp/voting-dapp.js index 4cbeebd..d8271a1 100644 --- a/app/components/voting-dapp/voting-dapp.js +++ b/app/components/voting-dapp/voting-dapp.js @@ -19,7 +19,6 @@ class VotingDapp extends React.Component { return