|
@@ -1,24 +1,424 @@
|
|
// Ensure we're `no_std` when compiling for Wasm.
|
|
// Ensure we're `no_std` when compiling for Wasm.
|
|
#![cfg_attr(not(feature = "std"), no_std)]
|
|
#![cfg_attr(not(feature = "std"), no_std)]
|
|
|
|
|
|
|
|
+#[cfg(feature = "std")]
|
|
|
|
+use serde::{Deserialize, Serialize};
|
|
|
|
+
|
|
|
|
+use codec::{Codec, Decode, Encode};
|
|
|
|
+//use rstd::collections::btree_map::BTreeMap;
|
|
|
|
+use rstd::collections::btree_set::BTreeSet;
|
|
use rstd::prelude::*;
|
|
use rstd::prelude::*;
|
|
|
|
+use srml_support::traits::Currency;
|
|
use srml_support::{
|
|
use srml_support::{
|
|
- decl_module, decl_storage, ensure, StorageMap, StorageValue,
|
|
|
|
|
|
+ decl_module, decl_storage, decl_event, ensure, StorageMap, StorageValue, Parameter
|
|
};
|
|
};
|
|
-//use rstd::collections::btree_map::BTreeMap;
|
|
|
|
-use rstd::collections::btree_set::BTreeSet;
|
|
|
|
-
|
|
|
|
|
|
+use runtime_primitives::traits::{Member, One, SimpleArithmetic, MaybeSerialize};
|
|
|
|
+use minting;
|
|
|
|
+use recurringrewards;
|
|
|
|
+use stake;
|
|
|
|
+use hiring;
|
|
use versioned_store_permissions;
|
|
use versioned_store_permissions;
|
|
|
|
+use super::super::membership::members as membership;
|
|
|
|
+
|
|
|
|
+/// Module configuration trait for this Substrate module.
|
|
|
|
+pub trait Trait: system::Trait + minting::Trait + recurringrewards::Trait + stake::Trait + hiring::Trait + versioned_store_permissions::Trait + membership::Trait + Sized {
|
|
|
|
+
|
|
|
|
+ /// The event type.
|
|
|
|
+ type Event: From<Event<Self>> + Into<<Self as system::Trait>::Event>;
|
|
|
|
+
|
|
|
|
+ /// Type for identifier for lead.
|
|
|
|
+ type LeadId: Parameter
|
|
|
|
+ + Member
|
|
|
|
+ + SimpleArithmetic
|
|
|
|
+ + Codec
|
|
|
|
+ + Default
|
|
|
|
+ + Copy
|
|
|
|
+ + MaybeSerialize
|
|
|
|
+ + PartialEq;
|
|
|
|
+
|
|
|
|
+ /// Type for identifier for curators.
|
|
|
|
+ type CuratorId: Parameter
|
|
|
|
+ + Member
|
|
|
|
+ + SimpleArithmetic
|
|
|
|
+ + Codec
|
|
|
|
+ + Default
|
|
|
|
+ + Copy
|
|
|
|
+ + MaybeSerialize
|
|
|
|
+ + PartialEq
|
|
|
|
+ + Ord;
|
|
|
|
+
|
|
|
|
+ /// Type for identifier for channels.
|
|
|
|
+ type ChannelId: Parameter
|
|
|
|
+ + Member
|
|
|
|
+ + SimpleArithmetic
|
|
|
|
+ + Codec
|
|
|
|
+ + Default
|
|
|
|
+ + Copy
|
|
|
|
+ + MaybeSerialize
|
|
|
|
+ + PartialEq;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Type for identifier for dynamic version store credential.
|
|
|
|
+pub type DynamicCredentialId<T: Trait> = T::PrincipalId;
|
|
|
|
+
|
|
|
|
+/// Balance type of runtime
|
|
|
|
+pub type BalanceOf<T> =
|
|
|
|
+ <<T as stake::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::Balance;
|
|
|
|
+
|
|
|
|
+/// Negative imbalance of runtime.
|
|
|
|
+pub type NegativeImbalance<T> =
|
|
|
|
+ <<T as stake::Trait>::Currency as Currency<<T as system::Trait>::AccountId>>::NegativeImbalance;
|
|
|
|
+
|
|
|
|
+/// The exit stage of a lead involvement in the working group.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub struct ExitedLeadRole<BlockNumber> {
|
|
|
|
+
|
|
|
|
+ /// When exit was initiated.
|
|
|
|
+ pub initiated_at_block_number: BlockNumber
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// The stage of the involvement of a lead in the working group.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub enum LeadRoleState<BlockNumber> {
|
|
|
|
+
|
|
|
|
+ /// Currently active.
|
|
|
|
+ Active,
|
|
|
|
+
|
|
|
|
+ /// No longer active, for some reason
|
|
|
|
+ Exited(ExitedLeadRole<BlockNumber>)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Must be default constructible because it indirectly is a value in a storage map.
|
|
|
|
+/// ***SHOULD NEVER ACTUALLY GET CALLED, IS REQUIRED TO DUE BAD STORAGE MODEL IN SUBSTRATE***
|
|
|
|
+impl<BlockNumber> Default for LeadRoleState<BlockNumber> {
|
|
|
|
+
|
|
|
|
+ fn default() -> Self {
|
|
|
|
+ LeadRoleState::Active
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Working group lead: curator lead
|
|
|
|
+/// For now this role is not staked or inducted through an structured process, like the hiring module,
|
|
|
|
+/// hence information about this is missing. Recurring rewards is included, somewhat arbitrarily!
|
|
|
|
+#[derive(Encode, Decode, Default, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub struct Lead<AccountId, RewardRelationshipId, BlockNumber> {
|
|
|
|
+
|
|
|
|
+ /// Account used to authenticate in this role,
|
|
|
|
+ pub role_account: AccountId,
|
|
|
|
+
|
|
|
|
+ /// Whether the role has recurring reward, and if so an identifier for this.
|
|
|
|
+ pub reward_relationship: Option<RewardRelationshipId>,
|
|
|
|
+
|
|
|
|
+ /// When was inducted
|
|
|
|
+ /// TODO: Add richer information about circumstances of induction, like referencing a council proposal?
|
|
|
|
+ pub inducted: BlockNumber,
|
|
|
|
+
|
|
|
|
+ /// The stage of the involvement of this lead in the working group.
|
|
|
|
+ pub stage: LeadRoleState<BlockNumber>
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Origin of exit initiation on behalf of a curator.'
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub enum CuratorExitInitiationOrigin {
|
|
|
|
+
|
|
|
|
+ /// Lead is origin.
|
|
|
|
+ Lead,
|
|
|
|
+
|
|
|
|
+ /// The curator exiting is the origin.
|
|
|
|
+ Curator
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// The exit stage of a curators involvement in the working group.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub struct ExitedCuratorRoleStage<BlockNumber> {
|
|
|
|
+
|
|
|
|
+ /// Origin for exit.
|
|
|
|
+ pub origin: CuratorExitInitiationOrigin,
|
|
|
|
+
|
|
|
|
+ /// When exit was initiated.
|
|
|
|
+ pub initiated_at_block_number: BlockNumber,
|
|
|
|
+
|
|
|
|
+ /// Explainer for why exit was initited.
|
|
|
|
+ pub rationale_text: Vec<u8>
|
|
|
|
+}
|
|
|
|
|
|
-pub use super::types::{*};
|
|
|
|
|
|
+/// The stage of the involvement of a curator in the working group.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub enum CuratorRoleStage<BlockNumber> {
|
|
|
|
|
|
-use system;
|
|
|
|
|
|
+ /// Currently active.
|
|
|
|
+ Active,
|
|
|
|
+
|
|
|
|
+ /// No longer active, for some reason
|
|
|
|
+ Exited(ExitedCuratorRoleStage<BlockNumber>)
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Must be default constructible because it indirectly is a value in a storage map.
|
|
|
|
+/// ***SHOULD NEVER ACTUALLY GET CALLED, IS REQUIRED TO DUE BAD STORAGE MODEL IN SUBSTRATE***
|
|
|
|
+impl<BlockNumber> Default for CuratorRoleStage<BlockNumber> {
|
|
|
|
+
|
|
|
|
+ fn default() -> Self {
|
|
|
|
+ CuratorRoleStage::Active
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// The induction of a curator in the working group.
|
|
|
|
+#[derive(Encode, Decode, Default, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub struct CuratorInduction<LeadId, ApplicationId, BlockNumber> {
|
|
|
|
+
|
|
|
|
+ /// Lead responsible
|
|
|
|
+ pub lead: LeadId,
|
|
|
|
+
|
|
|
|
+ /// Application through which curator was inducted
|
|
|
|
+ pub application: ApplicationId,
|
|
|
|
+
|
|
|
|
+ /// When induction occurred
|
|
|
|
+ pub at_block: BlockNumber
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Working group participant: curator
|
|
|
|
+/// This role can be staked, have reward and be inducted through the hiring module.
|
|
|
|
+#[derive(Encode, Decode, Default, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub struct Curator<AccountId, RewardRelationshipId, StakeId, BlockNumber, LeadId, ApplicationId> {
|
|
|
|
+
|
|
|
|
+ /// Account used to authenticate in this role,
|
|
|
|
+ pub role_account: AccountId,
|
|
|
|
+
|
|
|
|
+ /// Whether the role has recurring reward, and if so an identifier for this.
|
|
|
|
+ pub reward_relationship: Option<RewardRelationshipId>,
|
|
|
|
+
|
|
|
|
+ /// Whether participant is staked, and if so, the identifier for this staking in the staking module.
|
|
|
|
+ pub stake: Option<StakeId>,
|
|
|
|
+
|
|
|
|
+ /// The stage of this curator in the working group.
|
|
|
|
+ pub stage: CuratorRoleStage<BlockNumber>,
|
|
|
|
+
|
|
|
|
+ /// How the curator was inducted into the working group.
|
|
|
|
+ pub induction: CuratorInduction<LeadId, ApplicationId, BlockNumber>,
|
|
|
|
+
|
|
|
|
+ /// Whether this curator can unilaterally alter the curation status of a channel.
|
|
|
|
+ pub can_update_channel_curation_status: bool
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Type of channel content.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub enum ChannelContentType {
|
|
|
|
+ Video,
|
|
|
|
+ Music,
|
|
|
|
+ Ebook
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Must be default constructible because it indirectly is a value in a storage map.
|
|
|
|
+/// ***SHOULD NEVER ACTUALLY GET CALLED, IS REQUIRED TO DUE BAD STORAGE MODEL IN SUBSTRATE***
|
|
|
|
+impl Default for ChannelContentType {
|
|
|
|
+
|
|
|
|
+ fn default() -> Self {
|
|
|
|
+ ChannelContentType::Video
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Status of channel, as set by the owner.
|
|
|
|
+/// Is only meant to affect visibility, mutation of channel and child content
|
|
|
|
+/// is unaffected on runtime.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub enum ChannelPublishingStatus {
|
|
|
|
+
|
|
|
|
+ /// Compliant UIs should render.
|
|
|
|
+ Published,
|
|
|
|
+
|
|
|
|
+ /// Compliant UIs should not render it or any child content.
|
|
|
|
+ NotPublished
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Must be default constructible because it indirectly is a value in a storage map.
|
|
|
|
+/// ***SHOULD NEVER ACTUALLY GET CALLED, IS REQUIRED TO DUE BAD STORAGE MODEL IN SUBSTRATE***
|
|
|
|
+impl Default for ChannelPublishingStatus {
|
|
|
|
+
|
|
|
|
+ fn default() -> Self {
|
|
|
|
+ ChannelPublishingStatus::Published
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Status of channel, as set by curators.
|
|
|
|
+/// Is only meant to affect visibility currently, but in the future
|
|
|
|
+/// it will also gate publication of new child content,
|
|
|
|
+/// editing properties, revenue flows, etc.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub enum ChannelCurationStatus {
|
|
|
|
+ Normal,
|
|
|
|
+ Censored
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Must be default constructible because it indirectly is a value in a storage map.
|
|
|
|
+/// ***SHOULD NEVER ACTUALLY GET CALLED, IS REQUIRED TO DUE BAD STORAGE MODEL IN SUBSTRATE***
|
|
|
|
+impl Default for ChannelCurationStatus {
|
|
|
|
+
|
|
|
|
+ fn default() -> Self {
|
|
|
|
+ ChannelCurationStatus::Normal
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// A channel for publishing content.
|
|
|
|
+#[derive(Encode, Decode, Default, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub struct Channel<MemberId, AccountId, BlockNumber> {
|
|
|
|
+
|
|
|
|
+ /// Unique human readble channel handle.
|
|
|
|
+ pub handle: Vec<u8>,
|
|
|
|
+
|
|
|
|
+ /// Whether channel has been verified, in the normal Web2.0 platform sense of being authenticated.
|
|
|
|
+ pub verified: bool,
|
|
|
|
+
|
|
|
|
+ /// Human readable description of channel purpose and scope.
|
|
|
|
+ pub description: Vec<u8>,
|
|
|
|
+
|
|
|
|
+ /// The type of channel.
|
|
|
|
+ pub content: ChannelContentType,
|
|
|
|
+
|
|
|
|
+ /// Member who owns channel.
|
|
|
|
+ pub owner: MemberId,
|
|
|
|
+
|
|
|
|
+ /// Account used to authenticate as owner.
|
|
|
|
+ /// Can be updated through membership role key.
|
|
|
|
+ pub role_account: AccountId,
|
|
|
|
+
|
|
|
|
+ /// Publication status of channel.
|
|
|
|
+ pub publishing_status: ChannelPublishingStatus,
|
|
|
|
+
|
|
|
|
+ /// Curation status of channel.
|
|
|
|
+ pub curation_status: ChannelCurationStatus,
|
|
|
|
+
|
|
|
|
+ /// When channel was established.
|
|
|
|
+ pub created: BlockNumber
|
|
|
|
+
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// The types of built in credential holders.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub enum BuiltInCredentialHolder {
|
|
|
|
+
|
|
|
|
+ /// Cyrrent working group lead.
|
|
|
|
+ Lead,
|
|
|
|
+
|
|
|
|
+ /// Any active urator in the working group.
|
|
|
|
+ AnyCurator,
|
|
|
|
+
|
|
|
|
+ /// Any active member in the membership registry.
|
|
|
|
+ AnyMember
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Holder of dynamic credential.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub enum DynamicCredentialHolder<CuratorId: Ord, ChannelId> {
|
|
|
|
+
|
|
|
|
+ /// Sets of curators.
|
|
|
|
+ Curators(BTreeSet<CuratorId>),
|
|
|
|
+
|
|
|
|
+ /// Owner of a channel.
|
|
|
|
+ ChannelOwner(ChannelId),
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Must be default constructible because it indirectly is a value in a storage map.
|
|
|
|
+/// ***SHOULD NEVER ACTUALLY GET CALLED, IS REQUIRED TO DUE BAD STORAGE MODEL IN SUBSTRATE***
|
|
|
|
+impl<CuratorId: Ord, ChannelId> Default for DynamicCredentialHolder<CuratorId, ChannelId> {
|
|
|
|
+
|
|
|
|
+ fn default() -> Self {
|
|
|
|
+ DynamicCredentialHolder::Curators(BTreeSet::new())
|
|
|
|
+ }
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Represents credential for authenticating as "the current lead".
|
|
|
|
+#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd, Default)]
|
|
|
|
+pub struct LeadCredential {
|
|
|
|
+
|
|
|
|
+ /// Whether it is currently possible to authenticate with this credential.
|
|
|
|
+ pub is_active: bool
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Represents credential for authenticating as "any curator".
|
|
|
|
+#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd, Default)]
|
|
|
|
+pub struct AnyCuratorCredential {
|
|
|
|
+
|
|
|
|
+ /// Whether it is currently possible to authenticate with this credential.
|
|
|
|
+ pub is_active: bool
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Represents credential for authenticating as "any member".
|
|
|
|
+#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd, Default)]
|
|
|
|
+pub struct AnyMemberCredential {
|
|
|
|
+
|
|
|
|
+ /// Whether it is currently possible to authenticate with this credential.
|
|
|
|
+ pub is_active: bool
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Represents credential to be referenced from the version store.
|
|
|
|
+/// It is dynamic in the sense that these can be created on the fly.
|
|
|
|
+#[derive(Encode, Decode, Default, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub struct DynamicCredential<CuratorId: Ord, ChannelId, BlockNumber> {
|
|
|
|
+
|
|
|
|
+ /// Who holds this credential, meaning they can successfully authenticate with this credential.
|
|
|
|
+ pub holder: DynamicCredentialHolder<CuratorId, ChannelId>,
|
|
|
|
+
|
|
|
|
+ /// Whether it is currently possible to authenticate with this credential.
|
|
|
|
+ pub is_active: bool,
|
|
|
|
+
|
|
|
|
+ /// When it was created.
|
|
|
|
+ pub created: BlockNumber,
|
|
|
|
+
|
|
|
|
+ /// Human readable description of credential.
|
|
|
|
+ pub description: Vec<u8>
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Policy governing any curator opening which can be made by lead.
|
|
|
|
+/// Be aware that all limits are forward looking in constrainign future extrinsics or method calls.
|
|
|
|
+/// Updating them has no side-effects beyond changing the limit.
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub struct OpeningPolicy<BlockNumber, StakingPolicy> {
|
|
|
|
+
|
|
|
|
+ /// Limits the total number of curators which can be active, or possibly active through an active opening.
|
|
|
|
+ /// The contribution of an active opening is counted by looking at the rationing policy of the opening.
|
|
|
|
+ /// A limit of N is counted as there being N actual active curators, as a worst case bound.
|
|
|
|
+ /// The absence of a limit is counted as "infinity", thus blocking any further openings from being created,
|
|
|
|
+ /// and is is not possible to actually hire a number of curators that would bring the number above this parameter `curator_limit`.
|
|
|
|
+ pub curator_limit: Option<u16>,
|
|
|
|
+
|
|
|
|
+ /// Maximum length of review period of applications
|
|
|
|
+ pub max_review_period_length: BlockNumber,
|
|
|
|
+
|
|
|
|
+ /// Staking policy for application
|
|
|
|
+ pub application_staking_policy: Option<StakingPolicy>,
|
|
|
|
+
|
|
|
|
+ /// Staking policy for role itself
|
|
|
|
+ pub role_staking_policy: Option<StakingPolicy>
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+/// Represents
|
|
|
|
+#[derive(Encode, Decode, Debug, Eq, PartialEq, Clone, PartialOrd)]
|
|
|
|
+pub enum WorkingGroupActor<T: Trait> {
|
|
|
|
+
|
|
|
|
+ ///
|
|
|
|
+ Lead(T::LeadId),
|
|
|
|
+
|
|
|
|
+ ///
|
|
|
|
+ Curator(T::CuratorId),
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+pub enum ChannelActor<T: Trait> {
|
|
|
|
+
|
|
|
|
+ ///
|
|
|
|
+ WorkingGroupActor(WorkingGroupActor<T>),
|
|
|
|
+
|
|
|
|
+ ///
|
|
|
|
+ Owner
|
|
|
|
+}
|
|
|
|
|
|
decl_storage! {
|
|
decl_storage! {
|
|
trait Store for Module<T: Trait> as ContentWorkingGroup {
|
|
trait Store for Module<T: Trait> as ContentWorkingGroup {
|
|
|
|
|
|
/// The mint currently funding the rewards for this module.
|
|
/// The mint currently funding the rewards for this module.
|
|
- pub Mint get(mint) config(): T::TokenMintId;
|
|
|
|
|
|
+ pub Mint get(mint) config(): <T as minting::Trait>::MintId;
|
|
|
|
|
|
/// The current lead.
|
|
/// The current lead.
|
|
pub CurrentLeadId get(current_lead_id) config(): Option<T::LeadId>;
|
|
pub CurrentLeadId get(current_lead_id) config(): Option<T::LeadId>;
|
|
@@ -52,22 +452,22 @@ decl_storage! {
|
|
|
|
|
|
/// The constraints lead must respect when creating a new curator opening.
|
|
/// The constraints lead must respect when creating a new curator opening.
|
|
/// Lack of policy is interpreted as blocking any new openings at all.
|
|
/// Lack of policy is interpreted as blocking any new openings at all.
|
|
- pub OpeningPolicy get(opening_policy) config(): Option<OpeningPolicy<T::BlockNumber, hiring::StakingPolicy<BalanceOf<T>, T::BlockNumber>>>;
|
|
|
|
|
|
+ pub OptOpeningPolicy get(opening_policy) config(): Option<OpeningPolicy<T::BlockNumber, hiring::StakingPolicy<BalanceOf<T>, T::BlockNumber>>>;
|
|
|
|
|
|
/// Credentials for built in roles.
|
|
/// Credentials for built in roles.
|
|
- pub LeadCredential get(lead_credential) config(): LeadCredential;
|
|
|
|
|
|
+ pub CredentialOfLead get(credential_of_lead) config(): LeadCredential;
|
|
|
|
|
|
/// The "any curator" credential.
|
|
/// The "any curator" credential.
|
|
- pub AnyCuratorCredential get(any_curator_credential) config(): AnyCuratorCredential;
|
|
|
|
|
|
+ pub CredentialOfAnyCurator get(credential_of_anycurator) config(): AnyCuratorCredential;
|
|
|
|
|
|
/// The "any member" credential.
|
|
/// The "any member" credential.
|
|
- pub AnyMemberCredential get(any_member_credential) config(): AnyMemberCredential;
|
|
|
|
|
|
+ pub CredentialOfAnyMember get(credential_of_anymember) config(): AnyMemberCredential;
|
|
|
|
|
|
/// Maps dynamic credential by
|
|
/// Maps dynamic credential by
|
|
- pub DynamicCredentialById get(dynamic_credential_by_id) config(): linked_map DynamicCredentialId => DynamicCredential<T::CuratorId, T::ChannelId, T::BlockNumber>;
|
|
|
|
|
|
+ pub DynamicCredentialById get(dynamic_credential_by_id) config(): linked_map DynamicCredentialId<T> => DynamicCredential<T::CuratorId, T::ChannelId, T::BlockNumber>;
|
|
|
|
|
|
/// ...
|
|
/// ...
|
|
- pub NextDynamicCredentialId get(next_dynamic_credential_id) config(): T::DynamicCredentialId;
|
|
|
|
|
|
+ pub NextDynamicCredentialId get(next_dynamic_credential_id) config(): DynamicCredentialId<T>;
|
|
|
|
|
|
/// Whether it is currently possible to create a channel via `create_channel` extrinsic.
|
|
/// Whether it is currently possible to create a channel via `create_channel` extrinsic.
|
|
pub ChannelCreationEnabled get(channel_creation_enabled) config(): bool;
|
|
pub ChannelCreationEnabled get(channel_creation_enabled) config(): bool;
|
|
@@ -85,7 +485,8 @@ decl_storage! {
|
|
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- /*
|
|
|
|
|
|
+
|
|
|
|
+/*
|
|
/// Substrate module events.
|
|
/// Substrate module events.
|
|
decl_event! {
|
|
decl_event! {
|
|
pub enum Event<T> where
|
|
pub enum Event<T> where
|
|
@@ -118,6 +519,15 @@ decl_event! {
|
|
}
|
|
}
|
|
*/
|
|
*/
|
|
|
|
|
|
|
|
+decl_event!(
|
|
|
|
+ pub enum Event<T>
|
|
|
|
+ where
|
|
|
|
+ <T as system::Trait>::AccountId,
|
|
|
|
+ {
|
|
|
|
+ MyOtherEvent(AccountId),
|
|
|
|
+ }
|
|
|
|
+);
|
|
|
|
+
|
|
decl_module! {
|
|
decl_module! {
|
|
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
|
pub struct Module<T: Trait> for enum Call where origin: T::Origin {
|
|
|
|
|
|
@@ -197,9 +607,9 @@ decl_module! {
|
|
/// Update channel curation status of a channel.
|
|
/// Update channel curation status of a channel.
|
|
///
|
|
///
|
|
/// Can
|
|
/// Can
|
|
- pub fn update_channel_curation_status(origin, WorkingGroupActor) {
|
|
|
|
-
|
|
|
|
|
|
+ pub fn update_channel_curation_status(origin) {
|
|
|
|
|
|
|
|
+ // WorkingGroupActor
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -209,25 +619,21 @@ decl_module! {
|
|
* Lead credential is managed as non-dispatchable.
|
|
* Lead credential is managed as non-dispatchable.
|
|
*/
|
|
*/
|
|
|
|
|
|
- pub fn update_any_member_credential() {
|
|
|
|
|
|
+ pub fn update_any_member_credential(origin) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- pub fn update_any_curator_credential() {
|
|
|
|
|
|
+ pub fn update_any_curator_credential(origin) {
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- pub fn create_dynamic_credential() {
|
|
|
|
-
|
|
|
|
- }
|
|
|
|
|
|
+ pub fn create_dynamic_credential(origin) {
|
|
|
|
|
|
- pub fn update_dynamic_credential() {
|
|
|
|
-
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ pub fn update_dynamic_credential(origin) {
|
|
|
|
|
|
-
|
|
|
|
-
|
|
|
|
|
|
+ }
|
|
|
|
|
|
/// ...
|
|
/// ...
|
|
pub fn update_channel_as_owner(origin) {
|
|
pub fn update_channel_as_owner(origin) {
|
|
@@ -347,7 +753,7 @@ impl<T: Trait> Module<T> {
|
|
*/
|
|
*/
|
|
|
|
|
|
/// ...
|
|
/// ...
|
|
-enum Credential<CuratorId, ChannelId, BlockNumber> {
|
|
|
|
|
|
+enum Credential<CuratorId: Ord, ChannelId, BlockNumber> {
|
|
Lead(LeadCredential),
|
|
Lead(LeadCredential),
|
|
AnyCurator(AnyCuratorCredential),
|
|
AnyCurator(AnyCuratorCredential),
|
|
AnyMember(AnyMemberCredential),
|
|
AnyMember(AnyMemberCredential),
|
|
@@ -388,10 +794,10 @@ impl<T: Trait> Module<T> {
|
|
|
|
|
|
match credential_id {
|
|
match credential_id {
|
|
|
|
|
|
- LEAD_CREDENTIAL_ID => CredentialHolder(BuiltInCredentialHolder(BuiltInCredentialHolder::Lead)),
|
|
|
|
- ANY_CURATOR_CREDENTIAL_ID => CredentialHolder(BuiltInCredentialHolder(BuiltInCredentialHolder::AnyCurator)),
|
|
|
|
- ANY_MEMBER_CREDENTIAL_ID => CredentialHolder(BuiltInCredentialHolder(BuiltInCredentialHolder::AnyMember)),
|
|
|
|
- _ => CredentialHolder(CandidateDynamicCredentialId(credential_id - 3)) // will map first dynamic id to 0
|
|
|
|
|
|
+ LEAD_CREDENTIAL_ID => CredentialHolder::BuiltInCredentialHolder(BuiltInCredentialHolder::Lead),
|
|
|
|
+ ANY_CURATOR_CREDENTIAL_ID => CredentialHolder::BuiltInCredentialHolder(BuiltInCredentialHolder::AnyCurator),
|
|
|
|
+ ANY_MEMBER_CREDENTIAL_ID => CredentialHolder::BuiltInCredentialHolder(BuiltInCredentialHolder::AnyMember),
|
|
|
|
+ _ => CredentialHolder::CandidateDynamicCredentialId(credential_id - T::PrincipalId::from(3)) // will map first dynamic id to 0
|
|
|
|
|
|
/*
|
|
/*
|
|
Add new built in credentials here below
|
|
Add new built in credentials here below
|