An open API service indexing awesome lists of open source software.

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

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.