文件 1 的 22: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 的 22:Blockheads.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./ERC2981ContractWideRoyalties.sol";
import "./Utils.sol";
import "./ERC721Tradable.sol";
interface ImageDataBlock {
function getData(uint256 slot) external pure returns (bytes memory);
function getLabel(uint256 slot) external pure returns (string memory);
}
interface IERC20 {
function transfer(address recipient, uint256 amount)
external
returns (bool);
function balanceOf(address account) external view returns (uint256);
}
contract Blockheads is ERC721Tradable, ERC2981ContractWideRoyalties {
event BlockheadReconfigured(uint256 tokenId);
uint256 public constant totalAvailable = 10000;
uint256 public currentlyAvailable = 1;
uint256 public mintCost = 0.05 ether;
uint256 public nextTokenId = 1;
bool public mintingEnabled = false;
struct Overrides {
uint32 background;
uint32 body;
uint32 arms;
uint32 head;
uint32 face;
uint32 headwear;
bool backgroundOverridden;
bool bodyOverridden;
bool armsOverridden;
bool headOverridden;
bool faceOverridden;
bool headwearOverridden;
}
struct ProfessionOverride {
uint32 profession;
bool overridden;
}
mapping(uint256 => Overrides) public overrides;
mapping(uint256 => ProfessionOverride) public professionOverrides;
mapping(uint256 => string) public nameOverrides;
mapping(string => bool) birthRegistry;
address backgroundDataBlock;
address bodyDataBlock;
address armsDataBlock;
address headDataBlock;
address faceDataBlock;
address headwearDataBlock;
constructor(
address proxyRegistryAddress,
address _backgroundDataBlock,
address _bodyDataBlock,
address _armsDataBlock,
address _headDataBlock,
address _faceDataBlock,
address _headwearDataBlock
) ERC721Tradable("Blockheads", "BLOK", proxyRegistryAddress) {
_setRoyalties(msg.sender, 1000);
backgroundDataBlock = _backgroundDataBlock;
bodyDataBlock = _bodyDataBlock;
armsDataBlock = _armsDataBlock;
headDataBlock = _headDataBlock;
faceDataBlock = _faceDataBlock;
headwearDataBlock = _headwearDataBlock;
}
function mint() public payable {
require(mintingEnabled);
require(msg.value >= mintCost, "Save up your quarters");
require(nextTokenId <= currentlyAvailable, "Batch Sold Out");
require(nextTokenId <= totalAvailable, "Sold out");
_safeMint(msg.sender, nextTokenId);
nextTokenId++;
}
function buy4get1free() public payable {
require(mintingEnabled);
require(msg.value >= mintCost * 4, "Save up your quarters");
require(nextTokenId + 5 < totalAvailable, "Sold out");
require(nextTokenId + 5 <= currentlyAvailable, "Batch Sold Out");
for (uint256 i = 0; i < 5; i++) {
_safeMint(msg.sender, nextTokenId);
nextTokenId++;
}
}
function setMintingEnabled(bool _enabled) public onlyOwner {
mintingEnabled = _enabled;
}
function setCurrentlyAvailable(uint256 available) public onlyOwner {
require(available > nextTokenId);
require(available <= totalAvailable);
currentlyAvailable = available;
}
function setMintCost(uint256 newCost) public onlyOwner {
mintCost = newCost;
}
function withdraw() public onlyOwner {
payable(owner()).transfer(address(this).balance);
}
function withdrawToContract() external onlyOwner {
(bool success, ) = msg.sender.call{value: address(this).balance}("");
require(success, "Transfer failed.");
}
function withdrawERC20(address tokenContract) external onlyOwner {
IERC20 tc = IERC20(tokenContract);
tc.transfer(owner(), tc.balanceOf(address(this)));
}
function backgroundIndex(uint256 tokenId) public view returns (uint32) {
if (overrides[tokenId].backgroundOverridden) {
return overrides[tokenId].background;
}
return initialValueFor(tokenId, "bg");
}
function bodyIndex(uint256 tokenId) public view returns (uint32) {
if (overrides[tokenId].bodyOverridden) {
return overrides[tokenId].body;
}
return initialValueFor(tokenId, "body");
}
function armsIndex(uint256 tokenId) public view returns (uint32) {
if (overrides[tokenId].armsOverridden) {
return overrides[tokenId].arms;
}
return initialValueFor(tokenId, "arms");
}
function headIndex(uint256 tokenId) public view returns (uint32) {
if (overrides[tokenId].headOverridden) {
return overrides[tokenId].head;
}
return initialValueFor(tokenId, "head");
}
function faceIndex(uint256 tokenId) public view returns (uint32) {
if (overrides[tokenId].faceOverridden) {
return overrides[tokenId].face;
}
return initialValueFor(tokenId, "face");
}
function headwearIndex(uint256 tokenId) public view returns (uint32) {
if (overrides[tokenId].headwearOverridden) {
return overrides[tokenId].headwear;
}
return initialValueFor(tokenId, "headwear");
}
function professionIndex(uint256 tokenId) public view returns (uint32) {
if (professionOverrides[tokenId].overridden) {
return professionOverrides[tokenId].profession;
}
return initialValueFor(tokenId, "profession");
}
function random(bytes memory input) internal pure returns (uint256) {
return uint256(keccak256(input));
}
function initialValueFor(uint256 tokenId, string memory keyPrefix)
private
pure
returns (uint32)
{
return uint32(random(abi.encodePacked(keyPrefix, tokenId)));
}
modifier ownsBoth(uint256 token1, uint256 token2) {
require(ownerOf(token1) == msg.sender);
require(ownerOf(token2) == msg.sender);
_;
}
function swapParts(
uint256 token1,
uint256 token2,
bool background,
bool body,
bool arms,
bool heads,
bool faces,
bool headwear
) public ownsBoth(token1, token2) {
require(background || body || arms || heads || faces || headwear);
if (background) {
uint32 newBG1 = backgroundIndex(token2);
uint32 newBG2 = backgroundIndex(token1);
overrides[token1].background = newBG1;
overrides[token2].background = newBG2;
overrides[token1].backgroundOverridden = true;
overrides[token2].backgroundOverridden = true;
}
if (body) {
uint32 newBody1 = bodyIndex(token2);
uint32 newBody2 = bodyIndex(token1);
overrides[token1].body = newBody1;
overrides[token2].body = newBody2;
overrides[token1].bodyOverridden = true;
overrides[token2].bodyOverridden = true;
}
if (arms) {
uint32 newArm1 = armsIndex(token2);
uint32 newArm2 = armsIndex(token1);
overrides[token1].arms = newArm1;
overrides[token2].arms = newArm2;
overrides[token1].armsOverridden = true;
overrides[token2].armsOverridden = true;
}
if (heads) {
uint32 newHead1 = headIndex(token2);
uint32 newHead2 = headIndex(token1);
overrides[token1].head = newHead1;
overrides[token2].head = newHead2;
overrides[token1].headOverridden = true;
overrides[token2].headOverridden = true;
}
if (faces) {
uint32 newFace1 = faceIndex(token2);
uint32 newFace2 = faceIndex(token1);
overrides[token1].face = newFace1;
overrides[token2].face = newFace2;
overrides[token1].faceOverridden = true;
overrides[token2].faceOverridden = true;
}
if (headwear) {
uint32 newHeadwear1 = headwearIndex(token2);
uint32 newHeadwear2 = headwearIndex(token1);
overrides[token1].headwear = newHeadwear1;
overrides[token2].headwear = newHeadwear2;
overrides[token1].headwearOverridden = true;
overrides[token2].headwearOverridden = true;
}
emit BlockheadReconfigured(token1);
emit BlockheadReconfigured(token2);
}
function swapProfessions(uint256 token1, uint256 token2)
public
ownsBoth(token1, token2)
{
uint32 newProfession1 = professionIndex(token2);
uint32 newProfession2 = professionIndex(token1);
professionOverrides[token1].profession = newProfession1;
professionOverrides[token2].profession = newProfession2;
professionOverrides[token1].overridden = true;
professionOverrides[token2].overridden = true;
emit BlockheadReconfigured(token1);
emit BlockheadReconfigured(token2);
}
function setName(uint256 tokenId, string memory name) public {
require(ownerOf(tokenId) == msg.sender);
require(bytes(name).length > 0);
require(!birthRegistry[name]);
birthRegistry[nameOverrides[tokenId]] = false;
nameOverrides[tokenId] = name;
birthRegistry[name] = true;
emit BlockheadReconfigured(tokenId);
}
function getName(uint256 tokenId) public view returns (string memory) {
if (bytes(nameOverrides[tokenId]).length > 0) {
return nameOverrides[tokenId];
}
return string(abi.encodePacked("Blockhead #", Utils.toString(tokenId)));
}
function getProfession(uint256 tokenId)
public
view
returns (string memory)
{
string[71] memory professions = [
"Firefighter",
"Teacher",
"Solidity Engineer",
"Architect",
"Philosopher",
"Dog Trainer",
"Pilot",
"Spy",
"Astronaut",
"Groundskeeper",
"Doctor",
"Investor",
"Curator",
"Chef",
"Artist",
"Police Officer",
"Fisherman",
"Nurse",
"Botanist",
"Influencer",
"Graphic Designer",
"Businessman",
"Podcaster",
"Racecar Driver",
"Midwife",
"Plumber",
"Product Manager",
"Founder",
"Comedian",
"Super Hero",
"Scuba Diver",
"Photographer",
"Yoga Instructor",
"Carpenter",
"Singer",
"Therapist",
"Mycologist",
"Forest Ranger",
"Mail Carrier",
"Secret Agent",
"DJ",
"Magician",
"Dog Whisperer",
"Zookeeper",
"Shaman",
"Curator",
"Bus Driver",
"Construction Worker",
"Train Conductor",
"Archeologist",
"Hockey Player",
"Basketball Player",
"Baseball Player",
"Golfer",
"Scientist",
"Florist",
"Farmer",
"Ski Instructor",
"Pet Groomer",
"Concierge",
"Dentist",
"Billionaire",
"Psychoanalyst",
"Mayor",
"Retired",
"Dogecoin Investor",
"Psychic",
"Uber Driver",
"Game Designer",
"President",
"Vice President"
];
return professions[professionIndex(tokenId) % professions.length];
}
function tokenURI(uint256 tokenId)
public
view
override
returns (string memory)
{
bytes
memory svg = "<svg xmlns='http://www.w3.org/2000/svg' preserveAspectRatio='xMinYMin meet' viewBox='0 0 25 25' width='500' height='500'>";
svg = abi.encodePacked(svg, getBgData(tokenId));
svg = abi.encodePacked(svg, getBodyData(tokenId));
svg = abi.encodePacked(svg, getArmsData(tokenId));
svg = abi.encodePacked(svg, getHeadData(tokenId));
svg = abi.encodePacked(svg, getFaceData(tokenId));
svg = abi.encodePacked(svg, getHeadwearData(tokenId));
svg = abi.encodePacked(svg, "</svg>");
bytes memory jsonPt1 = abi.encodePacked(
'{"name": "',
getName(tokenId),
'", "description": "Blockheads", "image": "data:image/svg+xml;base64,',
Utils.base64Encode(svg),
'", "attributes": [{"trait_type": "Background", "value": "',
getBgLabel(tokenId),
'"}, ',
'{"trait_type": "Profession", "value": "',
getProfession(tokenId),
'"}, '
);
string memory json = Utils.base64Encode(
abi.encodePacked(
jsonPt1,
'{"trait_type": "Body", "value": "',
getBodyLabel(tokenId),
'"}, ',
'{"trait_type": "Arms", "value": "',
getArmsLabel(tokenId),
'"}, ',
'{"trait_type": "Head", "value": "',
getHeadLabel(tokenId),
'"}, ',
'{"trait_type": "Face", "value": "',
getFaceLabel(tokenId),
'"}, ',
'{"trait_type": "Headwear", "value": "',
getHeadwearLabel(tokenId),
'"}]}'
)
);
return string(abi.encodePacked("data:application/json;base64,", json));
}
function getBgData(uint256 tokenId) public view returns (bytes memory) {
ImageDataBlock bgData = ImageDataBlock(backgroundDataBlock);
return bgData.getData(backgroundIndex(tokenId));
}
function getBodyData(uint256 tokenId) public view returns (bytes memory) {
ImageDataBlock bodyData = ImageDataBlock(bodyDataBlock);
return bodyData.getData(bodyIndex(tokenId));
}
function getArmsData(uint256 tokenId) public view returns (bytes memory) {
ImageDataBlock armsData = ImageDataBlock(armsDataBlock);
return armsData.getData(armsIndex(tokenId));
}
function getHeadData(uint256 tokenId) public view returns (bytes memory) {
ImageDataBlock headData = ImageDataBlock(headDataBlock);
return headData.getData(headIndex(tokenId));
}
function getFaceData(uint256 tokenId) public view returns (bytes memory) {
ImageDataBlock faceData = ImageDataBlock(faceDataBlock);
return faceData.getData(faceIndex(tokenId));
}
function getHeadwearData(uint256 tokenId)
public
view
returns (bytes memory)
{
ImageDataBlock dataBlock = ImageDataBlock(headwearDataBlock);
return dataBlock.getData(headwearIndex(tokenId));
}
function getBgLabel(uint256 tokenId) public view returns (string memory) {
ImageDataBlock bgData = ImageDataBlock(backgroundDataBlock);
return bgData.getLabel(backgroundIndex(tokenId));
}
function getBodyLabel(uint256 tokenId) public view returns (string memory) {
ImageDataBlock bodyData = ImageDataBlock(bodyDataBlock);
return bodyData.getLabel(bodyIndex(tokenId));
}
function getArmsLabel(uint256 tokenId) public view returns (string memory) {
ImageDataBlock armsData = ImageDataBlock(armsDataBlock);
return armsData.getLabel(armsIndex(tokenId));
}
function getHeadLabel(uint256 tokenId) public view returns (string memory) {
ImageDataBlock headData = ImageDataBlock(headDataBlock);
return headData.getLabel(headIndex(tokenId));
}
function getFaceLabel(uint256 tokenId) public view returns (string memory) {
ImageDataBlock faceData = ImageDataBlock(faceDataBlock);
return faceData.getLabel(faceIndex(tokenId));
}
function getHeadwearLabel(uint256 tokenId)
public
view
returns (string memory)
{
ImageDataBlock dataBlock = ImageDataBlock(headwearDataBlock);
return dataBlock.getLabel(headwearIndex(tokenId));
}
function isMintInBox(uint256 tokenId) public view returns (bool) {
Overrides memory o = overrides[tokenId];
if (
o.backgroundOverridden ||
o.bodyOverridden ||
o.armsOverridden ||
o.headOverridden ||
o.faceOverridden ||
o.headwearOverridden
) {
return false;
}
return true;
}
function setBackgroundDataBlockAddress(address newAddr) public onlyOwner {
backgroundDataBlock = newAddr;
}
function setBodyDataBlockAddress(address newAddr) public onlyOwner {
bodyDataBlock = newAddr;
}
function setHeadDataBlockAddress(address newAddr) public onlyOwner {
headDataBlock = newAddr;
}
function setFaceDataBlockAddress(address newAddr) public onlyOwner {
faceDataBlock = newAddr;
}
function setArmsDataBlockAddress(address newAddr) public onlyOwner {
armsDataBlock = newAddr;
}
function setHeadwearDataBlockAddress(address newAddr) public onlyOwner {
headwearDataBlock = newAddr;
}
function setRoyalties(address newRoyaltiesAddr) public onlyOwner {
_setRoyalties(newRoyaltiesAddr, 1000);
}
}
文件 3 的 22:ContentMixin.sol
pragma solidity ^0.8.0;
abstract contract ContextMixin {
function msgSender()
internal
view
returns (address payable sender)
{
if (msg.sender == address(this)) {
bytes memory array = msg.data;
uint256 index = msg.data.length;
assembly {
sender := and(
mload(add(array, index)),
0xffffffffffffffffffffffffffffffffffffffff
)
}
} else {
sender = payable(msg.sender);
}
return sender;
}
}
文件 4 的 22: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;
}
}
文件 5 的 22:EIP712Base.sol
pragma solidity ^0.8.0;
import { Initializable } from "./Initializable.sol";
contract EIP712Base is Initializable {
struct EIP712Domain {
string name;
string version;
address verifyingContract;
bytes32 salt;
}
string constant public ERC712_VERSION = "1";
bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256(
bytes(
"EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)"
)
);
bytes32 internal domainSeperator;
function _initializeEIP712(
string memory name
)
internal
initializer
{
_setDomainSeperator(name);
}
function _setDomainSeperator(string memory name) internal {
domainSeperator = keccak256(
abi.encode(
EIP712_DOMAIN_TYPEHASH,
keccak256(bytes(name)),
keccak256(bytes(ERC712_VERSION)),
address(this),
bytes32(getChainId())
)
);
}
function getDomainSeperator() public view returns (bytes32) {
return domainSeperator;
}
function getChainId() public view returns (uint256) {
uint256 id;
assembly {
id := chainid()
}
return id;
}
function toTypedMessageHash(bytes32 messageHash)
internal
view
returns (bytes32)
{
return
keccak256(
abi.encodePacked("\x19\x01", getDomainSeperator(), messageHash)
);
}
}
文件 6 的 22: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;
}
}
文件 7 的 22:ERC2981ContractWideRoyalties.sol
pragma solidity ^0.8.0;
import '@openzeppelin/contracts/utils/introspection/ERC165.sol';
import './IERC2981Royalties.sol';
abstract contract ERC2981ContractWideRoyalties is IERC2981Royalties {
address private _royaltiesRecipient;
uint256 private _royaltiesValue;
function _setRoyalties(address recipient, uint256 value) internal {
require(value <= 10000, 'ERC2981Royalties: Too high');
_royaltiesRecipient = recipient;
_royaltiesValue = value;
}
function royaltyInfo(uint256, uint256 value)
external
view
override
returns (address receiver, uint256 royaltyAmount)
{
return (_royaltiesRecipient, (value * _royaltiesValue) / 10000);
}
}
文件 8 的 22: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 {}
}
文件 9 的 22: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();
}
}
文件 10 的 22:ERC721Tradable.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/ERC721.sol";
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "./common/meta-transactions/ContentMixin.sol";
import "./common/meta-transactions/NativeMetaTransaction.sol";
contract OwnableDelegateProxy {}
contract ProxyRegistry {
mapping(address => OwnableDelegateProxy) public proxies;
}
abstract contract ERC721Tradable is
ContextMixin,
ERC721Enumerable,
NativeMetaTransaction,
Ownable
{
address proxyRegistryAddress;
constructor(
string memory _name,
string memory _symbol,
address _proxyRegistryAddress
) ERC721(_name, _symbol) {
proxyRegistryAddress = _proxyRegistryAddress;
_initializeEIP712(_name);
}
function isApprovedForAll(address owner, address operator)
public
view
override
returns (bool)
{
ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress);
if (address(proxyRegistry.proxies(owner)) == operator) {
return true;
}
return super.isApprovedForAll(owner, operator);
}
function _msgSender() internal view override returns (address sender) {
return ContextMixin.msgSender();
}
function setOpenseaProxyAddress(address _proxyAddress) public onlyOwner {
proxyRegistryAddress = _proxyAddress;
}
}
文件 11 的 22:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 12 的 22:IERC2981Royalties.sol
pragma solidity ^0.8.0;
interface IERC2981Royalties {
function royaltyInfo(uint256 _tokenId, uint256 _value)
external
view
returns (address _receiver, uint256 _royaltyAmount);
}
文件 13 的 22: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;
}
文件 14 的 22: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);
}
文件 15 的 22: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);
}
文件 16 的 22:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 17 的 22:Initializable.sol
pragma solidity ^0.8.0;
contract Initializable {
bool inited = false;
modifier initializer() {
require(!inited, "already inited");
_;
inited = true;
}
}
文件 18 的 22:NativeMetaTransaction.sol
pragma solidity ^0.8.0;
import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol";
import {EIP712Base} from "./EIP712Base.sol";
contract NativeMetaTransaction is EIP712Base {
using SafeMath for uint256;
bytes32 private constant META_TRANSACTION_TYPEHASH = keccak256(
bytes(
"MetaTransaction(uint256 nonce,address from,bytes functionSignature)"
)
);
event MetaTransactionExecuted(
address userAddress,
address payable relayerAddress,
bytes functionSignature
);
mapping(address => uint256) nonces;
struct MetaTransaction {
uint256 nonce;
address from;
bytes functionSignature;
}
function executeMetaTransaction(
address userAddress,
bytes memory functionSignature,
bytes32 sigR,
bytes32 sigS,
uint8 sigV
) public payable returns (bytes memory) {
MetaTransaction memory metaTx = MetaTransaction({
nonce: nonces[userAddress],
from: userAddress,
functionSignature: functionSignature
});
require(
verify(userAddress, metaTx, sigR, sigS, sigV),
"Signer and signature do not match"
);
nonces[userAddress] = nonces[userAddress].add(1);
emit MetaTransactionExecuted(
userAddress,
payable(msg.sender),
functionSignature
);
(bool success, bytes memory returnData) = address(this).call(
abi.encodePacked(functionSignature, userAddress)
);
require(success, "Function call not successful");
return returnData;
}
function hashMetaTransaction(MetaTransaction memory metaTx)
internal
pure
returns (bytes32)
{
return
keccak256(
abi.encode(
META_TRANSACTION_TYPEHASH,
metaTx.nonce,
metaTx.from,
keccak256(metaTx.functionSignature)
)
);
}
function getNonce(address user) public view returns (uint256 nonce) {
nonce = nonces[user];
}
function verify(
address signer,
MetaTransaction memory metaTx,
bytes32 sigR,
bytes32 sigS,
uint8 sigV
) internal view returns (bool) {
require(signer != address(0), "NativeMetaTransaction: INVALID_SIGNER");
return
signer ==
ecrecover(
toTypedMessageHash(hashMetaTransaction(metaTx)),
sigV,
sigR,
sigS
);
}
}
文件 19 的 22: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);
}
}
文件 20 的 22:SafeMath.sol
pragma solidity ^0.8.0;
library SafeMath {
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
function sub(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
function div(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
function mod(
uint256 a,
uint256 b,
string memory errorMessage
) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
文件 21 的 22: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);
}
}
文件 22 的 22:Utils.sol
pragma solidity ^0.8.0;
library Utils {
bytes internal constant TABLE =
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
function base64Encode(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);
}
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);
}
}
{
"compilationTarget": {
"contracts/Blockheads.sol": "Blockheads"
},
"evmVersion": "istanbul",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs",
"useLiteralContent": true
},
"optimizer": {
"enabled": true,
"runs": 100
},
"remappings": []
}
[{"inputs":[{"internalType":"address","name":"proxyRegistryAddress","type":"address"},{"internalType":"address","name":"_backgroundDataBlock","type":"address"},{"internalType":"address","name":"_bodyDataBlock","type":"address"},{"internalType":"address","name":"_armsDataBlock","type":"address"},{"internalType":"address","name":"_headDataBlock","type":"address"},{"internalType":"address","name":"_faceDataBlock","type":"address"},{"internalType":"address","name":"_headwearDataBlock","type":"address"}],"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":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"BlockheadReconfigured","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"address payable","name":"relayerAddress","type":"address"},{"indexed":false,"internalType":"bytes","name":"functionSignature","type":"bytes"}],"name":"MetaTransactionExecuted","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":"ERC712_VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"armsIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"backgroundIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","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":"tokenId","type":"uint256"}],"name":"bodyIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"buy4get1free","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"currentlyAvailable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"},{"internalType":"bytes","name":"functionSignature","type":"bytes"},{"internalType":"bytes32","name":"sigR","type":"bytes32"},{"internalType":"bytes32","name":"sigS","type":"bytes32"},{"internalType":"uint8","name":"sigV","type":"uint8"}],"name":"executeMetaTransaction","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"faceIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"getArmsData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getArmsLabel","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getBgData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getBgLabel","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getBodyData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getBodyLabel","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getChainId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getDomainSeperator","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFaceData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFaceLabel","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getHeadData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getHeadLabel","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getHeadwearData","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getHeadwearLabel","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getName","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getNonce","outputs":[{"internalType":"uint256","name":"nonce","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getProfession","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"headIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"headwearIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"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":"uint256","name":"tokenId","type":"uint256"}],"name":"isMintInBox","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"mintCost","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"mintingEnabled","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nameOverrides","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nextTokenId","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"overrides","outputs":[{"internalType":"uint32","name":"background","type":"uint32"},{"internalType":"uint32","name":"body","type":"uint32"},{"internalType":"uint32","name":"arms","type":"uint32"},{"internalType":"uint32","name":"head","type":"uint32"},{"internalType":"uint32","name":"face","type":"uint32"},{"internalType":"uint32","name":"headwear","type":"uint32"},{"internalType":"bool","name":"backgroundOverridden","type":"bool"},{"internalType":"bool","name":"bodyOverridden","type":"bool"},{"internalType":"bool","name":"armsOverridden","type":"bool"},{"internalType":"bool","name":"headOverridden","type":"bool"},{"internalType":"bool","name":"faceOverridden","type":"bool"},{"internalType":"bool","name":"headwearOverridden","type":"bool"}],"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":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"professionIndex","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"professionOverrides","outputs":[{"internalType":"uint32","name":"profession","type":"uint32"},{"internalType":"bool","name":"overridden","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"value","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":"newAddr","type":"address"}],"name":"setArmsDataBlockAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddr","type":"address"}],"name":"setBackgroundDataBlockAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddr","type":"address"}],"name":"setBodyDataBlockAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"available","type":"uint256"}],"name":"setCurrentlyAvailable","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddr","type":"address"}],"name":"setFaceDataBlockAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddr","type":"address"}],"name":"setHeadDataBlockAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newAddr","type":"address"}],"name":"setHeadwearDataBlockAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newCost","type":"uint256"}],"name":"setMintCost","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"_enabled","type":"bool"}],"name":"setMintingEnabled","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"name","type":"string"}],"name":"setName","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_proxyAddress","type":"address"}],"name":"setOpenseaProxyAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newRoyaltiesAddr","type":"address"}],"name":"setRoyalties","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":"token1","type":"uint256"},{"internalType":"uint256","name":"token2","type":"uint256"},{"internalType":"bool","name":"background","type":"bool"},{"internalType":"bool","name":"body","type":"bool"},{"internalType":"bool","name":"arms","type":"bool"},{"internalType":"bool","name":"heads","type":"bool"},{"internalType":"bool","name":"faces","type":"bool"},{"internalType":"bool","name":"headwear","type":"bool"}],"name":"swapParts","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"token1","type":"uint256"},{"internalType":"uint256","name":"token2","type":"uint256"}],"name":"swapProfessions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","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":"totalAvailable","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":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenContract","type":"address"}],"name":"withdrawERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawToContract","outputs":[],"stateMutability":"nonpayable","type":"function"}]