UserProfile Contract
The UserProfile contract represents a user profile on the ThetaFans platform. It allows users to manage their profile information, publish videos, set subscription tiers, and handle subscriptions and donations. The contract inherits from the ERC721 and Ownable contracts, providing ownership functionality and ERC721 token capabilities.
Contract Overview
The UserProfile contract consists of the following key features and functionalities:
User Profile Logic
profileName: A string representing the name of the user's profile.profileDescription: A string describing the user's profile.tokenIdNumber: An incremental value indicating the number of tokens released.amountPublishedVideos: The total number of videos published by the user.publishedVideos: An array containing the metadata of the published videos.videosIndex: A mapping that indexes the videos by their URL.amountCreator: The amount of funds available for the profile owner to withdraw.totalDonated: The total amount of funds donated to the profile.suscriptionFee: The percentage fee charged on each subscription payment.
Tier Logic
userTier: A mapping that stores the subscription tier for each user (bronze, silver, gold).tierData: A mapping that stores the details of each subscription tier, including name, price, and subscription count.
Subscription Logic
subscriptionDuration: The duration (in seconds) of a subscription period.subscriberDueDate: A mapping that tracks the due date of each subscriber's subscription.subscriberLastPaid: A mapping that tracks the last payment date of each subscriber.userSubscribed: A mapping that tracks whether a user is currently subscribed.userSubscribe(uint _tier): A function that allows users to subscribe to a specific tier by paying the required price.
Video Management
addVideo(string memory _name, string memory _videoURL, string memory _description, uint _tier): A function for adding a new video to the user's profile.hideVideo(string memory _videoUrl): A function that hides a specific video from being visible.showVideo(string memory _videoUrl): A function that makes a hidden video visible again.getVideosData(): A function that retrieves an array of the metadata for all published videos.
Owner Functions
withdrawAmount(): A function for the profile owner to withdraw the accumulated funds.checkSubscribers(): A function that checks if subscribers have paid their monthly subscription and removes their subscription if not.
Last updated