Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
nucleo
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Code
Merge requests
1
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
blockchain
nucleo
Commits
2c6119e1
Commit
2c6119e1
authored
6 years ago
by
Robert Martin-Legene
Browse files
Options
Downloads
Patches
Plain Diff
Minor tweaks
parent
a84e4f89
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Ballot.sol
+13
-11
13 additions, 11 deletions
src/Ballot.sol
with
13 additions
and
11 deletions
src/Ballot.sol
+
13
−
11
View file @
2c6119e1
...
@@ -20,8 +20,8 @@ contract Ballot {
...
@@ -20,8 +20,8 @@ contract Ballot {
struct Votingrules {
struct Votingrules {
string title;
string title;
address chairman;
address chairman;
uint vote
AtOrAfter
;
uint vote
Starts
;
uint vote
AtOr
Before;
uint voteBefore;
// A NOTE ON PERCENTAGES
// A NOTE ON PERCENTAGES
// At present floats do not exist. Since we merely use
// At present floats do not exist. Since we merely use
// our floats to later present to the outside world,
// our floats to later present to the outside world,
...
@@ -60,8 +60,8 @@ contract Ballot {
...
@@ -60,8 +60,8 @@ contract Ballot {
/// Create a new ballot to choose one of `proposalNames`.
/// Create a new ballot to choose one of `proposalNames`.
constructor(
constructor(
string ballotTitle,
string ballotTitle,
uint vote
AtOrAfter
,
uint vote
Starts
,
uint vote
AtOr
Before,
uint voteBefore,
uint percentOfRegisteredVotersReqToBeValid,
uint percentOfRegisteredVotersReqToBeValid,
uint percentOfVotesCastToWin,
uint percentOfVotesCastToWin,
bool countNonvotesAsBlanks,
bool countNonvotesAsBlanks,
...
@@ -69,13 +69,15 @@ contract Ballot {
...
@@ -69,13 +69,15 @@ contract Ballot {
)
)
public
public
{
{
require( voteAtOrBefore > now );
require( voteBefore > now );
require( percentOfRegisteredVotersReqToBeValid <= 100000000 );
require( percentOfVotesCastToWin <= 100000000 );
// chairman can not automatically vote. Chairman must
// chairman can not automatically vote. Chairman must
// giveRightToVote to himself if he wants to vote.
// giveRightToVote to himself if he wants to vote.
rules.chairman = msg.sender;
rules.chairman = msg.sender;
rules.title = ballotTitle;
rules.title = ballotTitle;
rules.vote
AtOrAfter
= vote
AtOrAfter
;
rules.vote
Starts
= vote
Starts
;
rules.vote
AtOr
Before = vote
AtOr
Before;
rules.voteBefore
= voteBefore;
rules.percentOfRegisteredVotersReqToBeValid = percentOfRegisteredVotersReqToBeValid;
rules.percentOfRegisteredVotersReqToBeValid = percentOfRegisteredVotersReqToBeValid;
rules.percentOfVotesCastToWin = percentOfVotesCastToWin;
rules.percentOfVotesCastToWin = percentOfVotesCastToWin;
rules.countNonvotesAsBlanks = countNonvotesAsBlanks;
rules.countNonvotesAsBlanks = countNonvotesAsBlanks;
...
@@ -104,8 +106,8 @@ contract Ballot {
...
@@ -104,8 +106,8 @@ contract Ballot {
public
public
{
{
// May only be called by chairman.
// May only be called by chairman.
require( msg.sender == rules.chairman );
require( msg.sender == rules.chairman
);
require( rules.vote
AtOr
Before <
=
now );
require( rules.voteBefore < now
);
uint idx = voterMap[voter];
uint idx = voterMap[voter];
// Can't add voters more than once.
// Can't add voters more than once.
require( idx == 0 );
require( idx == 0 );
...
@@ -145,8 +147,8 @@ contract Ballot {
...
@@ -145,8 +147,8 @@ contract Ballot {
public
public
{
{
require( proposal < numproposals );
require( proposal < numproposals );
require( rules.vote
AtOrAfter
>= now );
require( rules.vote
Starts
>= now
);
require( rules.vote
AtOr
Before <
=
now );
require( rules.voteBefore < now
);
int idx = getVoterIdx( msg.sender );
int idx = getVoterIdx( msg.sender );
require( idx > -1 );
require( idx > -1 );
uint uidx = uint( idx );
uint uidx = uint( idx );
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment