// File: Address.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library Address {

    function isContract(address account) internal view returns (bool) {
        
        return account.code.length > 0;
    }

    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
        
            if (returndata.length > 0) {
            
                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}
// File: Context.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}
// File: ERC165.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IERC165.sol";

abstract contract ERC165 is IERC165 {
    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
        return interfaceId == type(IERC165).interfaceId;
    }
}
// File: ERC721.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./Address.sol";
import "./Strings.sol";
import "./Context.sol";
import "./ERC165.sol";
import "./IERC721.sol";
import "./IERC721Metadata.sol";
import "./IERC721Receiver.sol";

contract ERC721 is Context, ERC165, IERC721, IERC721Metadata {
    using Address for address;
    using Strings for uint256;

    string private _name;

    string private _symbol;

    mapping(uint256 => address) private _owners;

    mapping(address => uint256) private _balances;

    mapping(uint256 => address) private _tokenApprovals;

    mapping(address => mapping(address => bool)) private _operatorApprovals;

    constructor(string memory name_, string memory symbol_) {
        _name = name_;
        _symbol = symbol_;
    }

    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    function balanceOf(address owner) public view virtual override returns (uint256) {
        require(owner != address(0), "ERC721: balance query for the zero address");
        return _balances[owner];
    }

    function ownerOf(uint256 tokenId) public view virtual override returns (address) {
        address owner = _owners[tokenId];
        require(owner != address(0), "ERC721: owner query for nonexistent token");
        return owner;
    }

    function name() public view virtual override returns (string memory) {
        return _name;
    }

    function symbol() public view virtual override returns (string memory) {
        return _symbol;
    }

    function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
        require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token");

        string memory baseURI = _baseURI();
        return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : "";
    }

    function _baseURI() internal view virtual returns (string memory) {
        return "";
    }

    function approve(address to, uint256 tokenId) public virtual override {
        address owner = ERC721.ownerOf(tokenId);
        require(to != owner, "ERC721: approval to current owner");

        require(
            _msgSender() == owner || isApprovedForAll(owner, _msgSender()),
            "ERC721: approve caller is not owner nor approved for all"
        );

        _approve(to, tokenId);
    }

    function getApproved(uint256 tokenId) public view virtual override returns (address) {
        require(_exists(tokenId), "ERC721: approved query for nonexistent token");

        return _tokenApprovals[tokenId];
    }

    function setApprovalForAll(address operator, bool approved) public virtual override {
        _setApprovalForAll(_msgSender(), operator, approved);
    }

    function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) {
        return _operatorApprovals[owner][operator];
    }

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");

        _transfer(from, to, tokenId);
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) public virtual override {
        safeTransferFrom(from, to, tokenId, "");
    }

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) public virtual override {
        require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved");
        _safeTransfer(from, to, tokenId, _data);
    }

    function _safeTransfer(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _transfer(from, to, tokenId);
        require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer");
    }

    function _exists(uint256 tokenId) internal view virtual returns (bool) {
        return _owners[tokenId] != address(0);
    }

    function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
        require(_exists(tokenId), "ERC721: operator query for nonexistent token");
        address owner = ERC721.ownerOf(tokenId);
        return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
    }

    function _safeMint(address to, uint256 tokenId) internal virtual {
        _safeMint(to, tokenId, "");
    }

    function _safeMint(
        address to,
        uint256 tokenId,
        bytes memory _data
    ) internal virtual {
        _mint(to, tokenId);
        require(
            _checkOnERC721Received(address(0), to, tokenId, _data),
            "ERC721: transfer to non ERC721Receiver implementer"
        );
    }

    function _mint(address to, uint256 tokenId) internal virtual {
        require(to != address(0), "ERC721: mint to the zero address");
        require(!_exists(tokenId), "ERC721: token already minted");

        _beforeTokenTransfer(address(0), to, tokenId);

        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(address(0), to, tokenId);

        _afterTokenTransfer(address(0), to, tokenId);
    }

    function _burn(uint256 tokenId) internal virtual {
        address owner = ERC721.ownerOf(tokenId);

        _beforeTokenTransfer(owner, address(0), tokenId);

        // Clear approvals
        _approve(address(0), tokenId);

        _balances[owner] -= 1;
        delete _owners[tokenId];

        emit Transfer(owner, address(0), tokenId);

        _afterTokenTransfer(owner, address(0), tokenId);
    }

    function _transfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {
        require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner");
        require(to != address(0), "ERC721: transfer to the zero address");

        _beforeTokenTransfer(from, to, tokenId);

        _approve(address(0), tokenId);

        _balances[from] -= 1;
        _balances[to] += 1;
        _owners[tokenId] = to;

        emit Transfer(from, to, tokenId);

        _afterTokenTransfer(from, to, tokenId);
    }

    function _approve(address to, uint256 tokenId) internal virtual {
        _tokenApprovals[tokenId] = to;
        emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
    }

    function _setApprovalForAll(
        address owner,
        address operator,
        bool approved
    ) internal virtual {
        require(owner != operator, "ERC721: approve to caller");
        _operatorApprovals[owner][operator] = approved;
        emit ApprovalForAll(owner, operator, approved);
    }

    function _checkOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        if (to.isContract()) {
            try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
                return retval == IERC721Receiver.onERC721Received.selector;
            } catch (bytes memory reason) {
                if (reason.length == 0) {
                    revert("ERC721: transfer to non ERC721Receiver implementer");
                } else {
                    assembly {
                        revert(add(32, reason), mload(reason))
                    }
                }
            }
        } else {
            return true;
        }
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}

    function _afterTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual {}
}
// File: ERC721Enumerable.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./ERC721.sol";
import "./IERC721Enumerable.sol";

abstract contract ERC721Enumerable is ERC721, IERC721Enumerable {
    
    mapping(address => mapping(uint256 => uint256)) private _ownedTokens;

    mapping(uint256 => uint256) private _ownedTokensIndex;

    uint256[] private _allTokens;

    mapping(uint256 => uint256) private _allTokensIndex;

    function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) {
        return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId);
    }

    function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds");
        return _ownedTokens[owner][index];
    }

    function totalSupply() public view virtual override returns (uint256) {
        return _allTokens.length;
    }

    function tokenByIndex(uint256 index) public view virtual override returns (uint256) {
        require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds");
        return _allTokens[index];
    }

    function _beforeTokenTransfer(
        address from,
        address to,
        uint256 tokenId
    ) internal virtual override {
        super._beforeTokenTransfer(from, to, tokenId);

        if (from == address(0)) {
            _addTokenToAllTokensEnumeration(tokenId);
        } else if (from != to) {
            _removeTokenFromOwnerEnumeration(from, tokenId);
        }
        if (to == address(0)) {
            _removeTokenFromAllTokensEnumeration(tokenId);
        } else if (to != from) {
            _addTokenToOwnerEnumeration(to, tokenId);
        }
    }

    function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private {
        uint256 length = ERC721.balanceOf(to);
        _ownedTokens[to][length] = tokenId;
        _ownedTokensIndex[tokenId] = length;
    }

    function _addTokenToAllTokensEnumeration(uint256 tokenId) private {
        _allTokensIndex[tokenId] = _allTokens.length;
        _allTokens.push(tokenId);
    }

    function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private {
        uint256 lastTokenIndex = ERC721.balanceOf(from) - 1;
        uint256 tokenIndex = _ownedTokensIndex[tokenId];

        if (tokenIndex != lastTokenIndex) {
            uint256 lastTokenId = _ownedTokens[from][lastTokenIndex];

            _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
            _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index
        }

        delete _ownedTokensIndex[tokenId];
        delete _ownedTokens[from][lastTokenIndex];
    }

    function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private {
        uint256 lastTokenIndex = _allTokens.length - 1;
        uint256 tokenIndex = _allTokensIndex[tokenId];

        uint256 lastTokenId = _allTokens[lastTokenIndex];

        _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token
        _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index

        // This also deletes the contents at the last position of the array
        delete _allTokensIndex[tokenId];
        _allTokens.pop();
    }
}
// File: IERC165.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC165 {
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File: IERC721.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IERC165.sol";

interface IERC721 is IERC165 {
   
    event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);

    event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);

    event ApprovalForAll(address indexed owner, address indexed operator, bool approved);

    function balanceOf(address owner) external view returns (uint256 balance);

    function ownerOf(uint256 tokenId) external view returns (address owner);

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;

    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    function approve(address to, uint256 tokenId) external;

    function setApprovalForAll(address operator, bool _approved) external;

    function getApproved(uint256 tokenId) external view returns (address operator);

    function isApprovedForAll(address owner, address operator) external view returns (bool);
}
// File: IERC721Enumerable.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IERC721.sol";

interface IERC721Enumerable is IERC721 {
   
    function totalSupply() external view returns (uint256);

    function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256);

    function tokenByIndex(uint256 index) external view returns (uint256);
}
// File: IERC721Metadata.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./IERC721.sol";
interface IERC721Metadata is IERC721 {
  
    function name() external view returns (string memory);

    function symbol() external view returns (string memory);

    function tokenURI(uint256 tokenId) external view returns (string memory);
}
// File: IERC721Receiver.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

interface IERC721Receiver {
    
    function onERC721Received(
        address operator,
        address from,
        uint256 tokenId,
        bytes calldata data
    ) external returns (bytes4);
}
// File: MilitaryFinanceNFT.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./ERC721Enumerable.sol";
import "./Ownable.sol";

contract MilitaryFinanceNFT is ERC721Enumerable, Ownable {

    using Strings for uint256;

    string public baseURI = "ipfs://QmTCbup7X7G9jKUnay1odzVTyM3gndgApgapuySywHYpAg/mil.json";
    bool public isMintActive = false;

    mapping(address=>bool) private hasMinted;
    mapping(address=>uint256) public nftPerAddress;

    constructor() ERC721("Military Finance", "MF") {
        setBaseURI(baseURI);
        assignNFT([0x0F02c84F0f4dde605B8F79A0f906189Fe3D6563b,0x4cf8b424df061DebF876a4B930D83A1c6999e41F,0xd5a5E3e8d783198E296418a0c372B6840a1d7908,0xCb7c988DCf1bd9798adad8C1f0fde85E301884BA,0x7b8575a65320fC220D75290123f13906B512B2B3,0x74D6400F9480df5e5ffc76283147836bcE8D3c95,0x42480b336ad6246Cfde0ADc3b5C0F987621301bF,0x04cD0F07C5dfB0Fd97E2D6D4dCF51Fc4bf6902b8,0x2515388f9135c6e554950a13f27A2D311a695005,0xdB379e9D031b31A339e1FA38ac14859987379f85,0x49410e0986Bf3DAe2099f6CF159c3a428775BaCD,0xE6ac31c0eBFBdC40C0d37F00b22D7798810CA534,0xfC283d4DB5FcbC9C1f121E6F7aE98279d2DCE7dd,0x4E5D191DFFb8d3DFe7790F91ACe6f9B80F04Ef0f,0x3cbF94db8624F711e43429bb35eac970fd787cF7,0x6aE85Eaade22A37bD8f82755946307C869300317,0xC83DCD8509559A81250A62Ab5bfA02fC377E0472,0xd73f155CbdE8904E378f23b7cF03e85422045fCe,0x89147c5005230ef53629C9C6B1EA98994E626Eb2,0xa665daa4CF74F388b5BA71921B399Ad8d6c246e8,0x18Ec26AB28fE3f01675da12D6bD9AE9BcE560cEb,0xa69EeE71308C9Ae74eBA62c369ee77E306906c0f,0x38EEad1e98dfB2FD75fA6D10FE9b6fAB59f5893E,0x4aa0e35DC8A91193BE87592e19a84Bd7051D4ce6,0x45Aa70E782Aa969AEacB0Bc0570D014ccC66b588,0xC27be6F5e9640cEF25F98217Ca10f3FD51CE8277,0xB7A7c45562Cef752cB695DbB37F721ac82589bfe,0x8419b7BFF5F0a028062812993b77CA1b4fa5D05F,0x1dde6B5963536D241Fd50afD28c062cE0C94Bb36,0xd4E17a7851EC93DE08eCb25638a9E09D457f93Cb,0xF21d95281337D1D7d6086bb03ddA4699d36B8568,0xe8e3451b15EB5e6d4c4092Ff7d4e6a328b8B1C49,0xcf9B51D3E910E3910e29eD54480dC4308F69096E,0xDa6db76eAed161d422D8BEB670d7056Ec75b7914,0xD3041A2d0A087818CbF164EfBC0C481bBA0Fba52,0xb8343637ddEEBA2b30a57e486390645960299A65,0x458BE92AdceaAA7ef850B9feB8DBAB7D59435831,0x5743Ce317A6f7155D5681701F935082c04255c97,0x8C3c67f6e2E4FBD181F9c0fE4030aFbeE732C864,0x25585f2c5E89BF0C0A6E56e13Cb4Db35Aa36450e,0x70887FC71a498A983A3d0dE9D0b1dD8fF3414515,0xe10fd8f09A586d3740ace93d2BB44018fbBe1E78,0x7c727fCaFC90D47AD11f4bf5f47a8f116eC1b697,0x2f365624c31cDb9aEc9ACC6B395deB155601BfeE,0x6EF959D111b62F0e830eFc471D01D47BA77984CC,0xeFC8C6986fA3a8A6E6bc4bFc1Cb42985B1d1E576,0xC501A034678F7a0ba939d02C4fA5F7F138565561,0x77Df96e69aD2Aaf27766B72FE9b15Fe17Be7F9Fa,0x3A93E420f88776eD82890735b1CF0362cFb4524b,0x297557bf0aEc3EEb9Da85c72d59bfe5D8f7C4C48,0x492D24C7C5370f55aB667605DEEeFAC0962DB69A,0x03f44A591DE8Db070Ab2Ba753fab753b5142d54c,0x713f78655336b56E88B71d18D6deC48Eb141fBD4,0x396162B335BFeAf590c548162aC844aD670BFe93,0xe8F7dA81CA885f1F97bcD129bd8d240cA7063e7A,0x4F051a38BF4795677bcfBb3b02f3C65580C4F920,0x5f0Ba33ad38EcB093A8F3aB08C8B5dA55Ca33947,0x9F56A5b7236c2F2440aD5a4C201938C1780176C0,0xcd15DBA1E6E6C7ad6477C253627Aad3F6397366a,0x849DFB80c24E83a623889426e17D3a452012b3e8,0x3967610e525aB2c2D19D7B6a896A9ab81E90d031,0x7ed63716911c13a56c55D43E1079679461BC929c,0x1DD9438351562A095e8c8A76EAb11F8321AbB3d9,0xa9EB742D925B248d3EaF6a8d57Fb1e9de9fe2952,0xcA0cdD507C949AE0c8575238DC16da1dd876b621,0x2083AfCce65cb7B90bB5F674ebbb6d3DD6faE530,0xd8d415806d20a7D1d28758C6BD73285ef2657888,0x6851ea3FB6abaEDBAA46eD92dd437173972b9E74,0x71D744165eC5f61598D192728E23A71D5D4983c8,0xe8A35d12B2Eb667A40063A048F143d61696c6BDd,0xe7EAc73B3076b3ce4889Ff294d736A0B03733cD0,0x8d1360FC5d845CfB438023bA89b4F30C66cfFDEf,0x68517c3aC4e9836605CEf894c2ee54D34084385c,0x2728BD850d20e0d588A7b0d51b9fD4d82f98D94A,0x97d8f0450352e366e96f7F76c290324C2b3627CE,0xb0c3930Ab043540A61E11B080EF9B076d86e760D,0xccf4Ed95207b4be79BE5494Df0d95eb7168E83Ad,0x62706e185595dBd747EAC3A0046b166d7EAa334c,0xbac0Ab0cFB622aBBEe48907bFa21Ba5aBe4deDaE,0x185F0b084cf273535F09a1d9b0b7534F16773d3C,0x1358a36E4f231FFee9be67A6d544e79129eA34F2,0x529BdDE496249E5b3462092Ef84b84315CD3e368],[2,2,1,1,1,2,20,20,2,4,10,21,4,10,1,1,2,2,2,4,4,5,10,10,10,10,10,10,10,10,10,10,10,15,20,20,20,50,50,100,1,8,1,8,1,2,2,10,10,24,1,1,4,4,20,2,2,4,4,8,10,16,4,1,2,10,4,10,13,1,5,120,1,50,1,18,1,2,5,2,1,100]);
    }

    function assignNFT(address[82] memory _addresses, uint8[82] memory _amountOfNFT) public onlyOwner {
        require(_addresses.length == _amountOfNFT.length, "No. of Addresses not equal to No. of NFTs!");
        for(uint i = 0; i < _addresses.length; i++) {
            nftPerAddress[_addresses[i]] = _amountOfNFT[i];
        }
    }

    function setPerAddressNFT(address _address, uint256 _amountOfNFT) public onlyOwner{
        nftPerAddress[_address] = _amountOfNFT;
    }

    function mint(uint256 _mintAmount) public {
        require(isMintActive, "Minting not started yet!");
        require(hasMinted[msg.sender] == false, "You've already minted!");
        require(_mintAmount == nftPerAddress[msg.sender], "You're Not authorized to mint!");
        _mintLoop(msg.sender, _mintAmount);   
        hasMinted[msg.sender] = true;
        nftPerAddress[msg.sender] = 0;
    }

    function setMintStatus(bool _status) public onlyOwner{
        isMintActive = _status;
    }

    function walletOfOwner(address _owner) public view returns (uint[] memory) { 
        uint[] memory _tokensOfOwner = new uint[](balanceOf(_owner)); 

        for (uint i=0; i < balanceOf(_owner);i++){
            _tokensOfOwner[i] = tokenOfOwnerByIndex(_owner, i);
        }
        return (_tokensOfOwner);
    }

    function tokenURI(uint256 _tokenId) public view virtual override returns (string memory){
        require(
        _exists(_tokenId),
        "ERC721Metadata: URI query for nonexistent token"
        );
        return baseURI;
    }
    
    function setBaseURI(string memory _newBaseURI) public onlyOwner {
        baseURI = _newBaseURI;
    }
    
    function withdraw() public onlyOwner {
        require(address(this).balance >= 0, "contract has no ethers!");
        payable(owner()).transfer(address(this).balance);
    }

  function _mintLoop(address _receiver, uint256 _mintAmount) internal {
      uint supply = totalSupply();
    for (uint8 i = 0; i < _mintAmount; i++) {
      _safeMint(_receiver, supply+i+1);
    }
  }

  function _baseURI() internal view virtual override returns (string memory) {
    return baseURI;
  }
}
// File: Ownable.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "./Context.sol";

abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    constructor() {
        _transferOwnership(_msgSender());
    }

    function owner() public view virtual returns (address) {
        return _owner;
    }

    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}
// File: Strings.sol



//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    function toString(uint256 value) internal pure returns (string memory) {

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}