Skip to content

UnitedCrowd/voting-contract

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

UnitedCrowd

Voting Contract

The voting contract is an ethereum ERC20 based smart contract designed to costumize votings and polls. The contract can be included in any sale-based smart contract in order to give tokenholder the right to vote. An external DAPP can be added to setup voting parameter.

  • Contract requires UniversalToken.sol
  • Contract based on solidity ^0.4.25

Function list

Basic functions

Function Description
contract Voting is CustomOwnable Constructor: Initlizes poll, determines the current state of a poll, defines voter and tokenmanager
createPoll creates a new poll
endPoll Ends a poll. Only the creator of a given poll can end that poll.
getPollStatus Returns the status of a poll.
getPollExpirationTime Gets the expiration date of a poll.
getPollHistory Gets the complete list of polls a user has voted in.
getPollInfoForVoter Gets a voter's vote and weight for a given expired poll.
getVotersForPoll Gets all the voters of a poll.
getLockedAmount Gets the amount of Voting Tokens that are locked for a given voter.
getTokenStake Gets the amount of Voting Credits for a given voter.
getIfUserHasVoted Checks if a user has voted for a specific poll.
modifier validPoll Modifier that checks for a valid poll ID.

Vote Operations

NOTE: weight is denominated in wei

Function Description
castVote Casts a vote for a given poll.

Token Operations

NOTE: User must approve transfer of tokens. weight is denominated in wei

Function Description
stakeVotingTokens Stakes tokens for a given voter in return for voting credits.
withdrawTokens Allows a voter to withdraw voting tokens after a poll has ended.
updateTokenBank Helper function that updates active token balances after a poll has ended.

About

Voting smart contract ERC20

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published