Browse Source

DAO to Dao to silence clippy warning

ignazio-bovo 3 years ago
parent
commit
483a74a625

+ 2 - 2
runtime-modules/common/src/lib.rs

@@ -65,8 +65,8 @@ pub trait StorageOwnership {
         + Ord
         + PartialEq;
 
-    /// DAO id representation.
-    type DAOId: Parameter
+    /// Dao id representation.
+    type DaoId: Parameter
         + Member
         + BaseArithmetic
         + Codec

+ 4 - 4
runtime-modules/common/src/storage.rs

@@ -34,24 +34,24 @@ impl<MemberId, ChannelId, DAOId> Default for StorageObjectOwner<MemberId, Channe
 // Defined in 'common' package
 pub trait StorageSystem<T: crate::StorageOwnership + crate::MembershipTypes> {
     fn atomically_add_content(
-        owner: StorageObjectOwner<T::MemberId, T::ChannelId, T::DAOId>,
+        owner: StorageObjectOwner<T::MemberId, T::ChannelId, T::DaoId>,
         content_parameters: Vec<ContentParameters<T::ContentId, T::DataObjectTypeId>>,
     ) -> DispatchResult;
 
     // Checks if given owner can add provided content to the storage frame_system
     fn can_add_content(
-        owner: StorageObjectOwner<T::MemberId, T::ChannelId, T::DAOId>,
+        owner: StorageObjectOwner<T::MemberId, T::ChannelId, T::DaoId>,
         content_parameters: Vec<ContentParameters<T::ContentId, T::DataObjectTypeId>>,
     ) -> DispatchResult;
 
     fn atomically_remove_content(
-        owner: &StorageObjectOwner<T::MemberId, T::ChannelId, T::DAOId>,
+        owner: &StorageObjectOwner<T::MemberId, T::ChannelId, T::DaoId>,
         content_ids: &[T::ContentId],
     ) -> DispatchResult;
 
     // Checks if given owner can remove content under given content ids from the storage frame_system
     fn can_remove_content(
-        owner: &StorageObjectOwner<T::MemberId, T::ChannelId, T::DAOId>,
+        owner: &StorageObjectOwner<T::MemberId, T::ChannelId, T::DaoId>,
         content_ids: &[T::ContentId],
     ) -> DispatchResult;
 }

+ 13 - 13
runtime-modules/content/src/lib.rs

@@ -48,7 +48,7 @@ pub(crate) type ContentParameters<T> = ContentParametersRecord<ContentId<T>, Dat
 pub(crate) type StorageObjectOwner<T> = StorageObjectOwnerRecord<
     <T as MembershipTypes>::MemberId,
     <T as StorageOwnership>::ChannelId,
-    <T as StorageOwnership>::DAOId,
+    <T as StorageOwnership>::DaoId,
 >;
 
 /// Type, used in diffrent numeric constraints representations
@@ -132,13 +132,13 @@ pub enum NewAsset<ContentParameters> {
 /// or delete or transfer a channel and its contents.
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 #[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)]
-pub enum ChannelOwner<MemberId, CuratorGroupId, DAOId> {
+pub enum ChannelOwner<MemberId, CuratorGroupId, DaoId> {
     /// A Member owns the channel
     Member(MemberId),
     /// A specific curation group owns the channel
     CuratorGroup(CuratorGroupId),
-    // Native DAO owns the channel
-    Dao(DAOId),
+    // Native Dao owns the channel
+    Dao(DaoId),
 }
 
 // simplification type
@@ -146,15 +146,15 @@ pub(crate) type ActorToChannelOwnerResult<T> = Result<
     ChannelOwner<
         <T as MembershipTypes>::MemberId,
         <T as ContentActorAuthenticator>::CuratorGroupId,
-        <T as StorageOwnership>::DAOId,
+        <T as StorageOwnership>::DaoId,
     >,
     Error<T>,
 >;
 
 // Default trait implemented only because its used in a Channel which needs to implement a Default trait
 // since it is a StorageValue.
-impl<MemberId: Default, CuratorGroupId, DAOId> Default
-    for ChannelOwner<MemberId, CuratorGroupId, DAOId>
+impl<MemberId: Default, CuratorGroupId, DaoId> Default
+    for ChannelOwner<MemberId, CuratorGroupId, DaoId>
 {
     fn default() -> Self {
         ChannelOwner::Member(MemberId::default())
@@ -189,10 +189,10 @@ pub struct ChannelCategoryUpdateParameters {
 /// If a channel is deleted, all videos, playlists and series will also be deleted.
 #[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
 #[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
-pub struct ChannelRecord<MemberId, CuratorGroupId, DAOId, AccountId, VideoId, PlaylistId, SeriesId>
+pub struct ChannelRecord<MemberId, CuratorGroupId, DaoId, AccountId, VideoId, PlaylistId, SeriesId>
 {
     /// The owner of a channel
-    owner: ChannelOwner<MemberId, CuratorGroupId, DAOId>,
+    owner: ChannelOwner<MemberId, CuratorGroupId, DaoId>,
     /// The videos under this channel
     pub videos: Vec<VideoId>,
     /// The playlists under this channel
@@ -209,7 +209,7 @@ pub struct ChannelRecord<MemberId, CuratorGroupId, DAOId, AccountId, VideoId, Pl
 pub type Channel<T> = ChannelRecord<
     <T as MembershipTypes>::MemberId,
     <T as ContentActorAuthenticator>::CuratorGroupId,
-    <T as StorageOwnership>::DAOId,
+    <T as StorageOwnership>::DaoId,
     <T as frame_system::Trait>::AccountId,
     <T as Trait>::VideoId,
     <T as Trait>::PlaylistId,
@@ -223,12 +223,12 @@ pub struct ChannelOwnershipTransferRequestRecord<
     ChannelId,
     MemberId,
     CuratorGroupId,
-    DAOId,
+    DaoId,
     Balance,
     AccountId,
 > {
     channel_id: ChannelId,
-    new_owner: ChannelOwner<MemberId, CuratorGroupId, DAOId>,
+    new_owner: ChannelOwner<MemberId, CuratorGroupId, DaoId>,
     payment: Balance,
     new_reward_account: Option<AccountId>,
 }
@@ -238,7 +238,7 @@ pub type ChannelOwnershipTransferRequest<T> = ChannelOwnershipTransferRequestRec
     <T as StorageOwnership>::ChannelId,
     <T as MembershipTypes>::MemberId,
     <T as ContentActorAuthenticator>::CuratorGroupId,
-    <T as StorageOwnership>::DAOId,
+    <T as StorageOwnership>::DaoId,
     BalanceOf<T>,
     <T as frame_system::Trait>::AccountId,
 >;

+ 2 - 2
runtime-modules/content/src/permissions/mod.rs

@@ -132,7 +132,7 @@ pub fn ensure_actor_authorized_to_create_channel<T: Trait>(
 pub fn ensure_actor_authorized_to_update_channel<T: Trait>(
     origin: T::Origin,
     actor: &ContentActor<T::CuratorGroupId, T::CuratorId, T::MemberId>,
-    owner: &ChannelOwner<T::MemberId, T::CuratorGroupId, T::DAOId>,
+    owner: &ChannelOwner<T::MemberId, T::CuratorGroupId, T::DaoId>,
 ) -> DispatchResult {
     // Only owner of a channel can update and delete channel assets.
     // Lead can update and delete curator group owned channel assets.
@@ -199,7 +199,7 @@ pub fn ensure_actor_authorized_to_set_featured_videos<T: Trait>(
 pub fn ensure_actor_authorized_to_censor<T: Trait>(
     origin: T::Origin,
     actor: &ContentActor<T::CuratorGroupId, T::CuratorId, T::MemberId>,
-    owner: &ChannelOwner<T::MemberId, T::CuratorGroupId, T::DAOId>,
+    owner: &ChannelOwner<T::MemberId, T::CuratorGroupId, T::DaoId>,
 ) -> DispatchResult {
     // Only lead and curators can censor channels and videos
     // Only lead can censor curator group owned channels and videos

+ 1 - 1
runtime-modules/content/src/tests/mock.rs

@@ -116,7 +116,7 @@ impl common::MembershipTypes for Test {
 
 impl common::StorageOwnership for Test {
     type ChannelId = u64;
-    type DAOId = u64;
+    type DaoId = u64;
     type ContentId = u64;
     type DataObjectTypeId = u64;
 }

+ 3 - 3
runtime-modules/storage/src/data_directory.rs

@@ -135,7 +135,7 @@ impl Default for LiaisonJudgement {
 pub type DataObject<T> = DataObjectInternal<
     MemberId<T>,
     ChannelId<T>,
-    DAOId<T>,
+    DaoId<T>,
     <T as frame_system::Trait>::BlockNumber,
     <T as pallet_timestamp::Trait>::Moment,
     DataObjectTypeId<T>,
@@ -148,14 +148,14 @@ pub type DataObject<T> = DataObjectInternal<
 pub struct DataObjectInternal<
     MemberId,
     ChannelId,
-    DAOId,
+    DaoId,
     BlockNumber,
     Moment,
     DataObjectTypeId,
     StorageProviderId,
 > {
     /// Content owner.
-    pub owner: StorageObjectOwner<MemberId, ChannelId, DAOId>,
+    pub owner: StorageObjectOwner<MemberId, ChannelId, DaoId>,
 
     /// Content added at.
     pub added_at: BlockAndTime<BlockNumber, Moment>,

+ 3 - 3
runtime-modules/storage/src/lib.rs

@@ -25,13 +25,13 @@ pub(crate) type ContentId<T> = <T as common::StorageOwnership>::ContentId;
 pub(crate) type ChannelId<T> = <T as common::StorageOwnership>::ChannelId;
 
 // Alias for the dao id.
-pub(crate) type DAOId<T> = <T as common::StorageOwnership>::DAOId;
+pub(crate) type DaoId<T> = <T as common::StorageOwnership>::DaoId;
 
-/// DAO object type id.
+/// Dao object type id.
 pub(crate) type DataObjectTypeId<T> = <T as common::StorageOwnership>::DataObjectTypeId;
 
 /// Storage provider is a worker from the working group module.
 pub type StorageProviderId<T> = working_group::WorkerId<T>;
 
 /// Alias for StorageObjectOwner
-pub type ObjectOwner<T> = StorageObjectOwner<MemberId<T>, ChannelId<T>, DAOId<T>>;
+pub type ObjectOwner<T> = StorageObjectOwner<MemberId<T>, ChannelId<T>, DaoId<T>>;

+ 1 - 1
runtime/src/lib.rs

@@ -511,7 +511,7 @@ impl common::MembershipTypes for Runtime {
 
 impl common::StorageOwnership for Runtime {
     type ChannelId = ChannelId;
-    type DAOId = DAOId;
+    type DaoId = DaoId;
     type ContentId = ContentId;
     type DataObjectTypeId = DataObjectTypeId;
 }

+ 2 - 2
runtime/src/primitives.rs

@@ -14,8 +14,8 @@ pub type TransactionPriority = u64;
 /// Alias for ContentId, used in various places.
 pub type ContentId = sp_core::H256;
 
-/// Alias for DAOId, used in various places.
-pub type DAOId = u64;
+/// Alias for DaoId, used in various places.
+pub type DaoId = u64;
 
 /// Alias for DataObjectTypeId, used in various places.
 pub type DataObjectTypeId = u64;