编译器
0.8.12+commit.f00d7308
文件 1 的 19:Address.sol
pragma solidity ^0.8.1;
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);
}
}
}
}
文件 2 的 19:CapsuleToken.sol
pragma solidity ^0.8.8;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/interfaces/IERC2981.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./ERC721A.sol";
import "./interfaces/ICapsuleMetadata.sol";
import "./interfaces/ICapsuleRenderer.sol";
import "./interfaces/ICapsuleToken.sol";
import "./interfaces/ITypeface.sol";
error ColorAlreadyMinted(uint256 capsuleId);
error InvalidColor();
error InvalidFontForRenderer(address renderer);
error InvalidRenderer();
error NoGiftAvailable();
error NotCapsuleOwner(address owner);
error NotCapsulesTypeface();
error PureColorNotAllowed();
error ValueBelowMintPrice();
contract CapsuleToken is
ICapsuleToken,
ERC721A,
IERC2981,
Ownable,
Pausable,
ReentrancyGuard
{
modifier requireMintPrice() {
if (msg.value < MINT_PRICE) revert ValueBelowMintPrice();
_;
}
modifier requireGift() {
if (giftCountOf(msg.sender) == 0) revert NoGiftAvailable();
_;
}
modifier onlyValidFontForRenderer(Font memory font, address renderer) {
if (!isValidFontForRenderer(font, renderer))
revert InvalidFontForRenderer(renderer);
_;
}
modifier onlyValidRenderer(address renderer) {
if (!isValidRenderer(renderer)) revert InvalidRenderer();
_;
}
modifier onlyMintableColor(bytes3 color) {
uint256 capsuleId = tokenIdOfColor[color];
if (_exists(capsuleId)) revert ColorAlreadyMinted(capsuleId);
if (!isValidColor(color)) revert InvalidColor();
_;
}
modifier onlyImpureColor(bytes3 color) {
if (isPureColor(color)) revert PureColorNotAllowed();
_;
}
modifier onlyCapsulesTypeface() {
if (msg.sender != capsulesTypeface) revert NotCapsulesTypeface();
_;
}
modifier onlyCapsuleOwner(uint256 capsuleId) {
address owner = ownerOf(capsuleId);
if (owner != msg.sender) revert NotCapsuleOwner(owner);
_;
}
constructor(
address _capsulesTypeface,
address _defaultRenderer,
address _capsuleMetadata,
address _feeReceiver,
bytes3[] memory _pureColors,
uint256 _royalty
) ERC721A("Capsules", "CAPS") {
capsulesTypeface = _capsulesTypeface;
_setDefaultRenderer(_defaultRenderer);
_setMetadata(_capsuleMetadata);
_setFeeReceiver(_feeReceiver);
pureColors = _pureColors;
emit SetPureColors(_pureColors);
_setRoyalty(_royalty);
_pause();
}
uint256 public constant MINT_PRICE = 1e16;
address public immutable capsulesTypeface;
address public defaultRenderer;
address public capsuleMetadata;
mapping(bytes3 => uint256) public tokenIdOfColor;
bytes3[] public pureColors;
address public feeReceiver;
uint256 public royalty;
mapping(address => bool) internal _validRenderers;
mapping(uint256 => bytes32[8]) internal _textOf;
mapping(uint256 => bytes3) internal _colorOf;
mapping(uint256 => Font) internal _fontOf;
mapping(uint256 => address) internal _rendererOf;
mapping(address => uint256) internal _giftCount;
string internal _contractURI;
function mint(
bytes3 color,
Font calldata font,
bytes32[8] calldata text
)
external
payable
whenNotPaused
requireMintPrice
onlyImpureColor(color)
nonReentrant
returns (uint256)
{
return _mintCapsule(msg.sender, color, font, text);
}
function mintGift(
bytes3 color,
Font calldata font,
bytes32[8] calldata text
)
external
whenNotPaused
requireGift
onlyImpureColor(color)
nonReentrant
returns (uint256 capsuleId)
{
_giftCount[msg.sender]--;
capsuleId = _mintCapsule(msg.sender, color, font, text);
emit MintGift(msg.sender);
}
function mintPureColorForFont(address to, Font calldata font)
external
whenNotPaused
onlyCapsulesTypeface
nonReentrant
returns (uint256)
{
bytes32[8] memory text;
return
_mintCapsule(to, pureColorForFontWeight(font.weight), font, text);
}
function tokenURI(uint256 capsuleId)
public
view
override
returns (string memory)
{
require(_exists(capsuleId), "ERC721A: URI query for nonexistent token");
return
ICapsuleMetadata(capsuleMetadata).metadataOf(
capsuleOf(capsuleId),
svgOf(capsuleId)
);
}
function contractURI() public view returns (string memory) {
return _contractURI;
}
function svgOf(uint256 capsuleId) public view returns (string memory) {
return
ICapsuleRenderer(rendererOf(capsuleId)).svgOf(capsuleOf(capsuleId));
}
function capsuleOf(uint256 capsuleId) public view returns (Capsule memory) {
bytes3 color = _colorOf[capsuleId];
return
Capsule({
id: capsuleId,
font: _fontOf[capsuleId],
text: _textOf[capsuleId],
color: color,
isPure: isPureColor(color)
});
}
function isPureColor(bytes3 color) public view returns (bool) {
bytes3[] memory _pureColors = pureColors;
unchecked {
for (uint256 i; i < _pureColors.length; i++) {
if (color == _pureColors[i]) return true;
}
}
return false;
}
function giftCountOf(address a) public view returns (uint256) {
return _giftCount[a];
}
function colorOf(uint256 capsuleId) public view returns (bytes3) {
return _colorOf[capsuleId];
}
function textOf(uint256 capsuleId) public view returns (bytes32[8] memory) {
return _textOf[capsuleId];
}
function fontOf(uint256 capsuleId) public view returns (Font memory) {
return _fontOf[capsuleId];
}
function rendererOf(uint256 capsuleId) public view returns (address) {
if (_rendererOf[capsuleId] != address(0)) return _rendererOf[capsuleId];
return defaultRenderer;
}
function isValidFontForRenderer(Font memory font, address renderer)
public
view
returns (bool)
{
return ICapsuleRenderer(renderer).isValidFont(font);
}
function isValidRenderer(address renderer) public view returns (bool) {
return _validRenderers[renderer];
}
function isValidColor(bytes3 color) public pure returns (bool) {
if (color[0] < 0xff && color[1] < 0xff && color[2] < 0xff) {
return false;
}
unchecked {
for (uint256 i; i < 3; i++) {
if (uint8(color[i]) % 5 != 0) return false;
}
}
return true;
}
function isValidCapsuleText(uint256 capsuleId)
external
view
returns (bool)
{
return
ICapsuleRenderer(rendererOf(capsuleId)).isValidText(
textOf(capsuleId)
);
}
function withdraw() external nonReentrant {
uint256 balance = address(this).balance;
payable(feeReceiver).transfer(balance);
emit Withdraw(feeReceiver, balance);
}
function royaltyInfo(uint256, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount)
{
return (feeReceiver, (salePrice * royalty) / 1000);
}
function supportsInterface(bytes4 interfaceId)
public
view
virtual
override(IERC165, ERC721A)
returns (bool)
{
return
interfaceId == type(IERC2981).interfaceId ||
super.supportsInterface(interfaceId);
}
receive() external payable {}
function setTextAndFont(
uint256 capsuleId,
bytes32[8] calldata text,
Font calldata font
) external {
_setText(capsuleId, text);
_setFont(capsuleId, font);
}
function setText(uint256 capsuleId, bytes32[8] calldata text) external {
_setText(capsuleId, text);
}
function setFont(uint256 capsuleId, Font calldata font) external {
_setFont(capsuleId, font);
}
function setRendererOf(uint256 capsuleId, address renderer)
external
onlyCapsuleOwner(capsuleId)
onlyValidRenderer(renderer)
{
_rendererOf[capsuleId] = renderer;
emit SetCapsuleRenderer(capsuleId, renderer);
}
function burn(uint256 capsuleId) external onlyCapsuleOwner(capsuleId) {
_burn(capsuleId);
}
function mintAsOwner(
address to,
bytes3 color,
Font calldata font,
bytes32[8] calldata text
)
external
payable
onlyOwner
onlyImpureColor(color)
nonReentrant
returns (uint256)
{
return _mintCapsule(to, color, font, text);
}
function setGiftCounts(
address[] calldata addresses,
uint256[] calldata counts
) external onlyOwner {
if (addresses.length != counts.length) {
revert("Number of addresses must equal number of gift counts.");
}
for (uint256 i; i < addresses.length; i++) {
address a = addresses[i];
uint256 count = counts[i];
_giftCount[a] = count;
emit SetGiftCount(a, count);
}
}
function setDefaultRenderer(address renderer) external onlyOwner {
_setDefaultRenderer(renderer);
}
function addValidRenderer(address renderer) external onlyOwner {
_addValidRenderer(renderer);
}
function setCapsuleMetadata(address _capsuleMetadata) external onlyOwner {
_setMetadata(_capsuleMetadata);
}
function setContractURI(string calldata __contractURI) external onlyOwner {
_setContractURI(__contractURI);
}
function setFeeReceiver(address newFeeReceiver) external onlyOwner {
_setFeeReceiver(newFeeReceiver);
}
function setRoyalty(uint256 royaltyAmount) external onlyOwner {
_setRoyalty(royaltyAmount);
}
function pause() external override onlyOwner {
_pause();
}
function unpause() external override onlyOwner {
_unpause();
}
function _startTokenId() internal pure override returns (uint256) {
return 1;
}
function _mintCapsule(
address to,
bytes3 color,
Font calldata font,
bytes32[8] memory text
)
internal
onlyMintableColor(color)
onlyValidFontForRenderer(font, defaultRenderer)
returns (uint256 capsuleId)
{
_mint(to, 1, new bytes(0), false);
capsuleId = _currentIndex - 1;
tokenIdOfColor[color] = capsuleId;
_colorOf[capsuleId] = color;
_fontOf[capsuleId] = font;
_textOf[capsuleId] = text;
emit MintCapsule(capsuleId, to, color, font, text);
}
function _setText(uint256 capsuleId, bytes32[8] calldata text)
internal
onlyCapsuleOwner(capsuleId)
{
_textOf[capsuleId] = text;
emit SetCapsuleText(capsuleId, text);
}
function _setFont(uint256 capsuleId, Font calldata font)
internal
onlyCapsuleOwner(capsuleId)
onlyValidFontForRenderer(font, rendererOf(capsuleId))
{
_fontOf[capsuleId] = font;
emit SetCapsuleFont(capsuleId, font);
}
function _addValidRenderer(address renderer) internal {
_validRenderers[renderer] = true;
emit AddValidRenderer(renderer);
}
function _isEmptyText(bytes32[8] memory text) internal pure returns (bool) {
for (uint256 i; i < 8; i++) {
if (!_isEmptyLine(text[i])) return false;
}
return true;
}
function pureColorForFontWeight(uint256 fontWeight)
internal
view
returns (bytes3)
{
return pureColors[(fontWeight / 100) - 1];
}
function _isEmptyLine(bytes32 line) internal pure returns (bool) {
bytes2[16] memory _line = _bytes32ToBytes2Array(line);
for (uint256 i; i < 16; i++) {
if (_line[i] != 0) return false;
}
return true;
}
function _bytes32ToBytes2Array(bytes32 b)
internal
pure
returns (bytes2[16] memory a)
{
for (uint256 i; i < 16; i++) {
a[i] = bytes2(abi.encodePacked(b[i * 2], b[i * 2 + 1]));
}
}
function _setDefaultRenderer(address renderer) internal {
_addValidRenderer(renderer);
defaultRenderer = renderer;
emit SetDefaultRenderer(renderer);
}
function _setRoyalty(uint256 royaltyAmount) internal {
require(royaltyAmount <= 1000, "Amount too high");
royalty = royaltyAmount;
emit SetRoyalty(royaltyAmount);
}
function _setContractURI(string calldata __contractURI) internal {
_contractURI = __contractURI;
emit SetContractURI(__contractURI);
}
function _setFeeReceiver(address newFeeReceiver) internal {
feeReceiver = newFeeReceiver;
emit SetFeeReceiver(newFeeReceiver);
}
function _setMetadata(address _capsuleMetadata) internal {
capsuleMetadata = _capsuleMetadata;
emit SetMetadata(_capsuleMetadata);
}
}
文件 3 的 19: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;
}
}
文件 4 的 19: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;
}
}
文件 5 的 19:ERC721A.sol
pragma solidity ^0.8.4;
import '@openzeppelin/contracts/token/ERC721/IERC721.sol';
import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol';
import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol';
import '@openzeppelin/contracts/utils/Address.sol';
import '@openzeppelin/contracts/utils/Context.sol';
import '@openzeppelin/contracts/utils/Strings.sol';
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
error ApprovalCallerNotOwnerNorApproved();
error ApprovalQueryForNonexistentToken();
error ApproveToCaller();
error ApprovalToCurrentOwner();
error BalanceQueryForZeroAddress();
error MintedQueryForZeroAddress();
error BurnedQueryForZeroAddress();
error AuxQueryForZeroAddress();
error MintToZeroAddress();
error MintZeroQuantity();
error OwnerIndexOutOfBounds();
error OwnerQueryForNonexistentToken();
error TokenIndexOutOfBounds();
error TransferCallerNotOwnerNorApproved();
error TransferFromIncorrectOwner();
error TransferToNonERC721ReceiverImplementer();
error TransferToZeroAddress();
error URIQueryForNonexistentToken();
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
struct TokenOwnership {
address addr;
uint64 startTimestamp;
bool burned;
}
struct AddressData {
uint64 balance;
uint64 numberMinted;
uint64 numberBurned;
uint64 aux;
}
uint256 internal _currentIndex;
uint256 internal _burnCounter;
string private _name;
string private _symbol;
mapping(uint256 => TokenOwnership) internal _ownerships;
mapping(address => AddressData) private _addressData;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
_currentIndex = _startTokenId();
}
function _startTokenId() internal view virtual returns (uint256) {
return 0;
}
function totalSupply() public view returns (uint256) {
unchecked {
return _currentIndex - _burnCounter - _startTokenId();
}
}
function _totalMinted() internal view returns (uint256) {
unchecked {
return _currentIndex - _startTokenId();
}
}
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 override returns (uint256) {
if (owner == address(0)) revert BalanceQueryForZeroAddress();
return uint256(_addressData[owner].balance);
}
function _numberMinted(address owner) internal view returns (uint256) {
if (owner == address(0)) revert MintedQueryForZeroAddress();
return uint256(_addressData[owner].numberMinted);
}
function _numberBurned(address owner) internal view returns (uint256) {
if (owner == address(0)) revert BurnedQueryForZeroAddress();
return uint256(_addressData[owner].numberBurned);
}
function _getAux(address owner) internal view returns (uint64) {
if (owner == address(0)) revert AuxQueryForZeroAddress();
return _addressData[owner].aux;
}
function _setAux(address owner, uint64 aux) internal {
if (owner == address(0)) revert AuxQueryForZeroAddress();
_addressData[owner].aux = aux;
}
function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) {
uint256 curr = tokenId;
unchecked {
if (_startTokenId() <= curr && curr < _currentIndex) {
TokenOwnership memory ownership = _ownerships[curr];
if (!ownership.burned) {
if (ownership.addr != address(0)) {
return ownership;
}
while (true) {
curr--;
ownership = _ownerships[curr];
if (ownership.addr != address(0)) {
return ownership;
}
}
}
}
}
revert OwnerQueryForNonexistentToken();
}
function ownerOf(uint256 tokenId) public view override returns (address) {
return ownershipOf(tokenId).addr;
}
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) {
if (!_exists(tokenId)) revert URIQueryForNonexistentToken();
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 override {
address owner = ERC721A.ownerOf(tokenId);
if (to == owner) revert ApprovalToCurrentOwner();
if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) {
revert ApprovalCallerNotOwnerNorApproved();
}
_approve(to, tokenId, owner);
}
function getApproved(uint256 tokenId) public view override returns (address) {
if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken();
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public override {
if (operator == _msgSender()) revert ApproveToCaller();
_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 {
_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 {
_transfer(from, to, tokenId);
if (to.isContract() && !_checkContractOnERC721Received(from, to, tokenId, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
}
function _exists(uint256 tokenId) internal view returns (bool) {
return _startTokenId() <= tokenId && tokenId < _currentIndex &&
!_ownerships[tokenId].burned;
}
function _safeMint(address to, uint256 quantity) internal {
_safeMint(to, quantity, '');
}
function _safeMint(
address to,
uint256 quantity,
bytes memory _data
) internal {
_mint(to, quantity, _data, true);
}
function _mint(
address to,
uint256 quantity,
bytes memory _data,
bool safe
) internal {
uint256 startTokenId = _currentIndex;
if (to == address(0)) revert MintToZeroAddress();
if (quantity == 0) revert MintZeroQuantity();
_beforeTokenTransfers(address(0), to, startTokenId, quantity);
unchecked {
_addressData[to].balance += uint64(quantity);
_addressData[to].numberMinted += uint64(quantity);
_ownerships[startTokenId].addr = to;
_ownerships[startTokenId].startTimestamp = uint64(block.timestamp);
uint256 updatedIndex = startTokenId;
uint256 end = updatedIndex + quantity;
if (safe && to.isContract()) {
do {
emit Transfer(address(0), to, updatedIndex);
if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
revert TransferToNonERC721ReceiverImplementer();
}
} while (updatedIndex != end);
if (_currentIndex != startTokenId) revert();
} else {
do {
emit Transfer(address(0), to, updatedIndex++);
} while (updatedIndex != end);
}
_currentIndex = updatedIndex;
}
_afterTokenTransfers(address(0), to, startTokenId, quantity);
}
function _transfer(
address from,
address to,
uint256 tokenId
) private {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr ||
isApprovedForAll(prevOwnership.addr, _msgSender()) ||
getApproved(tokenId) == _msgSender());
if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved();
if (prevOwnership.addr != from) revert TransferFromIncorrectOwner();
if (to == address(0)) revert TransferToZeroAddress();
_beforeTokenTransfers(from, to, tokenId, 1);
_approve(address(0), tokenId, prevOwnership.addr);
unchecked {
_addressData[from].balance -= 1;
_addressData[to].balance += 1;
_ownerships[tokenId].addr = to;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(from, to, tokenId);
_afterTokenTransfers(from, to, tokenId, 1);
}
function _burn(uint256 tokenId) internal virtual {
TokenOwnership memory prevOwnership = ownershipOf(tokenId);
_beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
_approve(address(0), tokenId, prevOwnership.addr);
unchecked {
_addressData[prevOwnership.addr].balance -= 1;
_addressData[prevOwnership.addr].numberBurned += 1;
_ownerships[tokenId].addr = prevOwnership.addr;
_ownerships[tokenId].startTimestamp = uint64(block.timestamp);
_ownerships[tokenId].burned = true;
uint256 nextTokenId = tokenId + 1;
if (_ownerships[nextTokenId].addr == address(0)) {
if (nextTokenId < _currentIndex) {
_ownerships[nextTokenId].addr = prevOwnership.addr;
_ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp;
}
}
}
emit Transfer(prevOwnership.addr, address(0), tokenId);
_afterTokenTransfers(prevOwnership.addr, address(0), tokenId, 1);
unchecked {
_burnCounter++;
}
}
function _approve(
address to,
uint256 tokenId,
address owner
) private {
_tokenApprovals[tokenId] = to;
emit Approval(owner, to, tokenId);
}
function _checkContractOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory _data
) private returns (bool) {
try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) {
return retval == IERC721Receiver(to).onERC721Received.selector;
} catch (bytes memory reason) {
if (reason.length == 0) {
revert TransferToNonERC721ReceiverImplementer();
} else {
assembly {
revert(add(32, reason), mload(reason))
}
}
}
}
function _beforeTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
function _afterTokenTransfers(
address from,
address to,
uint256 startTokenId,
uint256 quantity
) internal virtual {}
}
文件 6 的 19:ICapsuleMetadata.sol
pragma solidity ^0.8.8;
import "./ICapsuleToken.sol";
interface ICapsuleMetadata {
function metadataOf(Capsule memory capsule, string memory image)
external
view
returns (string memory);
}
文件 7 的 19:ICapsuleRenderer.sol
pragma solidity ^0.8.8;
import "./ICapsuleToken.sol";
import "./ITypeface.sol";
interface ICapsuleRenderer {
function typeface() external view returns (address);
function svgOf(Capsule memory capsule)
external
view
returns (string memory);
function isValidFont(Font memory font) external view returns (bool);
function isValidText(bytes32[8] memory line) external view returns (bool);
}
文件 8 的 19:ICapsuleToken.sol
pragma solidity ^0.8.8;
import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ITypeface.sol";
struct Capsule {
uint256 id;
bytes3 color;
Font font;
bytes32[8] text;
bool isPure;
}
interface ICapsuleToken {
event AddValidRenderer(address renderer);
event MintCapsule(
uint256 indexed id,
address indexed to,
bytes3 indexed color,
Font font,
bytes32[8] text
);
event MintGift(address minter);
event SetDefaultRenderer(address renderer);
event SetFeeReceiver(address receiver);
event SetMetadata(address metadata);
event SetPureColors(bytes3[] colors);
event SetRoyalty(uint256 royalty);
event SetCapsuleFont(uint256 indexed id, Font font);
event SetCapsuleRenderer(uint256 indexed id, address renderer);
event SetCapsuleText(uint256 indexed id, bytes32[8] text);
event SetContractURI(string contractURI);
event SetGiftCount(address _address, uint256 count);
event Withdraw(address to, uint256 amount);
function capsuleOf(uint256 capsuleId)
external
view
returns (Capsule memory);
function isPureColor(bytes3 color) external view returns (bool);
function colorOf(uint256 capsuleId) external view returns (bytes3);
function textOf(uint256 capsuleId)
external
view
returns (bytes32[8] memory);
function fontOf(uint256 capsuleId) external view returns (Font memory);
function svgOf(uint256 capsuleId) external view returns (string memory);
function mint(
bytes3 color,
Font calldata font,
bytes32[8] memory text
) external payable returns (uint256);
function mintPureColorForFont(address to, Font calldata font)
external
returns (uint256);
function mintAsOwner(
address to,
bytes3 color,
Font calldata font,
bytes32[8] calldata text
) external payable returns (uint256);
function setGiftCounts(
address[] calldata addresses,
uint256[] calldata counts
) external;
function setTextAndFont(
uint256 capsuleId,
bytes32[8] calldata text,
Font calldata font
) external;
function setText(uint256 capsuleId, bytes32[8] calldata text) external;
function setFont(uint256 capsuleId, Font calldata font) external;
function setRendererOf(uint256 capsuleId, address renderer) external;
function setDefaultRenderer(address renderer) external;
function addValidRenderer(address renderer) external;
function burn(uint256 capsuleId) external;
function isValidFontForRenderer(Font memory font, address renderer)
external
view
returns (bool);
function isValidColor(bytes3 color) external view returns (bool);
function isValidCapsuleText(uint256 capsuleId) external view returns (bool);
function isValidRenderer(address renderer) external view returns (bool);
function contractURI() external view returns (string memory);
function withdraw() external;
function setFeeReceiver(address _feeReceiver) external;
function setRoyalty(uint256 _royalty) external;
function setContractURI(string calldata _contractURI) external;
function pause() external;
function unpause() external;
}
文件 9 的 19:IERC165.sol
pragma solidity ^0.8.0;
import "../utils/introspection/IERC165.sol";
文件 10 的 19:IERC2981.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
interface IERC2981 is IERC165 {
function royaltyInfo(uint256 tokenId, uint256 salePrice)
external
view
returns (address receiver, uint256 royaltyAmount);
}
文件 11 的 19: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;
}
文件 12 的 19: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);
function tokenByIndex(uint256 index) external view returns (uint256);
}
文件 13 的 19: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);
}
文件 14 的 19:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 15 的 19:ITypeface.sol
pragma solidity ^0.8.8;
struct Font {
uint256 weight;
string style;
}
interface ITypeface {
event SetSource(Font font);
event SetSourceHash(Font font, bytes32 sourceHash);
event SetDonationAddress(address donationAddress);
function name() external view returns (string memory);
function supportsCodePoint(bytes3 codePoint) external view returns (bool);
function sourceOf(Font memory font) external view returns (bytes memory);
function hasSource(Font memory font) external view returns (bool);
function setSource(Font memory font, bytes memory source) external;
function setDonationAddress(address donationAddress) external;
function donationAddress() external view returns (address);
}
文件 16 的 19: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() {
_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);
}
}
文件 17 的 19:Pausable.sol
pragma solidity ^0.8.0;
import "../utils/Context.sol";
abstract contract Pausable is Context {
event Paused(address account);
event Unpaused(address account);
bool private _paused;
constructor() {
_paused = false;
}
function paused() public view virtual returns (bool) {
return _paused;
}
modifier whenNotPaused() {
require(!paused(), "Pausable: paused");
_;
}
modifier whenPaused() {
require(paused(), "Pausable: not paused");
_;
}
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
文件 18 的 19: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;
}
}
文件 19 的 19: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/CapsuleToken.sol": "CapsuleToken"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 1000
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"_capsulesTypeface","type":"address"},{"internalType":"address","name":"_defaultRenderer","type":"address"},{"internalType":"address","name":"_capsuleMetadata","type":"address"},{"internalType":"address","name":"_feeReceiver","type":"address"},{"internalType":"bytes3[]","name":"_pureColors","type":"bytes3[]"},{"internalType":"uint256","name":"_royalty","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"name":"ColorAlreadyMinted","type":"error"},{"inputs":[],"name":"InvalidColor","type":"error"},{"inputs":[{"internalType":"address","name":"renderer","type":"address"}],"name":"InvalidFontForRenderer","type":"error"},{"inputs":[],"name":"InvalidRenderer","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[],"name":"NoGiftAvailable","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"NotCapsuleOwner","type":"error"},{"inputs":[],"name":"NotCapsulesTypeface","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"PureColorNotAllowed","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"ValueBelowMintPrice","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"renderer","type":"address"}],"name":"AddValidRenderer","type":"event"},{"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":"uint256","name":"id","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"bytes3","name":"color","type":"bytes3"},{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"indexed":false,"internalType":"struct Font","name":"font","type":"tuple"},{"indexed":false,"internalType":"bytes32[8]","name":"text","type":"bytes32[8]"}],"name":"MintCapsule","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"minter","type":"address"}],"name":"MintGift","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"indexed":false,"internalType":"struct Font","name":"font","type":"tuple"}],"name":"SetCapsuleFont","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"address","name":"renderer","type":"address"}],"name":"SetCapsuleRenderer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"},{"indexed":false,"internalType":"bytes32[8]","name":"text","type":"bytes32[8]"}],"name":"SetCapsuleText","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"string","name":"contractURI","type":"string"}],"name":"SetContractURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"renderer","type":"address"}],"name":"SetDefaultRenderer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"receiver","type":"address"}],"name":"SetFeeReceiver","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_address","type":"address"},{"indexed":false,"internalType":"uint256","name":"count","type":"uint256"}],"name":"SetGiftCount","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"metadata","type":"address"}],"name":"SetMetadata","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes3[]","name":"colors","type":"bytes3[]"}],"name":"SetPureColors","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"royalty","type":"uint256"}],"name":"SetRoyalty","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"MINT_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"renderer","type":"address"}],"name":"addValidRenderer","outputs":[],"stateMutability":"nonpayable","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":"capsuleId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"capsuleMetadata","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"name":"capsuleOf","outputs":[{"components":[{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes3","name":"color","type":"bytes3"},{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"internalType":"struct Font","name":"font","type":"tuple"},{"internalType":"bytes32[8]","name":"text","type":"bytes32[8]"},{"internalType":"bool","name":"isPure","type":"bool"}],"internalType":"struct Capsule","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"capsulesTypeface","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"name":"colorOf","outputs":[{"internalType":"bytes3","name":"","type":"bytes3"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultRenderer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeReceiver","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"name":"fontOf","outputs":[{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"internalType":"struct Font","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"a","type":"address"}],"name":"giftCountOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[{"internalType":"bytes3","name":"color","type":"bytes3"}],"name":"isPureColor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"name":"isValidCapsuleText","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes3","name":"color","type":"bytes3"}],"name":"isValidColor","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"internalType":"struct Font","name":"font","type":"tuple"},{"internalType":"address","name":"renderer","type":"address"}],"name":"isValidFontForRenderer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"renderer","type":"address"}],"name":"isValidRenderer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes3","name":"color","type":"bytes3"},{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"internalType":"struct Font","name":"font","type":"tuple"},{"internalType":"bytes32[8]","name":"text","type":"bytes32[8]"}],"name":"mint","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"bytes3","name":"color","type":"bytes3"},{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"internalType":"struct Font","name":"font","type":"tuple"},{"internalType":"bytes32[8]","name":"text","type":"bytes32[8]"}],"name":"mintAsOwner","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"bytes3","name":"color","type":"bytes3"},{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"internalType":"struct Font","name":"font","type":"tuple"},{"internalType":"bytes32[8]","name":"text","type":"bytes32[8]"}],"name":"mintGift","outputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"internalType":"struct Font","name":"font","type":"tuple"}],"name":"mintPureColorForFont","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","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":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"pureColors","outputs":[{"internalType":"bytes3","name":"","type":"bytes3"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"name":"rendererOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"royalty","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"salePrice","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"royaltyAmount","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":"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":[{"internalType":"address","name":"_capsuleMetadata","type":"address"}],"name":"setCapsuleMetadata","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"__contractURI","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"renderer","type":"address"}],"name":"setDefaultRenderer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newFeeReceiver","type":"address"}],"name":"setFeeReceiver","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"},{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"internalType":"struct Font","name":"font","type":"tuple"}],"name":"setFont","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"addresses","type":"address[]"},{"internalType":"uint256[]","name":"counts","type":"uint256[]"}],"name":"setGiftCounts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"},{"internalType":"address","name":"renderer","type":"address"}],"name":"setRendererOf","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"royaltyAmount","type":"uint256"}],"name":"setRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"},{"internalType":"bytes32[8]","name":"text","type":"bytes32[8]"}],"name":"setText","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"},{"internalType":"bytes32[8]","name":"text","type":"bytes32[8]"},{"components":[{"internalType":"uint256","name":"weight","type":"uint256"},{"internalType":"string","name":"style","type":"string"}],"internalType":"struct Font","name":"font","type":"tuple"}],"name":"setTextAndFont","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":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"name":"svgOf","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"name":"textOf","outputs":[{"internalType":"bytes32[8]","name":"","type":"bytes32[8]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes3","name":"","type":"bytes3"}],"name":"tokenIdOfColor","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"capsuleId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]