https://github.com/udayj/dynamic_voting_system
Dynamic voting system
https://github.com/udayj/dynamic_voting_system
cairo cairo-lang starknet starknet-ecosystem
Last synced: 3 months ago
JSON representation
Dynamic voting system
- Host: GitHub
- URL: https://github.com/udayj/dynamic_voting_system
- Owner: udayj
- Created: 2022-05-05T11:31:04.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2022-05-07T08:21:24.000Z (about 3 years ago)
- Last Synced: 2025-01-13T14:29:27.600Z (4 months ago)
- Topics: cairo, cairo-lang, starknet, starknet-ecosystem
- Language: Cairo
- Homepage:
- Size: 72.3 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Dynamic Voting System
### Basic Idea
This is an exploratory project for working with hints/dictionaries in cairo. It is based on the code and idea given [here](https://www.cairo-lang.org/docs/hello_cairo/voting.html). The main modification is around the processing of votes and maintaining the merkel tree. This system allows one to send multiple votes till voting is open. The process_vote function will not update state if new vote is same as previous vote. However, if the new vote is different compared to previous vote then yes/no votes are adjusted accordingly and the merkel tree maintaining state is changed. An important observation here comes from using the dictionary from starkware.cairo.common.dict. Specifically, the dictionary is represented as a chronological list of accesses (read/write/modify). So even a read access means the internal pointer gets updated. [This](https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/cairo/common/dict_access.cairo) reference is useful.