Repository navigation
[BUIDL Audition Platform] (SC): Build Unified Voting System with Auto Role Detection (either Judge or Staker). #102
Description
Issue Description:
You are to implement the voting system! Here's where judges and stakers cast their votes for artists in any given audition. The judges vote is actually a plus for their evaluation of the artist performance which is based on different skill sets of the artist and their performance, and this has been implemented, ensure to check the current state of the contract. The beauty is in the simplicity - one function that automatically detects if you're a judge or staker and assigns the right voting weight. The Judges vote is to complement a staker's vote.
Note: also provide an implementation to assign more voting weight to a celebrity artist who is a judge, get more voting weight than the regular judge.
Judges get their assigned weights, which is a way super much more bigger weight compared to the stakers, stakers get fixed 0.5 weight. Every vote requires an IPFS hash containing the voter's commentary (validated off-chain before reaching the contract). Real-time scoring updates immediately with each vote.
This makes the voting system transparent, anyone can see current standings at any time. No surprises, no manipulation. we are to achieve transparency with this voting system
📌 Requirements
- Unified Voting Function: Single function handles both judge and staker votes
- Automatic Role Detection: Contract determines if caller is judge(or a celebrity artist who gets to act as a judge too) or eligible staker
- IPFS Commentary Integration: Every vote requires pre-validated IPFS hash for reasoning (the reason for a vote should be given)
- Real-Time Score Updates: Artist scores update immediately with each vote
- Prevent Double Voting: Each voter can only vote once per artist
- Vote Weight Assignment: Judges get assigned weights so also celebrity artist acting as a Judge, stakers get fixed 0.5 weight for example
- Voting Window Management: Time-based voting periods with clear start/end
- Vote Storage: Comprehensive vote data storage for transparency
- Integration with Staking: Verify staker eligibility through staking contract which will be provided from this issue [BUIDL Audition Platform] (SC): Build Fixed-Amount Staking Contract for Voter Eligibility #101
- Event Emission: Detailed events for all voting activities
🔍 Implementation Approach
Note: This is but an example;
struct Vote {
voter: ContractAddress,
artist_id: u256,
audition_id: u256,
weight: u256,
vote_type: VoteType, // Judge or Staker
ipfs_content_hash: felt252, // Pre-validated commentary
timestamp: u64
}
enum VoteType {
Judge,
Staker
}
// Unified voting function pseudo-code
fn cast_vote(
audition_id: u256,
artist_id: u256,
ipfs_content_hash: felt252 // Pre-validated off-chain
) {
//possible logic flow
let caller = get_caller_address();
1. Prevent double voting
assert(!self.has_voted.read((caller, artist_id)));
2. Verify voting is active
assert(self.is_voting_active.read(audition_id));
3. Auto-detect role (judge or staker)
let (vote_weight, vote_type) = if self.is_judge(caller) {
(self.get_judge_weight(caller), VoteType::Judge)
} else {
// Verify staker eligibility
assert(self.staking_contract.is_eligible_voter(caller, audition_id));
(self.staker_base_weight.read(), VoteType::Staker)
};
4. Record vote and update scores
5. Mark as voted
6. Emit voting event
}
considering the psudo code, it's just an example just provide an implementation which will work perfectly
🎯 Testing Requirements
- Provide integration test to test unified function with both judge and staker votes
- Test automatic role detection accuracy
- Test double voting prevention
- Test real-time score updates
- Test IPFS hash integration
- Test voting window enforcement
- Test integration with staking contract
- Test comprehensive event emission
- Ensure to test your entire logic implementation asserting everything works as it should
- Test all edge cases
🚀 Expected Outcome
Seamless voting experience with automatic role detection, real-time transparency, and comprehensive vote tracking.
Please reach out to me on telegram https://t.me/MusicStrk_CJ/1
Activity
emarc99 commentedon Aug 1, 2025
Would love to tackle this!
wheval commentedon Aug 1, 2025
Hello, I would love to get this done. I have vast experience in Cairo.
Recommended by OnlyDust for exceptional experience, quality, and reliability.
tusharrrr1 commentedon Aug 1, 2025
Review the Existing Contract
Understand how judges and celebrity judges are currently defined.
Check existing voting or evaluation mechanisms.
Design Data Structures
Define structures for votes, vote history, and artist scores.
Map voters to artists to prevent double voting.
Integrate Role Detection
Detect if the voter is a judge, celebrity judge, or a staker.
Retrieve voting weights based on role.
Connect to Staking Contract
Use the provided staking contract to verify staker eligibility.
Implement a Unified Voting Function
Create one function to handle votes from both judges and stakers.
Include logic to calculate and apply the appropriate vote weight.
Enforce IPFS Commentary Requirement
Ensure every vote includes a valid IPFS hash for off-chain reasoning.
Enable Real-Time Score Updates
Update artist scores immediately after each vote.
Prevent Double Voting
Track if a voter has already voted for a specific artist.
psychemist commentedon Aug 1, 2025
Hi. I would love to work on this issue as I implemented the governance and voting contracts and have the required experience.
CollinsC1O commentedon Aug 2, 2025
Hi Boss @emarc99 Gm
we are trying to have this audition contract properly modularized. Can you ensure your implementation is provided in the aligned file to ensure everything is related but still separation of concern is achieved. if need be pls create a dedicated file under the audition folder that properly integrates with the season and audition contract and the staking contract that will be put out soon #104
CollinsC1O commentedon Aug 8, 2025
Hello @emarc99 any update on this issue yet?
the staking contract is fully ready. please provide a pr as soon as possible
CollinsC1O commentedon Aug 10, 2025
Hello @emarc99 any update on this. A lot of issues are pending and waiting for your pr to be merge. Depending on this issue being resolved.
Please can we have this ready to be merged today
CollinsC1O commentedon Aug 10, 2025
Hello @emarc99 any update on this. A lot of issues are pending and waiting for your pr to be merge. Depending on this issue being resolved.
Please can we have this ready to be merged today
emarc99 commentedon Aug 10, 2025
Apologies bro, I haven't been fully on seat. Expect faster responses, thanks!
CollinsC1O commentedon Aug 16, 2025
Hi bro @emarc99 Gm
I will want you to make a PR before the end of today
CollinsC1O commentedon Aug 16, 2025
hope you've been making progress with this
CollinsC1O commentedon Aug 18, 2025
hello @emarc99 sent you a message and I have not yet heard from you
OWK50GA commentedon Aug 25, 2025
Hola, @CollinsC1O
If this is still available for contribution, we can get to work, Ser
wayzeek commentedon Sep 2, 2025
Hello @CollinsC1O, can I take this over ? :)
wayzeek commentedon Sep 9, 2025
gm @CollinsC1O,
here is the PR :
#123
please let me know if you need anything :)