Skip to content
Verified contractPartial

Poll

Address0x7cd8a688b5ddcbce19db6a71d56be2d65d84e481
Balance

0 ETH

 

Transactions

3

 

Compiler

solc 0.1.6

 

Same code

1 more contract

 

Details

Compiler
solc 0.1.6+commit.d41f8b7c
Language
solidity
Optimization
No
License
Not stated
Match
Partialcreation code: yes, runtime code: yes
Verified on Sourcify
Created in block
438,777
Creation transaction
0x9f7c5776c9…ceea6dbbdc

Poll.sol

// Recovered by EthereumHistory (ethereumhistory.com) -sw
contract Poll {
    struct PollData {
        address owner;
        string title;
        uint maxVotes;
        string options;
        uint deadline;
        bool open;
    }

    string[] public votes;
    uint numVotes = 0;

    event Voted(string v);

    function Poll(string options, string title, uint maxVotes, uint deadline) {
        p.owner = msg.sender;
        p.options = options;
        p.title = title;
        p.maxVotes = maxVotes;
        p.deadline = deadline;
        p.open = true;
    }

    PollData public p;

    function vote(string v) returns (uint) {
        if (msg.sender != p.owner || p.open != true) return 0;
        votes[numVotes] = v;
        numVotes++;
        Voted(v);
        if (p.maxVotes > 0) {
            if (numVotes >= p.maxVotes) endPoll();
        }
        return 1;
    }

    function endPoll() returns (uint) {
        if (msg.sender != p.owner) return 0;
        p.open = false;
        return 1;
    }
}
Compiler settingsShow
{
  "optimizer": {
    "runs": 200,
    "enabled": false
  }
}

Source code and metadata: Sourcify.

The source code belongs to the authors of the contract.