ソースを参照

content-directory: simple reward account for channels

Mokhtar Naamani 4 年 前
コミット
6cc09fd3b8
3 ファイル変更6 行追加10 行削除
  1. 4 7
      runtime-modules/content/src/lib.rs
  2. 0 2
      runtime/src/lib.rs
  3. 2 1
      types/src/content/index.ts

+ 4 - 7
runtime-modules/content/src/lib.rs

@@ -76,9 +76,6 @@ pub trait Trait:
     /// Channel Transfer Payments Escrow Account seed for ModuleId to compute deterministic AccountId
     type ChannelOwnershipPaymentEscrowId: Get<[u8; 8]>;
 
-    /// ChannelRevenueTreasury seed for ModuleId to compute deterministic AccountId
-    type ChannelRevenueTreasuryId: Get<[u8; 8]>;
-
     /// Type of identifier for Videos
     type VideoId: NumericIdentifier;
 
@@ -174,7 +171,7 @@ pub struct ChannelRecord<
     CuratorGroupId,
     ChannelCategoryId,
     DAOId,
-    Balance,
+    AccountId,
     VideoId,
     PlaylistId,
     SeriesId,
@@ -191,8 +188,8 @@ pub struct ChannelRecord<
     series: Vec<SeriesId>,
     /// If curators have censored this channel or not
     is_censored: bool,
-    /// Earned revenue yet to be withdrawn by channel owner
-    revenue: Balance,
+    /// Reward account where revenue is sent if set.
+    reward_account: Option<AccountId>,
 }
 
 // Channel alias type for simplification.
@@ -201,7 +198,7 @@ pub type Channel<T> = ChannelRecord<
     <T as ContentActorAuthenticator>::CuratorGroupId,
     <T as Trait>::ChannelCategoryId,
     <T as StorageOwnership>::DAOId,
-    BalanceOf<T>,
+    <T as system::Trait>::AccountId,
     <T as Trait>::VideoId,
     <T as Trait>::PlaylistId,
     <T as Trait>::SeriesId,

+ 0 - 2
runtime/src/lib.rs

@@ -370,13 +370,11 @@ impl pallet_finality_tracker::Trait for Runtime {
 parameter_types! {
     pub const MaxNumberOfCuratorsPerGroup: MaxNumber = 50;
     pub const ChannelOwnershipPaymentEscrowId: [u8; 8] = *b"chescrow";
-    pub const ChannelRevenueTreasuryId: [u8; 8] = *b"chtresry";
 }
 
 impl content::Trait for Runtime {
     type Event = Event;
     type ChannelOwnershipPaymentEscrowId = ChannelOwnershipPaymentEscrowId;
-    type ChannelRevenueTreasuryId = ChannelRevenueTreasuryId;
     type ChannelCategoryId = ChannelCategoryId;
     type VideoId = VideoId;
     type VideoCategoryId = VideoCategoryId;

+ 2 - 1
types/src/content/index.ts

@@ -3,6 +3,7 @@ import { bool, u64, u32, u128, Null, Bytes } from '@polkadot/types/primitive'
 import { MemberId } from '../members'
 import { JoyStructDecorated, JoyEnum, ChannelId, JoyBTreeSet, DAOId, Url } from '../common'
 import { ContentParameters } from '../storage'
+import AccountId from '@polkadot/types/generic/AccountId'
 
 export class CuratorId extends u64 {}
 export class CuratorGroupId extends u64 {}
@@ -40,7 +41,7 @@ export class Channel extends JoyStructDecorated({
   playlists: Vec.with(PlaylistId),
   series: Vec.with(SeriesId),
   is_censored: bool,
-  revenue: u128,
+  reward_account: Option.with(AccountId),
 }) {}
 
 export class ChannelCreationParameters extends JoyStructDecorated({