thirdweb

Profile

This contract allows developers to create profiles for different users in their games and dapps. Users can set up their profile by providing a tokenURI, which represents the metadata associated with their profile.

Contract Features

  • Profiles are represented as ERC721 tokens.
  • Profiles are non-transferrable, meaning they cannot be transferred between addresses.
  • The contract implements the @thirdweb-dev/contracts/base/ERC721Base.sol base contract, which provides basic ERC721 functionality with royalty support.
  • The contract emits an URISet event when a profile's tokenURI is set or updated.

Getting Started

  • Deploy the contract by providing a name, symbol, royalty recipient address, and royalty basis points (BPS) during deployment.
  • Users can then call the setupProfile function, providing their desired tokenURI, to create or update their profile.
  • Developers can use the getTokenId and getTokenURI functions to retrieve the token ID and tokenURI associated with a user's profile, respectively.

Important Notes

  • Profiles are non-transferrable, meaning they cannot be transferred between addresses. The _beforeTokenTransfers function is implemented to enforce this restriction.
  • Users need to approve the contract's address to spend their NFTs before they can set up their profile.
  • The contract uses the _setTokenURI function to set or update the tokenURI associated with a profile. Developers should override this function to implement their own logic for setting tokenURIs.
  • Developers should ensure that they maintain an adequate balance of reward tokens in the contract, which can be deposited using the deposit function.
  • By default, the contract uses a starting token ID of 1, which can be changed by overriding the _startTokenId function.

OPERATOR_FILTER_REGISTRY

(OPERATOR_FILTER_REGISTRY)

view

Published by

View all contracts

Details

  • Publish Date

    Apr 30, 2023

  • Licenses

    Apache-2.0, MIT


  • Learn more about Publish