Skip to content

Commit

Permalink
WIP: Change membership traits to be implemented for nonfungibles inst…
Browse files Browse the repository at this point in the history
…ead of nonfungible
  • Loading branch information
olanod committed Mar 14, 2024
1 parent b20a9cb commit 41d7246
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions substrate/frame/support/src/traits/members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,22 +403,31 @@ pub mod membership {

/// Access data associated to a unique membership
pub trait Inspect<AccountId> {
type GroupId: Parameter;
type MembershipId: Parameter;
type MembershipInfo: Membership<Id = Self::MembershipId>;

/// Retrieve membership data that is expected to belong to member
fn get_membership(
id: impl Into<Self::MembershipId>,
group: Self::GroupId,
id: Self::MembershipId,
member: &AccountId,
) -> Option<Self::MembershipInfo>;

/// Retrieve all memberships belonging to member
fn account_memberships(member: &AccountId) -> impl Iterator<Item = Self::MembershipId>;

/// Check membership is owned by the given account
fn has_membership(id: impl Into<Self::MembershipId>, member: &AccountId) -> bool {
fn has_membership(
group: &Self::GroupId,
id: &Self::MembershipId,
member: &AccountId,
) -> bool {
Self::get_membership(id, member).is_some()
}

/// Retrieve all memberships belonging to an account
fn account_memberships(member: &AccountId) -> impl Iterator<Item = Self::MembershipId>;

/// How many members exist in a group
fn member_count(group: Self::GroupId) -> usize;
}

/// Change data related to a unique membership
Expand Down

0 comments on commit 41d7246

Please sign in to comment.