Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
target
.snfoundry_cache/
.tool-versions
30 changes: 30 additions & 0 deletions src/chainlib/ChainLib.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,33 @@ pub mod ChainLib {
use crate::interfaces::IChainLib::IChainLib;
use crate::base::types::{TokenBoundAccount, User, Role, Rank};

#[derive(Copy, Drop, Serde, starknet::Store, PartialEq, Debug)]
pub enum ContentType {
#[default]
Text,
Video,
Image,
// Any other content type
}

#[derive(Copy, Drop, Serde, starknet::Store, PartialEq, Debug)]
pub enum Category {
Software,
#[default]
Education,
Literature,
Art
}

#[derive(Copy, Drop, Serde, starknet::Store, Debug)]
pub struct ContentMetadata {
pub content_id: felt252,
pub title: felt252,
pub description: felt252,
pub content_type: ContentType,
pub creator: ContractAddress,
pub category: Category
}

#[storage]
struct Storage {
Expand All @@ -19,6 +46,9 @@ pub mod ChainLib {
next_course_id: u256,
user_id: u256,
users: Map<u256, User>,
creators_content: Map::<ContractAddress, ContentMetadata>,
content: Map::<felt252, ContentMetadata>,
content_tags: Map::<ContentMetadata, Array<felt252>>
}


Expand Down