# How to create Collections with DRTR NFT ## Overview DRTR NFT is an implementation of [ERC-1155](https://eips.ethereum.org/EIPS/eip-1155) standart. This standard combines Non-Fungible and Fungible behaviour in one smart-contract. and also allows batch creation and transfer of tokens. For purposes of DRTR we have only Non-Fungible behaviour implemented. DRTR introduces an abstraction of NFT Collections: a batch of NFTs minted together. Within the Collection tokens are distinguished by their index in a batch. The whole id of the token is constructed as hash of concatenation index of collection and index of token in that collection. Properties of each NFT can be classified as on-chain and off-chain. ERC-1155 only regulates how off-chain properties should work. This off-chain properties are organaised as JSON Metadata. With DRTR a concept of generic on-chain name/value properties is introduced and may be used if needed. Off-chain properties are supposed to be provided by some kind of server or decentralized storage (IPFS). ## Minting Collections To mint a Collection of DRTR tokens the `owner` od a contract should call `mintCollection(address beneficiary, uint256 itemsCount)` method, providing address who should receive this newly minted tokens and how many tokens are to be minted. ## Providing On-Chain Properties To set on-chain properties of the items contract owner should call `setProperty(bytes32 propertieHash, bytes32[] ids, bytes[] values)` method, providing keccak256 hash of propertie name with arrays of item ids (see `getId(uint256 collection, uint256 num)` method) and values to set for this ids. ## Providing Off-Chain Metadata ### Contract-Level Metadata Contract-Level Metadata is not included in ERC-1155 standart, but specified by [OpenSea documentation](https://docs.opensea.io/docs/contract-level-metadata). The URL of the metadata file can be obtained on-chain calling `contractURI()` method on DRTR token. It can be set by owner using `setContractURI(string calldata _contractURI)` method. ### Item-specific Metadata Metadata of individual token is specified by [ERC-1155](https://eips.ethereum.org/EIPS/eip-1155#metadata) and it's URL can be obtained by calling `uri(uint256 _id)` method. It is called by exchanges like OpenSea to get name of the item, it's image and other properties. For DRTR this URL can be set by owner calling `setURI(string url)` method and providing it with an URL containing a placeholder `{id}` in place of item id. Example: `https://example.com/drtr/{id}.json` To generate the id the same way it will be used by OpenSea, one may call `getId(uint256 collection, uint256 num)` method of the DRTR contract. The `0x` prefix of the result should be omitted. Alternatively, it can be generated as a hexadecimal representation of keccak256 hash of 64-byte array where first 32 bytes represent the collection index and second 32 bytes represent the index of item in the collection. Example: `a6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49` is an `id` of Item 1 in Collection 0. ### Summary To provide correct metadata server-side should provide: 1. URL of Contract-level metadata, which return JSON specified in [OpenSea docs](https://docs.opensea.io/docs/contract-level-metadata) 2. URL template for item-specific metadata, using `{id}` placeholder for item id. Url generated by this template should provide JSON specified in [ERC-1155](https://eips.ethereum.org/EIPS/eip-1155#metadata) Owner of DRTR should set this URLs using `setContractURI()` and `setURI()` methods.