A university voting system powered by a Soulbound Token (SBT).
Only students who hold an active PRZToken can create proposals and vote.
File: src/PRZToken.sol
- Minting is owner-only (university administration).
- One token per student (
tokenOfStudent). - Token is non-transferable (SBT behavior):
transferFrom/safeTransferFromrevert. - Approvals are disabled:
approve/setApprovalForAllrevert. - Voting eligibility is controlled via
isTokenActive[tokenId].
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.
- Non-transferable: any attempt to
transferFromorsafeTransferFromwill revert. - Non-approvable:
approveandsetApprovalForAllrevert, 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.
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)
- create proposals:
- 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)
File: src/lib/Errors.sol
- Foundry (
forge,cast,anvil)
curl -L https://foundry.paradigm.xyz | bash