ProjectApproval

DOCUMENTSUTILITY

Contract purpose

This Smart Contract is useful for surveys, gathering people's opinion about different projects someone wants to implement. One use case may be asking the residents of a particular area if they agree with projects proposed by local politicians.

Contract parameters

_ownerName: the name of the projects initiator

Exposed methods and variables

owner the ethereum address of the contract creator

nrOfProjects the total number of projects added to the contract

projectList when called with the proper index, it returns the details about a particular project

addProject called by the owner when the wants to add a new project for people's approval and emits ProjectAdded event

parameter nametypedetails
_descriptionstringproject description
_estimatedBudgetintegerthe amount of money needed to be spent in order to complete the project

voteFor called by the people who agree with a particular proposed project and returns the number of pro and against votes gathered until that point. A voter can only vote once per project when the project is open for voting.

parameter nametypedetails
_projectIDintegerunique identifier of the project

voteAgainst called by the people who disagree with a particular proposed project and returns the number of pro and against votes gathered until that point. A voter can only vote once per project when the project is open for voting.

parameter nametypedetails
_projectIDintegerunique identifier of the project

closeVote this function is called by the owner when the voting period for a project has ended. Also, it emits voteClosed event when the number of pro and against votes is not the same, so the project is either approved or not approved. If the number of votes is equal, the vote cannot be closed yet and the equalVotes event is emitted.

parameter nametypedetails
_projectIDintegerunique identifier of the project

Events

ProjectAdded

parameter nametypedetails
IDintegerthe index of the added project

voteClosed

parameter nametypedetails
Prointegerthe number of votes for the project
Againstintegerthe number of votes against the project
Messagestring"Approved" -if pro votes > against votes or "NOT Approved" - if pro votes < against votes

EqualVotes

parameter nametypedetails
Votesintegerthe number of votes (either pro or against)
Messagestring"Not decided, vote still open"
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract