文件 1 的 15:Address.sol
pragma solidity ^0.8.0;
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, "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);
}
}
}
}
文件 2 的 15:Context.sol
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;
}
}
文件 3 的 15:ERC165.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
abstract contract ERC165 is IERC165 {
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
文件 4 的 15:ERC721.sol
pragma solidity ^0.8.0;
import "./IERC721.sol";
import "./IERC721Receiver.sol";
import "./extensions/IERC721Metadata.sol";
import "../../utils/Address.sol";
import "../../utils/Context.sol";
import "../../utils/Strings.sol";
import "../../utils/introspection/ERC165.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 {
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), "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 || 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 {
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);
}
function _burn(uint256 tokenId) internal virtual {
address owner = ERC721.ownerOf(tokenId);
_beforeTokenTransfer(owner, address(0), tokenId);
_approve(address(0), tokenId);
_balances[owner] -= 1;
delete _owners[tokenId];
emit Transfer(owner, address(0), tokenId);
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own");
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);
}
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;
}
}
function _beforeTokenTransfer(
address from,
address to,
uint256 tokenId
) internal virtual {}
}
文件 5 的 15:ERC721Enumerable.sol
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;
_ownedTokensIndex[lastTokenId] = tokenIndex;
}
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;
_allTokensIndex[lastTokenId] = tokenIndex;
delete _allTokensIndex[tokenId];
_allTokens.pop();
}
}
文件 6 的 15:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 7 的 15:IERC721.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/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
) 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;
}
文件 8 的 15:IERC721Enumerable.sol
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 tokenId);
function tokenByIndex(uint256 index) external view returns (uint256);
}
文件 9 的 15:IERC721Metadata.sol
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);
}
文件 10 的 15:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 11 的 15:Ownable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
constructor() {
_setOwner(_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 {
_setOwner(address(0));
}
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 {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
文件 12 的 15:QuiltGenerator.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/Strings.sol";
library QuiltGenerator {
struct QuiltStruct {
uint256[5][5] patches;
uint256 quiltX;
uint256 quiltY;
uint256 quiltW;
uint256 quiltH;
uint256 xOff;
uint256 yOff;
uint256 maxX;
uint256 maxY;
uint256 patchXCount;
uint256 patchYCount;
uint256 roundness;
uint256 themeIndex;
uint256 backgroundIndex;
uint256 backgroundThemeIndex;
uint256 calmnessFactor;
bool includesSpecialPatch;
bool hovers;
bool animatedBg;
}
struct RandValues {
uint256 x;
uint256 y;
uint256 roundness;
uint256 theme;
uint256 bg;
uint256 cf;
uint256 spX;
uint256 spY;
}
function getQuiltForSeed(string memory seed)
external
pure
returns (QuiltStruct memory, string memory)
{
QuiltStruct memory quilt;
RandValues memory rand;
rand.x = random(seed, "X") % 100;
rand.y = random(seed, "Y") % 100;
if (rand.x < 1) {
quilt.patchXCount = 1;
} else if (rand.x < 10) {
quilt.patchXCount = 2;
} else if (rand.x < 60) {
quilt.patchXCount = 3;
} else if (rand.x < 90) {
quilt.patchXCount = 4;
} else {
quilt.patchXCount = 5;
}
if (quilt.patchXCount == 1) {
quilt.patchYCount = 1;
} else if (rand.y < 10) {
quilt.patchYCount = 2;
} else if (rand.y < 60) {
quilt.patchYCount = 3;
} else if (rand.y < 90) {
quilt.patchYCount = 4;
} else {
quilt.patchYCount = 5;
}
if (quilt.patchXCount == 2 && quilt.patchYCount == 5) {
quilt.patchXCount = 3;
}
if (quilt.patchYCount == 2 && quilt.patchXCount == 5) {
quilt.patchYCount = 3;
}
quilt.includesSpecialPatch = random(seed, "ISP") % 4000 > 3996;
rand.spX = random(seed, "SPX") % quilt.patchXCount;
rand.spY = random(seed, "SPY") % quilt.patchYCount;
for (uint256 col = 0; col < quilt.patchXCount; col++) {
for (uint256 row = 0; row < quilt.patchYCount; row++) {
quilt.patches[col][row] =
random(seed, string(abi.encodePacked("P", col, row))) %
15;
if (quilt.includesSpecialPatch) {
quilt.patches[rand.spX][rand.spY] = 15;
}
}
}
quilt.maxX = 64 * quilt.patchXCount + (quilt.patchXCount - 1) * 4;
quilt.maxY = 64 * quilt.patchYCount + (quilt.patchYCount - 1) * 4;
quilt.xOff = (500 - quilt.maxX) / 2;
quilt.yOff = (500 - quilt.maxY) / 2;
quilt.quiltW = quilt.maxX + 32;
quilt.quiltH = quilt.maxY + 32;
quilt.quiltX = quilt.xOff + 0 - 16;
quilt.quiltY = quilt.yOff + 0 - 16;
rand.roundness = random(seed, "R") % 100;
if (rand.roundness < 70) {
quilt.roundness = 8;
} else if (rand.roundness < 90) {
quilt.roundness = 16;
} else {
quilt.roundness = 0;
}
rand.theme = random(seed, "T") % 1000;
if (rand.theme < 115) {
quilt.themeIndex = 0;
} else if (rand.theme < 230) {
quilt.themeIndex = 1;
} else if (rand.theme < 345) {
quilt.themeIndex = 2;
} else if (rand.theme < 460) {
quilt.themeIndex = 3;
} else if (rand.theme < 575) {
quilt.themeIndex = 4;
} else if (rand.theme < 690) {
quilt.themeIndex = 5;
} else if (rand.theme < 805) {
quilt.themeIndex = 6;
} else if (rand.theme < 930) {
quilt.themeIndex = 7;
} else if (rand.theme < 990) {
quilt.themeIndex = 8;
} else {
quilt.themeIndex = 9;
}
quilt.backgroundThemeIndex = random(seed, "SBGT") % 100 > 33
? random(seed, "SBGT") % 10
: quilt.themeIndex;
rand.bg = random(seed, "BG") % 100;
if (rand.bg < 70) {
quilt.backgroundIndex = 0;
} else if (rand.bg < 80) {
quilt.backgroundIndex = 1;
} else if (rand.bg < 90) {
quilt.backgroundIndex = 2;
} else {
quilt.backgroundIndex = 3;
}
rand.cf = random(seed, "CF") % 100;
if (rand.cf < 50) {
quilt.calmnessFactor = 1;
} else if (rand.cf < 70) {
quilt.calmnessFactor = 2;
} else if (rand.cf < 95) {
quilt.calmnessFactor = 3;
} else {
quilt.calmnessFactor = 4;
}
quilt.hovers = random(seed, "H") % 100 > 90;
quilt.animatedBg = random(seed, "ABG") % 100 > 70;
string[4][10] memory colors = [
["#5c457b", "#ff8fa4", "#f9bdbd", "#fbced6"],
["#006d77", "#ffafcc", "#ffe5ef", "#bde0fe"],
["#3d405b", "#f2cc8f", "#e07a5f", "#f4f1de"],
["#333d29", "#656d4a", "#dda15e", "#c2c5aa"],
["#6d2e46", "#d5b9b2", "#a26769", "#ece2d0"],
["#006d77", "#83c5be", "#ffddd2", "#edf6f9"],
["#351f39", "#726a95", "#719fb0", "#a0c1b8"],
["#472e2a", "#e78a46", "#fac459", "#fde3ae"],
["#0d1b2a", "#2f4865", "#7b88a7", "#b4c0d0"],
["#222222", "#eeeeee", "#bbbbbb", "#eeeeee"]
];
string[16] memory patches = [
'<path fill="url(#c3)" d="M0 0h64v64H0z"/><path fill="url(#c1)" d="M0 0h64v32H0z"/><path fill="url(#c2)" d="M0 32 16 0v32H0Zm16 0L32 0v32H16Zm16 0L48 0v32H32Zm16 0L64 0v32H48Z"/><circle cx="16" cy="48" r="4" fill="url(#c1)"/><circle cx="48" cy="48" r="4" fill="url(#c1)"/>',
'<path fill="url(#c2)" d="M0 0h64v64H0z"/><path fill="url(#c1)" d="M32 0h32v64H32z"/><path fill="url(#c3)" d="M0 64 64 0v64H0Z"/><circle cx="46" cy="46" r="10" fill="url(#c2)"/>',
'<path fill="url(#c2)" d="M0 0h64v64H0z"/><path fill="url(#c1)" d="m52 16 8-16h16l-8 16v16l8 16v16H60V48l-8-16V16Zm-64 0 8-16h16L4 16v16l8 16v16H-4V48l-8-16V16Z"/><path fill="url(#c3)" d="m4 16 8-16h16l-8 16v16l8 16v16H12V48L4 32V16Zm32 0 8-16h16l-8 16v16l8 16v16H44V48l-8-16V16Z"/>',
'<path fill="url(#c1)" d="M0 0h64v64H0z"/><path fill="url(#c3)" d="M0 60h64v8H0zm0-16h64v8H0zm0-16h64v8H0zm0-16h64v8H0zM0-4h64v8H0z"/>',
'<path fill="url(#c1)" d="M0 0h64v64H0z"/><path fill="url(#c3)" d="M16 0H8L0 8v8L16 0Zm16 0h-8L0 24v8L32 0Zm16 0h-8L0 40v8L48 0Zm16 0h-8L0 56v8L64 0Zm0 16V8L8 64h8l48-48Zm0 16v-8L24 64h8l32-32Zm0 16v-8L40 64h8l16-16Zm0 16v-8l-8 8h8Z"/>',
'<path fill="url(#c3)" d="M0 0h64v64H0z"/><path fill="url(#c1)" d="M0 64 32 0v64H0Zm32 0L64 0v64H32Z"/>',
'<path fill="url(#c1)" d="M0 0h64v64H0z"/><path fill="url(#c3)" d="M0 64 64 0v64H0Z"/>',
'<path fill="url(#c3)" d="M0 0h64v64H0z"/><path fill="url(#c1)" d="M0 16V0h64L48 16V0L32 16V0L16 16V0L0 16Z"/><path fill="url(#c2)" d="M0 48V32h64L48 48V32L32 48V32L16 48V32L0 48Z"/>',
'<path fill="url(#c3)" d="M0 0h64v64H0z"/><path fill="url(#c1)" d="M0 0h48v48H0z"/><path fill="url(#c2)" d="M0 48 48 0v48H0Z"/><circle cx="23" cy="25" r="8" fill="url(#c3)"/>',
'<path fill="url(#c3)" d="M0 0h64v64H0z"/><path fill="url(#c1)" d="M0 0h32v32H0zm32 32h32v32H32z"/>',
'<path fill="url(#c1)" d="M0 0h64v64H0z"/><path fill="url(#c3)" d="M16 0 0 16v16l16-16 16 16 16-16 16 16V16L48 0 32 16 16 0Zm0 32L0 48v16l16-16 16 16 16-16 16 16V48L48 32 32 48 16 32Z"/>',
'<path fill="url(#c3)" d="M0 0h64v64H0z"/><path fill="url(#c1)" d="M8 8h40v8H8z"/><path fill="url(#c2)" d="M24 32h8v8h-8zm8-8h8v8h-8z"/><path fill="url(#c1)" d="M24 24h8v8h-8zm8 8h8v8h-8zM16 48h40v8H16z"/><path fill="url(#c2)" d="M8 16h8v40H8zm40-8h8v40h-8z"/>',
'<path fill="url(#c3)" d="M0 0h64v64H0z"/><path fill="url(#c1)" d="m24 4 8 8-8 8V4Zm0 40 8 8-8 8V44Zm-4-20-8 8-8-8h16Zm40 0-8 8-8-8h16ZM40 4l-8 8 8 8V4Zm0 40-8 8 8 8V44Zm-20-4-8-8-8 8h16Zm40 0-8-8-8 8h16Z"/><path fill="url(#c2)" d="M24 24h16v16H24z"/>',
'<path fill="url(#c1)" d="M0 0h64v64H0z"/><path fill="url(#c2)" d="m32 0 16 16-16 16V0Zm0 64L16 48l16-16v32ZM48 0l16 16-16 16V0ZM16 64 .0000014 48 16 32v32Z"/><path fill="url(#c3)" d="M0 16 16 2e-7 32 16H0Zm64 32L48 64 32 48h32ZM32 32 16 16 0 32h32Zm0 0 16 16 16-16H32Z"/>',
'<path fill="url(#c2)" d="M0 0h64v64H0z"/><path fill="url(#c3)" d="M0 0h64v64H0z"/><path fill="url(#c2)" d="M32 32-.0000014.0000019 32 5e-7V32Zm0 0 32 32H32V32Z"/><path fill="url(#c1)" d="M32 32-.00000381 64l.0000028-32H32Zm0 0L64 0v32H32Z"/>',
'<rect width="64" height="64" fill="url(#c2)"/><path fill="url(#c1)" d="M9 50v14h46V50h-2v-6h-2v-6h-2v-4h-2v-2h-4v2h-2v4H23v-4h-2v-2h-4v2h-2v4h-2v6h-2v6H9Z"/><path fill="url(#c3)" d="M11 50v14h42V50h-2v-6h-2v-6h-2v-4h-4v4h-2v2H23v-2h-2v-4h-4v4h-2v6h-2v6h-2Z"/><path fill="url(#c2)" d="M23 44v-4h4v4h-4Zm6 0v-4h6v4h-6Zm8 0v-4h4v4h-4ZM13 54h-2v8h2v-8Zm38 8v-8h2v8h-2Z"/><path fill="url(#c1)" d="M15 48v-2h2v2h2v2h-2v2h-2v-2h2v-2h-2Zm6 2v-4h4v4h-4Zm8 2v-2h2v-2h2v2h2v2h-6Zm10-2v-4h4v4h-4Zm8-4h2v2h-2v2h2v2h-2v-2h-2v-2h2v-2Z"/>'
];
string[4] memory backgrounds = [
string(
abi.encodePacked(
'<pattern id="bp" width="64" height="64" patternUnits="userSpaceOnUse"><circle cx="32" cy="32" r="8" fill="transparent" stroke="url(#c1)" stroke-width="1" opacity=".6"/></pattern><filter id="bf"><feTurbulence type="fractalNoise" baseFrequency="0.2" numOctaves="1" seed="',
seed,
'"/><feDisplacementMap in="SourceGraphic" xChannelSelector="B" scale="200"/></filter><g filter="url(#bf)"><rect x="-50%" y="-50%" width="200%" height="200%" fill="url(#bp)">',
quilt.animatedBg
? '<animateTransform attributeName="transform" type="translate" dur="4s" values="0,0; 0,64;" repeatCount="indefinite"/>'
: "",
"</rect></g>"
)
),
string(
abi.encodePacked(
'<pattern id="bp" width="128" height="128" patternUnits="userSpaceOnUse"><path d="m64 16 32 32H64V16ZM128 16l32 32h-32V16ZM0 16l32 32H0V16ZM128 76l-32 32h32V76ZM64 76l-32 32h32V76Z" fill="url(#c2)"/></pattern><filter id="bf"><feTurbulence type="fractalNoise" baseFrequency="0.002" numOctaves="1" seed="',
seed,
'"/><feDisplacementMap in="SourceGraphic" scale="100"/></filter><g filter="url(#bf)"><rect x="-50%" y="-50%" width="200%" height="200%" fill="url(#bp)" opacity=".2">',
quilt.animatedBg
? '<animateTransform attributeName="transform" type="translate" dur="4s" values="0,0; 0,128;" repeatCount="indefinite"/>'
: "",
"</rect></g>"
)
),
string(
abi.encodePacked(
'<pattern id="bp" width="64" height="64" patternUnits="userSpaceOnUse"><path d="M32 0L0 32V64L32 32L64 64V32L32 0Z" fill="url(#c1)" opacity=".1"/></pattern><filter id="bf"><feTurbulence type="fractalNoise" baseFrequency="0.004" numOctaves="1" seed="',
seed,
'"/><feDisplacementMap in="SourceGraphic" scale="200"/></filter><g filter="url(#bf)"><rect x="-50%" y="-50%" width="200%" height="200%" fill="url(#bp)">',
quilt.animatedBg
? '<animateTransform attributeName="transform" type="translate" dur="4s" values="0,0; -128,0;" repeatCount="indefinite"/>'
: "",
"</rect></g>"
)
),
string(
abi.encodePacked(
'<pattern id="bp" width="80" height="40" patternUnits="userSpaceOnUse"><path d="M0 20a20 20 0 1 1 0 1M40 0a20 20 0 1 0 40 0m0 40a20 20 0 1 0 -40 0" fill="url(#c2)" opacity=".2"/></pattern><filter id="bf"><feTurbulence type="fractalNoise" baseFrequency="0.02" numOctaves="1" seed="',
seed,
'"/><feDisplacementMap in="SourceGraphic" scale="200"/></filter><g filter="url(#bf)"><rect x="-50%" y="-50%" width="200%" height="200%" fill="url(#bp)">',
quilt.animatedBg
? '<animateTransform attributeName="transform" type="translate" dur="4s" values="0,0; 0,-80;" repeatCount="indefinite"/>'
: "",
"</rect></g>"
)
)
];
string[7] memory svgParts;
for (uint256 col = 0; col < quilt.patchXCount; col++) {
for (uint256 row = 0; row < quilt.patchYCount; row++) {
uint256 x = quilt.xOff + 68 * col;
uint256 y = quilt.yOff + 68 * row;
uint256 patchPartIndex = quilt.patches[col][row];
svgParts[0] = string(
abi.encodePacked(
svgParts[0],
'<mask id="s',
Strings.toString(col + 1),
Strings.toString(row + 1),
'"><rect rx="',
Strings.toString(quilt.roundness),
'" x="',
Strings.toString(x),
'" y="',
Strings.toString(y),
'" width="64" height="64" fill="white"/></mask>'
)
);
svgParts[5] = string(
abi.encodePacked(
svgParts[5],
'<g mask="url(#s',
Strings.toString(col + 1),
Strings.toString(row + 1),
')"><g transform="translate(',
Strings.toString(x),
" ",
Strings.toString(y),
')">',
patches[patchPartIndex],
"</g></g>"
)
);
svgParts[6] = string(
abi.encodePacked(
svgParts[6],
'<rect rx="',
Strings.toString(quilt.roundness),
'" stroke-width="2" stroke-linecap="round" stroke="url(#c1)" stroke-dasharray="4 4" x="',
Strings.toString(x),
'" y="',
Strings.toString(y),
'" width="64" height="64" fill="transparent"/>'
)
);
}
}
svgParts[1] = string(
abi.encodePacked(
'<linearGradient id="c1"><stop stop-color="',
colors[quilt.themeIndex][0],
'"/></linearGradient><linearGradient id="c2"><stop stop-color="',
colors[quilt.themeIndex][1],
'"/></linearGradient><linearGradient id="c3"><stop stop-color="',
colors[quilt.themeIndex][2],
'"/></linearGradient><linearGradient id="c4"><stop stop-color="',
colors[quilt.backgroundThemeIndex][3],
'"/></linearGradient>'
)
);
svgParts[2] = backgrounds[quilt.backgroundIndex];
svgParts[3] = string(
abi.encodePacked(
'<rect transform="translate(',
Strings.toString(quilt.quiltX + 8),
" ",
Strings.toString(quilt.quiltY + 8),
')" x="0" y="0" width="',
Strings.toString(quilt.quiltW),
'" height="',
Strings.toString(quilt.quiltH),
'" rx="',
Strings.toString(
quilt.roundness == 0 ? 0 : quilt.roundness + 8
),
'" fill="url(#c1)"/>'
)
);
svgParts[4] = string(
abi.encodePacked(
'<rect x="',
Strings.toString(quilt.quiltX),
'" y="',
Strings.toString(quilt.quiltY),
'" width="',
Strings.toString(quilt.quiltW),
'" height="',
Strings.toString(quilt.quiltH),
'" rx="',
Strings.toString(
quilt.roundness == 0 ? 0 : quilt.roundness + 8
),
'" fill="url(#c2)" stroke="url(#c1)" stroke-width="2"/>'
)
);
string memory svg = string(
abi.encodePacked(
'<svg width="500" height="500" viewBox="0 0 500 500" xmlns="http://www.w3.org/2000/svg"><defs>',
svgParts[0],
svgParts[1],
'</defs><rect width="500" height="500" fill="url(#c4)"/>',
svgParts[2],
'<filter id="f" x="-50%" y="-50%" width="200%" height="200%"><feTurbulence baseFrequency="',
quilt.calmnessFactor * 3 >= 10 ? "0.0" : "0.00",
Strings.toString(quilt.calmnessFactor * 3),
'" seed="',
seed,
'"/><feDisplacementMap in="SourceGraphic" scale="10"/></filter><g><g filter="url(#f)">',
svgParts[3]
)
);
svg = string(
abi.encodePacked(
svg,
quilt.hovers
? '<animateTransform attributeName="transform" type="scale" additive="sum" dur="4s" values="1 1; 1.005 1.02; 1 1;" calcMode="spline" keySplines="0.45, 0, 0.55, 1; 0.45, 0, 0.55, 1;" repeatCount="indefinite"/>'
: "",
'</g><g filter="url(#f)">',
svgParts[4],
svgParts[5],
svgParts[6],
quilt.hovers
? '<animateTransform attributeName="transform" type="translate" dur="4s" values="0,0; -4,-16; 0,0;" calcMode="spline" keySplines="0.45, 0, 0.55, 1; 0.45, 0, 0.55, 1;" repeatCount="indefinite"/>'
: "",
"</g></g></svg>"
)
);
return (quilt, svg);
}
function random(string memory seed, string memory key)
internal
pure
returns (uint256)
{
return uint256(keccak256(abi.encodePacked(key, seed)));
}
}
文件 13 的 15:Quilts.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./QuiltGenerator.sol";
contract Quilts is ERC721Enumerable, ReentrancyGuard, Ownable {
uint256 public constant MAX_SUPPLY = 4000;
uint256 public constant PRICE = 0.025 ether;
uint256 public constant MAX_PER_TX = 10;
uint256 public constant MAX_PER_ADDRESS = 20;
uint256 public tokensMinted;
bool public isSaleActive = false;
bool public hasStitcherMinted = false;
mapping(address => uint256) private _mintedPerAddress;
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
require(tokenId > 0 && tokenId <= tokensMinted, "Invalid token ID");
QuiltGenerator.QuiltStruct memory quilt;
string memory svg;
(quilt, svg) = QuiltGenerator.getQuiltForSeed(
Strings.toString(tokenId * 4444)
);
string[10] memory colorNames = [
"Pink panther",
"Cherry blossom",
"Desert",
"Forest",
"Mushroom",
"Mint tea",
"Fairy grove",
"Pumpkin",
"Twilight",
"Black & white"
];
string[16] memory patchNames = [
"Quilty",
"Waterfront",
"Flow",
"Bengal",
"Sunbeam",
"Spires",
"Division",
"Crashing waves",
"Equilibrium",
"Ichimatsu",
"Highlands",
"Log cabin",
"Maiz",
"Flying geese",
"Pinwheel",
"Kawaii"
];
string[4] memory backgroundNames = [
"Dusty",
"Flags",
"Electric",
"Groovy"
];
string[4] memory calmnessNames = ["Serene", "Calm", "Wavey", "Chaotic"];
string memory patches;
for (uint256 col = 0; col < quilt.patchXCount; col++) {
for (uint256 row = 0; row < quilt.patchYCount; row++) {
patches = string(
abi.encodePacked(
patches,
'"',
patchNames[quilt.patches[col][row]],
'"',
col == quilt.patchXCount - 1 &&
row == quilt.patchYCount - 1
? ""
: ","
)
);
}
}
string memory attributes = string(
abi.encodePacked(
'[{"trait_type":"Background","value":"',
backgroundNames[quilt.backgroundIndex],
'"},{"trait_type":"Animated background","value":"',
quilt.animatedBg ? "Yes" : "No",
'"},{"trait_type":"Theme","value":"',
colorNames[quilt.themeIndex],
'"},{"trait_type":"Background theme","value":"',
colorNames[quilt.backgroundThemeIndex],
'"},{"trait_type":"Patches","value":[',
patches,
']},{"trait_type":"Special patch","value":"',
quilt.includesSpecialPatch ? "Yes" : "No",
'"},{"trait_type":"Patch count","value":',
Strings.toString(quilt.patchXCount * quilt.patchYCount)
)
);
attributes = string(
abi.encodePacked(
attributes,
'},{"trait_type":"Aspect ratio","value":"',
Strings.toString(quilt.patchXCount),
":",
Strings.toString(quilt.patchYCount),
'"},{"trait_type":"Calmness","value":"',
calmnessNames[quilt.calmnessFactor - 1],
'"},{"trait_type":"Hovers","value":"',
quilt.hovers ? "Yes" : "No",
'"},{"trait_type":"Roundness","value":',
Strings.toString(quilt.roundness),
"}]"
)
);
string memory json = Base64.encode(
bytes(
string(
abi.encodePacked(
'{"name":"Quilt #',
Strings.toString(tokenId),
'","description":"Generative cozy quilts stitched on-chain and stored on the Ethereum network, forever.","attributes":',
attributes,
',"image":"data:image/svg+xml;base64,',
Base64.encode(bytes(svg)),
'"}'
)
)
)
);
string memory output = string(
abi.encodePacked("data:application/json;base64,", json)
);
return output;
}
function _claim(uint256 numTokens) private {
require(totalSupply() < MAX_SUPPLY, "All quilts minted");
require(
totalSupply() + numTokens <= MAX_SUPPLY,
"Minting exceeds max supply"
);
require(numTokens <= MAX_PER_TX, "Mint fewer quilts");
require(numTokens > 0, "Must mint at least 1 quilt");
require(
_mintedPerAddress[_msgSender()] + numTokens <= MAX_PER_ADDRESS,
"Exceeds wallet limit"
);
for (uint256 i = 0; i < numTokens; i++) {
uint256 tokenId = tokensMinted + 1;
_safeMint(_msgSender(), tokenId);
tokensMinted += 1;
_mintedPerAddress[_msgSender()] += 1;
}
}
function claim(uint256 numTokens) public payable virtual {
require(isSaleActive, "Sale not active");
require(PRICE * numTokens == msg.value, "ETH amount is incorrect");
_claim(numTokens);
}
function stitcherClaim() public onlyOwner {
require(!hasStitcherMinted, "Stitcher already claimed quilts");
_claim(10);
hasStitcherMinted = true;
}
function toggleSale() public onlyOwner {
isSaleActive = !isSaleActive;
}
function withdrawAll() public payable nonReentrant onlyOwner {
require(payable(_msgSender()).send(address(this).balance));
}
constructor() ERC721("Quilts", "QLTS") {}
}
library Base64 {
bytes internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function encode(bytes memory data) internal pure returns (string memory) {
uint256 len = data.length;
if (len == 0) return "";
uint256 encodedLen = 4 * ((len + 2) / 3);
bytes memory result = new bytes(encodedLen + 32);
bytes memory table = TABLE;
assembly {
let tablePtr := add(table, 1)
let resultPtr := add(result, 32)
for {
let i := 0
} lt(i, len) {
} {
i := add(i, 3)
let input := and(mload(add(data, i)), 0xffffff)
let out := mload(add(tablePtr, and(shr(18, input), 0x3F)))
out := shl(8, out)
out := add(
out,
and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF)
)
out := shl(8, out)
out := add(
out,
and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF)
)
out := shl(8, out)
out := add(
out,
and(mload(add(tablePtr, and(input, 0x3F))), 0xFF)
)
out := shl(224, out)
mstore(resultPtr, out)
resultPtr := add(resultPtr, 4)
}
switch mod(len, 3)
case 1 {
mstore(sub(resultPtr, 2), shl(240, 0x3d3d))
}
case 2 {
mstore(sub(resultPtr, 1), shl(248, 0x3d))
}
mstore(result, encodedLen)
}
return string(result);
}
}
文件 14 的 15:ReentrancyGuard.sol
pragma solidity ^0.8.0;
abstract contract ReentrancyGuard {
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
modifier nonReentrant() {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
_;
_status = _NOT_ENTERED;
}
}
文件 15 的 15:Strings.sol
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);
}
}
{
"compilationTarget": {
"contracts/Quilts.sol": "Quilts"
},
"evmVersion": "istanbul",
"libraries": {
"contracts/QuiltGenerator.sol:QuiltGenerator": "0xb9f8163690b9694ac695afe26076d4d403276c55"
},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 200
},
"remappings": []
}
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"MAX_PER_ADDRESS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PER_TX","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_SUPPLY","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"numTokens","type":"uint256"}],"name":"claim","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"hasStitcherMinted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isSaleActive","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"stitcherClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"toggleSale","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokensMinted","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAll","outputs":[],"stateMutability":"payable","type":"function"}]