Skip to content

ZK-solidity-army/week2

Repository files navigation

Ballot project

Usage

npx ts-node ./scripts/viem/*.ts ...

Voting System Scripts

This repository contains scripts to interact with a voting system smart contract on the Ethereum blockchain.

Prerequisites

Before running the scripts, ensure you have the following installed:

  • Node.js
  • TypeScript (npm install -g typescript)

Voting System Scripts

Deploy

To deploy the voting system contract with predefined proposals:

npm run deploy

Test

To run tests:

npm test

Vote

To cast a vote for a specific proposal:

npm run vote <address> <proposalIndex>

Example:

npm run vote 0x123456789abcdef123456789abcdef123456789 1

Delegate

To delegate your vote to another address for a specific proposal:

npm run delegate <delegateAddress> <proposalIndex>

Example:

npm run delegate 0xabcdef123456789abcdef123456789abcdef123 2

Winning Proposal

To get the winning proposal from a deployed voting system contract:

npm run winningProposal <address>

Example:

npm run winningProposal 0x123456789abcdef123456789abcdef123456789

Give Right to Vote

To give the right to vote to a specific address:

npm run giveRightToVote <address> <addressToWhom>

Example:

npm run giveRightToVote 0x123456789abcdef123456789abcdef123456789 0xabcdef123456789abcdef123456789abcdef123

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors