contract Relics is ERC721 {
    address private _owner;
    uint256 public tokenCounter;
    bool public saleStatus = false;
    bool public collectionLock = true; // if true, can keep minting (not locked) 
    address payable wallet = 0x5c2B89CBeC1a4996Aa5e81f3dFf8505ABeC6B34c;
    string public relicURI = "nothingtostart";
    constructor () public ERC721 ("Relics of the PixaVerse", "ROTP"){
        tokenCounter = 1;
        _setOwner(wallet);
    }

    function mintRelic() public {
        require(saleStatus);
        require(collectionLock);
        _safeMint(msg.sender, tokenCounter);
        _setTokenURI(tokenCounter, relicURI);
        tokenCounter = tokenCounter + 1;
    }

    function ownermintRelic() public {
        require(msg.sender == wallet);
        require(collectionLock);        
        _safeMint(msg.sender, tokenCounter);
        _setTokenURI(tokenCounter, relicURI);
        tokenCounter = tokenCounter + 1;
    }

    function changeRelicURI(string memory inputURI) public {
        require(msg.sender == wallet);
        relicURI = inputURI;
    }

    function startSale() public {
        require(msg.sender == wallet);
        saleStatus = true;
    }

    function stopSale() public {
        require(msg.sender == wallet);
        saleStatus = false;
    }

    function lockcollection() public {
        require(msg.sender == wallet);
        collectionLock = false;
    }

    function getBalance() public view returns (uint256) {
        return address(this).balance;
    }

    function withdrawAmount(uint256 amount) public {
        require(msg.sender == wallet);
        require(amount <= getBalance());
        msg.sender.transfer(amount);
    }    

    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _setOwner(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _setOwner(newOwner);
    }

    function _setOwner(address newOwner) private {
        require(msg.sender == wallet);
        address oldOwner = _owner;
        _owner = newOwner;
    }

}
function transferOwnership(address newOwner) public virtual onlyOwner {
    require(newOwner != address(0), "Ownable: new owner is the zero address");
    _setOwner(newOwner);
}

/**
 * @dev Transfers ownership of the contract to a new account (`newOwner`).
 * Can only be called by the current owner.
 */