{"id":13288215,"url":"https://github.com/circuit-shell/BlockVote-DApp","last_synced_at":"2025-03-10T05:32:18.870Z","repository":{"id":46219320,"uuid":"424748093","full_name":"SPECTR3R/BlockVote-DApp","owner":"SPECTR3R","description":"Smart contracts for a voting DApp using blokchain and Near protocol.","archived":false,"fork":false,"pushed_at":"2021-11-07T06:39:23.000Z","size":15592,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-07-29T16:58:25.368Z","etag":null,"topics":["assemblyscript","blockchain","dapps-development","near","smart-contracts","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SPECTR3R.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-04T21:43:37.000Z","updated_at":"2023-03-08T23:35:37.000Z","dependencies_parsed_at":"2022-09-25T05:40:25.855Z","dependency_job_id":null,"html_url":"https://github.com/SPECTR3R/BlockVote-DApp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SPECTR3R%2FBlockVote-DApp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SPECTR3R%2FBlockVote-DApp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SPECTR3R%2FBlockVote-DApp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SPECTR3R%2FBlockVote-DApp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SPECTR3R","download_url":"https://codeload.github.com/SPECTR3R/BlockVote-DApp/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":221151746,"owners_count":16764913,"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","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":["assemblyscript","blockchain","dapps-development","near","smart-contracts","typescript"],"created_at":"2024-07-29T16:55:00.712Z","updated_at":"2025-03-10T05:32:13.559Z","avatar_url":"https://github.com/SPECTR3R.png","language":"TypeScript","readme":"# BlockVote - DApp\n\nPaquete de [Contratos Inteligentes] escritos en [AssemblyScript] para un sistema de votación online usando blockchain.\n\nEl objetivo de esta aplicación es crear un sistema de votación simple y seguro. Se usa NEAR como protocolo de blockchain.\n\n## Prototipo\n\nPuedes acceder al prototipo de la aplicacion en este [enlace](https://www.justinmind.com/usernote/tests/68299055/68314322/68314380/index.html), o descarga la aplicación [justinmind] y abre en ella el archivo blockVote.vp de este repositorio.\n\n\u003cp align=\"center\"\u003e\n  \u003cimg src=\"public/screen.png\" width=\"600px\" alt=\"prototipe screen text\"\u003e\n\u003c/p\u003e\n\n## Instalación\n\n- Clona este repo, antes de compilar el código, necesitarás instalar [Node.js] ≥ 12\n- En caso de ser necesario, instala yarn vía npm: `npm install --global yarn`.\n- Ejecuta `yarn` desde el directorio raiz del repo de la aplicación.\n\n## Contratos inteligentes\n\nPara este proyecto desarrollamos 4 contratos inteligentes para satisacer la logica de negocio, el código se encuentra en `../assembly/index.ts`. Los contratos son:\n\n1. incrementVotes: Incrementa el voto de un candidato.\n2. getVotes: Obtiene los votos de un usucandidatoario\n3. recordUser: Registra que un usuario ha votado.\n4. userDidParticipate: Verifica si un usuario ya votó.\n\n## Ejecutando las pruebas ⚙️\n\n1. Tests: El código de pruebas se encuentra en `../assembly/__tests__/main.spec.ts`.\n2. Primero compila el paquete usando `yarn asb`.\n3. Después ejecuta `yarn test` para correr los tests. Esto corre las pruebas estándar de AssemblyScript tests usando [as-pect].\n\n### Analizando las pruebas 🔩\n\n1. Se verifica primero que nadie haya votando por un candidato.\n2. Se extrae la cantidad de votos de un candidato y se aumentan los votos en una unidad.\n3. Se verifica que un usuario no ha votado.\n4. Se verifica que un usuario ha votado.\n\n## Despliegue 📦\n\n1. Desde la raíz del proyecto, deployar el paquete con `near dev-deploy build/release/votescontract.wasm`.\n2. Copiar el accountIdy sustituirlo en los siguientes comandos para probar el funcionamiento de los contratos.\n\n```bash\nnear call \u003caccountId\u003e incrementVotes '{\"candidate\":\"amlo\"}' --account-id \u003caccountId\u003e\nnear view \u003caccountId\u003e getVotes '{\"candidate\":\"amlo\"}' --account-id \u003caccountId\u003e\nnear call \u003caccountId\u003e recordUser '{\"user\":\"jorge\"}' --account-id \u003caccountId\u003e\nnear view \u003caccountId\u003e userDidParticipate '{\"user\":\"jorge\"}' --account-id \u003caccountId\u003e\n```\n\n## Autores ✒️\n\n- [Armando del Río](https://www.linkedin.com/in/adrio1992/)\n- [Luis Yañez](https://www.linkedin.com/in/jorge-chavarin/)\n- [Jorge Chavarín](https://github.com/lyanezca)\n\n[contratos inteligentes]: https://docs.near.org/docs/develop/contracts/overview\n[assemblyscript]: https://www.assemblyscript.org/\n[node.js]: https://nodejs.org/en/download/package-manager/\n[as-pect]: https://www.npmjs.com/package/@as-pect/cli\n[justinmind]: https://www.justinmind.com/usernote/tests/68299055/68299921/68299923/index.html\n[yarn documentation]: https://classic.yarnpkg.com/lang/en/docs/install/#windows-stable\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcircuit-shell%2FBlockVote-DApp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcircuit-shell%2FBlockVote-DApp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcircuit-shell%2FBlockVote-DApp/lists"}