aboutsummaryrefslogtreecommitdiffstats
path: root/contracts
diff options
context:
space:
mode:
authorWayne Chiu <chaoweichiu@gmail.com>2019-01-08 13:55:54 +0800
committerWayne Chiu <chaoweichiu@gmail.com>2019-01-08 13:55:54 +0800
commitdda0de45b0fd83f5b10842e97d43c7c41d8769a0 (patch)
treeebbee0410b36fca444aad30c1a8af13aa26b9ce1 /contracts
parente5fd4bab963abb69934f445db1111f528a9566e9 (diff)
downloaddexon-lottery-dda0de45b0fd83f5b10842e97d43c7c41d8769a0.tar
dexon-lottery-dda0de45b0fd83f5b10842e97d43c7c41d8769a0.tar.gz
dexon-lottery-dda0de45b0fd83f5b10842e97d43c7c41d8769a0.tar.bz2
dexon-lottery-dda0de45b0fd83f5b10842e97d43c7c41d8769a0.tar.lz
dexon-lottery-dda0de45b0fd83f5b10842e97d43c7c41d8769a0.tar.xz
dexon-lottery-dda0de45b0fd83f5b10842e97d43c7c41d8769a0.tar.zst
dexon-lottery-dda0de45b0fd83f5b10842e97d43c7c41d8769a0.zip
change storage back to memory to save gas
Diffstat (limited to 'contracts')
-rw-r--r--contracts/Election.sol4
1 files changed, 2 insertions, 2 deletions
diff --git a/contracts/Election.sol b/contracts/Election.sol
index e535975..5b8ca75 100644
--- a/contracts/Election.sol
+++ b/contracts/Election.sol
@@ -96,13 +96,13 @@ contract Election {
address highestCandidate;
for (uint x = 0; x < numOfCandidates; x++) {
address currentAddr = candiatesList[x];
- Candidate memory currentCandidate = candidateData[round][currentAddr];
+ Candidate storage currentCandidate = candidateData[round][currentAddr];
if (currentCandidate.vote > maxVote) {
highestCandidate = currentAddr;
maxVote = currentCandidate.vote;
}
}
- Candidate memory electedPerson = candidateData[round][highestCandidate];
+ Candidate storage electedPerson = candidateData[round][highestCandidate];
emit elected(round, highestCandidate, electedPerson.name, electedPerson.vote);
delete candiatesList;
}