diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..b77abd6 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2024 HORUS LABS + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. \ No newline at end of file diff --git a/readme.md b/readme.md index 406a041..9a2e4ed 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,18 @@ -# Karst + +

+ +

+ + +

+ + + +

+ +
+

Karst

+
Karst is a permissionless and composable social graph built on Starknet, empowering creators to own every part of their social experience. @@ -38,9 +52,8 @@ For more information on writing and running tests, refer to the [Starknet-Foundr ## Architecture -Check out the architecture below, and also reference [lens protocol](https://github.com/lens-protocol/core/tree/master) to understand more. +Check out the contract architecture below. -*Architecture Preview.* Screenshot 2024-05-24 at 00 11 16 diff --git a/src/base/types.cairo b/src/base/types.cairo index 5fdd777..f714171 100644 --- a/src/base/types.cairo +++ b/src/base/types.cairo @@ -16,17 +16,23 @@ pub struct FollowData { follow_timestamp: u64 } +// /** +// * @notice A struct containing the parameters supplied to the post method +// * +// * @param contentURI URI pointing to the post content +// * @param profile_address profile address that owns the post +// */ #[derive(Drop, Serde, starknet::Store)] pub struct PostParams { contentURI: ByteArray, profile_address: 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 -// * @param pub_count The number of publications made to this profile. -// * @param metadataURI MetadataURI is used to store the profile's metadata, for example: displayed name, description, interests, etc. +// * @notice A struct containing profile data. +// * profile_address The profile ID of a karst profile +// * profile_owner The address that created the profile_address +// * @param pub_count The number of publications made to this profile. +// * @param metadataURI MetadataURI is used to store the profile's metadata, for example: displayed name, description, interests, etc. #[derive(Drop, Serde, starknet::Store)] pub struct Profile { profile_address: ContractAddress, @@ -49,7 +55,6 @@ pub struct Profile { // * @param root_profile_address The profile ID of the root post (to determine if comments/quotes and mirrors come from it). // * @param root_pub_id The publication ID of the root post (to determine if comments/quotes and mirrors come from it). // */ - #[derive(Debug, Drop, Serde, starknet::Store)] pub struct Publication { pointed_profile_address: ContractAddress, @@ -78,20 +83,28 @@ enum PublicationType { Quote } - +// /** +// * @notice A struct containing the parameters supplied to the comment method +// * +// * @param profile_address profile address that owns the comment +// * @param contentURI URI pointing to the comment content +// * @param pointed_profile_address profile address of the referenced publication/comment +// * @param pointed_pub_id ID of the pointed publication +// */ #[derive(Drop, Serde, starknet::Store)] -struct ReferencePubParams { +struct CommentParams { profile_address: ContractAddress, - content_URI: ByteArray, + contentURI: ByteArray, pointed_profile_address: ContractAddress, - pointed_pub_id: u256 + pointed_pub_id: u256, } #[derive(Drop, Serde, starknet::Store)] -struct CommentParams { +struct ReferencePubParams { profile_address: ContractAddress, - contentURI: ByteArray, - pointedProfile_address: ContractAddress, - pointedPubId: u256, + content_URI: ByteArray, + pointed_profile_address: ContractAddress, + pointed_pub_id: u256 } + diff --git a/src/interfaces/IPublication.cairo b/src/interfaces/IPublication.cairo index 94e46fb..e775c29 100644 --- a/src/interfaces/IPublication.cairo +++ b/src/interfaces/IPublication.cairo @@ -6,6 +6,9 @@ use karst::base::types::{PostParams, ReferencePubParams, PublicationType, Public #[starknet::interface] pub trait IKarstPublications { + // ************************************************************************* + // EXTERNALS + // ************************************************************************* fn post( ref self: T, contentURI: ByteArray, @@ -20,6 +23,10 @@ pub trait IKarstPublications { pointed_pub_id: u256, profile_contract_address: ContractAddress, ) -> u256; + + // ************************************************************************* + // GETTERS + // ************************************************************************* fn get_publication(self: @T, user: ContractAddress, pubIdAssigned: u256) -> Publication; fn get_publication_type( self: @T, profile_address: ContractAddress, pub_id_assigned: u256 diff --git a/src/interfaces/IRegistry.cairo b/src/interfaces/IRegistry.cairo index 3f21d1e..6700c8f 100644 --- a/src/interfaces/IRegistry.cairo +++ b/src/interfaces/IRegistry.cairo @@ -5,6 +5,9 @@ use starknet::ContractAddress; // ************************************************************************* #[starknet::interface] pub trait IRegistry { + // ************************************************************************* + // EXTERNALS + // ************************************************************************* fn create_account( ref self: TContractState, implementation_hash: felt252, @@ -12,6 +15,10 @@ pub trait IRegistry { token_id: u256, salt: felt252 ) -> ContractAddress; + + // ************************************************************************* + // GETTERS + // ************************************************************************* fn get_account( self: @TContractState, implementation_hash: felt252, diff --git a/tests/test_publication.cairo b/tests/test_publication.cairo index df973ae..d4caf3f 100644 --- a/tests/test_publication.cairo +++ b/tests/test_publication.cairo @@ -122,7 +122,7 @@ fn __setup__() -> ( stop_prank( CheatTarget::Multiple(array![publication_contract_address, profile_contract_address]), ); - ////// + return ( nft_contract_address, registry_contract_address, @@ -171,7 +171,6 @@ fn test_post() { ); } - #[test] fn test_comment() { let (