DERA chain docs
  • Introduction
  • NFT2.0
    • Introduction
    • Architecture
    • Concepts
      • Collection
      • NFT2.0
      • Data Registry
      • Derivative NFT
      • Derived Account
      • Token Bound Account (aka TBA)
    • Smart Contracts
      • Interfaces
        • Factory
        • Dynamicity
        • Derivability
        • Cross chain ability
      • Use cases
        • Create collection
        • Mint NFT2.0
        • Create Data registry
        • Write onchain data
        • Retrieve onchain data
        • Mint Derivative NFT2.0
        • Create TBA
    • SDK
      • Setup
        • Create Console Account
        • Manage API key
        • Set up metadata schema
        • Initialize the SDK
      • API reference
        • Get List Collection
        • Get List Collection By Owner
        • Get Collection Info
        • Get List NFT By Collection
        • Get List NFT By Owner
        • Get List Derivative NFT By Original
        • Get NFT Info
        • Get List Data Registry
        • Get Data Registry By Owner
        • Get Data Registry Info
        • Get NFT onchain data
        • Get NFT protocol-scoped onchain data
        • Get User Freemint Info
        • Get Claim Token Uri Info
        • Upload JSON Uri Data To IPFS
        • Generate Presigned URL To Upload Image (IPFS)
        • Utility Functions
    • App guide
      • NFT2Scan
        • Create Collection
        • Mint NFT2.0
        • Mint Derivative NFT2.0
      • NFT2Console
        • Create Dapp
        • Register data schema
        • Manage API keys
        • Manage onchain data
    • References
      • Links
  • Bridge
    • Introduction
    • Bridge Token
    • Bridge NFT
  • Staking
    • Introduction
    • Validate
    • Delegate
  • Smart Contracts
    • EVM compatibility
    • Hardhat
    • Foundry
    • Account Abstraction
    • SubQuery Indexer
    • SAFE multisign
  • Nodes & Validators
    • Run a Node
    • Become a Validator
Powered by GitBook
On this page
  1. NFT2.0
  2. Smart Contracts
  3. Interfaces

Dynamicity

Smart contracts interface

In comparison with legacy NFT, NFT2.0 possesses dynamicity attribute, i.e. its data will be stored and retrieved onchain, which guarantees availability, immutability for smart contracts to consume.

IDynamic interface is the following:

interface IDynamicV2 {
  /**
   * @dev The registry MUST emit the WriteBatch event upon writing batch successful
   */
  event WriteBatch(address collection, uint256 startId, uint256 endId, bytes32 key, bytes value);

  /**
    * @dev Write single NFT data in terms of key/value.
    *   
    * Emits Write event.
    * @param collection the collection address of NFT
    * @param tokenId the NFT token ID
    * @param key the key hash
    * @param value the ABI encoded value
    */
  function write(address collection, uint256 tokenId, bytes32 key, bytes calldata value) external payable;

  /**
    * @dev Write batch NFT data in terms of key/value.
    *   
    * Emits Write event.
    * @param collection the collection address of NFT
    * @param startId the first id of batch
    * @param endId the last id of batch
    * @param key the key hash
    * @param value the ABI encoded value
    */
  function writeBatch(address collection, uint256 startId, uint256 endId, bytes32 key, bytes calldata value) external payable;

  /**
    * @dev Return the value corresponding to specific key of an NFT.
    *   
    * @param collection the collection address of NFT
    * @param tokenId the NFT token ID
    * @param key the Keccak256 hashed key
    * @return the ABI encoded value
    */
  function read(address collection, uint256 tokenId, bytes32 key) external view returns (bytes memory);  
}
PreviousFactoryNextDerivability

Last updated 7 months ago