Install all the dependencies
npm installTo test project with hardhat, run:
npx hardhat coverageTo deploy you first need to create file named .env with the following format:
ALCHEMY_API_URL= <your alchemy api url>
OWNER=<your metamask private key>
ACC1=<your metamask private key>
ACC2=<your metamask private key>
ACC3=<your metamask private key>Test eth can be obtained here https://faucet.rinkeby.io/
Then deploy to the testnet
npx hardhat run scripts/deploy.ts --network rinkebyexport CONTRACTADDRESS=<address which you received when deployed the contract>To add voting with 3 days deadline
npx hardhat addVoting --deadline 256200 --address $CONTRACTADDRESS --network rinkebyTo participate in voting with provided election id and account id
npx hardhat participate --electionid 1 --account 1 --address $CONTRACTADDRESS --network rinkebyTo vote for a candidate
npx hardhat vote --address $CONTRACTADDRESS --candidateid <candidateID> --election 1 --account 2 --network rinkeby # npx hardhat vote --address $CONTRACTADDRESS --candidate 1 --election 1 --account 2 --network rinkebyTo withdraw prize
npx hardhat withdrawprize --address $CONTRACTADDRESS --winner <accountID> --election 1 --network rinkeby # npx hardhat withdrawprize --address $CONTRACTADDRESS --winner 1 --election 1 --network rinkebyTo withdraw fee
npx hardhat withdrawfee --address $CONTRACTADDRESS --network rinkeby # npx hardhat withdrawfee --address $CONTRACTADDRESS --network rinkeby