pragma solidity ^0.4.25; contract Assemblee { address[] participants; string[] descriVotes; uint[] votesPour; uint[] votesContre; string nomAssemble; constructor(string memory nom) public { nomAssemble = nom; } function rejoindre() public { participants.push(msg.sender); } function estParticipant(address par) public view returns (bool) { for (uint i=0; i<participants.length; i++) { if (participants[i]==par){ return true; } } return false; } function proposerUnVote(string memory description) public { require(estParticipant(msg.sender), "Il faut etre participant"); descriVotes.push(description); votesPour.push(0); votesContre.push(0); } function voter(uint v,bool sens)public { require(estParticipant(msg.sender), "Il faut etre participant"); if (sens) { votesPour[v]+=1; }else { votesContre[v]+=1; } } function getVotesPour(uint ind) public constant returns (uint){ return votesPour[ind]; } function getVotesContre(uint ind) public constant returns (uint) { return votesContre[ind]; } }
0.4.25