npx ts-node ./scripts/viem/*.ts ...
This repository contains scripts to interact with a voting system smart contract on the Ethereum blockchain.
Before running the scripts, ensure you have the following installed:
- Node.js
- TypeScript (
npm install -g typescript)
To deploy the voting system contract with predefined proposals:
npm run deployTo run tests:
npm testTo cast a vote for a specific proposal:
npm run vote <address> <proposalIndex>Example:
npm run vote 0x123456789abcdef123456789abcdef123456789 1To delegate your vote to another address for a specific proposal:
npm run delegate <delegateAddress> <proposalIndex>Example:
npm run delegate 0xabcdef123456789abcdef123456789abcdef123 2To get the winning proposal from a deployed voting system contract:
npm run winningProposal <address>Example:
npm run winningProposal 0x123456789abcdef123456789abcdef123456789To give the right to vote to a specific address:
npm run giveRightToVote <address> <addressToWhom>Example:
npm run giveRightToVote 0x123456789abcdef123456789abcdef123456789 0xabcdef123456789abcdef123456789abcdef123