MaikMike / Ballot-Smart-Contract

Learning Solidity

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Ballot Project

Setup Project

Install dependencies

npm run install

Create a .env file and add your env variables

cp .env.example .env

Compile smart contract

npm run compile

Deploy

Deploy with hardhat

npm run compile
npm run deploy:hardhat

Deploy with Viem

npm run compile
npm run deploy:viem <PROPOSAL_1> <PROPOSAL_N>

See your contract deployed in:

https://sepolia.etherscan.io/address/<CONTRACT_ADDRESS>

Interact with the contract

Cast vote:

npm run contract:cast-vote <CONTRACT_ADDRESS> <PROPOSAL_INDEX>

Give right to vote:

npm run contract:give-right-to-vote <CONTRACT_ADDRESS> <NEW_VOTER_ADDRESS>

Delegate vote:

npm run contract:delegate-vote <CONTRACT_ADDRESS> <DELEGATE_VOTE_ADDRESS>

Query winner name:

npm run contract:query-winner-name <CONTRACT_ADDRESS>

Query winning proposals

npm run contract:query-winning-proposals <CONTRACT_ADDRESS>

About

Learning Solidity


Languages

Language:TypeScript 73.0%Language:Solidity 27.0%