Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Communities] Promoting/demoting members within the community #323

Closed
2 tasks done
Tracked by #125
pandres95 opened this issue Nov 16, 2023 · 0 comments · Fixed by #324
Closed
2 tasks done
Tracked by #125

[Communities] Promoting/demoting members within the community #323

pandres95 opened this issue Nov 16, 2023 · 0 comments · Fixed by #324
Assignees
Labels
community enhancement New feature or request

Comments

@pandres95
Copy link
Member

pandres95 commented Nov 16, 2023

Types

src/types/parameters.rs

pub type MemberRankOf<T> = <T as Config>::MemberRank;

Storage

src/lib.rs

/// Stores the rank of a community (specified by its
/// [`CommunityId`][`Config::CommunityId`]) member (specified by it's
/// [`AccountId`][`frame_system::Config::AccountId`]).
#[pallet::storage]
#[pallet::getter(fn member_rank)]
pub(super) type MemberRanks<T> =
	StorageDoubleMap<_, Blake2_128Concat, CommunityIdOf<T>, Blake2_128Concat, AccountIdOf<T>, MemberRankOf<T>>;

Implementation

Calls

Privileged methods (as of now, they'd have to pass a referenda):

  • promote_member: Increases the rank of a member in the community.
  • demote_member: Decreases the rank of a member in the community.

Traits

src/traits/rank.rs

pub trait Inspect<Rank>
where
	Rank: Default + Parameter + PartialEq + PartialOrd + Saturating,
{
	/// Retrieves the current rank of the member
	fn rank(&self) -> Rank;
}

pub trait Mutate<Rank>
where
	Rank: Default + Parameter + PartialEq + PartialOrd + Saturating,
{
	/// Retrieves a new rank for the member as increasing by one
	fn promote(&self) -> Self;
	/// Retrieves a new rank for the member as decreasing by one
	fn demote(&self) -> Self;
}
@pandres95 pandres95 mentioned this issue Nov 16, 2023
6 tasks
@pandres95 pandres95 self-assigned this Nov 17, 2023
@pandres95 pandres95 added enhancement New feature or request community labels Nov 17, 2023
@pandres95 pandres95 changed the title Promoting/demoting members within the community. [Community] Promoting/demoting members within the community Nov 17, 2023
@pandres95 pandres95 changed the title [Community] Promoting/demoting members within the community [Communities] Promoting/demoting members within the community Nov 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community enhancement New feature or request
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant