-
Notifications
You must be signed in to change notification settings - Fork 115
Open
Labels
Description
🎯 Objective
Develop a comprehensive TypeScript service layer for the Product Voting Contract that manages product voting, ranking systems, and community-driven product evaluation within the StarShop marketplace.
🏗 Service Structure
src/shared/services/product_voting/
voting.service.ts // Main service class
types/
voting.types.ts // TypeScript interfaces
ranking.types.ts // Ranking types
limits.types.ts // Voting limits types
utils/
voting.utils.ts // Helper functions
constants/
voting.constants.ts // Contract addresses, error codes🗂 Requirements
1. Voting Operations
voteForProduct(productId, user, vote)- Vote for productupdateVote(productId, user, newVote)- Update existing voteremoveVote(productId, user)- Remove votegetVote(productId, user)- Get user's votegetVotingResults(productId)- Get voting results
2. Ranking Management
getProductRanking(productId)- Get product rankinggetTopProducts(limit, category?)- Get top-ranked productsupdateRanking(productId)- Update product rankinggetRankingHistory(productId)- Get ranking history
3. Voting Limits & Validation
checkVotingLimits(user)- Check user voting limitsgetVotingPower(user)- Get user's voting powervalidateVote(vote)- Validate vote datagetVotingStats(productId)- Get voting statistics
4. Community Features
getVotingLeaderboard()- Get voting leaderboardgetUserVotingHistory(user)- Get user's voting historygetVotingTrends(timeframe)- Get voting trends