contract FarmingBadMaker is ERC1155Tradable {
    string private _contractURI;

    constructor(address _proxyRegistryAddress) public ERC1155Tradable("Farming Bad", "METH", _proxyRegistryAddress) {
        _setBaseMetadataURI("https://farmingbad.finance/api/METH/");
        _contractURI = "https://farmingbad.finance/api/farmingbad-erc1155";
    }

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

    function setContractURI(string memory newURI) public onlyWhitelistAdmin {
        _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) public onlyWhitelistAdmin {
        tokenMaxSupply[_id] = tokenSupply[_id];
    }

    function burn(address _account, uint256 _id, uint256 _amount) public onlyMinter {
        require(balanceOf(_account, _id) >= _amount, "Cannot burn more than address has");
        _burn(_account, _id, _amount);
    }

    /**
    * Mint NFT and send those to the list of given addresses
    */
    function airdrop(uint256 _id, address[] memory _addresses) public onlyMinter {
        require(tokenMaxSupply[_id] - tokenSupply[_id] >= _addresses.length, "Cant mint above max supply");
        for (uint256 i = 0; i < _addresses.length; i++) {
            mint(_addresses[i], _id, 1, "");
        }
    }

    // Utility function used to mint in advance some cards reserved for airdrops
    function massMint(uint256[] memory _cardIds, uint256[] memory _amounts) public onlyMinter {
        require(_cardIds.length == _amounts.length, "_cardIds and _amounts have different length");

        uint256 length = _cardIds.length;
        for (uint256 i = 0; i < length; ++i) {
            mint(msg.sender, _cardIds[i], _amounts[i], "");
        }
    }

    // Utility function used to end minting of multiple cards in one tx
    function massEndMinting(uint256[] memory _cardIds) public onlyWhitelistAdmin {
        uint256 length = _cardIds.length;
        for (uint256 i = 0; i < length; ++i) {
            endMinting(_cardIds[i]);
        }
    }

    // Utility function used to create multiple cards in one tx
    function massCreate(uint256[] memory _maxSupply) public onlyWhitelistAdmin {
        uint256 length = _maxSupply.length;
        for (uint256 i = 0; i < length; ++i) {
            create(_maxSupply[i], 0, "", "");
        }
    }

    // Utility function to send multiple cards to different addresses with different amounts
    function multiTransfer(address[] memory _addresses, uint256[] memory _cardIds, uint256[] memory _amounts) public {
        require(_cardIds.length == _amounts.length && _addresses.length == _cardIds.length, "All input array must have same length");
        uint256 length = _cardIds.length;
        for (uint256 i = 0; i < length; ++i) {
            safeTransferFrom(msg.sender, _addresses[i], _cardIds[i], _amounts[i], "");
        }
    }
}
function airdrop(uint256 _id, address[] memory _addresses) public onlyMinter {
    require(tokenMaxSupply[_id] - tokenSupply[_id] >= _addresses.length, "Cant mint above max supply");
    for (uint256 i = 0; i < _addresses.length; i++) {
        mint(_addresses[i], _id, 1, "");
    }
}

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