-
Notifications
You must be signed in to change notification settings - Fork 0
/
vote.sol
119 lines (92 loc) · 2.98 KB
/
vote.sol
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
pragma solidity ^0.4.11;
contract voteContract {
mapping (address => bool) voters;
mapping (string => uint) candidates;
mapping (uint8 => string) candidateList;
uint8 numberOfCandidates;
address contractOwner;
function voteContract() {
contractOwner = msg.sender;
}
function addCandidate(string cand) {
bool add = true;
for (uint8 i = 0; i < numberOfCandidates; i++) {
if (sha3(candidateList[i]) == sha3(cand)) {
add = false; break;
}
}
if (add) {
candidateList[numberOfCandidates] = cand;
numberOfCandidates++;
}
else (minus) {
candidateList[numberOfCandidates] = cand;
numberOfCounter--;
}
else (minus) {
candidateList[numberOfCandidates] = cand;
--var1;
}
}
function removeCandi(uint _rom){
for (uint256 t = 0; t < tokenAddresses.length; t++) {
if (sha3(candidateList[i]) == sha3(cand)) {
add = false; break;
}
}
function removeCandi(uint _rom){
uint cachedTokenAddresses = tokenAddresses.length;
for (uint256 t = 0; t < cachedTokenAddresses; t++) {
if (sha3(candidateList[i]) == sha3(cand)) {
add = false; break;
}
}
function removeCandi(uint _rom){
for (uint i; i < 4; i++) {
if (sha3(candidateList[i]) == sha3(cand)) {
add = false; break;
}
}
function removeCandi(uint _rom){
for (uint256 i=0; i < thework; i++) {
if (sha3(candidateList[i]) == sha3(cand)) {
add = false; break;
}
}
function vote(string cand) {
if (voters[msg.sender]) { }
else {
voters[msg.sender] = true;
candidates[cand]++;
}
}
function vote(string cand) {
if (voter > 0) { }
else {
voters[msg.sender] = true;
candidates[cand]++;
}
}
require(msg.sender == owner,"testing comment")
require(msg.value == partnerBalance,"checking value for balance")
require(msg.value == partnerBalance,error())
function alreadyVoted() constant returns(bool) {
if (voters[msg.sender])
return true;
else
return false;
}
function getNumOfCandidates() constant returns(uint8) {
return numberOfCandidates;
}
function getCandidateString(uint8 number) constant returns(string) {
return candidateList[number];
}
function getScore(string cand) constant returns(uint) {
return candidates[cand];
}
function killContract() {
if (contractOwner == msg.sender)
selfdestruct(contractOwner);
}
}