Skip to content

Commit

Permalink
Merge pull request #114 from horuslabsio/ft_community
Browse files Browse the repository at this point in the history
 Community Features Implementation
  • Loading branch information
Darlington02 authored Oct 8, 2024
2 parents 195e539 + 8705016 commit 1af9ce6
Show file tree
Hide file tree
Showing 15 changed files with 1,514 additions and 8 deletions.
7 changes: 6 additions & 1 deletion src/base/constants/errors.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ pub mod Errors {
pub const INVALID_PROFILE_ADDRESS: felt252 = 'Karst: invalid profile address!';
pub const SELF_FOLLOWING: felt252 = 'Karst: self follow is forbidden';
pub const ALREADY_REACTED: felt252 = 'Karst: already react to post!';
pub const ALREADY_MEMBER: felt252 = 'Karst: already a Member';
pub const COMMUNITY_DOES_NOT_EXIST: felt252 = 'Karst: Community does not exist';
pub const NOT_COMMUNITY_OWNER: felt252 = 'Karst: Not Community owner';
pub const NOT_MEMBER: felt252 = 'Karst: Not a Community Member';
pub const NOT_TOKEN_OWNER: felt252 = 'Karst: Not a Token Owner';
pub const TOKEN_DOES_NOT_EXIST: felt252 = 'Karst: Token does not exist';
pub const SELF_TIPPING: felt252 = 'Karst: self-tip forbidden!';
pub const SELF_TRANSFER: felt252 = 'Karst: self-transfer forbidden!';
pub const SELF_REQUEST: felt252 = 'Karst: self-request forbidden!';
Expand All @@ -27,5 +33,4 @@ 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 TOKEN_DOES_NOT_EXIST: felt252 = 'Karst: token_id does not exist!';
}
66 changes: 60 additions & 6 deletions src/base/constants/types.cairo
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use starknet::ContractAddress;

// *************************************************************************
// PROFILE
// TYPES
// *************************************************************************
use starknet::ContractAddress;


// * @notice A struct containing profile data.
// * profile_address The profile ID of a karst profile
// * profile_owner The address that created the profile_address
Expand All @@ -19,9 +20,6 @@ pub struct Profile {
pub follow_nft: ContractAddress
}

// *************************************************************************
// PUBLICATION
// *************************************************************************
// /**
// * @notice A struct containing publication data.
// *
Expand Down Expand Up @@ -143,6 +141,62 @@ pub struct QuoteParams {
pub reference_pub_type: PublicationType
}


#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct CommunityDetails {
pub community_id: u256,
pub community_owner: ContractAddress,
pub community_metadata_uri: ByteArray,
pub community_nft_address: ContractAddress,
pub community_total_members: u256,
pub community_premium_status: bool,
pub community_type: CommunityType
}

// /**
// * @notice A struct containing the parameters required for the `join_community()` function.
// *
// * @param profile_address The address of the profile of the community member.
// * @param community_id The id of the community he join.
// * @param total_publications The toal publication of the member in the community.
// * @param community_token_id The community token ID of the member.
// */
#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct CommunityMember {
pub profile_address: ContractAddress,
pub community_id: u256,
pub total_publications: u256,
pub community_token_id: u256,
pub ban_status: bool,
}


#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct CommunityGateKeepDetails {
pub community_id: u256,
pub gate_keep_type: GateKeepType,
pub community_nft_address: ContractAddress,
pub entry_fee: u256
}

// permissioned_addresses: Vec<ContractAddress>,

#[derive(Debug, Drop, Serde, starknet::Store, Clone, PartialEq)]
pub enum GateKeepType {
None,
NFTGating,
PermissionedGating,
Paid,
}


#[derive(Debug, Drop, Serde, starknet::Store, Clone, PartialEq)]
pub enum CommunityType {
Free,
Standard,
Business
}

#[derive(Debug, Drop, Serde, starknet::Store, Clone)]
pub struct Upvote {
pub publication_id: u256,
Expand Down
1 change: 1 addition & 0 deletions src/base/token_uris.cairo
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
pub mod follow_token_uri;
pub mod handle_token_uri;
pub mod profile_token_uri;
pub mod community_token_uri;
pub mod traits;
5 changes: 5 additions & 0 deletions src/base/token_uris/community_token_uri.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pub mod CommunityTokenUri {
pub fn get_token_uri(token_id: u256, mint_timestamp: u64) -> ByteArray {
"TODO"
}
}
1 change: 1 addition & 0 deletions src/community.cairo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pub mod community;
Loading

0 comments on commit 1af9ce6

Please sign in to comment.