Practice Project after My Ethereum coding 101 Course

Here is a voting system smart contract I made that functions pretty well if anybody can give me ideas on what I should add to it to make it more complex as well as work on my coding skills it would be much appreciated! As of right now, it works just fine but if you see any bugs please let me know!

pragma solidity 0.7.5;

contract VoterSystem{
    address private governor;
    uint votePassNumber;
    struct Voter{
        address payment;
        string name;
        uint age;
        string race;
        uint id;
    struct Poll{
        uint pollnumber;
        uint votes;
        string pollDescription;
        bool votePassed;
    Voter[] votingList;
    Poll[] pollList;
    Poll[] billsPassed;
    mapping (address => mapping(uint => bool)) voteCounter;
    constructor(uint _votePassNumber){
        governor = msg.sender;
        votePassNumber = _votePassNumber;
    modifier onlyGovernor(){
        require(msg.sender == governor, "You have to be governor");
    modifier onlyVoters(){
        bool voterTest = false;
        for(uint n = 0; n < votingList.length; ++n){
            if(votingList[n].payment == msg.sender){
                voterTest = true;
        require(voterTest == true);
    function register(string memory _name, uint _age, string memory _race) public {
        require(msg.sender != governor, "Governor's can't register");
        votingList.push(Voter(msg.sender, _name, _age, _race, votingList.length));
    function createPoll(string memory _poll) public onlyGovernor{
        pollList.push(Poll(pollList.length, 0, _poll, false));
    function vote(uint _pollNumber) public onlyVoters {
        require(voteCounter[msg.sender][_pollNumber] = true, "You already voted on this bill!");
        require(msg.sender != governor, "Governors arent allowed to vote!");
        require(pollList[_pollNumber].votes < votePassNumber, "Bill already passed.");
        voteCounter[msg.sender][_pollNumber] == true;
        if(pollList[_pollNumber].pollnumber == _pollNumber){
        if(pollList[_pollNumber].votes >= votePassNumber){
            pollList[_pollNumber].votePassed = true;
    function getPollDescription(uint _id) public view returns(string memory) {
        return (pollList[_id].pollDescription);
    function getBillPassed(uint _id) public view returns(string memory) {
        return (billsPassed[_id].pollDescription);
1 Like

You could build a frontend for it using html & JavaScript