|
@@ -7,9 +7,13 @@ mod tests;
|
|
|
|
|
|
mod errors;
|
|
|
mod permissions;
|
|
|
+mod types;
|
|
|
+mod vnft_auction;
|
|
|
|
|
|
pub use errors::*;
|
|
|
pub use permissions::*;
|
|
|
+pub use types::*;
|
|
|
+pub use vnft_auction::*;
|
|
|
|
|
|
use core::hash::Hash;
|
|
|
|
|
@@ -24,6 +28,7 @@ use frame_system::ensure_signed;
|
|
|
pub use serde::{Deserialize, Serialize};
|
|
|
use sp_arithmetic::traits::{BaseArithmetic, One, Zero};
|
|
|
use sp_runtime::traits::{MaybeSerializeDeserialize, Member};
|
|
|
+pub use sp_runtime::Perbill;
|
|
|
use sp_std::collections::btree_set::BTreeSet;
|
|
|
use sp_std::vec;
|
|
|
use sp_std::vec::Vec;
|
|
@@ -39,21 +44,6 @@ pub use common::{
|
|
|
MembershipTypes, StorageOwnership, Url,
|
|
|
};
|
|
|
|
|
|
-pub(crate) type ContentId<T> = <T as StorageOwnership>::ContentId;
|
|
|
-
|
|
|
-pub(crate) type DataObjectTypeId<T> = <T as StorageOwnership>::DataObjectTypeId;
|
|
|
-
|
|
|
-pub(crate) type ContentParameters<T> = ContentParametersRecord<ContentId<T>, DataObjectTypeId<T>>;
|
|
|
-
|
|
|
-pub(crate) type StorageObjectOwner<T> = StorageObjectOwnerRecord<
|
|
|
- <T as MembershipTypes>::MemberId,
|
|
|
- <T as StorageOwnership>::ChannelId,
|
|
|
- <T as StorageOwnership>::DAOId,
|
|
|
->;
|
|
|
-
|
|
|
-/// Type, used in diffrent numeric constraints representations
|
|
|
-pub type MaxNumber = u32;
|
|
|
-
|
|
|
/// A numeric identifier trait
|
|
|
pub trait NumericIdentifier:
|
|
|
Parameter
|
|
@@ -77,6 +67,7 @@ impl NumericIdentifier for u64 {}
|
|
|
/// Module configuration trait for Content Directory Module
|
|
|
pub trait Trait:
|
|
|
frame_system::Trait
|
|
|
+ + pallet_timestamp::Trait
|
|
|
+ ContentActorAuthenticator
|
|
|
+ Clone
|
|
|
+ StorageOwnership
|
|
@@ -117,352 +108,13 @@ pub trait Trait:
|
|
|
type StorageSystem: StorageSystem<Self>;
|
|
|
}
|
|
|
|
|
|
-/// Specifies how a new asset will be provided on creating and updating
|
|
|
-/// Channels, Videos, Series and Person
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub enum NewAsset<ContentParameters> {
|
|
|
- /// Upload to the storage frame_system
|
|
|
- Upload(ContentParameters),
|
|
|
- /// Multiple url strings pointing at an asset
|
|
|
- Urls(Vec<Url>),
|
|
|
-}
|
|
|
-
|
|
|
-/// The owner of a channel, is the authorized "actor" that can update
|
|
|
-/// 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> {
|
|
|
- /// A Member owns the channel
|
|
|
- Member(MemberId),
|
|
|
- /// A specific curation group owns the channel
|
|
|
- CuratorGroup(CuratorGroupId),
|
|
|
- // Native DAO owns the channel
|
|
|
- Dao(DAOId),
|
|
|
-}
|
|
|
-
|
|
|
-// simplification type
|
|
|
-pub(crate) type ActorToChannelOwnerResult<T> = Result<
|
|
|
- ChannelOwner<
|
|
|
- <T as MembershipTypes>::MemberId,
|
|
|
- <T as ContentActorAuthenticator>::CuratorGroupId,
|
|
|
- <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>
|
|
|
-{
|
|
|
- fn default() -> Self {
|
|
|
- ChannelOwner::Member(MemberId::default())
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/// A category which channels can belong to.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct ChannelCategory {
|
|
|
- // No runtime information is currently stored for a Category.
|
|
|
-}
|
|
|
-
|
|
|
-/// Information on the category being created.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct ChannelCategoryCreationParameters {
|
|
|
- /// Metadata for the category.
|
|
|
- meta: Vec<u8>,
|
|
|
-}
|
|
|
-
|
|
|
-/// Information on the category being updated.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct ChannelCategoryUpdateParameters {
|
|
|
- // as this is the only field it is not an Option
|
|
|
- /// Metadata update for the category.
|
|
|
- new_meta: Vec<u8>,
|
|
|
-}
|
|
|
-
|
|
|
-/// Type representing an owned channel which videos, playlists, and series can belong to.
|
|
|
-/// 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>
|
|
|
-{
|
|
|
- /// The owner of a channel
|
|
|
- owner: ChannelOwner<MemberId, CuratorGroupId, DAOId>,
|
|
|
- /// The videos under this channel
|
|
|
- pub videos: Vec<VideoId>,
|
|
|
- /// The playlists under this channel
|
|
|
- playlists: Vec<PlaylistId>,
|
|
|
- /// The series under this channel
|
|
|
- series: Vec<SeriesId>,
|
|
|
- /// If curators have censored this channel or not
|
|
|
- is_censored: bool,
|
|
|
- /// Reward account where revenue is sent if set.
|
|
|
- reward_account: Option<AccountId>,
|
|
|
-}
|
|
|
-
|
|
|
-// Channel alias type for simplification.
|
|
|
-pub type Channel<T> = ChannelRecord<
|
|
|
- <T as MembershipTypes>::MemberId,
|
|
|
- <T as ContentActorAuthenticator>::CuratorGroupId,
|
|
|
- <T as StorageOwnership>::DAOId,
|
|
|
- <T as frame_system::Trait>::AccountId,
|
|
|
- <T as Trait>::VideoId,
|
|
|
- <T as Trait>::PlaylistId,
|
|
|
- <T as Trait>::SeriesId,
|
|
|
->;
|
|
|
-
|
|
|
-/// A request to buy a channel by a new ChannelOwner.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct ChannelOwnershipTransferRequestRecord<
|
|
|
- ChannelId,
|
|
|
- MemberId,
|
|
|
- CuratorGroupId,
|
|
|
- DAOId,
|
|
|
- Balance,
|
|
|
- AccountId,
|
|
|
-> {
|
|
|
- channel_id: ChannelId,
|
|
|
- new_owner: ChannelOwner<MemberId, CuratorGroupId, DAOId>,
|
|
|
- payment: Balance,
|
|
|
- new_reward_account: Option<AccountId>,
|
|
|
-}
|
|
|
-
|
|
|
-// ChannelOwnershipTransferRequest type alias for simplification.
|
|
|
-pub type ChannelOwnershipTransferRequest<T> = ChannelOwnershipTransferRequestRecord<
|
|
|
- <T as StorageOwnership>::ChannelId,
|
|
|
- <T as MembershipTypes>::MemberId,
|
|
|
- <T as ContentActorAuthenticator>::CuratorGroupId,
|
|
|
- <T as StorageOwnership>::DAOId,
|
|
|
- BalanceOf<T>,
|
|
|
- <T as frame_system::Trait>::AccountId,
|
|
|
->;
|
|
|
-
|
|
|
-/// Information about channel being created.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct ChannelCreationParameters<ContentParameters, AccountId> {
|
|
|
- /// Assets referenced by metadata
|
|
|
- assets: Vec<NewAsset<ContentParameters>>,
|
|
|
- /// Metadata about the channel.
|
|
|
- meta: Vec<u8>,
|
|
|
- /// optional reward account
|
|
|
- reward_account: Option<AccountId>,
|
|
|
-}
|
|
|
-
|
|
|
-/// Information about channel being updated.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct ChannelUpdateParameters<ContentParameters, AccountId> {
|
|
|
- /// Assets referenced by metadata
|
|
|
- assets: Option<Vec<NewAsset<ContentParameters>>>,
|
|
|
- /// If set, metadata update for the channel.
|
|
|
- new_meta: Option<Vec<u8>>,
|
|
|
- /// If set, updates the reward account of the channel
|
|
|
- reward_account: Option<Option<AccountId>>,
|
|
|
-}
|
|
|
-
|
|
|
-/// A category that videos can belong to.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct VideoCategory {
|
|
|
- // No runtime information is currently stored for a Category.
|
|
|
-}
|
|
|
-
|
|
|
-/// Information about the video category being created.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct VideoCategoryCreationParameters {
|
|
|
- /// Metadata about the video category.
|
|
|
- meta: Vec<u8>,
|
|
|
-}
|
|
|
-
|
|
|
-/// Information about the video category being updated.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct VideoCategoryUpdateParameters {
|
|
|
- // Because it is the only field it is not an Option
|
|
|
- /// Metadata update for the video category.
|
|
|
- new_meta: Vec<u8>,
|
|
|
-}
|
|
|
-
|
|
|
-/// Information about the video being created.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct VideoCreationParameters<ContentParameters> {
|
|
|
- /// Assets referenced by metadata
|
|
|
- assets: Vec<NewAsset<ContentParameters>>,
|
|
|
- /// Metadata for the video.
|
|
|
- meta: Vec<u8>,
|
|
|
-}
|
|
|
-
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct VideoUpdateParameters<ContentParameters> {
|
|
|
- /// Assets referenced by metadata
|
|
|
- assets: Option<Vec<NewAsset<ContentParameters>>>,
|
|
|
- /// If set, metadata update for the video.
|
|
|
- new_meta: Option<Vec<u8>>,
|
|
|
-}
|
|
|
-
|
|
|
-/// A video which belongs to a channel. A video may be part of a series or playlist.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct Video<ChannelId, SeriesId> {
|
|
|
- pub in_channel: ChannelId,
|
|
|
- // keep track of which season the video is in if it is an 'episode'
|
|
|
- // - prevent removing a video if it is in a season (because order is important)
|
|
|
- pub in_series: Option<SeriesId>,
|
|
|
- /// Whether the curators have censored the video or not.
|
|
|
- pub is_censored: bool,
|
|
|
-}
|
|
|
-
|
|
|
-/// Information about the plyalist being created.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct PlaylistCreationParameters {
|
|
|
- /// Metadata about the playlist.
|
|
|
- meta: Vec<u8>,
|
|
|
-}
|
|
|
-
|
|
|
-/// Information about the playlist being updated.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct PlaylistUpdateParameters {
|
|
|
- // It is the only field so its not an Option
|
|
|
- /// Metadata update for the playlist.
|
|
|
- new_meta: Vec<u8>,
|
|
|
-}
|
|
|
-
|
|
|
-/// A playlist is an ordered collection of videos.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct Playlist<ChannelId> {
|
|
|
- /// The channel the playlist belongs to.
|
|
|
- in_channel: ChannelId,
|
|
|
-}
|
|
|
-
|
|
|
-/// Information about the episode being created or updated.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub enum EpisodeParameters<VideoId, ContentParameters> {
|
|
|
- /// A new video is being added as the episode.
|
|
|
- NewVideo(VideoCreationParameters<ContentParameters>),
|
|
|
- /// An existing video is being made into an episode.
|
|
|
- ExistingVideo(VideoId),
|
|
|
-}
|
|
|
-
|
|
|
-/// Information about the season being created or updated.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct SeasonParameters<VideoId, ContentParameters> {
|
|
|
- /// Season assets referenced by metadata
|
|
|
- assets: Option<Vec<NewAsset<ContentParameters>>>,
|
|
|
- // ?? It might just be more straighforward to always provide full list of episodes at cost of larger tx.
|
|
|
- /// If set, updates the episodes of a season. Extends the number of episodes in a season
|
|
|
- /// when length of new_episodes is greater than previously set. Last elements must all be
|
|
|
- /// 'Some' in that case.
|
|
|
- /// Will truncate existing season when length of new_episodes is less than previously set.
|
|
|
- episodes: Option<Vec<Option<EpisodeParameters<VideoId, ContentParameters>>>>,
|
|
|
- /// If set, Metadata update for season.
|
|
|
- meta: Option<Vec<u8>>,
|
|
|
-}
|
|
|
-
|
|
|
-/// Information about the series being created or updated.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct SeriesParameters<VideoId, ContentParameters> {
|
|
|
- /// Series assets referenced by metadata
|
|
|
- assets: Option<Vec<NewAsset<ContentParameters>>>,
|
|
|
- // ?? It might just be more straighforward to always provide full list of seasons at cost of larger tx.
|
|
|
- /// If set, updates the seasons of a series. Extend a series when length of seasons is
|
|
|
- /// greater than previoulsy set. Last elements must all be 'Some' in that case.
|
|
|
- /// Will truncate existing series when length of seasons is less than previously set.
|
|
|
- seasons: Option<Vec<Option<SeasonParameters<VideoId, ContentParameters>>>>,
|
|
|
- meta: Option<Vec<u8>>,
|
|
|
-}
|
|
|
-
|
|
|
-/// A season is an ordered list of videos (episodes).
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct Season<VideoId> {
|
|
|
- episodes: Vec<VideoId>,
|
|
|
-}
|
|
|
-
|
|
|
-/// A series is an ordered list of seasons that belongs to a channel.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct Series<ChannelId, VideoId> {
|
|
|
- in_channel: ChannelId,
|
|
|
- seasons: Vec<Season<VideoId>>,
|
|
|
-}
|
|
|
-
|
|
|
-// The actor the caller/origin is trying to act as for Person creation and update and delete calls.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub enum PersonActor<MemberId, CuratorId> {
|
|
|
- Member(MemberId),
|
|
|
- Curator(CuratorId),
|
|
|
-}
|
|
|
-
|
|
|
-/// The authorized actor that may update or delete a Person.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub enum PersonController<MemberId> {
|
|
|
- /// Member controls the person
|
|
|
- Member(MemberId),
|
|
|
- /// Any curator controls the person
|
|
|
- Curators,
|
|
|
-}
|
|
|
-
|
|
|
-// Default trait implemented only because its used in Person which needs to implement a Default trait
|
|
|
-// since it is a StorageValue.
|
|
|
-impl<MemberId: Default> Default for PersonController<MemberId> {
|
|
|
- fn default() -> Self {
|
|
|
- PersonController::Member(MemberId::default())
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-/// Information for Person being created.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct PersonCreationParameters<ContentParameters> {
|
|
|
- /// Assets referenced by metadata
|
|
|
- assets: Vec<NewAsset<ContentParameters>>,
|
|
|
- /// Metadata for person.
|
|
|
- meta: Vec<u8>,
|
|
|
-}
|
|
|
-
|
|
|
-/// Information for Persion being updated.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct PersonUpdateParameters<ContentParameters> {
|
|
|
- /// Assets referenced by metadata
|
|
|
- assets: Option<Vec<NewAsset<ContentParameters>>>,
|
|
|
- /// Metadata to update person.
|
|
|
- new_meta: Option<Vec<u8>>,
|
|
|
-}
|
|
|
-
|
|
|
-/// A Person represents a real person that may be associated with a video.
|
|
|
-#[cfg_attr(feature = "std", derive(Serialize, Deserialize))]
|
|
|
-#[derive(Encode, Decode, Default, Clone, PartialEq, Eq, Debug)]
|
|
|
-pub struct Person<MemberId> {
|
|
|
- /// Who can update or delete this person.
|
|
|
- controlled_by: PersonController<MemberId>,
|
|
|
-}
|
|
|
-
|
|
|
decl_storage! {
|
|
|
trait Store for Module<T: Trait> as Content {
|
|
|
pub ChannelById get(fn channel_by_id): map hasher(blake2_128_concat) T::ChannelId => Channel<T>;
|
|
|
|
|
|
pub ChannelCategoryById get(fn channel_category_by_id): map hasher(blake2_128_concat) T::ChannelCategoryId => ChannelCategory;
|
|
|
|
|
|
- pub VideoById get(fn video_by_id): map hasher(blake2_128_concat) T::VideoId => Video<T::ChannelId, T::SeriesId>;
|
|
|
+ pub VideoById get(fn video_by_id): map hasher(blake2_128_concat) T::VideoId => Video<T>;
|
|
|
|
|
|
pub VideoCategoryById get(fn video_category_by_id): map hasher(blake2_128_concat) T::VideoCategoryId => VideoCategory;
|
|
|
|
|
@@ -495,6 +147,30 @@ decl_storage! {
|
|
|
|
|
|
/// Map, representing CuratorGroupId -> CuratorGroup relation
|
|
|
pub CuratorGroupById get(fn curator_group_by_id): map hasher(blake2_128_concat) T::CuratorGroupId => CuratorGroup<T>;
|
|
|
+
|
|
|
+ /// Min auction round time
|
|
|
+ pub MinRoundTime get(fn min_round_time) config(): T::Moment;
|
|
|
+
|
|
|
+ /// Max auction round time
|
|
|
+ pub MaxRoundTime get(fn max_round_time) config(): T::Moment;
|
|
|
+
|
|
|
+ /// Min auction staring price
|
|
|
+ pub MinStartingPrice get(fn min_starting_price) config(): BalanceOf<T>;
|
|
|
+
|
|
|
+ /// Max auction staring price
|
|
|
+ pub MaxStartingPrice get(fn max_starting_price) config(): BalanceOf<T>;
|
|
|
+
|
|
|
+ /// Min creator royalty
|
|
|
+ pub MinCreatorRoyalty get(fn min_creator_royalty) config(): Perbill;
|
|
|
+
|
|
|
+ /// Max creator royalty
|
|
|
+ pub MaxCreatorRoyalty get(fn max_creator_royalty) config(): Perbill;
|
|
|
+
|
|
|
+ /// Min auction bid step
|
|
|
+ pub MinBidStep get(fn min_bid_step) config(): BalanceOf<T>;
|
|
|
+
|
|
|
+ /// Max auction bid step
|
|
|
+ pub MaxBidStep get(fn max_bid_step) config(): BalanceOf<T>;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -928,13 +604,15 @@ decl_module! {
|
|
|
// == MUTATION SAFE ==
|
|
|
//
|
|
|
|
|
|
- let video: Video<T::ChannelId, T::SeriesId> = Video {
|
|
|
+ let video: Video<T> = VideoRecord {
|
|
|
in_channel: channel_id,
|
|
|
// keep track of which season the video is in if it is an 'episode'
|
|
|
// - prevent removing a video if it is in a season (because order is important)
|
|
|
in_series: None,
|
|
|
/// Whether the curators have censored the video or not.
|
|
|
is_censored: false,
|
|
|
+ /// Newly created video has no nft
|
|
|
+ nft_status: NFTStatus::NoneIssued,
|
|
|
};
|
|
|
|
|
|
VideoById::<T>::insert(video_id, video);
|
|
@@ -1290,9 +968,7 @@ impl<T: Trait> Module<T> {
|
|
|
Ok(ChannelById::<T>::get(channel_id))
|
|
|
}
|
|
|
|
|
|
- fn ensure_video_exists(
|
|
|
- video_id: &T::VideoId,
|
|
|
- ) -> Result<Video<T::ChannelId, T::SeriesId>, Error<T>> {
|
|
|
+ fn ensure_video_exists(video_id: &T::VideoId) -> Result<Video<T>, Error<T>> {
|
|
|
ensure!(
|
|
|
VideoById::<T>::contains_key(video_id),
|
|
|
Error::<T>::VideoDoesNotExist
|
|
@@ -1301,7 +977,7 @@ impl<T: Trait> Module<T> {
|
|
|
}
|
|
|
|
|
|
// Ensure given video is not in season
|
|
|
- fn ensure_video_can_be_removed(video: Video<T::ChannelId, T::SeriesId>) -> DispatchResult {
|
|
|
+ fn ensure_video_can_be_removed(video: Video<T>) -> DispatchResult {
|
|
|
ensure!(video.in_series.is_none(), Error::<T>::VideoInSeason);
|
|
|
Ok(())
|
|
|
}
|