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

Factory

Factory smart contract

In each supported blockchain, there is one Factory smart contract deployed, which facilitates clients to create NFT2.0 collection, data registry, derived-account in a permissionless manner.

IFactory smart contract interface

interface IFactory {
  /**
   * @dev The factory MUST emit the DataRegistryCreated event upon successful creation data registry.
   */
  event DataRegistryCreated(address dapp, address registry, string dappURI);

  /**
   * @dev The factory MUST emit the DataRegistryV2Created event upon successful creation data registry.
   */
  event DataRegistryV2Created(address indexed dapp, address indexed registry, string dappURI);

  /**
   * @dev The factory MUST emit the CollectionCreated event upon successful creation collection.
   */  
  event CollectionCreated(address owner, address collection, CollectionKind kind);

  /**
   * @dev The factory MUST emit the AddonsCreated event upon successful creation addons.
   */ 
  event AddonsCreated(address indexed collection, uint8 indexed kind, address addons, bytes32 campaignId, bytes data);

  /**
   * @dev The factory MUST emit the DerivedAccountCreated event upon successful creation derived account.
   */ 
  event DerivedAccountCreated(address underlyingCollection, uint256 underlyingTokenId, address derivedAccount);

  /**
   * @dev The factory MUST emit the Fee event upon successful setting fee.
   */ 
  event Fee(bytes32 action, uint256 fee);

  /**
   * @dev create data registry v1 (deprecated)
   * @param dappUri dapp uri
   */
  function createDataRegistry(string calldata dappUri) external returns (address registry);

  /**
   * @dev create data registry v2
   * @param dappUri dapp uri
   * @param settings dapp settings
   */
  function createDataRegistryV2(string calldata dappUri, DataRegistrySettings calldata settings) external returns (address registry);

  /**
   * @dev create ERC721 collection
   * @param name name of collection
   * @param symbol symbol
   * @param settings including royalty rate, addons settings
   * @param kind standard or 721A
   */
  function createCollection(string calldata name, string calldata symbol, CollectionSettings calldata settings, CollectionKind kind) external returns (address);

  /**
   * @dev create collection addons
   * @param collection address
   * @param kind uint8
   * @param settingsData abi encoded
   * @return address addons contract 
   */
  function createAddons(address collection, uint8 kind, bytes calldata settingsData) external returns (address);

  /**
   * @dev create TBA account for NFT
   * @param underlyingCollection collection address
   * @param underlyingTokenId tokenId
   */
  function createDerivedAccount(address underlyingCollection, uint256 underlyingTokenId) external returns (address);

  /**
   * @dev lookup data registry
   * @param dapp owner address
   */
  function dataRegistryOf(address dapp) external view returns (address);

  /**
   * @dev lookup collection
   * @param owner account address
   * @param name collection name
   * @param symbol collection symbol
   */
  function collectionOf(address owner, string calldata name, string calldata symbol) external view returns (address);

  /**
   * @dev lookup TBA
   * @param underlyingCollection collection address
   * @param underlyingTokenId tokenId
   */
  function derivedAccountOf(address underlyingCollection, uint256 underlyingTokenId) external view returns (address);
}
PreviousInterfacesNextDynamicity

Last updated 7 months ago