Guest User

Untitled

a guest
May 27th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. pragma solidity ^0.4.24;
  2.  
  3. import './society.sol';
  4.  
  5. contract Proposals is Society {
  6. /** There will be an active list of proposals. Everybody can vote for one proposal.
  7. *
  8. *
  9. */
  10.  
  11. struct Proposal {
  12. uint id;
  13. string description;
  14. uint votes;
  15. uint32 dateStamp;
  16. }
  17.  
  18. Proposal[] public allActiveProposals;
  19.  
  20. function newProposal(string _description) external {
  21. uint citizenId = addressToCitizenId[msg.sender];
  22. require(citizens[citizenId - 1].lastProposal <= uint32(now - 1 weeks));
  23. // Only 1 proposal per week allowed
  24. allActiveProposals.length++;
  25. uint proposalId = allActiveProposals.length - 1;
  26.  
  27. uint32 dateStamp = uint32(now);
  28. allActiveProposals[proposalId] = Proposal(proposalId, _description, 0, dateStamp);
  29. citizens[citizenId - 1].lastProposal = dateStamp;
  30. }
  31. }
Add Comment
Please, Sign In to add comment