diff --git a/src/base/types.cairo b/src/base/types.cairo index f714171..d142524 100644 --- a/src/base/types.cairo +++ b/src/base/types.cairo @@ -101,10 +101,41 @@ struct CommentParams { #[derive(Drop, Serde, starknet::Store)] -struct ReferencePubParams { +pub struct ReferencePubParams { profile_address: ContractAddress, content_URI: ByteArray, pointed_profile_address: ContractAddress, pointed_pub_id: u256 } +// /** +// * @notice A struct containing the parameters required for the `mirror()` function. +// * +// * @param profile_address The address of the profile to publish to. +// * @param metadata_URI the URI containing metadata attributes to attach to this mirror publication. +// * @param pointed_profile_id The profile address to point the mirror to. +// * @param pointed_pub_id The publication ID to point the mirror to. +// */ +#[derive(Drop, Serde, starknet::Store)] +pub struct MirrorParams { + profile_address: ContractAddress, + metadata_URI: ByteArray, + pointed_profile_address: ContractAddress, + pointed_pub_id: u256 +} + +// /** +// * @notice A struct containing the parameters required for the `quote()` function. +// * +// * @param profile_address The address of the profile to publish to. +// * @param content_URI The URI to set for this new publication. +// * @param pointed_profile_address The profile address of the publication author that is quoted. +// * @param pointed_pub_id The publication ID that is quoted. +// */ +#[derive(Drop, Serde, starknet::Store)] +pub struct QuoteParams { + profile_address: ContractAddress, + content_URI: ByteArray, + pointed_profile_address: ContractAddress, + pointed_pub_id: u256 +} diff --git a/src/profile/profile.cairo b/src/profile/profile.cairo index 0faad7f..4d2e149 100644 --- a/src/profile/profile.cairo +++ b/src/profile/profile.cairo @@ -104,7 +104,7 @@ mod KarstProfile { /// @notice increments user's publication count /// @params profile_address the targeted profile address - /// how do we get the function? it acts an pub_count increase for all publication type. + /// how do we gate the function? it acts an pub_count increase for all publication type. fn increment_publication_count( ref self: ContractState, profile_address: ContractAddress ) -> u256 { diff --git a/src/publication/publication.cairo b/src/publication/publication.cairo index a0aac6e..e9d766e 100644 --- a/src/publication/publication.cairo +++ b/src/publication/publication.cairo @@ -1,8 +1,9 @@ -//! Contract for Karst Publications - +//! Contract for Karst Publications V1 +// [Len Publication Contract](https://github.com/lens-protocol/core/blob/master/contracts/libraries/PublicationLib.sol) use starknet::{ContractAddress, get_caller_address}; use karst::base::types::{ - PostParams, PublicationType, CommentParams, ReferencePubParams, Publication + PostParams, PublicationType, CommentParams, ReferencePubParams, Publication, MirrorParams, + QuoteParams }; use karst::interfaces::IProfile::{IKarstProfileDispatcher, IKarstProfileDispatcherTrait}; use core::option::OptionTrait; @@ -22,10 +23,6 @@ pub trait IKarstPublications { profile_address: ContractAddress, profile_contract_address: ContractAddress ) -> u256; - fn get_publication(self: @T, user: ContractAddress, pubIdAssigned: u256) -> Publication; - fn get_publication_type( - self: @T, profile_address: ContractAddress, pub_id_assigned: u256 - ) -> PublicationType; fn comment( ref self: T, profile_address: ContractAddress, @@ -34,12 +31,16 @@ pub trait IKarstPublications { pointed_pub_id: u256, profile_contract_address: ContractAddress, ) -> u256; + fn mirror(ref self: T, mirrorParams: MirrorParams) -> u256; + fn quote(ref self: T, quoteParams: QuoteParams) -> 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 + ) -> PublicationType; fn get_publication_content_uri( self: @T, profile_address: ContractAddress, pub_id: u256 ) -> ByteArray; -// ************************************************************************* -// PROFILE INTERACTION FUNCTIONS -// ************************************************************************* } #[starknet::contract] @@ -49,7 +50,8 @@ pub mod Publications { // ************************************************************************* use starknet::{ContractAddress, get_contract_address, get_caller_address}; use karst::base::types::{ - PostParams, Publication, PublicationType, ReferencePubParams, CommentParams + PostParams, Publication, PublicationType, ReferencePubParams, CommentParams, QuoteParams, + MirrorParams }; use super::IKarstPublications; use karst::interfaces::IProfile::{IKarstProfileDispatcher, IKarstProfileDispatcherTrait}; @@ -149,6 +151,26 @@ pub mod Publications { ); pubIdAssigned } + + // /** + // * @notice Publishes a mirror to a given profile. + // * + // * @param mirrorParams the MirrorParams struct reference types.cairo to know MirrorParams. + // * + // * @return uint256 The created publication's pubId. + // */ + fn mirror(ref self: ContractState, mirrorParams: MirrorParams) -> u256 { + // logic here + 0 + } + + fn quote(ref self: ContractState, quoteParams: QuoteParams) -> u256 { + // logic here + 0 + } + ////////////////////////////////////////////////////////////// + /// GETTERS////////////////////////////////////////////////// + /// ///////////////////////////////////////////////////////// fn get_publication_content_uri( self: @ContractState, profile_address: ContractAddress, pub_id: u256 ) -> ByteArray {