Smart Contract Details

Smart Contract Details for MemeLordz NFT

The MemeLordz NFT smart contract is designed to handle various functionalities necessary for managing and interacting with NFTs within the MemeLordz ecosystem. This includes minting, burning, transferring, and querying NFTs. Below are detailed descriptions of the read and write functions, along with code snippets to illustrate the contract's implementation.

Read Functions

  1. balanceOf: Returns the number of NFTs owned by a given address.

  2. getApproved: Returns the address approved to transfer a specific NFT.

  3. isApprovedForAll: Checks if an operator is approved to manage all of an owner's assets.

  4. name: Returns the name of the token collection.

  5. owner: Returns the owner of the contract.

  6. ownerOf: Returns the owner of a specific NFT.

  7. supportsInterface: Checks if a contract implements a given interface.

  8. symbol: Returns the symbol of the token collection.

  9. tokenByIndex: Returns a token ID at a given index.

  10. tokenIdsByOwner: Returns all token IDs owned by a given address.

  11. tokenOfOwnerByIndex: Returns a token ID owned by a specific address at a given index.

  12. tokenURI: Returns the URI for a specific token.

  13. totalSupply: Returns the total supply of tokens.

Write Functions

  1. approve: Approves another address to transfer a specific token.

  2. burnToken: Burns a specific token.

  3. mintToken: Mints a new token.

  4. mintVRFToken: Mints a new token using VRF for randomness.

  5. rawFulfillRandomness: Handles the VRF response.

  6. renounceOwnership: Renounces ownership of the contract.

  7. safeTransferFrom: Safely transfers a token.

  8. setApprovalForAll: Approves or removes an operator for all tokens.

  9. setBaseURI: Sets the base URI for tokens.

  10. setBnbMintCost: Sets the mint cost in BNB.

  11. setBnbVrfCost: Sets the VRF mint cost in BNB.

  12. setFreqs: Sets the frequencies for random minting.

  13. setLinkFee: Sets the LINK fee for VRF.

  14. setLordzMintCost: Sets the mint cost in LORDZ tokens.

  15. setLordzVRFCost: Sets the VRF mint cost in LORDZ tokens.

  16. setRoyalAddr: Sets the royalty address.

  17. setTokenAddr: Sets the token address for LORDZ.

  18. setTokenMetadataURI: Sets the metadata URI for a token.

  19. transferFrom: Transfers a token from one address to another.

  20. transferOwnership: Transfers ownership of the contract.

  21. withdrawBNB: Withdraws BNB from the contract.

  22. withdrawBNBto: Withdraws BNB to a specific address.

  23. withdrawLink: Withdraws LINK tokens from the contract.

Contract Source Code

Below is a simplified snippet of the MemeLordz NFT contract implementation:

Function Descriptions

balanceOf: Retrieves the number of NFTs owned by an address. getApproved: Gets the approved address for a specific NFT. isApprovedForAll: Checks if an operator is approved to manage all of an owner's assets. name: Returns the token collection name. owner: Returns the owner of the contract. ownerOf: Returns the owner of a specific NFT. supportsInterface: Checks if a contract implements a given interface. symbol: Returns the token collection symbol. tokenByIndex: Retrieves a token ID at a given index. tokenIdsByOwner: Returns all token IDs owned by a specific address. tokenOfOwnerByIndex: Retrieves a token ID owned by a specific address at a given index. tokenURI: Returns the URI for a specific token. totalSupply: Returns the total number of tokens.

approve: Authorizes another address to transfer a specific token.

burnToken: Destroys a specific token.

mintToken: Mints a new token and assigns it to a user.

mintVRFToken: Mints a new token using VRF for randomness.

rawFulfillRandomness: Handles the VRF response.

renounceOwnership: Relinquishes ownership of the contract.

safeTransferFrom: Securely transfers a token.

setApprovalForAll: Authorizes or removes an operator for all tokens.

setBaseURI: Sets the base URI for token metadata.

setBnbMintCost: Establishes the BNB mint cost.

setBnbVrfCost: Sets the VRF mint cost in BNB.

setFreqs: Configures frequencies for random minting.

setLinkFee: Establishes the LINK fee for VRF.

setLordzMintCost: Sets the mint cost in LORDZ tokens.

setLordzVRFCost: Configures the VRF mint cost in LORDZ tokens.

setRoyalAddr: Establishes the royalty address.

setTokenAddr: Sets the token address for LORDZ.

setTokenMetadataURI: Assigns the metadata URI for a token.

transferFrom: Transfers a token between addresses.

transferOwnership: Transfers contract ownership.

withdrawBNB: Withdraws BNB from the contract.

withdrawBNBto: Withdraws BNB to a specific address.

withdrawLink: Withdraws LINK tokens from the contract.

This comprehensive approach ensures that all interactions with MemeLordz NFTs are secure, efficient, and transparent, leveraging the capabilities of blockchain technology to enhance the gaming experience.

Last updated