Skip to content

UserVote Structure

Overview

UserVote tracks a user's voting activity in the acronym game, including their vote choice, submission count, and current round.

  • File: include/uservote.sol
  • License: Sharia
  • Solidity: ^0.8.21

What This Means For Players

Plain English Summary: UserVote is your voting record for the word game. It tracks which submission you voted for, how many phrases you submitted this round, and which round you participated in. Votes reset each round.

Real-World Analogy: Think of it like a ballot at a talent show. It records which act you voted for (Vote), how many times you performed (Submissions), and which episode it was (Round). Next episode, you get a fresh ballot.

How It Affects Your Gameplay: - One vote per round - Your Vote field stores your single vote choice - Submission tracking - The game tracks how many phrases you submitted - Round expiry - When a new round starts, your old vote doesn't count anymore

Definition

struct UserVote {
    uint16 Vote;         // ID of voted submission
    uint8 Submissions;   // Number of submissions this round
    uint64 Round;        // Current round number
}

Field Descriptions

Field Type Purpose
Vote uint16 The ACRONYM.Id that the user voted for
Submissions uint8 How many phrases user submitted (0-255)
Round uint64 Which round this vote applies to

Voting Mechanic

  1. Users submit phrases (tracked in Submissions)
  2. Users vote for their favorite submission
  3. Vote is stored with round context
  4. Round changes invalidate old votes

Usage Patterns

Tracking Votes

mapping(uint64 soul => UserVote) userVotes;

// User submits a phrase
userVotes[soul].Submissions++;

// User votes
userVotes[soul].Vote = submissionId;
userVotes[soul].Round = currentRound;

Round Management

// Check if vote is current
function isValidVote(uint64 soul) view returns (bool) {
    return userVotes[soul].Round == currentRound;
}

// New round resets context
function newRound() {
    currentRound++;
    // Old votes become invalid (wrong round)
}

Submission Limits

uint8 constant MAX_SUBMISSIONS = 3;

function submit(string memory phrase) {
    UserVote storage uv = userVotes[getSoul()];
    require(uv.Submissions < MAX_SUBMISSIONS, "Too many submissions");
    uv.Submissions++;
    // Store phrase...
}

Dependencies

None - standalone struct definition.

Used By

Game contracts that implement voting mechanics for the acronym game.

Example Flow

// Round 1 starts
uint64 currentRound = 1;

// Alice submits twice and votes
userVotes[aliceSoul] = UserVote({
    Vote: 5,           // Voted for submission #5
    Submissions: 2,    // Submitted 2 phrases
    Round: 1
});

// Bob submits once, hasn't voted
userVotes[bobSoul] = UserVote({
    Vote: 0,           // No vote yet
    Submissions: 1,
    Round: 1
});

// Round 2 starts - old votes invalid
currentRound = 2;
// Alice's vote for submission #5 no longer counts
// (userVotes[aliceSoul].Round != currentRound)

Storage Considerations

  • uint16 Vote: Supports up to 65,535 submissions per round
  • uint8 Submissions: Limits to 255 submissions per user per round
  • uint64 Round: Supports ~18 quintillion rounds

Contract Verification

Property Value
Keccak256 Hash 0x2d30c8e7f280d25e7ef2343e9681f4818ff107456ab57944bebd78c054565e9b
Source URL https://raw.githubusercontent.com/busytoby/atropa_pulsechain/main/solidity/dysnomia/include/uservote.sol
Hash Generated 2026-02-08T00:29:08Z