Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/channel #123

Merged
merged 7 commits into from
Oct 14, 2024
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
7 changes: 6 additions & 1 deletion src/base/constants/errors.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,10 @@ pub mod Errors {
pub const AUTO_RENEW_DURATION_ENDED: felt252 = 'Karst: auto renew ended!';
pub const INVALID_JOLT: felt252 = 'Karst: invalid jolt!';
pub const INVALID_JOLT_RECIPIENT: felt252 = 'Karst: not request recipient!';
pub const INVALID_LENGTH: felt252 = 'Karst: Invalid Length';
pub const NOT_CHANNEL_OWNER: felt252 = 'Karst: not channel owner';
pub const NOT_CHANNEL_MODERATOR: felt252 = 'Karst: not channel moderator';
pub const NOT_CHANNEL_MEMBER: felt252 = 'Karst: not channel member';
pub const BANNED_FROM_CHANNEL: felt252 = 'Karst: banned from channel';
pub const CHANNEL_HAS_NO_MEMBER: felt252 = 'Karst: channel has no members';
pub const INVALID_LENGTH: felt252 = 'Karst: array mismatch';
}
83 changes: 54 additions & 29 deletions src/base/constants/types.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,27 @@ pub struct Profile {
pub follow_nft: ContractAddress
}

// *************************************************************************
// FOLLOW
// *************************************************************************

// /**
// * @notice A struct containing token follow-related data.
// *
// * @param followed_profile_address The ID of the profile being followed.
// * @param follower_profile_address The ID of the profile following.
// * @param followTimestamp The timestamp of the current follow, if a profile is using the token to
// follow.
// * @param block_status true if follower is blocked, false otherwise
// */
#[derive(Drop, Serde, starknet::Store)]
pub struct FollowData {
pub followed_profile_address: ContractAddress,
pub follower_profile_address: ContractAddress,
pub follow_timestamp: u64,
pub block_status: bool,
}

// *************************************************************************
// PUBLICATION
// *************************************************************************
Expand Down Expand Up @@ -144,6 +165,20 @@ pub struct QuoteParams {
pub reference_pub_type: PublicationType
}

#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct Upvote {
pub publication_id: u256,
pub transaction_executor: ContractAddress,
pub block_timestamp: u64,
}

#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct Downvote {
pub publication_id: u256,
pub transaction_executor: ContractAddress,
pub block_timestamp: u64,
}

// *************************************************************************
// COMMUNITY
// *************************************************************************
Expand Down Expand Up @@ -201,39 +236,29 @@ pub enum CommunityType {
Business
}

#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct Upvote {
pub publication_id: u256,
pub transaction_executor: ContractAddress,
pub block_timestamp: u64,
}
// *************************************************************************
// CHANNEL
// *************************************************************************

#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct Downvote {
pub publication_id: u256,
pub transaction_executor: ContractAddress,
pub block_timestamp: u64,
#[derive(Drop, Serde, Clone, starknet::Store)]
pub struct ChannelDetails {
pub channel_id: u256,
pub community_id: u256,
pub channel_owner: ContractAddress,
pub channel_metadata_uri: ByteArray,
pub channel_nft_address: ContractAddress,
pub channel_total_members: u256,
pub channel_censorship: bool,
}

// *************************************************************************
// FOLLOW
// *************************************************************************

// /**
// * @notice A struct containing token follow-related data.
// *
// * @param followed_profile_address The ID of the profile being followed.
// * @param follower_profile_address The ID of the profile following.
// * @param followTimestamp The timestamp of the current follow, if a profile is using the token to
// follow.
// * @param block_status true if follower is blocked, false otherwise
// */
#[derive(Drop, Serde, starknet::Store)]
pub struct FollowData {
pub followed_profile_address: ContractAddress,
pub follower_profile_address: ContractAddress,
pub follow_timestamp: u64,
pub block_status: bool,
#[derive(Drop, Serde, Clone, starknet::Store)]
pub struct ChannelMember {
pub profile: ContractAddress,
pub channel_id: u256,
pub total_publications: u256,
pub channel_token_id: u256,
pub ban_status: bool,
}

// *************************************************************************
Expand Down
1 change: 1 addition & 0 deletions src/base/token_uris.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ pub mod follow_token_uri;
pub mod handle_token_uri;
pub mod profile_token_uri;
pub mod community_token_uri;
pub mod channel_token_uri;
pub mod traits;
5 changes: 5 additions & 0 deletions src/base/token_uris/channel_token_uri.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub mod ChannelTokenUri {
pub fn get_token_uri(token_id: u256, mint_timestamp: u64) -> ByteArray {
"TODO"
}
}
2 changes: 2 additions & 0 deletions src/channel.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub mod channel;
pub mod channelNFT;
Loading
Loading