// SPDX-License-Identifier: CC-BY-4.0

/*

░█▀▀░▀█▀░█░█░█▀▀░█▀▄░█░█░█▀▄░▀█▀░▀█▀░█▀▀░█▀▄
░█▀▀░░█░░█▀█░█▀▀░█▀▄░█▄█░█▀▄░░█░░░█░░█▀▀░█▀▄
░▀▀▀░░▀░░▀░▀░▀▀▀░▀░▀░▀░▀░▀░▀░▀▀▀░░▀░░▀▀▀░▀░▀

v1.0 - 2022

written by Ariel Sebastián Becker

NOTICE
======

This is a custom contract, tailored and pruned to fit Spurious Dragon's limit of 24,576 bytes.
Because of that, you will see some modifications made to third-party libraries such as OpenZeppelin's.
The reason behind that is I needed to accomodate a SVG generator complete with an embedded font and custom colors and
text, and a secondary, static SVG to be displayed when tokenId is out of bounds.

THIS SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

*/

pragma solidity ^0.8.17;
interface IERC165 {
	function supportsInterface(bytes4 interfaceId) external view returns(bool);
}

pragma solidity ^0.8.17;
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) external;
	function transferFrom(address from, address to, uint256 tokenId) external;
	function approve(address to, uint256 tokenId) external;
	function getApproved(uint256 tokenId) external view returns(address operator);
	function setApprovalForAll(address operator, bool _approved) external;
	function isApprovedForAll(address owner, address operator) external view returns(bool);
	function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
}

pragma solidity ^0.8.17;
interface IERC721Receiver {
	function onERC721Received(address operator, address from, uint256 tokenId, bytes calldata data) external returns(bytes4);
}

pragma solidity ^0.8.17;
library Address {
	function isContract(address account) internal view returns(bool) {
		uint256 size;
		assembly {
			size := extcodesize(account)
		}
		return size > 0;
	}

	function sendValue(address payable recipient, uint256 amount) internal {
		require(address(this).balance >= amount, "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, "Insufficient balance!");
		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);
			}
		}
	}
}

pragma solidity ^0.8.17;
abstract contract Context {
	function _msgSender() internal view virtual returns(address) {
		return msg.sender;
	}

	function _msgData() internal view virtual returns(bytes calldata) {
		return msg.data;
	}
}

pragma solidity ^0.8.17;
library Strings {
	bytes16 private constant _SYMBOLS = "0123456789abcdef";
	uint8 private constant _ADDRESS_LENGTH = 20;

	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, 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] = _SYMBOLS[value & 0xf];
			value >>= 4;
		}

		return string(buffer);
	}

	function toHexString(address addr) internal pure returns(string memory) {
		return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
	}

	function stringLength(string memory s) internal pure returns(uint256) {
		return bytes(s).length;
	}
}

pragma solidity ^0.8.17;
abstract contract ERC165 is IERC165 {
	function supportsInterface(bytes4 interfaceId) public view virtual override returns(bool) {
		return interfaceId == type(IERC165).interfaceId;
	}
}

pragma solidity ^0.8.17;
contract ERC721 is Context, ERC165, IERC721 {
	using Address for address;
	using Strings for uint256;

	mapping(uint256 => address) private _owners;
	mapping(address => uint256) private _balances;
	mapping(uint256 => address) private _tokenApprovals;
	mapping(address => mapping(address => bool)) private _operatorApprovals;

	function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns(bool) {
		return
		interfaceId == type(IERC721).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), "Not minted yet!");
		return owner;
	}

	function approve(address to, uint256 tokenId) public virtual override {
		address owner = ERC721.ownerOf(tokenId);
		require(to != owner, "Not authorized!");
		require(
			_msgSender() == owner || isApprovedForAll(owner, _msgSender()),
				"Not authorized!"
		);
		_approve(to, tokenId);
	}

	function getApproved(uint256 tokenId) public view virtual override returns(address) {
		require(_exists(tokenId), "Nonexistent token!");
		return _tokenApprovals[tokenId];
	}

	function setApprovalForAll(address operator, bool approved) public virtual override {
		require(operator != _msgSender(), "ERC721: approve to caller");
		_operatorApprovals[_msgSender()][operator] = approved;
		emit ApprovalForAll(_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), "Not authorized!");
		_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), "Not authorized!");
		_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), "Attempted 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), "Token does not exist!");
		address owner = ERC721.ownerOf(tokenId);
		return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, 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 {
		_balances[to] += 1;
		_owners[tokenId] = to;
		emit Transfer(address(0), to, tokenId);
	}

	function _transfer(address from, address to, uint256 tokenId) internal virtual {
		require(ERC721.ownerOf(tokenId) == from, "Not authorized!");
		require(to != address(0), "Cannot transfer to zero addy!");
		require(to != address(0), "Cannot transfer to zero addy!");
		require(tokenId > 0, "Cannot transfer token 0!");
		_approve(address(0), tokenId);
		_balances[from] -= 1;
		_balances[to] += 1;
		_owners[tokenId] = to;
		emit Transfer(from, to, tokenId);
	}

	function _approve(address to, uint256 tokenId) internal virtual {
		_tokenApprovals[tokenId] = to;
		emit Approval(ERC721.ownerOf(tokenId), to, tokenId);
	}

	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;
		}
	}
}

pragma solidity ^0.8.17;
contract Ownable {
	string public constant NOT_CURRENT_OWNER = "018001";
	string public constant CANNOT_TRANSFER_TO_ZERO_ADDRESS = "018002";
	address public owner;
	event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

	constructor() {
		owner = msg.sender;
	}

	modifier onlyOwner() {
		require(msg.sender == owner, NOT_CURRENT_OWNER);
		_;
	}

	function transferOwnership(address _newOwner) public onlyOwner {
		require(_newOwner != address(0), CANNOT_TRANSFER_TO_ZERO_ADDRESS);
		emit OwnershipTransferred(owner, _newOwner);
		owner = _newOwner;
	}
}

pragma solidity ^0.8.17;
library Base64 {
	string internal constant _TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";

	function encode(bytes memory data) internal pure returns(string memory) {
		if(data.length == 0) return "";
		string memory table = _TABLE;
		string memory result = new string(4 * ((data.length + 2) / 3));

		assembly {
			let tablePtr := add(table, 1)
			let resultPtr := add(result, 32)
			for {
				let dataPtr := data
				let endPtr := add(data, mload(data))
			} lt(dataPtr, endPtr) {

			} {
				dataPtr := add(dataPtr, 3)
				let input := mload(dataPtr)
				mstore8(resultPtr, mload(add(tablePtr, and(shr(18, input), 0x3F))))
				resultPtr := add(resultPtr, 1) // Advance
				mstore8(resultPtr, mload(add(tablePtr, and(shr(12, input), 0x3F))))
				resultPtr := add(resultPtr, 1) // Advance
				mstore8(resultPtr, mload(add(tablePtr, and(shr(6, input), 0x3F))))
				resultPtr := add(resultPtr, 1) // Advance
				mstore8(resultPtr, mload(add(tablePtr, and(input, 0x3F))))
				resultPtr := add(resultPtr, 1) // Advance
			}

			switch mod(mload(data), 3)
			case 1 {
				mstore8(sub(resultPtr, 1), 0x3d)
				mstore8(sub(resultPtr, 2), 0x3d)
			}
			case 2 {
				mstore8(sub(resultPtr, 1), 0x3d)
			}
		}

		return result;
	}
}

pragma solidity ^0.8.17;
contract Etherwriter is Context, ERC721 {
	struct Texts {
		string texta;
		string textb;
		string textc;
		string textd;
		string color;
	}

	bool private _paused = true;

	uint256 private _mintFee = 194600000000000000; //194600000000000000, 0.1946 ETH
	uint256 private _mintedTokens = 0;
	uint256 private _maxCap = 10000; // 0 to 9999.
	address private _smartContractOwner = 0x4DaE7E6c0Ca196643012cDc526bBc6b445A2ca59;

	mapping(uint256 => Texts) private tokenData;

	string private _name = 'Etherwriter';
	string private _symbol = 'EWR';
	string private _description = '140 characters of pure freedom.';
	string private _strWebsite = 'https://arielbecker.com/etherwriter/';
	string private _strCoverImage = string(abi.encodePacked(_strWebsite, 'logo.png'));
	string private _strPaused = "Contract is paused.";
	string private _strNotAuthorized = 'Not authorized!';
	string private _strNotEnoughETH = 'Not enough ETH!';
	string private _strTransferFailed = 'Transfer failed.';
	string private _strOutOfBounds = 'Out of bounds!';
	string private _strTextTooLong = 'Text too long!';
	string private _strContractJSON = string(abi.encodePacked(
		'{',
			'"name": "', _name, '",',
			'"description": "', _description, '",',
			'"image": "', _strCoverImage, '",',
			'"external_link": "', _strWebsite, '",',
			'"seller_fee_basis_points": 500,',
			'"fee_recipient": "0x4DaE7E6c0Ca196643012cDc526bBc6b445A2ca59"',
		'}'
	));

	string private _font = '@font-face{font-family:"Xe";font-style:normal;font-weight:400;font-stretch:100%;src:url(data:font/woff2;base64,d09GMgABAAAAACfYABIAAAAASUgAACdzAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGkQbMByDEgZgAIJSCIF0CZ8UEQgK1QTERAuBSAABNgIkA4FOBCAFhmMHgXkMhTsbBj8VctNpuR2QqDf3IxiF9Gpw+gv4//rANpY12i8gDg5C2RrKSFIOSxPkoruNL0YcefnqbT/to/vFwRQM3wk3VHzWbRg8QelpXPl1G09WkHgVoeGXR0t7G8Qt01QYLgPTMAHOHKGxT5Jci3Jp1aMRLFohtOKNZHPWFEDFstfAC7kouFqZIeE9IB0+gZ75KkD3uhfRlx9PJA3QqWFIkSLxJXeJ7wJexAu1pm1KjG47ssP/d/aLwxvdDxYPz9+7c+//jU0W8LS0rYu+QYNKOUs0f/+3NP0z82f6tqJyWl2pu+c9ae9sy01yKsoLLBXgTFpFpKK8QHeaynwBKCw0gWHpDycq6pM6TV6jAsLay7Q98bT8/HOYjCDLkJZttyw7y/RLOk0XeJCSrZ+pCHBgKMKy2Ot5LT0CB/zS1tuMCec7+lUytKptH2jXMeEsYmv+gbTkcpAdxq7qy5Knw/nhkc//ND/pk+Si7d3/7JktaYU3FLiEBUC9+96TXpHsN7K9kTQuU1Jm7C0znvnOeH51AWNvLWjhnqDAUv23lIZSaoVhOWEsHCWwARZAUBiNainT7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DC,U+2000-206F,U+2074,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;}';

	event ChangedText(address indexed Owner, uint256 indexed tokenId, string firstLine, string secondLine, string thirdLine, string fourthLine);

	modifier onlyAdmin {
		require(_msgSender() == _smartContractOwner, _strNotAuthorized);
		_;
	}

	modifier onlyOwner(uint256 tokenId) {
		require(_msgSender() == ownerOf(tokenId), _strNotAuthorized);
		_;
	}

	constructor() ERC721() {
		_smartContractOwner = msg.sender;
	}

	// Aux internal functions

	function _createTextBlock(uint256 tokenId, uint256 level) private view returns(string memory) {
		string memory text = tokenData[tokenId].texta;
		if(level == 1) {
			text = tokenData[tokenId].textb;
		}
		if(level == 2) {
			text = tokenData[tokenId].textc;
		}
		else if(level == 3) {
			text = tokenData[tokenId].textd;
		}

		return string(
			abi.encodePacked(
				'<text visibility="hidden" x="100" y="', Strings.toString(level), '90" font-family="Xe" font-size="40" fill="', tokenData[tokenId].color, '">',
				text
			)
		);
	}

	function _determineColor(uint256 _tokenId) private pure returns(string memory) {
		string memory _color = '#888888';
		if(_tokenId == 0) {
			// 1, token 0, electric pink, 0.01%, non-transferrable.
			_color = '#F9016A';
		}
		else if(_tokenId > 0 && _tokenId < 11) {
			// 10, 1 to 10, phosphor cerulean, 0.1%.
			_color = '#01B3F9';
		}
		else if(_tokenId > 10 && _tokenId < 111) {
			//100, 11 to 110, phosphor red, 1%.
			_color = '#FF1900';
		}
		else if(_tokenId > 110 && _tokenId < 1111) {
			//1000, 111 to 1110, phosphor green, 10%.
			_color = '#19FF00';
		}
		// 8889, 1111 to 9999, light gray, 88.89%.

		return _color;
	}

	function modifyTokenData(uint256 tokenId, string memory a, string memory b, string memory c, string memory d) private {
		require(Strings.stringLength(a) < 41, _strTextTooLong);
		require(Strings.stringLength(b) < 41, _strTextTooLong);
		require(Strings.stringLength(c) < 41, _strTextTooLong);
		require(Strings.stringLength(d) < 41, _strTextTooLong);

		tokenData[tokenId].texta = a;
		tokenData[tokenId].textb = b;
		tokenData[tokenId].textc = c;
		tokenData[tokenId].textd = d;
	}

	// Main public functions

	/// @dev Use this function to change the token's text.
	///	 Note: Only token's owner can change this.
	/// @param tokenId token ID.
	/// @param firstLine First line of text. Must be 40 characters or less.
	/// @param secondLine Second line of text. Must be 40 characters or less.
	/// @param thirdLine Third line of text. Must be 40 characters or less.
	/// @param fourthLine Fourth line of text. Must be 40 characters or less.
	function changeTokenText(uint256 tokenId, string memory firstLine, string memory secondLine, string memory thirdLine, string memory fourthLine) onlyOwner(tokenId) public {
		require(tokenId < _mintedTokens, _strOutOfBounds);
		modifyTokenData(tokenId, firstLine, secondLine, thirdLine, fourthLine);
		emit ChangedText(_msgSender(), tokenId, firstLine, secondLine, thirdLine, fourthLine);
	}

	/// @dev Changes the website URI.
	///	 Note: Only contract's owner can change this.
	/// @param _newWebsite New URI.
	function changeWebURI(string memory _newWebsite) onlyAdmin public {
		_strWebsite = _newWebsite;
	}

	/// @dev Returns the URI to the contract's JSON.
	///	 Note: can be a URL or a base64-encoded JSON.
	function contractURI() public view returns(string memory) {
		string memory _retValue = string(
			abi.encodePacked(
				'data:application/json;base64,',
				Base64.encode(abi.encodePacked(_strContractJSON))
			)
		);

		return _retValue;
	}

	/// @dev Creates a dynamic base-64 representation of a SMIL SVG containing the token's text.
	/// @param tokenId Token ID.
	function generateAnimation(uint256 tokenId) public view returns(string memory) {
		require(tokenId < _mintedTokens, _strOutOfBounds);
		bytes memory svg = abi.encodePacked(
			'<svg xmlns="http://www.w3.org/2000/svg" version="1.1" viewBox="0 0 1010 460" width="100%" height="100%" preserveAspectRatio="xMinYMin meet" style="background-color:#0A0A0A;"><style xmlns="http://www.w3.org/2000/svg" type="text/css">',
			_font,
			'</style>',
			_createTextBlock(tokenId, 0),
			'<set begin="1" to="visible" attributeType="auto" attributeName="visibility"></set></text>',
			_createTextBlock(tokenId, 1),
			'<set begin="mv2.end" to="visible" attributeType="auto" attributeName="visibility"></set><set begin="mv8.end" to="hidden" attributeType="auto" attributeName="visibility"></set></text>',
			_createTextBlock(tokenId, 2),
			'<set begin="mv4.end" to="visible" attributeType="auto" attributeName="visibility"></set><set begin="mv8.end" to="hidden" attributeType="auto" attributeName="visibility"></set></text>',
			_createTextBlock(tokenId, 3),
			'<set begin="mv6.end" to="visible" attributeType="auto" attributeName="visibility"></set><set begin="mv8.end" to="hidden" attributeType="auto" attributeName="visibility"></set></text><g><rect x="100" y="40" width="30" height="60" fill="', tokenData[tokenId].color, '"><animate id="bl1" begin="1; mv8.end" to="#0A0A0A" dur="0.5s" repeatCount="2" attributeType="auto" attributeName="fill"></animate><animate id="bl2" begin="mv1.end" to="#0A0A0A" dur="0.5s" repeatCount="2" attributeType="auto" attributeName="fill"></animate><animate id="bl3" begin="mv2.end" to="#0A0A0A" dur="0.5s" repeatCount="2" attributeType="auto" attributeName="fill"></animate><animate id="bl4" begin="mv3.end" to="#0A0A0A" dur="0.5s" repeatCount="2" attributeType="auto" attributeName="fill"></animate><animate id="bl5" begin="mv4.end" to="#0A0A0A" dur="0.5s" repeatCount="2" attributeType="auto" attributeName="fill"></animate><animate id="bl6" begin="mv5.end" to="#0A0A0A" dur="0.5s" repeatCount="2" attributeType="auto" attributeName="fill"></animate><animate id="bl7" begin="mv6.end" to="#0A0A0A" dur="0.5s" repeatCount="2" attributeType="auto" attributeName="fill"></animate><animate id="bl8" begin="mv7.end" to="#0A0A0A" dur="0.5s" repeatCount="10" attributeType="auto" attributeName="fill"></animate><set begin="mv2.begin" to="140" fill="freeze" attributeType="auto" attributeName="y"></set><set begin="mv4.begin" to="240" fill="freeze" attributeType="auto" attributeName="y"></set><set begin="mv6.begin" to="340" fill="freeze" attributeType="auto" attributeName="y"></set><set begin="mv8.begin" to="40" fill="freeze" attributeType="auto" attributeName="y"></set></rect><rect x="125" y="40" width="800" height="60" fill="#0A0A0A"><set begin="mv2.begin" to="140" fill="freeze" attributeType="auto" attributeName="y"></set><set begin="mv4.begin" to="240" fill="freeze" attributeType="auto" attributeName="y"></set><set begin="mv6.begin" to="340" fill="freeze" attributeType="auto" attributeName="y"></set><set begin="mv8.begin" to="40" fill="freeze" attributeType="auto" attributeName="y"></set></rect><animateTransform id="mv1" begin="bl1.end" attributeName="transform" type="translate" from="0,0" to="20,0" dur="0.05s" accumulate="sum" calcMode="discrete" repeatCount="',
			Strings.toString(Strings.stringLength(tokenData[tokenId].texta)),
			'" fill="freeze"></animateTransform><animateTransform id="mv2" begin="bl2.end" attributeName="transform" type="translate" from="456,0" to="0,0" dur="0.05s" fill="freeze"></animateTransform><animateTransform id="mv3" begin="bl3.end" attributeName="transform" type="translate" from="0,0" to="20,0" dur="0.05s" accumulate="sum" calcMode="discrete" repeatCount="',
			Strings.toString(Strings.stringLength(tokenData[tokenId].textb)),
			'" fill="freeze"></animateTransform><animateTransform id="mv4" begin="bl4.end" attributeName="transform" type="translate" from="456,0" to="0,0" dur="0.05s" fill="freeze"></animateTransform><animateTransform id="mv5" begin="bl5.end" attributeName="transform" type="translate" from="0,0" to="20,0" dur="0.05s" accumulate="sum" calcMode="discrete" repeatCount="',
			Strings.toString(Strings.stringLength(tokenData[tokenId].textc)),
			'" fill="freeze"></animateTransform><animateTransform id="mv6" begin="bl6.end" attributeName="transform" type="translate" from="456,0" to="0,0" dur="0.05s" fill="freeze"></animateTransform><animateTransform id="mv7" begin="bl7.end" attributeName="transform" type="translate" from="0,0" to="20,0" dur="0.05s" accumulate="sum" calcMode="discrete" repeatCount="',
			Strings.toString(Strings.stringLength(tokenData[tokenId].textd)),
			'" fill="freeze"></animateTransform><animateTransform id="mv8" begin="bl8.end" attributeName="transform" type="translate" from="456,0" to="0,0" dur="0.05s" fill="freeze"></animateTransform></g></svg>'
		);

		return string(
			abi.encodePacked(
				'data:image/svg+xml;base64,',
				Base64.encode(svg)
			)
		);
	}

	/// @dev Mints a new token with the specified lines of text.
	/// @param firstLine First line of text. Must be 40 characters or less.
	/// @param secondLine Second line of text. Must be 40 characters or less.
	/// @param thirdLine Third line of text. Must be 40 characters or less.
	/// @param fourthLine Fourth line of text. Must be 40 characters or less.
	function mint(string memory firstLine, string memory secondLine, string memory thirdLine, string memory fourthLine) public payable {
		uint256 index = _mintedTokens;
		require(!_paused, _strPaused);
		require(index >= 0, _strOutOfBounds);
		require(index < _maxCap, _strOutOfBounds);

		if(_msgSender() != _smartContractOwner) {
			require(msg.value >= _mintFee, _strNotEnoughETH);
		}

		modifyTokenData(index, firstLine, secondLine, thirdLine, fourthLine);
		tokenData[index].color = _determineColor(index);

		_mintedTokens++;
		_mint(_msgSender(), index);
	}

	/// @dev Returns the contract's name.
	function name() public view returns(string memory) {
		return _name;
	}

	/// @dev Pauses the contract.
	///	 Note: Only contract's owner can change this.
	function pause() onlyAdmin public {
		_paused = true;
	}

	/// @dev Returns the contract's symbol, or ticker.
	function symbol() public view returns(string memory) {
		return _symbol;
	}

	/// @dev Returns a base64-encoded JSON that describes the given tokenID
	/// @param tokenId Token ID.
	function tokenURI(uint256 tokenId) public view returns(string memory) {
		require(tokenId < _mintedTokens, _strOutOfBounds);
		return string(
			abi.encodePacked(
				'data:application/json;base64,',
				Base64.encode(abi.encodePacked(
					'{',
						'"name": "Etherwriter #', Strings.toString(tokenId), '",',
						'"description": "', _description, '",',
						'"attributes": [',
							'{',
								'"trait_type": "Color", ',
								'"value": "', tokenData[tokenId].color, '"',
							'}',
						'],',
						'"animation_url": "', generateAnimation(tokenId), '",',
						'"cover": "', _strCoverImage, '",',
						'"l1": "', tokenData[tokenId].texta, '",',
						'"l2": "', tokenData[tokenId].textb, '",',
						'"l3": "', tokenData[tokenId].textc, '",',
						'"l4": "', tokenData[tokenId].textd, '",',
						'"c": "', tokenData[tokenId].color, '"',
					'}'
				))
			)
		);
	}

	/// @dev Unpauses the contract.
	///	 Note: Only contract's owner can change this.
	function unpause() onlyAdmin public {
		_paused = false;
	}

	/// @dev Allows to withdraw any ETH available on this contract.
	///	 Note: Only contract's owner can withdraw.
	function withdraw() public onlyAdmin payable {
		uint balance = address(this).balance;
		require(balance > 0, _strNotEnoughETH);
		(bool success, ) = (_msgSender()).call{value: balance}("");
		require(success, _strTransferFailed);
	}
}