diff --git a/src/events/eventnft.cairo b/src/events/eventnft.cairo index 9a1b248..f739552 100644 --- a/src/events/eventnft.cairo +++ b/src/events/eventnft.cairo @@ -1,6 +1,3 @@ -/// @title Event NFT Contract for managing event-specific non-fungible tokens -/// @notice This contract implements functionality for minting and burning event-specific NFTs -/// @dev Implements ERC721 and SRC5 standards using OpenZeppelin components #[starknet::contract] pub mod EventNFT { use starknet::{ContractAddress, get_block_timestamp}; @@ -31,8 +28,6 @@ pub mod EventNFT { // ************************************************************************* // EVENTS // ************************************************************************* - /// @notice Events emitted by the contract - /// @dev Combines ERC721 and SRC5 events #[event] #[derive(Drop, starknet::Event)] enum Event { @@ -42,8 +37,6 @@ pub mod EventNFT { SRC5Event: SRC5Component::Event } - /// @notice Contract storage structure - /// @dev Includes ERC721 and SRC5 storage along with custom mappings #[storage] struct Storage { #[substorage(v0)] @@ -56,9 +49,6 @@ pub mod EventNFT { event_id: u256 } - /// @notice Initializes the EventNFT contract - /// @param event_id The unique identifier for the event this NFT collection represents - /// @dev Sets up the initial state of the contract #[constructor] fn constructor(ref self: ContractState, event_id: u256) { self.event_id.write(event_id); @@ -68,8 +58,6 @@ pub mod EventNFT { impl eventnft of IEventNFT { /// @notice mints an event NFT /// @param address address of user trying to mint the event NFT token - /// @return The ID of the newly minted token - /// @dev Reverts if the user already has an NFT from this collection fn mint_nft(ref self: ContractState, user_address: ContractAddress) -> u256 { let balance = self.erc721.balance_of(user_address); assert(balance.is_zero(), ALREADY_MINTED); @@ -84,10 +72,24 @@ pub mod EventNFT { self.last_minted_id.read() } + fn get_user_token_id(self: @ContractState, user_address: ContractAddress) -> u256 { + self.user_token_id.read(user_address) + } + + fn name(self: @ContractState) -> ByteArray { + self.erc721.name() + } + + fn symbol(self: @ContractState) -> ByteArray { + self.erc721.symbol() + } + + fn token_uri(self: @ContractState, token_id: u256) -> ByteArray { + self.erc721.token_uri(token_id) + } + /// @notice burns a community NFT - /// @param user_address address of user trying to burn the community NFT token - /// @param token_id The ID of the token to burn - /// @dev Reverts if the token doesn't exist or if the user isn't the owner + /// @param address address of user trying to burn the community NFT token fn burn_nft(ref self: ContractState, user_address: ContractAddress, token_id: u256) { let user_token_id = self.user_token_id.read(user_address); assert(user_token_id == token_id, NOT_TOKEN_OWNER); diff --git a/src/interfaces/IEventNFT.cairo b/src/interfaces/IEventNFT.cairo index a94c08f..97ab36d 100644 --- a/src/interfaces/IEventNFT.cairo +++ b/src/interfaces/IEventNFT.cairo @@ -1,10 +1,11 @@ use starknet::ContractAddress; -/// @title Event NFT Interface -/// @notice Interface for minting and burning event-specific NFTs -/// @dev Implements basic NFT functionality for event attendance tracking #[starknet::interface] pub trait IEventNFT { fn mint_nft(ref self: TContractState, user_address: ContractAddress) -> u256; fn burn_nft(ref self: TContractState, user_address: ContractAddress, token_id: u256); + fn get_user_token_id(self: @TContractState, user_address: ContractAddress) -> u256; + fn name(self: @TContractState) -> ByteArray; + fn symbol(self: @TContractState) -> ByteArray; + fn token_uri(self: @TContractState, token_id: u256) -> ByteArray; }