Skip to content

Szooot/university-vote-system

Repository files navigation

University Vote dApp (Foundry + Solidity)

A university voting system powered by a Soulbound Token (SBT).
Only students who hold an active PRZToken can create proposals and vote.

Overview

PRZToken (SBT / ERC-721)

File: src/PRZToken.sol

  • Minting is owner-only (university administration).
  • One token per student (tokenOfStudent).
  • Token is non-transferable (SBT behavior): transferFrom / safeTransferFrom revert.
  • Approvals are disabled: approve / setApprovalForAll revert.
  • Voting eligibility is controlled via isTokenActive[tokenId].

What is a Soulbound Token (SBT)?

A Soulbound Token is an NFT-like token that is bound to a wallet and cannot be transferred to another address.
In this project, PRZToken is implemented as an ERC-721 with transfer/approval functions explicitly disabled.

How PRZToken behaves in this project

  • Non-transferable: any attempt to transferFrom or safeTransferFrom will revert.
  • Non-approvable: approve and setApprovalForAll revert, so no third party can move tokens.
  • Identity / membership primitive: holding a PRZToken represents being a recognized student.
  • Active vs inactive: the admin can disable a token (isTokenActive[tokenId] = false) to revoke voting/proposal rights without burning the token.
  • 1 token per student: tokenOfStudent[address] ensures each wallet can hold only one PRZToken at a time.

Vote

File: src/Vote.sol

  • Inherits from PRZToken (token + voting live in the same deployed contract).
  • Students with an active token can:
    • create proposals: setupProposal(title, description)
    • vote once per proposal: voteInFavorProposal(proposalId) / voteAgainstProposal(proposalId)
  • Voting window per proposal: 14 days (DURATION = 14 days)
  • Approval threshold: 80% yes votes (THRESHOLD_PERCENT = 80)
  • Results are owner-only and available only after the deadline: proposalResults(proposalId)

Custom errors

File: src/lib/Errors.sol

Repo structure

Requirements

Installation (Foundry)

Install on Linux/macOS

curl -L https://foundry.paradigm.xyz | bash

About

System based on blockchain build for enabling students to submit proposals for improvements at the university

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors