ERC721Core

[ALPHA] ERC-721 Core

An ERC-721 contract capable of installing hooks.

  • Publish Date

    Jan 31, 2024

  • Licenses

    MIT, Apache-2.0

Hooks: Modular, Upgradeable smart contracts

thirdweb is redesigning its smart contracts so that developers can use only and exactly what onchain infrastructure they need for their use case. Read more about the hooks architecture in this post.

NOTE: this smart contract and architecture is in alpha testing and NOT AUDITED.

What are Hooks?

Hooks are external calls made to hook functions implemented by a hook contract. These calls are made at fixed, pre-defined points in the execution of functions in the core contract.

mint tokens via hooks

ERC-721 Core

Developers deploy non-upgradeable minimal clones of token core contracts e.g. the ERC-721 Core contract.

  • This contract is initializable, and meant to be used with proxy contracts.
  • Implements the token standard (and the respective token metadata standard).
  • Uses a role based permission model .
  • Implements the HookInstaller interface.

ERC-721 Hooks

  • BeforeMint: called before a token is minted in the ERC721Core.mint call.
  • BeforeTransfer: called before a token is transferred in the ERC721.transferFrom call.
  • BeforeBurn: called before a token is burned in the ERC721Core.burn call.
  • BeforeApprove: called before the ERC721.approve and ERC721.setApprovalForAll calls.
  • Token URI: called to fetch the return value for the ERC721Metadata.tokenURI function.
  • Royalty: called to fetch the return value for the ERC2981.royaltyInfo function.

Code and Usage

ADMIN_ROLE_BITS

view

No inputs required