Skip to content

vpatsenko/bitdao

Repository files navigation

Advanced Sample Hardhat Project

Spinning up the app

Install all the dependencies

npm install

Testing

To test project with hardhat, run:

npx hardhat coverage

Deploying to the rinkeby network

To 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 rinkeby

Running hardhat tasks

export CONTRACTADDRESS=<address which you received when deployed the contract>

To add voting with 3 days deadline

npx hardhat addVoting --deadline 256200 --address $CONTRACTADDRESS --network rinkeby

To participate in voting with provided election id and account id

npx hardhat participate --electionid 1 --account 1 --address $CONTRACTADDRESS --network rinkeby

To 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 rinkeby

To withdraw prize

npx hardhat withdrawprize --address $CONTRACTADDRESS --winner <accountID> --election 1 --network rinkeby # npx hardhat withdrawprize --address $CONTRACTADDRESS --winner 1 --election 1  --network rinkeby

To withdraw fee

npx hardhat withdrawfee --address $CONTRACTADDRESS --network rinkeby # npx hardhat withdrawfee --address $CONTRACTADDRESS --network rinkeby

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published