编译器
0.8.27+commit.40a35a09
文件 1 的 44: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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
文件 2 的 44:AddressUpgradeable.sol
pragma solidity ^0.8.1;
library AddressUpgradeable {
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 functionCallWithValue(target, data, 0, "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");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, 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) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
if (returndata.length > 0) {
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
文件 3 的 44:AdminControl.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "./IAdminControl.sol";
abstract contract AdminControl is Ownable, IAdminControl, ERC165 {
using EnumerableSet for EnumerableSet.AddressSet;
EnumerableSet.AddressSet private _admins;
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IAdminControl).interfaceId
|| super.supportsInterface(interfaceId);
}
modifier adminRequired() {
require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin");
_;
}
function getAdmins() external view override returns (address[] memory admins) {
admins = new address[](_admins.length());
for (uint i = 0; i < _admins.length(); i++) {
admins[i] = _admins.at(i);
}
return admins;
}
function approveAdmin(address admin) external override onlyOwner {
if (!_admins.contains(admin)) {
emit AdminApproved(admin, msg.sender);
_admins.add(admin);
}
}
function revokeAdmin(address admin) external override onlyOwner {
if (_admins.contains(admin)) {
emit AdminRevoked(admin, msg.sender);
_admins.remove(admin);
}
}
function isAdmin(address admin) public override view returns (bool) {
return (owner() == admin || _admins.contains(admin));
}
}
文件 4 的 44: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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
文件 5 的 44:CreatorCore.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165Checker.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol";
import "../extensions/ICreatorExtensionTokenURI.sol";
import "../extensions/ICreatorExtensionRoyalties.sol";
import "./ICreatorCore.sol";
abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 {
using Strings for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
using AddressUpgradeable for address;
uint256 internal _tokenCount = 0;
address internal _approveTransferBase;
EnumerableSet.AddressSet internal _extensions;
EnumerableSet.AddressSet internal _blacklistedExtensions;
mapping (address => string) private _extensionBaseURI;
mapping (address => bool) private _extensionBaseURIIdentical;
mapping (address => string) private _extensionURIPrefix;
mapping (uint256 => string) internal _tokenURIs;
struct RoyaltyConfig {
address payable receiver;
uint16 bps;
}
mapping (address => RoyaltyConfig[]) internal _extensionRoyalty;
mapping (uint256 => RoyaltyConfig[]) internal _tokenRoyalty;
bytes4 private constant _CREATOR_CORE_V1 = 0x28f10a21;
bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6;
bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584;
bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c;
bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a;
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(ICreatorCore).interfaceId || interfaceId == _CREATOR_CORE_V1 || super.supportsInterface(interfaceId)
|| interfaceId == _INTERFACE_ID_ROYALTIES_CREATORCORE || interfaceId == _INTERFACE_ID_ROYALTIES_RARIBLE
|| interfaceId == _INTERFACE_ID_ROYALTIES_FOUNDATION || interfaceId == _INTERFACE_ID_ROYALTIES_EIP2981;
}
function requireExtension() internal view {
require(_extensions.contains(msg.sender), "Must be registered extension");
}
function requireNonBlacklist(address extension) internal view {
require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");
}
function getExtensions() external view override returns (address[] memory extensions) {
extensions = new address[](_extensions.length());
for (uint i; i < _extensions.length();) {
extensions[i] = _extensions.at(i);
unchecked { ++i; }
}
return extensions;
}
function _registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) internal virtual {
require(extension != address(this) && extension.isContract(), "Invalid");
emit ExtensionRegistered(extension, msg.sender);
_extensionBaseURI[extension] = baseURI;
_extensionBaseURIIdentical[extension] = baseURIIdentical;
_extensions.add(extension);
_setApproveTransferExtension(extension, true);
}
function setApproveTransferExtension(bool enabled) external override {
requireExtension();
_setApproveTransferExtension(msg.sender, enabled);
}
function _setApproveTransferExtension(address extension, bool enabled) internal virtual;
function _unregisterExtension(address extension) internal {
emit ExtensionUnregistered(extension, msg.sender);
_extensions.remove(extension);
}
function _blacklistExtension(address extension) internal {
require(extension != address(0) && extension != address(this), "Cannot blacklist yourself");
if (_extensions.contains(extension)) {
emit ExtensionUnregistered(extension, msg.sender);
_extensions.remove(extension);
}
if (!_blacklistedExtensions.contains(extension)) {
emit ExtensionBlacklisted(extension, msg.sender);
_blacklistedExtensions.add(extension);
}
}
function _setBaseTokenURIExtension(string calldata uri, bool identical) internal {
_extensionBaseURI[msg.sender] = uri;
_extensionBaseURIIdentical[msg.sender] = identical;
}
function _setTokenURIPrefixExtension(string calldata prefix) internal {
_extensionURIPrefix[msg.sender] = prefix;
}
function _setTokenURIExtension(uint256 tokenId, string calldata uri) internal {
require(_tokenExtension(tokenId) == msg.sender, "Invalid token");
_tokenURIs[tokenId] = uri;
}
function _setBaseTokenURI(string calldata uri) internal {
_extensionBaseURI[address(0)] = uri;
}
function _setTokenURIPrefix(string calldata prefix) internal {
_extensionURIPrefix[address(0)] = prefix;
}
function _setTokenURI(uint256 tokenId, string calldata uri) internal {
require(tokenId > 0 && tokenId <= _tokenCount && _tokenExtension(tokenId) == address(0), "Invalid token");
_tokenURIs[tokenId] = uri;
}
function _tokenURI(uint256 tokenId) internal view returns (string memory) {
require(tokenId > 0 && tokenId <= _tokenCount, "Invalid token");
address extension = _tokenExtension(tokenId);
require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");
if (bytes(_tokenURIs[tokenId]).length != 0) {
if (bytes(_extensionURIPrefix[extension]).length != 0) {
return string(abi.encodePacked(_extensionURIPrefix[extension], _tokenURIs[tokenId]));
}
return _tokenURIs[tokenId];
}
if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionTokenURI).interfaceId)) {
return ICreatorExtensionTokenURI(extension).tokenURI(address(this), tokenId);
}
if (!_extensionBaseURIIdentical[extension]) {
return string(abi.encodePacked(_extensionBaseURI[extension], tokenId.toString()));
} else {
return _extensionBaseURI[extension];
}
}
function _getRoyalties(uint256 tokenId) view internal returns (address payable[] memory receivers, uint256[] memory bps) {
RoyaltyConfig[] memory royalties = _tokenRoyalty[tokenId];
if (royalties.length == 0) {
address extension = _tokenExtension(tokenId);
if (extension != address(0)) {
if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionRoyalties).interfaceId)) {
(receivers, bps) = ICreatorExtensionRoyalties(extension).getRoyalties(address(this), tokenId);
if (receivers.length > 0) return (receivers, bps);
}
royalties = _extensionRoyalty[extension];
}
}
if (royalties.length == 0) {
royalties = _extensionRoyalty[address(0)];
}
if (royalties.length > 0) {
receivers = new address payable[](royalties.length);
bps = new uint256[](royalties.length);
for (uint i; i < royalties.length;) {
receivers[i] = royalties[i].receiver;
bps[i] = royalties[i].bps;
unchecked { ++i; }
}
}
}
function _getRoyaltyReceivers(uint256 tokenId) view internal returns (address payable[] memory recievers) {
(recievers, ) = _getRoyalties(tokenId);
}
function _getRoyaltyBPS(uint256 tokenId) view internal returns (uint256[] memory bps) {
(, bps) = _getRoyalties(tokenId);
}
function _getRoyaltyInfo(uint256 tokenId, uint256 value) view internal returns (address receiver, uint256 amount){
(address payable[] memory receivers, uint256[] memory bps) = _getRoyalties(tokenId);
require(receivers.length <= 1, "More than 1 royalty receiver");
if (receivers.length == 0) {
return (address(this), 0);
}
return (receivers[0], bps[0]*value/10000);
}
function _setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
_checkRoyalties(receivers, basisPoints);
delete _tokenRoyalty[tokenId];
_setRoyalties(receivers, basisPoints, _tokenRoyalty[tokenId]);
emit RoyaltiesUpdated(tokenId, receivers, basisPoints);
}
function _setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) internal {
_checkRoyalties(receivers, basisPoints);
delete _extensionRoyalty[extension];
_setRoyalties(receivers, basisPoints, _extensionRoyalty[extension]);
if (extension == address(0)) {
emit DefaultRoyaltiesUpdated(receivers, basisPoints);
} else {
emit ExtensionRoyaltiesUpdated(extension, receivers, basisPoints);
}
}
function _checkRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) private pure {
require(receivers.length == basisPoints.length, "Invalid input");
uint256 totalBasisPoints;
for (uint i; i < basisPoints.length;) {
totalBasisPoints += basisPoints[i];
unchecked { ++i; }
}
require(totalBasisPoints < 10000, "Invalid total royalties");
}
function _setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints, RoyaltyConfig[] storage royalties) private {
for (uint i; i < basisPoints.length;) {
royalties.push(
RoyaltyConfig(
{
receiver: receivers[i],
bps: uint16(basisPoints[i])
}
)
);
unchecked { ++i; }
}
}
function _setApproveTransferBase(address extension) internal {
_approveTransferBase = extension;
emit ApproveTransferUpdated(extension);
}
function getApproveTransfer() external view override returns (address) {
return _approveTransferBase;
}
function _tokenExtension(uint256 tokenId) internal virtual view returns(address);
}
文件 6 的 44:ERC1155Base.sol
pragma solidity ^0.8.0;
import "./ERC1155Core.sol";
abstract contract ERC1155Base is ERC1155Core {
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
}
文件 7 的 44:ERC1155Core.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol";
import "@openzeppelin/contracts/token/ERC1155/extensions/IERC1155MetadataURI.sol";
import "@openzeppelin/contracts/utils/Address.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
abstract contract ERC1155Core is ERC165, IERC1155, IERC1155MetadataURI {
using Address for address;
string internal _name;
string internal _symbol;
mapping(uint256 => mapping(address => uint256)) private _balances;
mapping(address => mapping(address => bool)) private _operatorApprovals;
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC1155).interfaceId ||
interfaceId == type(IERC1155MetadataURI).interfaceId ||
super.supportsInterface(interfaceId);
}
function balanceOf(address account, uint256 id) public view virtual override returns (uint256) {
require(account != address(0), "ERC1155: address zero is not a valid owner");
return _balances[id][account];
}
function balanceOfBatch(address[] memory accounts, uint256[] memory ids)
public
view
virtual
override
returns (uint256[] memory)
{
require(accounts.length == ids.length, "ERC1155: accounts and ids length mismatch");
uint256[] memory batchBalances = new uint256[](accounts.length);
for (uint256 i = 0; i < accounts.length; ++i) {
batchBalances[i] = balanceOf(accounts[i], ids[i]);
}
return batchBalances;
}
function name() public view virtual returns (string memory) {
return _name;
}
function symbol() public view virtual returns (string memory) {
return _symbol;
}
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(msg.sender, operator, approved);
}
function isApprovedForAll(address account, address operator) public view virtual override returns (bool) {
return _operatorApprovals[account][operator];
}
function safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) public virtual override {
require(
from == msg.sender || isApprovedForAll(from, msg.sender),
"ERC1155: caller is not token owner or approved"
);
_safeTransferFrom(from, to, id, amount, data);
}
function safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) public virtual override {
require(
from == msg.sender || isApprovedForAll(from, msg.sender),
"ERC1155: caller is not token owner or approved"
);
_safeBatchTransferFrom(from, to, ids, amounts, data);
}
function _safeTransferFrom(
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = msg.sender;
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
emit TransferSingle(operator, from, to, id, amount);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, from, to, id, amount, data);
}
function _safeBatchTransferFrom(
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
require(to != address(0), "ERC1155: transfer to the zero address");
address operator = msg.sender;
_beforeTokenTransfer(operator, from, to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; ++i) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: insufficient balance for transfer");
unchecked {
_balances[id][from] = fromBalance - amount;
}
_balances[id][to] += amount;
}
emit TransferBatch(operator, from, to, ids, amounts);
_afterTokenTransfer(operator, from, to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, from, to, ids, amounts, data);
}
function _mint(
address to,
uint256 id,
uint256 amount,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
address operator = msg.sender;
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
_balances[id][to] += amount;
emit TransferSingle(operator, address(0), to, id, amount);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeTransferAcceptanceCheck(operator, address(0), to, id, amount, data);
}
function _mintBatch(
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {
require(to != address(0), "ERC1155: mint to the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = msg.sender;
_beforeTokenTransfer(operator, address(0), to, ids, amounts, data);
for (uint256 i = 0; i < ids.length; i++) {
_balances[ids[i]][to] += amounts[i];
}
emit TransferBatch(operator, address(0), to, ids, amounts);
_afterTokenTransfer(operator, address(0), to, ids, amounts, data);
_doSafeBatchTransferAcceptanceCheck(operator, address(0), to, ids, amounts, data);
}
function _burn(
address from,
uint256 id,
uint256 amount
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
address operator = msg.sender;
uint256[] memory ids = _asSingletonArray(id);
uint256[] memory amounts = _asSingletonArray(amount);
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
emit TransferSingle(operator, from, address(0), id, amount);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
function _burnBatch(
address from,
uint256[] memory ids,
uint256[] memory amounts
) internal virtual {
require(from != address(0), "ERC1155: burn from the zero address");
require(ids.length == amounts.length, "ERC1155: ids and amounts length mismatch");
address operator = msg.sender;
_beforeTokenTransfer(operator, from, address(0), ids, amounts, "");
for (uint256 i = 0; i < ids.length; i++) {
uint256 id = ids[i];
uint256 amount = amounts[i];
uint256 fromBalance = _balances[id][from];
require(fromBalance >= amount, "ERC1155: burn amount exceeds balance");
unchecked {
_balances[id][from] = fromBalance - amount;
}
}
emit TransferBatch(operator, from, address(0), ids, amounts);
_afterTokenTransfer(operator, from, address(0), ids, amounts, "");
}
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC1155: setting approval status for self");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
function _beforeTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _afterTokenTransfer(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) internal virtual {}
function _doSafeTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256 id,
uint256 amount,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155Received(operator, from, id, amount, data) returns (bytes4 response) {
if (response != IERC1155Receiver.onERC1155Received.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non-ERC1155Receiver implementer");
}
}
}
function _doSafeBatchTransferAcceptanceCheck(
address operator,
address from,
address to,
uint256[] memory ids,
uint256[] memory amounts,
bytes memory data
) private {
if (to.isContract()) {
try IERC1155Receiver(to).onERC1155BatchReceived(operator, from, ids, amounts, data) returns (
bytes4 response
) {
if (response != IERC1155Receiver.onERC1155BatchReceived.selector) {
revert("ERC1155: ERC1155Receiver rejected tokens");
}
} catch Error(string memory reason) {
revert(reason);
} catch {
revert("ERC1155: transfer to non-ERC1155Receiver implementer");
}
}
}
function _asSingletonArray(uint256 element) private pure returns (uint256[] memory) {
uint256[] memory array = new uint256[](1);
array[0] = element;
return array;
}
}
文件 8 的 44:ERC1155Creator.sol
pragma solidity ^0.8.0;
import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
import "./core/ERC1155CreatorCore.sol";
import "./token/ERC1155/ERC1155Base.sol";
contract ERC1155Creator is AdminControl, ERC1155Base, ERC1155CreatorCore {
using EnumerableSet for EnumerableSet.AddressSet;
mapping(uint256 => uint256) private _totalSupply;
constructor (string memory _name, string memory _symbol) ERC1155Base(_name, _symbol) {}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC1155Core, ERC1155CreatorCore, AdminControl) returns (bool) {
return ERC1155CreatorCore.supportsInterface(interfaceId) || ERC1155Core.supportsInterface(interfaceId) || AdminControl.supportsInterface(interfaceId);
}
function _beforeTokenTransfer(address, address from, address to, uint256[] memory ids, uint256[] memory amounts, bytes memory) internal virtual override {
_approveTransfer(from, to, ids, amounts);
}
function registerExtension(address extension, string calldata baseURI) external override adminRequired {
requireNonBlacklist(extension);
_registerExtension(extension, baseURI, false);
}
function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external override adminRequired {
requireNonBlacklist(extension);
_registerExtension(extension, baseURI, baseURIIdentical);
}
function unregisterExtension(address extension) external override adminRequired {
_unregisterExtension(extension);
}
function blacklistExtension(address extension) external override adminRequired {
_blacklistExtension(extension);
}
function setBaseTokenURIExtension(string calldata uri_) external override {
requireExtension();
_setBaseTokenURIExtension(uri_, false);
}
function setBaseTokenURIExtension(string calldata uri_, bool identical) external override {
requireExtension();
_setBaseTokenURIExtension(uri_, identical);
}
function setTokenURIPrefixExtension(string calldata prefix) external override {
requireExtension();
_setTokenURIPrefixExtension(prefix);
}
function setTokenURIExtension(uint256 tokenId, string calldata uri_) external override {
requireExtension();
_setTokenURIExtension(tokenId, uri_);
}
function setTokenURIExtension(uint256[] calldata tokenIds, string[] calldata uris) external override {
requireExtension();
require(tokenIds.length == uris.length, "Invalid input");
for (uint i; i < tokenIds.length;) {
_setTokenURIExtension(tokenIds[i], uris[i]);
unchecked { ++i; }
}
}
function setBaseTokenURI(string calldata uri_) external override adminRequired {
_setBaseTokenURI(uri_);
}
function setTokenURIPrefix(string calldata prefix) external override adminRequired {
_setTokenURIPrefix(prefix);
}
function setTokenURI(uint256 tokenId, string calldata uri_) external override adminRequired {
_setTokenURI(tokenId, uri_);
}
function setTokenURI(uint256[] calldata tokenIds, string[] calldata uris) external override adminRequired {
require(tokenIds.length == uris.length, "Invalid input");
for (uint i; i < tokenIds.length;) {
_setTokenURI(tokenIds[i], uris[i]);
unchecked { ++i; }
}
}
function setMintPermissions(address extension, address permissions) external override adminRequired {
_setMintPermissions(extension, permissions);
}
function mintBaseNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) public virtual override nonReentrant adminRequired returns(uint256[] memory) {
return _mintNew(address(0), to, amounts, uris);
}
function mintBaseExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) public virtual override nonReentrant adminRequired {
for (uint i; i < tokenIds.length;) {
uint256 tokenId = tokenIds[i];
require(tokenId > 0 && tokenId <= _tokenCount, "Invalid token");
require(_tokenExtension(tokenId) == address(0), "Token created by extension");
unchecked { ++i; }
}
_mintExisting(address(0), to, tokenIds, amounts);
}
function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) public virtual override nonReentrant returns(uint256[] memory tokenIds) {
requireExtension();
return _mintNew(msg.sender, to, amounts, uris);
}
function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) public virtual override nonReentrant {
requireExtension();
for (uint i; i < tokenIds.length;) {
require(_tokenExtension(tokenIds[i]) == address(msg.sender), "Token not created by this extension");
unchecked { ++i; }
}
_mintExisting(msg.sender, to, tokenIds, amounts);
}
function _mintNew(address extension, address[] calldata to, uint256[] calldata amounts, string[] calldata uris) internal returns(uint256[] memory tokenIds) {
if (to.length > 1) {
tokenIds = new uint256[](1);
require(uris.length <= 1 && (amounts.length == 1 || to.length == amounts.length), "Invalid input");
} else {
tokenIds = new uint256[](amounts.length);
require(uris.length == 0 || amounts.length == uris.length, "Invalid input");
}
for (uint i; i < tokenIds.length;) {
++_tokenCount;
tokenIds[i] = _tokenCount;
_tokensExtension[_tokenCount] = extension;
unchecked { ++i; }
}
if (extension != address(0)) {
_checkMintPermissions(to, tokenIds, amounts);
}
if (to.length == 1 && tokenIds.length == 1) {
_mint(to[0], tokenIds[0], amounts[0], new bytes(0));
} else if (to.length > 1) {
if (amounts.length == 1) {
for (uint i; i < to.length;) {
_mint(to[i], tokenIds[0], amounts[0], new bytes(0));
unchecked { ++i; }
}
} else {
for (uint i; i < to.length;) {
_mint(to[i], tokenIds[0], amounts[i], new bytes(0));
unchecked { ++i; }
}
}
} else {
_mintBatch(to[0], tokenIds, amounts, new bytes(0));
}
for (uint i; i < tokenIds.length;) {
if (i < uris.length && bytes(uris[i]).length > 0) {
_tokenURIs[tokenIds[i]] = uris[i];
}
unchecked { ++i; }
}
}
function _mintExisting(address extension, address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) internal {
if (extension != address(0)) {
_checkMintPermissions(to, tokenIds, amounts);
}
if (to.length == 1 && tokenIds.length == 1 && amounts.length == 1) {
_mint(to[0], tokenIds[0], amounts[0], new bytes(0));
} else if (to.length == 1 && tokenIds.length == amounts.length) {
_mintBatch(to[0], tokenIds, amounts, new bytes(0));
} else if (tokenIds.length == 1 && amounts.length == 1) {
for (uint i; i < to.length;) {
_mint(to[i], tokenIds[0], amounts[0], new bytes(0));
unchecked { ++i; }
}
} else if (tokenIds.length == 1 && to.length == amounts.length) {
for (uint i; i < to.length;) {
_mint(to[i], tokenIds[0], amounts[i], new bytes(0));
unchecked { ++i; }
}
} else if (to.length == tokenIds.length && to.length == amounts.length) {
for (uint i; i < to.length;) {
_mint(to[i], tokenIds[i], amounts[i], new bytes(0));
unchecked { ++i; }
}
} else {
revert("Invalid input");
}
}
function tokenExtension(uint256 tokenId) public view virtual override returns (address extension) {
extension = _tokenExtension(tokenId);
require(extension != address(0), "No extension for token");
require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");
}
function burn(address account, uint256[] calldata tokenIds, uint256[] calldata amounts) public virtual override nonReentrant {
require(account == msg.sender || isApprovedForAll(account, msg.sender), "Caller is not owner or approved");
require(tokenIds.length == amounts.length, "Invalid input");
if (tokenIds.length == 1) {
_burn(account, tokenIds[0], amounts[0]);
} else {
_burnBatch(account, tokenIds, amounts);
}
_postBurn(account, tokenIds, amounts);
}
function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external override adminRequired {
_setRoyaltiesExtension(address(0), receivers, basisPoints);
}
function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external override adminRequired {
_setRoyalties(tokenId, receivers, basisPoints);
}
function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external override adminRequired {
_setRoyaltiesExtension(extension, receivers, basisPoints);
}
function getRoyalties(uint256 tokenId) external view virtual override returns (address payable[] memory, uint256[] memory) {
return _getRoyalties(tokenId);
}
function getFees(uint256 tokenId) external view virtual override returns (address payable[] memory, uint256[] memory) {
return _getRoyalties(tokenId);
}
function getFeeRecipients(uint256 tokenId) external view virtual override returns (address payable[] memory) {
return _getRoyaltyReceivers(tokenId);
}
function getFeeBps(uint256 tokenId) external view virtual override returns (uint[] memory) {
return _getRoyaltyBPS(tokenId);
}
function royaltyInfo(uint256 tokenId, uint256 value) external view virtual override returns (address, uint256) {
return _getRoyaltyInfo(tokenId, value);
}
function uri(uint256 tokenId) public view virtual override returns (string memory) {
return _tokenURI(tokenId);
}
function totalSupply(uint256 tokenId) external view virtual override returns (uint256) {
return _totalSupply[tokenId];
}
function _mint(address account, uint256 id, uint256 amount, bytes memory data) internal virtual override {
super._mint(account, id, amount, data);
_totalSupply[id] += amount;
}
function _mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data) internal virtual override {
super._mintBatch(to, ids, amounts, data);
for (uint i; i < ids.length;) {
_totalSupply[ids[i]] += amounts[i];
unchecked { ++i; }
}
}
function _burn(address account, uint256 id, uint256 amount) internal virtual override {
super._burn(account, id, amount);
_totalSupply[id] -= amount;
}
function _burnBatch(address account, uint256[] memory ids, uint256[] memory amounts) internal virtual override {
super._burnBatch(account, ids, amounts);
for (uint i; i < ids.length;) {
_totalSupply[ids[i]] -= amounts[i];
unchecked { ++i; }
}
}
function setApproveTransfer(address extension) external override adminRequired {
_setApproveTransferBase(extension);
}
}
文件 9 的 44:ERC1155CreatorCore.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "../extensions/ERC1155/IERC1155CreatorExtensionApproveTransfer.sol";
import "../extensions/ERC1155/IERC1155CreatorExtensionBurnable.sol";
import "../permissions/ERC1155/IERC1155CreatorMintPermissions.sol";
import "./IERC1155CreatorCore.sol";
import "./CreatorCore.sol";
abstract contract ERC1155CreatorCore is CreatorCore, IERC1155CreatorCore {
uint256 constant public VERSION = 3;
using EnumerableSet for EnumerableSet.AddressSet;
mapping (address => bool) internal _extensionApproveTransfers;
mapping (address => address) internal _extensionPermissions;
mapping (uint256 => address) internal _tokensExtension;
function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorCore, IERC165) returns (bool) {
return interfaceId == type(IERC1155CreatorCore).interfaceId || super.supportsInterface(interfaceId);
}
function _setApproveTransferExtension(address extension, bool enabled) internal override {
if (ERC165Checker.supportsInterface(extension, type(IERC1155CreatorExtensionApproveTransfer).interfaceId)) {
_extensionApproveTransfers[extension] = enabled;
emit ExtensionApproveTransferUpdated(extension, enabled);
}
}
function _setMintPermissions(address extension, address permissions) internal {
require(_extensions.contains(extension), "Invalid extension");
require(permissions == address(0) || ERC165Checker.supportsInterface(permissions, type(IERC1155CreatorMintPermissions).interfaceId), "Invalid address");
if (_extensionPermissions[extension] != permissions) {
_extensionPermissions[extension] = permissions;
emit MintPermissionsUpdated(extension, permissions, msg.sender);
}
}
function _checkMintPermissions(address[] memory to, uint256[] memory tokenIds, uint256[] memory amounts) internal {
if (_extensionPermissions[msg.sender] != address(0)) {
IERC1155CreatorMintPermissions(_extensionPermissions[msg.sender]).approveMint(msg.sender, to, tokenIds, amounts);
}
}
function _postBurn(address owner, uint256[] calldata tokenIds, uint256[] calldata amounts) internal virtual {
require(tokenIds.length > 0, "Invalid input");
address extension = _tokensExtension[tokenIds[0]];
for (uint i; i < tokenIds.length;) {
require(_tokensExtension[tokenIds[i]] == extension, "Mismatched token originators");
unchecked { ++i; }
}
if (extension != address(0)) {
if (ERC165Checker.supportsInterface(extension, type(IERC1155CreatorExtensionBurnable).interfaceId)) {
IERC1155CreatorExtensionBurnable(extension).onBurn(owner, tokenIds, amounts);
}
}
}
function _approveTransfer(address from, address to, uint256[] memory tokenIds, uint256[] memory amounts) internal {
if (from == address(0)) return;
address extension = _tokensExtension[tokenIds[0]];
for (uint i; i < tokenIds.length;) {
require(_tokensExtension[tokenIds[i]] == extension, "Mismatched token originators");
unchecked { ++i; }
}
if (extension != address(0) && _extensionApproveTransfers[extension]) {
require(IERC1155CreatorExtensionApproveTransfer(extension).approveTransfer(msg.sender, from, to, tokenIds, amounts), "Extension approval failure");
} else if (_approveTransferBase != address(0)) {
require(IERC1155CreatorExtensionApproveTransfer(_approveTransferBase).approveTransfer(msg.sender, from, to, tokenIds, amounts), "Extension approval failure");
}
}
function _tokenExtension(uint256 tokenId) internal view override returns(address) {
return _tokensExtension[tokenId];
}
}
文件 10 的 44: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;
}
}
文件 11 的 44:ERC165Checker.sol
pragma solidity ^0.8.0;
import "./IERC165.sol";
library ERC165Checker {
bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff;
function supportsERC165(address account) internal view returns (bool) {
return
supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) &&
!supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID);
}
function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) {
return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId);
}
function getSupportedInterfaces(
address account,
bytes4[] memory interfaceIds
) internal view returns (bool[] memory) {
bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length);
if (supportsERC165(account)) {
for (uint256 i = 0; i < interfaceIds.length; i++) {
interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]);
}
}
return interfaceIdsSupported;
}
function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) {
if (!supportsERC165(account)) {
return false;
}
for (uint256 i = 0; i < interfaceIds.length; i++) {
if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) {
return false;
}
}
return true;
}
function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) {
bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId);
bool success;
uint256 returnSize;
uint256 returnValue;
assembly {
success := staticcall(30000, account, add(encodedParams, 0x20), mload(encodedParams), 0x00, 0x20)
returnSize := returndatasize()
returnValue := mload(0x00)
}
return success && returnSize >= 0x20 && returnValue > 0;
}
}
文件 12 的 44:ERC721Base.sol
pragma solidity ^0.8.0;
import "./ERC721Core.sol";
abstract contract ERC721Base is ERC721Core {
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
}
文件 13 的 44:ERC721Bybit.sol
pragma solidity ^0.8.27;
import "@manifoldxyz/creator-core-solidity/contracts/ERC721Creator.sol";
import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
contract ERC721Bybit is AdminControl, ERC721Creator {
constructor(
string memory _name,
string memory _symbol
) ERC721Creator(_name, _symbol) {}
function mint(
address to
) public adminRequired nonReentrant returns (uint256 tokenId) {
return _mintBase(to, "", 0);
}
function supportsInterface(
bytes4 interfaceId
) public view virtual override(ERC721Creator, AdminControl) returns (bool) {
return ERC721Creator.supportsInterface(interfaceId);
}
}
文件 14 的 44:ERC721Core.sol
pragma solidity ^0.8.0;
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/utils/Address.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
abstract contract ERC721Core is ERC165, IERC721, IERC721Metadata {
using Address for address;
using Strings for uint256;
string internal _name;
string internal _symbol;
struct TokenData {
address owner;
uint96 data;
}
mapping(uint256 => TokenData) internal _tokenData;
mapping(address => uint256) private _balances;
mapping(uint256 => address) private _tokenApprovals;
mapping(address => mapping(address => bool)) private _operatorApprovals;
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return
interfaceId == type(IERC721).interfaceId ||
interfaceId == type(IERC721Metadata).interfaceId ||
super.supportsInterface(interfaceId);
}
function balanceOf(address owner) public view virtual override returns (uint256) {
require(owner != address(0), "ERC721: address zero is not a valid owner");
return _balances[owner];
}
function ownerOf(uint256 tokenId) public view virtual override returns (address) {
address owner = _tokenData[tokenId].owner;
require(owner != address(0), "ERC721: invalid token ID");
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 approve(address to, uint256 tokenId) public virtual override {
address owner = ERC721Core.ownerOf(tokenId);
require(to != owner, "ERC721: approval to current owner");
require(
msg.sender == owner || isApprovedForAll(owner, msg.sender),
"ERC721: approve caller is not token owner or approved for all"
);
_approve(to, tokenId);
}
function getApproved(uint256 tokenId) public view virtual override returns (address) {
_requireMinted(tokenId);
return _tokenApprovals[tokenId];
}
function setApprovalForAll(address operator, bool approved) public virtual override {
_setApprovalForAll(msg.sender, 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(msg.sender, tokenId), "ERC721: caller is not token owner or 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(msg.sender, tokenId), "ERC721: caller is not token owner or 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 _tokenData[tokenId].owner != address(0);
}
function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) {
address owner = ERC721Core.ownerOf(tokenId);
return (spender == owner || isApprovedForAll(owner, spender) || getApproved(tokenId) == spender);
}
function _safeMint(address to, uint256 tokenId, uint96 tokenData) internal virtual {
_safeMint(to, tokenId, tokenData, "");
}
function _safeMint(
address to,
uint256 tokenId,
uint96 tokenData,
bytes memory data
) internal virtual {
require(to != address(0), "ERC721: mint to the zero address");
require(!_exists(tokenId), "ERC721: token already minted");
_beforeTokenTransfer(address(0), to, tokenId, tokenData);
unchecked {
_balances[to] += 1;
}
_tokenData[tokenId] = TokenData({
owner: to,
data: tokenData
});
emit Transfer(address(0), to, tokenId);
_afterTokenTransfer(address(0), to, tokenId, tokenData);
require(
_checkOnERC721Received(address(0), to, tokenId, data),
"ERC721: transfer to non ERC721Receiver implementer"
);
}
function _burn(uint256 tokenId) internal virtual {
TokenData memory tokenData = _tokenData[tokenId];
address owner = tokenData.owner;
uint96 data = tokenData.data;
_beforeTokenTransfer(owner, address(0), tokenId, data);
_approve(address(0), tokenId);
unchecked {
_balances[owner] -= 1;
}
delete _tokenData[tokenId];
emit Transfer(owner, address(0), tokenId);
_afterTokenTransfer(owner, address(0), tokenId, data);
}
function _transfer(
address from,
address to,
uint256 tokenId
) internal virtual {
TokenData memory tokenData = _tokenData[tokenId];
address owner = tokenData.owner;
require(owner == from, "ERC721: transfer from incorrect owner");
require(to != address(0), "ERC721: transfer to the zero address");
uint96 data = tokenData.data;
_beforeTokenTransfer(from, to, tokenId, data);
_approve(address(0), tokenId);
unchecked {
_balances[from] -= 1;
_balances[to] += 1;
}
_tokenData[tokenId].owner = to;
emit Transfer(from, to, tokenId);
_afterTokenTransfer(from, to, tokenId, data);
}
function _approve(address to, uint256 tokenId) internal virtual {
_tokenApprovals[tokenId] = to;
emit Approval(ERC721Core.ownerOf(tokenId), to, tokenId);
}
function _setApprovalForAll(
address owner,
address operator,
bool approved
) internal virtual {
require(owner != operator, "ERC721: approve to caller");
_operatorApprovals[owner][operator] = approved;
emit ApprovalForAll(owner, operator, approved);
}
function _requireMinted(uint256 tokenId) internal view virtual {
require(_exists(tokenId), "ERC721: invalid token ID");
}
function _checkOnERC721Received(
address from,
address to,
uint256 tokenId,
bytes memory data
) private returns (bool) {
if (to.isContract()) {
try IERC721Receiver(to).onERC721Received(msg.sender, 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,
uint96 tokenData
) internal virtual {}
function _afterTokenTransfer(
address from,
address to,
uint256 tokenId,
uint96 tokenData
) internal virtual {}
}
文件 15 的 44:ERC721Creator.sol
pragma solidity ^0.8.0;
import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
import "./core/ERC721CreatorCore.sol";
import "./token/ERC721/ERC721Base.sol";
contract ERC721Creator is AdminControl, ERC721Base, ERC721CreatorCore {
using EnumerableSet for EnumerableSet.AddressSet;
constructor (string memory _name, string memory _symbol) ERC721Base(_name, _symbol) {}
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721Core, ERC721CreatorCore, AdminControl) returns (bool) {
return ERC721CreatorCore.supportsInterface(interfaceId) || ERC721Core.supportsInterface(interfaceId) || AdminControl.supportsInterface(interfaceId);
}
function _beforeTokenTransfer(address from, address to, uint256 tokenId, uint96 data) internal virtual override {
_approveTransfer(from, to, tokenId, uint16(data));
}
function registerExtension(address extension, string calldata baseURI) external override adminRequired {
requireNonBlacklist(extension);
_registerExtension(extension, baseURI, false);
}
function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external override adminRequired {
requireNonBlacklist(extension);
_registerExtension(extension, baseURI, baseURIIdentical);
}
function unregisterExtension(address extension) external override adminRequired {
_unregisterExtension(extension);
}
function blacklistExtension(address extension) external override adminRequired {
_blacklistExtension(extension);
}
function setBaseTokenURIExtension(string calldata uri) external override {
requireExtension();
_setBaseTokenURIExtension(uri, false);
}
function setBaseTokenURIExtension(string calldata uri, bool identical) external override {
requireExtension();
_setBaseTokenURIExtension(uri, identical);
}
function setTokenURIPrefixExtension(string calldata prefix) external override {
requireExtension();
_setTokenURIPrefixExtension(prefix);
}
function setTokenURIExtension(uint256 tokenId, string calldata uri) external override {
requireExtension();
_setTokenURIExtension(tokenId, uri);
}
function setTokenURIExtension(uint256[] calldata tokenIds, string[] calldata uris) external override {
requireExtension();
require(tokenIds.length == uris.length, "Invalid input");
for (uint i; i < tokenIds.length;) {
_setTokenURIExtension(tokenIds[i], uris[i]);
unchecked { ++i; }
}
}
function setBaseTokenURI(string calldata uri) external override adminRequired {
_setBaseTokenURI(uri);
}
function setTokenURIPrefix(string calldata prefix) external override adminRequired {
_setTokenURIPrefix(prefix);
}
function setTokenURI(uint256 tokenId, string calldata uri) external override adminRequired {
_setTokenURI(tokenId, uri);
}
function setTokenURI(uint256[] calldata tokenIds, string[] calldata uris) external override adminRequired {
require(tokenIds.length == uris.length, "Invalid input");
for (uint i; i < tokenIds.length;) {
_setTokenURI(tokenIds[i], uris[i]);
unchecked { ++i; }
}
}
function setMintPermissions(address extension, address permissions) external override adminRequired {
_setMintPermissions(extension, permissions);
}
function mintBase(address to) public virtual override nonReentrant adminRequired returns(uint256) {
return _mintBase(to, "", 0);
}
function mintBase(address to, string calldata uri) public virtual override nonReentrant adminRequired returns(uint256) {
return _mintBase(to, uri, 0);
}
function mintBaseBatch(address to, uint16 count) public virtual override nonReentrant adminRequired returns(uint256[] memory tokenIds) {
tokenIds = new uint256[](count);
uint256 firstTokenId = _tokenCount+1;
_tokenCount += count;
for (uint i; i < count;) {
tokenIds[i] = _mintBase(to, "", firstTokenId+i);
unchecked { ++i; }
}
}
function mintBaseBatch(address to, string[] calldata uris) public virtual override nonReentrant adminRequired returns(uint256[] memory tokenIds) {
tokenIds = new uint256[](uris.length);
uint256 firstTokenId = _tokenCount+1;
_tokenCount += uris.length;
for (uint i; i < uris.length;) {
tokenIds[i] = _mintBase(to, uris[i], firstTokenId+i);
unchecked { ++i; }
}
}
function _mintBase(address to, string memory uri, uint256 tokenId) internal virtual returns(uint256) {
if (tokenId == 0) {
++_tokenCount;
tokenId = _tokenCount;
}
_preMintBase(to, tokenId);
_safeMint(to, tokenId, 0);
if (bytes(uri).length > 0) {
_tokenURIs[tokenId] = uri;
}
return tokenId;
}
function mintExtension(address to) public virtual override nonReentrant returns(uint256) {
requireExtension();
return _mintExtension(to, "", 0, 0);
}
function mintExtension(address to, string calldata uri) public virtual override nonReentrant returns(uint256) {
requireExtension();
return _mintExtension(to, uri, 0, 0);
}
function mintExtension(address to, uint80 data) public virtual override nonReentrant returns(uint256) {
requireExtension();
return _mintExtension(to, "", data, 0);
}
function mintExtensionBatch(address to, uint16 count) public virtual override nonReentrant returns(uint256[] memory tokenIds) {
requireExtension();
tokenIds = new uint256[](count);
uint256 firstTokenId = _tokenCount+1;
_tokenCount += count;
for (uint i; i < count;) {
tokenIds[i] = _mintExtension(to, "", 0, firstTokenId+i);
unchecked { ++i; }
}
}
function mintExtensionBatch(address to, string[] calldata uris) public virtual override nonReentrant returns(uint256[] memory tokenIds) {
requireExtension();
tokenIds = new uint256[](uris.length);
uint256 firstTokenId = _tokenCount+1;
_tokenCount += uris.length;
for (uint i; i < uris.length;) {
tokenIds[i] = _mintExtension(to, uris[i], 0, firstTokenId+i);
unchecked { ++i; }
}
}
function mintExtensionBatch(address to, uint80[] calldata data) public virtual override nonReentrant returns(uint256[] memory tokenIds) {
requireExtension();
tokenIds = new uint256[](data.length);
uint256 firstTokenId = _tokenCount+1;
_tokenCount += data.length;
for (uint i; i < data.length;) {
tokenIds[i] = _mintExtension(to, "", data[i], firstTokenId+i);
unchecked { ++i; }
}
}
function _mintExtension(address to, string memory uri, uint80 data, uint256 tokenId) internal virtual returns(uint256) {
if (tokenId == 0) {
++_tokenCount;
tokenId = _tokenCount;
}
_checkMintPermissions(to, tokenId);
_preMintExtension(to, tokenId);
_safeMint(to, tokenId, data << 16 | _extensionToIndex[msg.sender]);
if (bytes(uri).length > 0) {
_tokenURIs[tokenId] = uri;
}
return tokenId;
}
function tokenExtension(uint256 tokenId) public view virtual override returns (address extension) {
require(_exists(tokenId), "Nonexistent token");
extension = _tokenExtension(tokenId);
require(extension != address(0), "No extension for token");
require(!_blacklistedExtensions.contains(extension), "Extension blacklisted");
}
function burn(uint256 tokenId) public virtual override nonReentrant {
require(_isApprovedOrOwner(msg.sender, tokenId), "Caller is not owner or approved");
address owner = ownerOf(tokenId);
address extension = _tokenExtension(tokenId);
_burn(tokenId);
_postBurn(owner, tokenId, extension);
}
function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external override adminRequired {
_setRoyaltiesExtension(address(0), receivers, basisPoints);
}
function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external override adminRequired {
require(_exists(tokenId), "Nonexistent token");
_setRoyalties(tokenId, receivers, basisPoints);
}
function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external override adminRequired {
_setRoyaltiesExtension(extension, receivers, basisPoints);
}
function getRoyalties(uint256 tokenId) external view virtual override returns (address payable[] memory, uint256[] memory) {
require(_exists(tokenId), "Nonexistent token");
return _getRoyalties(tokenId);
}
function getFees(uint256 tokenId) external view virtual override returns (address payable[] memory, uint256[] memory) {
require(_exists(tokenId), "Nonexistent token");
return _getRoyalties(tokenId);
}
function getFeeRecipients(uint256 tokenId) external view virtual override returns (address payable[] memory) {
require(_exists(tokenId), "Nonexistent token");
return _getRoyaltyReceivers(tokenId);
}
function getFeeBps(uint256 tokenId) external view virtual override returns (uint[] memory) {
require(_exists(tokenId), "Nonexistent token");
return _getRoyaltyBPS(tokenId);
}
function royaltyInfo(uint256 tokenId, uint256 value) external view virtual override returns (address, uint256) {
require(_exists(tokenId), "Nonexistent token");
return _getRoyaltyInfo(tokenId, value);
}
function tokenURI(uint256 tokenId) public view virtual override returns (string memory) {
require(_exists(tokenId), "Nonexistent token");
return _tokenURI(tokenId);
}
function setApproveTransfer(address extension) external override adminRequired {
_setApproveTransferBase(extension);
}
function _tokenExtension(uint256 tokenId) internal view override returns(address) {
uint16 extensionIndex = uint16(_tokenData[tokenId].data);
if (extensionIndex == 0) return address(0);
return _indexToExtension[extensionIndex];
}
function tokenData(uint256 tokenId) external view returns (uint80) {
return uint80(_tokenData[tokenId].data >> 16);
}
}
文件 16 的 44:ERC721CreatorCore.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "../extensions/ERC721/IERC721CreatorExtensionApproveTransfer.sol";
import "../extensions/ERC721/IERC721CreatorExtensionBurnable.sol";
import "../permissions/ERC721/IERC721CreatorMintPermissions.sol";
import "./IERC721CreatorCore.sol";
import "./CreatorCore.sol";
abstract contract ERC721CreatorCore is CreatorCore, IERC721CreatorCore {
uint256 constant public VERSION = 3;
bytes4 private constant _ERC721_CREATOR_CORE_V1 = 0x9088c207;
using EnumerableSet for EnumerableSet.AddressSet;
mapping (address => bool) internal _extensionApproveTransfers;
mapping (address => address) internal _extensionPermissions;
uint16 private _extensionCounter;
mapping (address => uint16) internal _extensionToIndex;
mapping (uint16 => address) internal _indexToExtension;
function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorCore, IERC165) returns (bool) {
return interfaceId == type(IERC721CreatorCore).interfaceId || interfaceId == _ERC721_CREATOR_CORE_V1 || super.supportsInterface(interfaceId);
}
function _setApproveTransferExtension(address extension, bool enabled) internal override {
if (ERC165Checker.supportsInterface(extension, type(IERC721CreatorExtensionApproveTransfer).interfaceId)) {
_extensionApproveTransfers[extension] = enabled;
emit ExtensionApproveTransferUpdated(extension, enabled);
}
}
function _setMintPermissions(address extension, address permissions) internal {
require(_extensions.contains(extension), "CreatorCore: Invalid extension");
require(permissions == address(0) || ERC165Checker.supportsInterface(permissions, type(IERC721CreatorMintPermissions).interfaceId), "Invalid address");
if (_extensionPermissions[extension] != permissions) {
_extensionPermissions[extension] = permissions;
emit MintPermissionsUpdated(extension, permissions, msg.sender);
}
}
function _checkMintPermissions(address to, uint256 tokenId) internal {
if (_extensionPermissions[msg.sender] != address(0)) {
IERC721CreatorMintPermissions(_extensionPermissions[msg.sender]).approveMint(msg.sender, to, tokenId);
}
}
function _preMintBase(address, uint256) internal virtual {}
function _preMintExtension(address, uint256) internal virtual {}
function _postBurn(address owner, uint256 tokenId, address extension) internal virtual {
if (extension != address(0)) {
if (ERC165Checker.supportsInterface(extension, type(IERC721CreatorExtensionBurnable).interfaceId)) {
IERC721CreatorExtensionBurnable(extension).onBurn(owner, tokenId);
}
}
if (bytes(_tokenURIs[tokenId]).length != 0) {
delete _tokenURIs[tokenId];
}
}
function _approveTransfer(address from, address to, uint256 tokenId) internal {
if (from == address(0)) return;
_approveTransfer(from, to, tokenId, _tokenExtension(tokenId));
}
function _approveTransfer(address from, address to, uint256 tokenId, uint16 extensionIndex) internal {
if (from == address(0)) return;
_approveTransfer(from, to, tokenId, _indexToExtension[extensionIndex]);
}
function _approveTransfer(address from, address to, uint256 tokenId, address extension) internal {
if (from == address(0)) return;
if (extension != address(0) && _extensionApproveTransfers[extension]) {
require(IERC721CreatorExtensionApproveTransfer(extension).approveTransfer(msg.sender, from, to, tokenId), "Extension approval failure");
} else if (_approveTransferBase != address(0)) {
require(IERC721CreatorExtensionApproveTransfer(_approveTransferBase).approveTransfer(msg.sender, from, to, tokenId), "Extension approval failure");
}
}
function _registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) internal override {
require(_extensionCounter < 0xFFFF, "Too many extensions");
if (_extensionToIndex[extension] == 0) {
++_extensionCounter;
_extensionToIndex[extension] = _extensionCounter;
_indexToExtension[_extensionCounter] = extension;
}
super._registerExtension(extension, baseURI, baseURIIdentical);
}
}
文件 17 的 44:EnumerableSet.sol
pragma solidity ^0.8.0;
library EnumerableSet {
struct Set {
bytes32[] _values;
mapping(bytes32 => uint256) _indexes;
}
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
function _remove(Set storage set, bytes32 value) private returns (bool) {
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
set._values[toDeleteIndex] = lastValue;
set._indexes[lastValue] = valueIndex;
}
set._values.pop();
delete set._indexes[value];
return true;
} else {
return false;
}
}
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
struct Bytes32Set {
Set _inner;
}
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
assembly {
result := store
}
return result;
}
struct AddressSet {
Set _inner;
}
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly {
result := store
}
return result;
}
struct UintSet {
Set _inner;
}
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly {
result := store
}
return result;
}
}
文件 18 的 44:IAdminControl.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IAdminControl is IERC165 {
event AdminApproved(address indexed account, address indexed sender);
event AdminRevoked(address indexed account, address indexed sender);
function getAdmins() external view returns (address[] memory);
function approveAdmin(address admin) external;
function revokeAdmin(address admin) external;
function isAdmin(address admin) external view returns (bool);
}
文件 19 的 44:ICreatorCore.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface ICreatorCore is IERC165 {
event ExtensionRegistered(address indexed extension, address indexed sender);
event ExtensionUnregistered(address indexed extension, address indexed sender);
event ExtensionBlacklisted(address indexed extension, address indexed sender);
event MintPermissionsUpdated(address indexed extension, address indexed permissions, address indexed sender);
event RoyaltiesUpdated(uint256 indexed tokenId, address payable[] receivers, uint256[] basisPoints);
event DefaultRoyaltiesUpdated(address payable[] receivers, uint256[] basisPoints);
event ApproveTransferUpdated(address extension);
event ExtensionRoyaltiesUpdated(address indexed extension, address payable[] receivers, uint256[] basisPoints);
event ExtensionApproveTransferUpdated(address indexed extension, bool enabled);
function getExtensions() external view returns (address[] memory);
function registerExtension(address extension, string calldata baseURI) external;
function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external;
function unregisterExtension(address extension) external;
function blacklistExtension(address extension) external;
function setBaseTokenURIExtension(string calldata uri) external;
function setBaseTokenURIExtension(string calldata uri, bool identical) external;
function setTokenURIPrefixExtension(string calldata prefix) external;
function setTokenURIExtension(uint256 tokenId, string calldata uri) external;
function setTokenURIExtension(uint256[] memory tokenId, string[] calldata uri) external;
function setBaseTokenURI(string calldata uri) external;
function setTokenURIPrefix(string calldata prefix) external;
function setTokenURI(uint256 tokenId, string calldata uri) external;
function setTokenURI(uint256[] memory tokenIds, string[] calldata uris) external;
function setMintPermissions(address extension, address permissions) external;
function setApproveTransferExtension(bool enabled) external;
function tokenExtension(uint256 tokenId) external view returns (address);
function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external;
function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external;
function getRoyalties(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
function getFeeRecipients(uint256 tokenId) external view returns (address payable[] memory);
function getFeeBps(uint256 tokenId) external view returns (uint[] memory);
function getFees(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256);
function setApproveTransfer(address extension) external;
function getApproveTransfer() external view returns (address);
}
文件 20 的 44:ICreatorExtensionRoyalties.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface ICreatorExtensionRoyalties is IERC165 {
function getRoyalties(address creator, uint256 tokenId) external view returns (address payable[] memory, uint256[] memory);
}
文件 21 的 44:ICreatorExtensionTokenURI.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface ICreatorExtensionTokenURI is IERC165 {
function tokenURI(address creator, uint256 tokenId) external view returns (string memory);
}
文件 22 的 44:IERC1155.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC1155 is IERC165 {
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
event URI(string value, uint256 indexed id);
function balanceOf(address account, uint256 id) external view returns (uint256);
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
function setApprovalForAll(address operator, bool approved) external;
function isApprovedForAll(address account, address operator) external view returns (bool);
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
文件 23 的 44:IERC1155CreatorCore.sol
pragma solidity ^0.8.0;
import "./CreatorCore.sol";
interface IERC1155CreatorCore is ICreatorCore {
function mintBaseNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);
function mintBaseExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory);
function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
function burn(address account, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
function totalSupply(uint256 tokenId) external view returns (uint256);
}
文件 24 的 44:IERC1155CreatorExtensionApproveTransfer.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IERC1155CreatorExtensionApproveTransfer is IERC165 {
function setApproveTransfer(address creator, bool enabled) external;
function approveTransfer(address operator, address from, address to, uint256[] calldata tokenIds, uint256[] calldata amounts) external returns (bool);
}
文件 25 的 44:IERC1155CreatorExtensionBurnable.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IERC1155CreatorExtensionBurnable is IERC165 {
function onBurn(address owner, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
}
文件 26 的 44:IERC1155CreatorMintPermissions.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IERC1155CreatorMintPermissions is IERC165 {
function approveMint(address extension, address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external;
}
文件 27 的 44:IERC1155MetadataURI.sol
pragma solidity ^0.8.0;
import "../IERC1155.sol";
interface IERC1155MetadataURI is IERC1155 {
function uri(uint256 id) external view returns (string memory);
}
文件 28 的 44:IERC1155Receiver.sol
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
interface IERC1155Receiver is IERC165 {
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
文件 29 的 44:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 30 的 44: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, bytes calldata data) external;
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 setApprovalForAll(address operator, bool approved) external;
function getApproved(uint256 tokenId) external view returns (address operator);
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
文件 31 的 44:IERC721Burnable.sol
pragma solidity ^0.8.27;
interface IERC721Burnable {
function burn(uint256 tokenId) external;
}
文件 32 的 44:IERC721CreatorCore.sol
pragma solidity ^0.8.0;
import "./ICreatorCore.sol";
interface IERC721CreatorCore is ICreatorCore {
function mintBase(address to) external returns (uint256);
function mintBase(address to, string calldata uri) external returns (uint256);
function mintBaseBatch(address to, uint16 count) external returns (uint256[] memory);
function mintBaseBatch(address to, string[] calldata uris) external returns (uint256[] memory);
function mintExtension(address to) external returns (uint256);
function mintExtension(address to, string calldata uri) external returns (uint256);
function mintExtension(address to, uint80 data) external returns (uint256);
function mintExtensionBatch(address to, uint16 count) external returns (uint256[] memory);
function mintExtensionBatch(address to, string[] calldata uris) external returns (uint256[] memory);
function mintExtensionBatch(address to, uint80[] calldata data) external returns (uint256[] memory);
function burn(uint256 tokenId) external;
function tokenData(uint256 tokenId) external view returns (uint80);
}
文件 33 的 44:IERC721CreatorExtensionApproveTransfer.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IERC721CreatorExtensionApproveTransfer is IERC165 {
function setApproveTransfer(address creator, bool enabled) external;
function approveTransfer(address operator, address from, address to, uint256 tokenId) external returns (bool);
}
文件 34 的 44:IERC721CreatorExtensionBurnable.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IERC721CreatorExtensionBurnable is IERC165 {
function onBurn(address owner, uint256 tokenId) external;
}
文件 35 的 44:IERC721CreatorMintPermissions.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/IERC165.sol";
interface IERC721CreatorMintPermissions is IERC165 {
function approveMint(address extension, address to, uint256 tokenId) external;
}
文件 36 的 44: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);
}
文件 37 的 44:IERC721Receiver.sol
pragma solidity ^0.8.0;
interface IERC721Receiver {
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
文件 38 的 44:Math.sol
pragma solidity ^0.8.0;
library Math {
enum Rounding {
Down,
Up,
Zero
}
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
function average(uint256 a, uint256 b) internal pure returns (uint256) {
return (a & b) + (a ^ b) / 2;
}
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
return a == 0 ? 0 : (a - 1) / b + 1;
}
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
uint256 prod0;
uint256 prod1;
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
if (prod1 == 0) {
return prod0 / denominator;
}
require(denominator > prod1, "Math: mulDiv overflow");
uint256 remainder;
assembly {
remainder := mulmod(x, y, denominator)
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
uint256 twos = denominator & (~denominator + 1);
assembly {
denominator := div(denominator, twos)
prod0 := div(prod0, twos)
twos := add(div(sub(0, twos), twos), 1)
}
prod0 |= prod1 * twos;
uint256 inverse = (3 * denominator) ^ 2;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
inverse *= 2 - denominator * inverse;
result = prod0 * inverse;
return result;
}
}
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
uint256 result = 1 << (log2(a) >> 1);
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
文件 39 的 44:Multicall3.sol
pragma solidity ^0.8.27;
contract Multicall3 {
struct Call {
address target;
bytes callData;
}
struct Call3 {
address target;
bool allowFailure;
bytes callData;
}
struct Call3Value {
address target;
bool allowFailure;
uint256 value;
bytes callData;
}
struct Result {
bool success;
bytes returnData;
}
function aggregate(
Call[] calldata calls
) public payable returns (uint256 blockNumber, bytes[] memory returnData) {
blockNumber = block.number;
uint256 length = calls.length;
returnData = new bytes[](length);
Call calldata call;
for (uint256 i = 0; i < length; ) {
bool success;
call = calls[i];
(success, returnData[i]) = call.target.call(call.callData);
require(success, "Multicall3: call failed");
unchecked {
++i;
}
}
}
function tryAggregate(
bool requireSuccess,
Call[] calldata calls
) public payable returns (Result[] memory returnData) {
uint256 length = calls.length;
returnData = new Result[](length);
Call calldata call;
for (uint256 i = 0; i < length; ) {
Result memory result = returnData[i];
call = calls[i];
(result.success, result.returnData) = call.target.call(
call.callData
);
if (requireSuccess)
require(result.success, "Multicall3: call failed");
unchecked {
++i;
}
}
}
function tryBlockAndAggregate(
bool requireSuccess,
Call[] calldata calls
)
public
payable
returns (
uint256 blockNumber,
bytes32 blockHash,
Result[] memory returnData
)
{
blockNumber = block.number;
blockHash = blockhash(block.number);
returnData = tryAggregate(requireSuccess, calls);
}
function blockAndAggregate(
Call[] calldata calls
)
public
payable
returns (
uint256 blockNumber,
bytes32 blockHash,
Result[] memory returnData
)
{
(blockNumber, blockHash, returnData) = tryBlockAndAggregate(
true,
calls
);
}
function aggregate3(
Call3[] calldata calls
) public payable returns (Result[] memory returnData) {
uint256 length = calls.length;
returnData = new Result[](length);
Call3 calldata calli;
for (uint256 i = 0; i < length; ) {
Result memory result = returnData[i];
calli = calls[i];
(result.success, result.returnData) = calli.target.call(
calli.callData
);
assembly {
if iszero(or(calldataload(add(calli, 0x20)), mload(result))) {
mstore(
0x00,
0x08c379a000000000000000000000000000000000000000000000000000000000
)
mstore(
0x04,
0x0000000000000000000000000000000000000000000000000000000000000020
)
mstore(
0x24,
0x0000000000000000000000000000000000000000000000000000000000000017
)
mstore(
0x44,
0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000
)
revert(0x00, 0x64)
}
}
unchecked {
++i;
}
}
}
function aggregate3Value(
Call3Value[] calldata calls
) public payable returns (Result[] memory returnData) {
uint256 valAccumulator;
uint256 length = calls.length;
returnData = new Result[](length);
Call3Value calldata calli;
for (uint256 i = 0; i < length; ) {
Result memory result = returnData[i];
calli = calls[i];
uint256 val = calli.value;
unchecked {
valAccumulator += val;
}
(result.success, result.returnData) = calli.target.call{value: val}(
calli.callData
);
assembly {
if iszero(or(calldataload(add(calli, 0x20)), mload(result))) {
mstore(
0x00,
0x08c379a000000000000000000000000000000000000000000000000000000000
)
mstore(
0x04,
0x0000000000000000000000000000000000000000000000000000000000000020
)
mstore(
0x24,
0x0000000000000000000000000000000000000000000000000000000000000017
)
mstore(
0x44,
0x4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000
)
revert(0x00, 0x84)
}
}
unchecked {
++i;
}
}
require(msg.value == valAccumulator, "Multicall3: value mismatch");
}
function getBlockHash(
uint256 blockNumber
) public view returns (bytes32 blockHash) {
blockHash = blockhash(blockNumber);
}
function getBlockNumber() public view returns (uint256 blockNumber) {
blockNumber = block.number;
}
function getCurrentBlockCoinbase() public view returns (address coinbase) {
coinbase = block.coinbase;
}
function getCurrentBlockDifficulty()
public
view
returns (uint256 difficulty)
{
difficulty = block.difficulty;
}
function getCurrentBlockGasLimit() public view returns (uint256 gaslimit) {
gaslimit = block.gaslimit;
}
function getCurrentBlockTimestamp()
public
view
returns (uint256 timestamp)
{
timestamp = block.timestamp;
}
function getEthBalance(address addr) public view returns (uint256 balance) {
balance = addr.balance;
}
function getLastBlockHash() public view returns (bytes32 blockHash) {
unchecked {
blockHash = blockhash(block.number - 1);
}
}
function getBasefee() public view returns (uint256 basefee) {
basefee = block.basefee;
}
function getChainId() public view returns (uint256 chainid) {
chainid = block.chainid;
}
}
文件 40 的 44: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());
}
modifier onlyOwner() {
_checkOwner();
_;
}
function owner() public view virtual returns (address) {
return _owner;
}
function _checkOwner() internal view virtual {
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);
}
}
文件 41 的 44: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() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
_status = _ENTERED;
}
function _nonReentrantAfter() private {
_status = _NOT_ENTERED;
}
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
文件 42 的 44:SequentialRedeemer.sol
pragma solidity ^0.8.27;
import "@manifoldxyz/creator-core-solidity/contracts/ERC1155Creator.sol";
import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "./interfaces/IERC721Burnable.sol";
contract SequentialRedeemer is AdminControl, ReentrancyGuard, IERC721Receiver {
enum RedemptionStatus {
Active,
Redeemed
}
struct QueueItem {
uint256 tokenId;
RedemptionStatus status;
}
QueueItem[] public queue;
uint256 public intervalStartTime;
uint256 public redemptionIntervalInS;
address public redeemableContractAddress;
address public rewardContractAddress;
constructor(
address _rewardContractAddress,
address _redeemableContractAddress,
uint256 _redemptionIntervalInS
) {
require(
_redemptionIntervalInS > 0,
"SequentialRedeemer: redemption interval must be greater than 0"
);
require(
_redeemableContractAddress != address(0),
"SequentialRedeemer: redeemable contract address cannot be 0"
);
require(
_rewardContractAddress != address(0),
"SequentialRedeemer: reward contract address cannot be 0"
);
intervalStartTime = block.timestamp;
redemptionIntervalInS = _redemptionIntervalInS;
redeemableContractAddress = _redeemableContractAddress;
rewardContractAddress = _rewardContractAddress;
}
function redeem(
uint256 queueIndex,
uint256 rewardTokenId
) public nonReentrant {
require(
isIndexEligible(queueIndex),
"SequentialRedeemer: user not eligible"
);
QueueItem storage currentItem = queue[queueIndex];
require(
currentItem.status == RedemptionStatus.Active,
"SequentialRedeemer: Token already redeemed"
);
address nftOwner = IERC721(redeemableContractAddress).ownerOf(
queue[queueIndex].tokenId
);
require(
nftOwner == msg.sender,
"SequentialRedeemer: user does not own token"
);
IERC721(redeemableContractAddress).safeTransferFrom(
msg.sender,
address(this),
currentItem.tokenId
);
IERC721Burnable(redeemableContractAddress).burn(currentItem.tokenId);
IERC721(rewardContractAddress).safeTransferFrom(
address(this),
msg.sender,
rewardTokenId
);
currentItem.status = RedemptionStatus.Redeemed;
}
function initQueue(QueueItem[] calldata items) external adminRequired {
for (uint256 i = 0; i < items.length; i++) {
queue.push(items[i]);
}
}
function setIntervalStartTime(
uint256 _intervalStartTime
) external adminRequired {
intervalStartTime = _intervalStartTime;
}
function setRedemptionInterval(
uint256 _redemptionIntervalInS
) external adminRequired {
redemptionIntervalInS = _redemptionIntervalInS;
}
function setRedeemableContractAddress(
address _redeemableContractAddress
) external adminRequired {
redeemableContractAddress = _redeemableContractAddress;
}
function setRewardContractAddress(
address _rewardContractAddress
) external adminRequired {
rewardContractAddress = _rewardContractAddress;
}
function restartTimer() public adminRequired {
intervalStartTime = block.timestamp;
uint256 newIndex = 0;
for (uint256 i = 0; i < queue.length; i++) {
if (queue[i].status == RedemptionStatus.Active) {
queue[newIndex] = queue[i];
newIndex++;
}
}
while (queue.length > newIndex) {
queue.pop();
}
}
function getLastEligibleIndex() public view returns (uint256) {
uint256 currentTime = block.timestamp;
uint256 timeSinceLastInteraction = currentTime - intervalStartTime;
uint256 intervalsPassed = timeSinceLastInteraction /
redemptionIntervalInS;
if (intervalsPassed >= queue.length) {
intervalsPassed = queue.length - 1;
}
return intervalsPassed;
}
function isIndexEligible(uint256 index) public view returns (bool) {
return index <= getLastEligibleIndex();
}
function queueLength() public view returns (uint256) {
return queue.length;
}
function getQueuePositionForTokenId(
uint256 tokenId
) public view returns (int256) {
for (uint256 i = 0; i < queue.length; i++) {
if (queue[i].tokenId == tokenId) {
return int256(i);
}
}
return -1;
}
function withdrawERC721(
address tokenAddress,
uint256 tokenId,
address to
) external adminRequired {
IERC721(tokenAddress).safeTransferFrom(address(this), to, tokenId);
}
function onERC721Received(
address,
address,
uint256,
bytes calldata
) external pure returns (bytes4) {
return IERC721Receiver.onERC721Received.selector;
}
}
文件 43 的 44:SignedMath.sol
pragma solidity ^0.8.0;
library SignedMath {
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
function average(int256 a, int256 b) internal pure returns (int256) {
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
function abs(int256 n) internal pure returns (uint256) {
unchecked {
return uint256(n >= 0 ? n : -n);
}
}
}
文件 44 的 44:Strings.sol
pragma solidity ^0.8.0;
import "./math/Math.sol";
import "./math/SignedMath.sol";
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}
{
"compilationTarget": {
"contracts/ERC721Bybit.sol": "ERC721Bybit"
},
"evmVersion": "paris",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 150
},
"remappings": []
}
[{"inputs":[{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminApproved","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"AdminRevoked","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":false,"internalType":"address","name":"extension","type":"address"}],"name":"ApproveTransferUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address payable[]","name":"receivers","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"basisPoints","type":"uint256[]"}],"name":"DefaultRoyaltiesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"extension","type":"address"},{"indexed":false,"internalType":"bool","name":"enabled","type":"bool"}],"name":"ExtensionApproveTransferUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"extension","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"ExtensionBlacklisted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"extension","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"ExtensionRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"extension","type":"address"},{"indexed":false,"internalType":"address payable[]","name":"receivers","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"basisPoints","type":"uint256[]"}],"name":"ExtensionRoyaltiesUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"extension","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"ExtensionUnregistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"extension","type":"address"},{"indexed":true,"internalType":"address","name":"permissions","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"MintPermissionsUpdated","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":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address payable[]","name":"receivers","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"basisPoints","type":"uint256[]"}],"name":"RoyaltiesUpdated","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":"VERSION","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"approveAdmin","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":"address","name":"extension","type":"address"}],"name":"blacklistExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"burn","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAdmins","outputs":[{"internalType":"address[]","name":"admins","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getApproveTransfer","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getExtensions","outputs":[{"internalType":"address[]","name":"extensions","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFeeBps","outputs":[{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFeeRecipients","outputs":[{"internalType":"address payable[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getFees","outputs":[{"internalType":"address payable[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getRoyalties","outputs":[{"internalType":"address payable[]","name":"","type":"address[]"},{"internalType":"uint256[]","name":"","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mint","outputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mintBase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"uri","type":"string"}],"name":"mintBase","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string[]","name":"uris","type":"string[]"}],"name":"mintBaseBatch","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint16","name":"count","type":"uint16"}],"name":"mintBaseBatch","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"mintExtension","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint80","name":"data","type":"uint80"}],"name":"mintExtension","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string","name":"uri","type":"string"}],"name":"mintExtension","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"string[]","name":"uris","type":"string[]"}],"name":"mintExtensionBatch","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint80[]","name":"data","type":"uint80[]"}],"name":"mintExtensionBatch","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint16","name":"count","type":"uint16"}],"name":"mintExtensionBatch","outputs":[{"internalType":"uint256[]","name":"tokenIds","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":[{"internalType":"address","name":"extension","type":"address"},{"internalType":"string","name":"baseURI","type":"string"}],"name":"registerExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"extension","type":"address"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"bool","name":"baseURIIdentical","type":"bool"}],"name":"registerExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"revokeAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"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":"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":"extension","type":"address"}],"name":"setApproveTransfer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"enabled","type":"bool"}],"name":"setApproveTransferExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"}],"name":"setBaseTokenURIExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"uri","type":"string"},{"internalType":"bool","name":"identical","type":"bool"}],"name":"setBaseTokenURIExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"extension","type":"address"},{"internalType":"address","name":"permissions","type":"address"}],"name":"setMintPermissions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address payable[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"basisPoints","type":"uint256[]"}],"name":"setRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"basisPoints","type":"uint256[]"}],"name":"setRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"extension","type":"address"},{"internalType":"address payable[]","name":"receivers","type":"address[]"},{"internalType":"uint256[]","name":"basisPoints","type":"uint256[]"}],"name":"setRoyaltiesExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"uri","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"string[]","name":"uris","type":"string[]"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"},{"internalType":"string[]","name":"uris","type":"string[]"}],"name":"setTokenURIExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"string","name":"uri","type":"string"}],"name":"setTokenURIExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"prefix","type":"string"}],"name":"setTokenURIPrefix","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"prefix","type":"string"}],"name":"setTokenURIPrefixExtension","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenData","outputs":[{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenExtension","outputs":[{"internalType":"address","name":"extension","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"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":[{"internalType":"address","name":"extension","type":"address"}],"name":"unregisterExtension","outputs":[],"stateMutability":"nonpayable","type":"function"}]