{"id":21519160,"url":"https://github.com/dcspark/plutus-voting-dapp","last_synced_at":"2025-09-09T22:47:54.558Z","repository":{"id":50261891,"uuid":"454450514","full_name":"dcSpark/plutus-voting-dapp","owner":"dcSpark","description":"A smart contract which enables users to vote for spending funds from a treasury UTXO.","archived":false,"fork":false,"pushed_at":"2022-05-05T08:50:38.000Z","size":31,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-09T22:09:09.254Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Haskell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcSpark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-02-01T15:54:56.000Z","updated_at":"2024-08-15T14:23:48.000Z","dependencies_parsed_at":"2022-08-25T14:30:57.208Z","dependency_job_id":null,"html_url":"https://github.com/dcSpark/plutus-voting-dapp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dcSpark/plutus-voting-dapp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fplutus-voting-dapp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fplutus-voting-dapp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fplutus-voting-dapp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fplutus-voting-dapp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcSpark","download_url":"https://codeload.github.com/dcSpark/plutus-voting-dapp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fplutus-voting-dapp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274375296,"owners_count":25273829,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-09T02:00:10.223Z","response_time":80,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T00:56:00.437Z","updated_at":"2025-09-09T22:47:54.524Z","avatar_url":"https://github.com/dcSpark.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\n  Plutus Voting Smart Contract\n\u003c/h1\u003e\n\u003cp align=\"center\"\u003eA smart contract which enables users to vote for spending funds from a treasury UTXO.\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-mit-blue?style=for-the-badge\u0026logo=none\" alt=\"license\" /\u003e\u003c/p\u003e\n\n## Disclaimer\n\nThe code on this repository has **not** been audited. We don't recommend it using in production without a full security audit. Use it at your own risk!.\n\n## Protocol\n\nThis contract allows to pay the content of a treasury to the an address that gets enough votes.\nA special designated token represents the vote. Depening on the intial voting token distribution, allows different voting power per wallet.\n\nProtocol steps:\n\n0. Preparation steps:\n    - Mint voting tokens and distribute among participating wallets.\n\n1. Set up the treasury:\n    - Lock tokens in the treasury with the vote configuration (voting token and required quorum)\n\n2. Vote for address(es):\n    - Locks the a number of vote tokens together with a datum containing the voted choice.\n\n3. Tally votes:\n    - Tries to collect more utxos with more than the required quorum on a particular choice.\n    - If successful, pays the content of the treasury to the winniing address.\n\n4. Return (or recall) vote\n    - At any time, a voter can get back all their votes\n\n## Building\n\nTo build the project execute `cabal build` at the project root.\n\nTo build:\n\n``` bash\n$ nix-shell\n...\n$ cabal build\n...\n```\n\n## Testing\n\nTo run use-case test execute the following commands at the project root.\n\n``` bash\n$ cabal test\nBuild profile: -w ghc-8.10.4.20210212 -O1\nIn order, the following will be built (use -v for more details):\n - voting-dapp-0.1.0.0 (test:voting-dapp-test) (first run)\nPreprocessing test suite 'voting-dapp-test' for voting-dapp-0.1.0.0..\nBuilding test suite 'voting-dapp-test' for voting-dapp-0.1.0.0..\nRunning 1 test suites...\nTest suite voting-dapp-test: RUNNING...\nuse cases\n  Simple endpoint tests\n    Expose endpoints:                                                OK\n    Build treasury:                                                  OK (0.02s)\n    Single vote:                                                     OK (0.04s)\n    Return vote:                                                     OK (0.08s)\n    Tally votes:                                                     OK (0.12s)\n  Voting scenarios\n    Voted wallet with quorum should get content of treasury:         OK (0.30s)\n    Voted wallets with no quorum should not get content of treasury: OK (0.17s)\n\nAll 7 tests passed (0.74s)\nTest suite voting-dapp-test: PASS\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcspark%2Fplutus-voting-dapp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcspark%2Fplutus-voting-dapp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcspark%2Fplutus-voting-dapp/lists"}