Employee Of The Month

ESCROWUTILITY

Contract purpose

This Smart Contract allows the employees of a company to vote one of them as being the employee of the month. There is no need to deploy the contract each month, it can be used repeatedly. The company manager adds to the contract all the employee addresses. Someone can vote only if he/she was previously registered by the manager. Also, an employee can be removed when he leaves the job and this will not allows him to vote anymore. The winner of this vote will receive a prize, an amount of wei sent to the contract by the manager when he signals that the voting can start.

Exposed methods and variables

manager the ethereum address of the company manager, given as parameter at contract creation

prize returns the prize pf this month

addEmployees this function allows the manager to register his employees. A maximum of 10 employees can be added at a time

parameter nametypedetails
_employeesarray of ethereum addressesthe addresses of the registered employees

startVoting with this function, the manager initiates the voting process and send to the contract the prize that is going to be received by the winner. It emits the VotingStarted event

parameter nametypedetails
_prizeintegerthe prize of the current month

vote employees can call this function to vote for any other employee. A person can vote only once

parameter nametypedetails
voteForethereum addressthe addresses of employee this person wants to vote

sendVoteAndPickWinner the manager calls this function to end the voting process and to pick the winner. ALso, it emits the WinnerPicked event and resets the contract parameters so that it can be used for a new round of voting

removeEmployee this function allows the manager to remove an employee from those who are registered

parameter nametypedetails
_employeeethereum addressthe address of the employee who will be removed

Events

VotingStarted

WinnerPicked

parameter nametypedetails
Winnerethereum addressthe address of the winner
Buy
Reviewed by Modex
Buy Contract Test Contract

Create an account or login to purchase this smart contract