//SPDX-License-Identifier: MIT pragma solidity 0.7.4; import "./Forum.sol"; contract Voting { Forum public forum; constructor(Forum addr) { forum = Forum(addr); } struct Poll { uint topicID; uint numOptions; string dataHash; mapping (address => uint) votes; mapping (uint => address[]) voters; bool enableVoteChanges; uint timestamp; } mapping (uint => Poll) polls; event PollCreated(uint topicID); event UserVoted(address userAddress); // Verify that poll exists function isPollExistent(uint topicID) public view returns (bool) { if (polls[topicID].timestamp != 0) return true; return false; } function createPoll(uint topicID, uint numOptions, string memory dataHash, bool enableVoteChanges) public returns (uint) { require(forum.hasUserSignedUp(msg.sender)); // Only registered users can create polls require(topicID