contract MintableToken is Ownable, IERC721, IERC721Metadata, ERC721Burnable, ERC721Base {

    uint256 public nextTokenId = 1;
    address public market=address(0x0);

    constructor (address _market) public {       
        market = _market;
        _registerInterface(bytes4(keccak256('MINT_WITH_ADDRESS')));
        transferOwnership(msg.sender);
    }


    function setMarket(address newMarket)public onlyOwner{
        market = newMarket;
    }

    function mintAndApproveMarket(string memory tokenIPFSPath) public returns(uint256 tokenId){
        uint256 __tokenId = nextTokenId;
        Fee[] memory fees=new Fee[](0);
        _mint(msg.sender,__tokenId,fees);
        _setTokenURI(__tokenId, tokenIPFSPath);
        approve(market,__tokenId);
        emit Mint(__tokenId, msg.sender, tokenIPFSPath);
        nextTokenId = nextTokenId+1;
        return __tokenId;
    }

    //function mint(uint256 tokenId, uint8 v, bytes32 r, bytes32 s, Fee[] memory _fees, string memory tokenURI) public {
    function mint(string memory tokenIPFSPath) public  returns(uint256 tokenId) {
        //require(owner() == ecrecover(keccak256(abi.encodePacked(this, tokenId)), v, r, s), "owner should sign tokenId");
        uint256 __tokenId = nextTokenId;
        Fee[] memory fees=new Fee[](0);
        _mint(msg.sender,__tokenId,fees);
        _setTokenURI(__tokenId, tokenIPFSPath);
        nextTokenId = nextTokenId+1;
        emit Mint(__tokenId, msg.sender, tokenIPFSPath);
        return __tokenId;
    }

    function setTokenURIPrefix(string memory tokenURIPrefix) public onlyOwner {
        _setTokenURIPrefix(tokenURIPrefix);
    }

    function setContractURI(string memory contractURI) public onlyOwner {
        _setContractURI(contractURI);
    }

    event Mint(uint256 tokenID,address owner, string uri);

}
/**
 * @title MintableToken
 * @dev anyone can mint token.
 */
function mint(string memory tokenIPFSPath) public  returns(uint256 tokenId) {
    //require(owner() == ecrecover(keccak256(abi.encodePacked(this, tokenId)), v, r, s), "owner should sign tokenId");
    uint256 __tokenId = nextTokenId;
    Fee[] memory fees=new Fee[](0);
    _mint(msg.sender,__tokenId,fees);
    _setTokenURI(__tokenId, tokenIPFSPath);
    nextTokenId = nextTokenId+1;
    emit Mint(__tokenId, msg.sender, tokenIPFSPath);
    return __tokenId;
}

//function mint(uint256 tokenId, uint8 v, bytes32 r, bytes32 s, Fee[] memory _fees, string memory tokenURI) public {