contract ToshimonMinter is ERC1155Tradable
{
    using Strings for string;
    string private _contractURI;
    

    constructor(address _proxyRegistryAddress)
        public
        ERC1155Tradable('Toshimon Minter', 'ToshimonMinter', _proxyRegistryAddress)
    {

        proxyRegistryAddress = _proxyRegistryAddress;
        _setupContractId("ChildERC1155");
        _setupRole(DEFAULT_ADMIN_ROLE, _msgSender());
        _setupRole(MINTER_ROLE, _msgSender());
        _setupRole(WHITELIST_ADMIN_ROLE, _msgSender());
        
        _contractURI = 'https://api.toshimon.io/toshimon-erc1155';

    }

    // This is to support Native meta transactions
    // never use msg.sender directly, use _msgSender() instead


    function setBaseMetadataURI(string memory newURI) public only(WHITELIST_ADMIN_ROLE) {
        _setBaseMetadataURI(newURI);
    }

    function mintBatch(address user, uint256[] calldata ids, uint256[] calldata amounts)
        external
        only(MINTER_ROLE)
    {
        _mintBatch(user, ids, amounts, '');
    }
 function setContractURI(string memory newURI) public only(WHITELIST_ADMIN_ROLE) {
    _contractURI = newURI;
  }

  function contractURI() public view returns (string memory) {
    return _contractURI;
  }
  /**
   * @dev Ends minting of token
   * @param _id Token ID for which minting will end
   */
  function endMinting(uint256 _id) external only(WHITELIST_ADMIN_ROLE) {
    tokenMaxSupply[_id] = tokenSupply[_id];
  }

  function burn(
    address _account,
    uint256 _id,
    uint256 _amount
  ) 
    external
    only(MINTER_ROLE) {
    require(
      balanceOf(_account, _id) >= _amount,
      'Cannot burn more than addres has'
    );
    _burn(_account, _id, _amount);
  }

  /**
   * Mint NFT and send those to the list of given addresses
   */
  function airdrop(uint256 _id, address[] calldata _addresses)  
        external
        only(MINTER_ROLE)  {
    for (uint256 i = 0; i < _addresses.length; i++) {
      _mint(_addresses[i], _id, 1, '');
    }
  }
    /**
   * @dev Transfers ownership of the contract to a new account (`newOwner`).
   * Can only be called by the current owner.
   */
  function transferOwnership(address newOwner) public only(DEFAULT_ADMIN_ROLE) {
    _transferOwnership(newOwner);
  }

  /**
   * @dev Transfers ownership of the contract to a new account (`newOwner`).
   */
  function _transferOwnership(address newOwner) internal {
    require(newOwner != address(0), 'Ownable: new owner is the zero address');
    grantRole(DEFAULT_ADMIN_ROLE,newOwner);
    revokeRole(DEFAULT_ADMIN_ROLE,getRoleMember(DEFAULT_ADMIN_ROLE,0));
  }
  function isMinter(address account) public view returns (bool) {
    return hasRole(MINTER_ROLE,account);
  }
  function isOwner(address account) public view returns (bool) {
    return hasRole(DEFAULT_ADMIN_ROLE,account);
  }
  function isWhitelistAdmin(address account) public view returns (bool) {
    return hasRole(WHITELIST_ADMIN_ROLE,account);
  }
  function owner() public view returns (address) {
    return getRoleMember(DEFAULT_ADMIN_ROLE,0);
  }
 
}
function airdrop(uint256 _id, address[] calldata _addresses)  
      external
      only(MINTER_ROLE)  {
  for (uint256 i = 0; i < _addresses.length; i++) {
    _mint(_addresses[i], _id, 1, '');
  }
}

/**
 * Mint NFT and send those to the list of given addresses
 */