Skip to content

rajranjan0608/agora_blockchain

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

We are having 3 smart contracts viz. MainContract, User and Election.

Election Contract

  1. creator (address)
  2. electionName (string)
  3. electionDescription (string)
  4. algorithm (enum)
  5. candidates (struct(id, name, voteCount))
  6. isOpen (boolean)
  7. sdate (string)
  8. edate (string)
  9. voters (mapping(address => boolean))
  10. results (winners[string])

User Contract

  1. userInfo
  2. elections (mapping(userid => [electionContract]))
  3. userPublicAddress

Main Contract

  1. userContracts (mapping(userPublicAddress => address))

Application flow

Public address of the users will be considered as their userID.

  • User creation
signup -> MainContract.createUser() -> new UserContract()
  • Creating new election
UserContract.createElection(info) => new Election()
  • One to Many relationship
MC -> user1, user2, user3, ....
user -> Election1, Election2, ....

Build and Tests

Use the below command to build (compile) the smart contracts

npm run build

Use the below command to run tests on the compiled smart contracts

npm run test

All of the test should pass

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published