mirror of
https://github.com/status-im/snt-voting.git
synced 2025-02-23 15:48:10 +00:00
Adding topic, to, value and data
This commit is contained in:
parent
9f122d36ff
commit
98dcb1f803
@ -97,6 +97,46 @@ class InnerForm extends PureComponent {
|
||||
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>
|
||||
@ -105,14 +145,14 @@ class InnerForm extends PureComponent {
|
||||
}
|
||||
|
||||
const ProposalManager = withFormik({
|
||||
mapPropsToValues: props => ({ title: '', description: '', url: '' }),
|
||||
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
|
||||
url: values.url,
|
||||
};
|
||||
|
||||
const { toHex } = web3.utils;
|
||||
@ -123,10 +163,10 @@ const ProposalManager = withFormik({
|
||||
const hexHash = toHex(hash);
|
||||
//TODO create toggle for address approval
|
||||
submitProposal(
|
||||
"0x00",
|
||||
"0x0000000000000000000000000000000000000000",
|
||||
0,
|
||||
"0x00",
|
||||
values.topic,
|
||||
values.to,
|
||||
values.value,
|
||||
values.data,
|
||||
hexHash
|
||||
)
|
||||
.send({from: web3.eth.defaultAccount, gasLimit: 1000000})
|
||||
|
@ -12,13 +12,12 @@ contract PollManager is Controlled {
|
||||
event PollCreated(uint256 pollId, uint8 numOptions);
|
||||
event PollCanceled(uint256 pollId);
|
||||
event Voted(address voter, uint8[] votes);
|
||||
|
||||
|
||||
MiniMeTokenFactory public tokenFactory;
|
||||
MiniMeTokenInterface public token;
|
||||
|
||||
Poll[] public polls;
|
||||
|
||||
|
||||
struct Vote {
|
||||
mapping(uint8 => uint8) distribution;
|
||||
bool voted;
|
||||
@ -48,6 +47,7 @@ contract PollManager is Controlled {
|
||||
uint8 _numOptions
|
||||
)
|
||||
public
|
||||
onlyController
|
||||
returns (uint pollId)
|
||||
{
|
||||
pollId = polls.length++;
|
||||
|
Loading…
x
Reference in New Issue
Block a user