Community Integration
Communities integrate with on-chain markets through the CommunityRegistry contract.
On-Chain Community Data
The CommunityRegistry stores:
- Community ownership (who can manage the community)
- Community ID mapping (links off-chain community to on-chain ID)
Market-Community Link
When creating a market:
- Creator can specify a
communityId(uint256) - Market contract stores this ID
- Used for permission checks and filtering
Hybrid Model
On-Chain (Critical)
- Community ownership
- Voting rights (who can vote on community markets)
- Market-community association
Off-Chain (Metadata)
- Community name, description, icon
- Membership lists
- Invite links
- Community settings
Why Hybrid
- Security: Critical permissions on-chain prevent manipulation
- Flexibility: Rich metadata off-chain for better UX
- Cost: Avoids gas fees for non-critical updates
- Performance: Fast queries for community features
Permission Flow
- User wants to create community market
- System checks on-chain: Does user own community?
- If yes, market created with community ID
- Off-chain: Market appears in community feed
- Voting: On-chain checks if user has voting rights