From c364b22dadc38fef64a2bb2b27c311393670407a Mon Sep 17 00:00:00 2001 From: mubarak23 Date: Thu, 3 Oct 2024 13:56:41 +0100 Subject: [PATCH] community token uri --- src/base/token_uris/community_token_uri.cairo | 5 +++++ src/communitynft/community_nft.cairo | 12 ++++-------- 2 files changed, 9 insertions(+), 8 deletions(-) create mode 100644 src/base/token_uris/community_token_uri.cairo diff --git a/src/base/token_uris/community_token_uri.cairo b/src/base/token_uris/community_token_uri.cairo new file mode 100644 index 0000000..3aa283b --- /dev/null +++ b/src/base/token_uris/community_token_uri.cairo @@ -0,0 +1,5 @@ +pub mod CommunityTokenUri { + pub fn get_token_uri(token_id: u256, mint_timestamp: u64) -> ByteArray { + "TODO" + } +} diff --git a/src/communitynft/community_nft.cairo b/src/communitynft/community_nft.cairo index 02762d7..77cb007 100644 --- a/src/communitynft/community_nft.cairo +++ b/src/communitynft/community_nft.cairo @@ -8,7 +8,8 @@ pub mod CommunityNft { use karst::interfaces::IHub::{IHubDispatcher, IHubDispatcherTrait}; use karst::base::{ constants::errors::Errors::{ALREADY_MINTED, NOT_TOKEN_OWNER, TOKEN_DOES_NOT_EXIST}, - utils::base64_extended::convert_into_byteArray + utils::base64_extended::convert_into_byteArray, + token_uris::community_token_uri::CommunityTokenUri::get_token_uri, }; use starknet::storage::{ Map, StoragePointerWriteAccess, StoragePointerReadAccess, StorageMapReadAccess, @@ -121,13 +122,8 @@ pub mod CommunityNft { /// @notice returns the token_uri for a particular token_id fn token_uri(self: @ContractState, token_id: u256) -> ByteArray { - assert(self.erc721.exists(token_id), TOKEN_DOES_NOT_EXIST); - let profile_address = self.profile_address.read(); - let community_id = self.community_id.read(); - let karst_hub = self.karst_hub.read(); - let token_uri = IHubDispatcher { contract_address: karst_hub } - .get_publication_content_uri(profile_address, community_id); - token_uri + let mint_timestamp: u64 = self.get_token_mint_timestamp(token_id); + get_token_uri(token_id, mint_timestamp) } } }