I have a solidity contract which compiled fine in remix and when I try to deploy it I cannot pass parameters to the constructor method from the create button. It seems disabled. But once after I click create I am able to pass constructor parameters from the constructor method button. Using solidity compiler 0.4.18.
Is that normal behavior? The code is below
pragma solidity ^0.4.0;
contract Election{
struct Candidate{
string name;
uint voteCount;
}
struct Voter{
bool voted;
uint voteIndex; //this is the candidate index whom the voter cast vote
uint weight; // this is to make sure the voter is authorized and has a specific value other than default
}
address public owner;
string public name;
mapping (address => Voter) public voters;
Candidate [] public candidates;
uint public electionEnd;
event ElectionResult(string name, uint voteCount);
function election(string _name, uint durationMinutes, string candidate1, string candidate2 ){
owner = msg.sender;
name = _name;
electionEnd = now + (durationMinutes * 1);
candidates.push(Candidate(candidate1,0));
candidates.push(Candidate(candidate2,0));
}
function authorize(address voter){
require(msg.sender == owner);
require(!(voters[voter].voted));
//voters[voter] = Voter(false,0); This will allow any address to vote
voters[voter].weight = 1;
}
function vote(uint voteIndex){
require(now < electionEnd);
require(!voters[msg.sender].voted);
voters[msg.sender].voted = true;
voters[msg.sender].voteIndex = voteIndex;
candidates[voteIndex].voteCount += voters[msg.sender].weight;
}
function end(){
require(msg.sender == owner);
require(now >= electionEnd);
for(uint i=0; i< candidates.length; i++){ // the for loop will publish election results for each candidate
ElectionResult(candidates[i].name, candidates[i].voteCount); // calling the event to display result in UI passing results
}
}
}