virto-network / virto-node

Virto Network blockchain node.
GNU General Public License v3.0
21 stars 10 forks source link

Categorize communities #385

Open olanod opened 4 months ago

olanod commented 4 months ago

Let's explore the possibility of encoding data in the community ID to identify and categorize them better. Later we can also use this information to enable/restrict parts of the system, e.g. some types of communities can be created permissionlessly paying different prices while others only by root.

type Region = u16;
type Index = u16;
type Moniker = [u8; 4];

// a granular type that can also be represented as a number(e.g. u64) when needed
enum CommunityId {
    GeneralCollective(Moniker),
    Local(Region, Option<Index>),
    Commercial(Industry, Index),
    Union(Index),
    Administrative(Index),
    OssProject(Index),
}

enum Industry { ... }
olanod commented 2 months ago

An alternative to introducing categories as part of the CommunityId is to add the category as a field in the info of the community, this might create less issues to migrate and integrate with other pallets in the runtime.