addNFT(address,uint256,uint256,uint256) :
This function adds a new Non-Fungible Token (NFT) to the contract. It takes in the address of the contract that holds the NFT, the ID of the NFT, the total amount of the NFT, and the price of the NFT. It then uses the safeTransferFrom function to transfer the NFT from the sender to the contract. Finally, it stores the information about the NFT in the nftInfo array. (autogenerated documentation)
deposit(uint256) :
This function allows a user to deposit a certain amount of tokens into a contract. It first transfers the tokens from the user's address to the contract's address using the safeTransferFrom() function. It then stores the user's information in the userInfo mapping, including the amount of tokens deposited, the user's points debt, and the time of the last update. Finally, it updates the user's amount and lastUpdateAt fields with the new values. (autogenerated documentation)
claim(uint256,uint256) :
This function allows a user to claim an NFT from the contract. It requires that the user has enough points to cover the cost of the NFT, and that there are still NFTs available to be claimed. It then deducts the cost of the NFT from the user's points balance and transfers the NFT to the user. Finally, it updates the remaining quantity of the NFT in the contract. (autogenerated documentation)
claimMultiple(uint256[],uint256[]) :
This function allows a user to claim multiple non-fungible tokens (NFTs) at once. It takes two arrays as parameters, one containing the indices of the NFTs to be claimed and the other containing the quantity of each NFT to be claimed. The function then loops through the arrays, calling the claim function for each NFT index and quantity. The claim function checks that the user has enough tokens to claim the NFTs and then transfers the NFTs to the user's account. (autogenerated documentation)
claimRandom() :
This function allows a user to claim a random NFT from the contract. It iterates through all the NFTs stored in the contract and checks the user's points balance. It then divides the user's balance by the price of the NFT to determine the maximum quantity of NFTs the user can claim. If the remaining quantity of the NFT is greater than 0 and the user has enough points to claim it, the function will call the claim() function to claim the NFT. If the user has enough points to claim more than the remaining quantity of the NFT, the function will claim the remaining quantity. (autogenerated documentation)
withdraw(uint256) :
This function allows a user to withdraw a specified amount of tokens from their account. It first checks that the user has enough tokens to withdraw, then subtracts the amount from the user's balance and updates the user's last update time. Finally, it transfers the specified amount of tokens to the user's account. (autogenerated documentation)
exit() :
This function allows a user to exit the contract and claim their winnings. It first calls the claimRandom() function, which calculates the user's winnings based on the random number generated. Then, it calls the withdraw() function, which sends the user their winnings from the contract. (autogenerated documentation)
pointsBalance(address) :
This function calculates and returns the total points balance of a user with a given address. It does this by retrieving the user's information from the userInfo mapping and adding the user's pointsDebt to the result of the _unDebitedPoints() function, which calculates the total points earned by the user that have not yet been debited. (autogenerated documentation)
_unDebitedPoints() :
This function calculates the amount of points that have not yet been debited from a user's account. It does this by taking the current timestamp, subtracting the timestamp of the user's last update, multiplying that by the emission rate, and then multiplying that by the user's amount. The result is the amount of points that have not yet been debited from the user's account. (autogenerated documentation)
nftCount() :
This function returns the total number of Non-Fungible Tokens (NFTs) that have been created. It works by accessing the nftInfo array, which stores information about each NFT, and counting the number of elements in the array. (autogenerated documentation)
onERC1155Received(address,address,uint256,uint256) :
This function is an event that is triggered when an ERC-1155 token is received. It takes in five parameters: the address of the operator, the address of the sender, the ID of the token, the value of the token, and any additional data associated with the token. The function returns a bytes4 value that is the keccak256 hash of the function signature. This event allows for the tracking of ERC-1155 token transfers and can be used to update the token balances of the sender and receiver. (autogenerated documentation)