Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
82cdfd45
Commit
82cdfd45
authored
Sep 27, 2017
by
holgerd77
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed naming for example contract variables to avoid static analysis warnings
parent
d1883d7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
example-contracts.js
src/app/editor/example-contracts.js
+13
-13
No files found.
src/app/editor/example-contracts.js
View file @
82cdfd45
...
...
@@ -24,11 +24,11 @@ contract Ballot {
proposals.length = _numProposals;
}
/// Give $(
v
oter) the right to vote on this ballot.
/// Give $(
toV
oter) the right to vote on this ballot.
/// May only be called by $(chairperson).
function giveRightToVote(address
v
oter) public {
if (msg.sender != chairperson || voters[
v
oter].voted) return;
voters[
v
oter].weight = 1;
function giveRightToVote(address
toV
oter) public {
if (msg.sender != chairperson || voters[
toV
oter].voted) return;
voters[
toV
oter].weight = 1;
}
/// Delegate your vote to the voter $(to).
...
...
@@ -47,21 +47,21 @@ contract Ballot {
delegateTo.weight += sender.weight;
}
/// Give a single vote to proposal $(
p
roposal).
function vote(uint8
p
roposal) public {
/// Give a single vote to proposal $(
toP
roposal).
function vote(uint8
toP
roposal) public {
Voter storage sender = voters[msg.sender];
if (sender.voted ||
p
roposal >= proposals.length) return;
if (sender.voted ||
toP
roposal >= proposals.length) return;
sender.voted = true;
sender.vote =
p
roposal;
proposals[
p
roposal].voteCount += sender.weight;
sender.vote =
toP
roposal;
proposals[
toP
roposal].voteCount += sender.weight;
}
function winningProposal() public constant returns (uint8 _winningProposal) {
uint256 winningVoteCount = 0;
for (uint8 prop
osal = 0; proposal < proposals.length; proposal
++)
if (proposals[prop
osal
].voteCount > winningVoteCount) {
winningVoteCount = proposals[prop
osal
].voteCount;
_winningProposal = prop
osal
;
for (uint8 prop
= 0; prop < proposals.length; prop
++)
if (proposals[prop].voteCount > winningVoteCount) {
winningVoteCount = proposals[prop].voteCount;
_winningProposal = prop;
}
}
}`
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment