编译器
0.8.17+commit.8df45f5f
文件 1 的 13:CreatorExtension.sol
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/introspection/ERC165.sol";
abstract contract CreatorExtension is ERC165 {
bytes4 constant internal LEGACY_EXTENSION_INTERFACE = 0x7005caad;
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165) returns (bool) {
return interfaceId == LEGACY_EXTENSION_INTERFACE
|| super.supportsInterface(interfaceId);
}
}
文件 2 的 13: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;
}
}
文件 3 的 13: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);
}
文件 4 的 13: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);
}
文件 5 的 13: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);
}
文件 6 的 13:IERC165.sol
pragma solidity ^0.8.0;
interface IERC165 {
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
文件 7 的 13: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);
}
文件 8 的 13:IERC721CreatorCoreVersion.sol
pragma solidity ^0.8.0;
interface IERC721CreatorCoreVersion {
function VERSION() external view returns(uint256);
}
文件 9 的 13:IManifoldERC721Edition.sol
pragma solidity ^0.8.0;
interface IManifoldERC721Edition {
error InvalidEdition();
error InvalidInput();
error TooManyRequested();
error InvalidToken();
event SeriesCreated(address caller, address creatorCore, uint256 series, uint256 maxSupply);
struct Recipient {
address recipient;
uint16 count;
}
enum StorageProtocol { INVALID, NONE, ARWEAVE, IPFS }
struct EditionInfo {
uint192 firstTokenId;
uint8 contractVersion;
uint24 totalSupply;
uint24 maxSupply;
StorageProtocol storageProtocol;
string location;
}
function createSeries(address creatorCore, uint256 instanceId, uint24 maxSupply_, StorageProtocol storageProtocol, string calldata location, Recipient[] memory recipients) external;
function setTokenURI(address creatorCore, uint256 instanceId, StorageProtocol storageProtocol, string calldata location) external;
function mint(address creatorCore, uint256 instanceId, uint24 currentSupply, Recipient[] memory recipients) external;
function getEditionInfo(address creatorCore, uint256 instanceId) external view returns(EditionInfo memory);
function getInstanceIdsForTokens(address creatorCore, uint256[] calldata tokenIds) external view returns(uint256[] memory);
function getInstanceTokenIds(address creatorCore, uint256 instanceId) external view returns(uint256[] memory);
}
文件 10 的 13:ManifoldERC721Edition.sol
pragma solidity ^0.8.0;
import "@manifoldxyz/libraries-solidity/contracts/access/IAdminControl.sol";
import "@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol";
import "@manifoldxyz/creator-core-solidity/contracts/extensions/CreatorExtension.sol";
import "@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/utils/Strings.sol";
import "../libraries/IERC721CreatorCoreVersion.sol";
import "./IManifoldERC721Edition.sol";
contract ManifoldERC721Edition is CreatorExtension, ICreatorExtensionTokenURI, IManifoldERC721Edition, ReentrancyGuard {
using Strings for uint256;
struct IndexRange {
uint256 startIndex;
uint256 count;
}
string private constant ARWEAVE_PREFIX = "https://arweave.net/";
string private constant IPFS_PREFIX = "ipfs://";
uint256 private constant MAX_UINT_24 = 0xffffff;
uint256 private constant MAX_UINT_56 = 0xffffffffffffff;
uint256 private constant MAX_UINT_192 = 0xffffffffffffffffffffffffffffffffffffffffffffffff;
mapping(address => mapping(uint256 => EditionInfo)) _editionInfo;
mapping(address => mapping(uint256 => IndexRange[])) _indexRanges;
mapping(address => uint256[]) _creatorInstanceIds;
modifier creatorAdminRequired(address creator) {
if (!IAdminControl(creator).isAdmin(msg.sender)) revert("Must be owner or admin of creator contract");
_;
}
function supportsInterface(bytes4 interfaceId) public view virtual override(CreatorExtension, IERC165) returns (bool) {
return
interfaceId == type(ICreatorExtensionTokenURI).interfaceId ||
interfaceId == type(IManifoldERC721Edition).interfaceId ||
CreatorExtension.supportsInterface(interfaceId);
}
function createSeries(address creatorCore, uint256 instanceId, uint24 maxSupply_, StorageProtocol storageProtocol, string calldata location, Recipient[] memory recipients) external override creatorAdminRequired(creatorCore) {
if (instanceId == 0 ||
instanceId > MAX_UINT_56 ||
maxSupply_ == 0 ||
storageProtocol == StorageProtocol.INVALID ||
_editionInfo[creatorCore][instanceId].storageProtocol != StorageProtocol.INVALID
) revert InvalidInput();
uint8 creatorContractVersion;
try IERC721CreatorCoreVersion(creatorCore).VERSION() returns(uint256 version) {
require(version <= 255, "Unsupported contract version");
creatorContractVersion = uint8(version);
} catch {}
_editionInfo[creatorCore][instanceId] = EditionInfo({
maxSupply: maxSupply_,
totalSupply: 0,
contractVersion: creatorContractVersion,
storageProtocol: storageProtocol,
location: location,
firstTokenId: 0
});
if (creatorContractVersion < 3) {
_creatorInstanceIds[creatorCore].push(instanceId);
}
emit SeriesCreated(msg.sender, creatorCore, instanceId, maxSupply_);
if (recipients.length > 0) _mintTokens(creatorCore, instanceId, _editionInfo[creatorCore][instanceId], recipients);
}
function setTokenURI(address creatorCore, uint256 instanceId, StorageProtocol storageProtocol, string calldata location) external override creatorAdminRequired(creatorCore) {
if (storageProtocol == StorageProtocol.INVALID) revert InvalidInput();
EditionInfo storage info = _getEditionInfo(creatorCore, instanceId);
info.storageProtocol = storageProtocol;
info.location = location;
}
function _getEditionInfo(address creatorCore, uint256 instanceId) private view returns(EditionInfo storage info) {
info = _editionInfo[creatorCore][instanceId];
if (info.storageProtocol == StorageProtocol.INVALID) revert InvalidEdition();
}
function getEditionInfo(address creatorCore, uint256 instanceId) public view returns(EditionInfo memory info) {
info = _editionInfo[creatorCore][instanceId];
if (info.storageProtocol == StorageProtocol.INVALID) revert InvalidEdition();
}
function getInstanceIdsForTokens(address creatorCore, uint256[] calldata tokenIds) external view override returns(uint256[] memory instanceIds) {
instanceIds = new uint256[](tokenIds.length);
for (uint256 i; i < tokenIds.length;) {
uint256 tokenId = tokenIds[i];
try IERC721CreatorCore(creatorCore).tokenExtension(tokenId) returns(address tokenExtension) {
if (tokenExtension == address(this)) {
uint256 creatorContractVersion;
uint256 instanceId;
try IERC721CreatorCoreVersion(creatorCore).VERSION() returns(uint256 version) {
creatorContractVersion = version;
} catch {}
if (creatorContractVersion >= 3) {
uint80 tokenData = IERC721CreatorCore(creatorCore).tokenData(tokenId);
instanceId = uint56(tokenData >> 24);
} else {
(instanceId, ) = _tokenInstanceAndIndex(creatorCore, tokenId);
}
instanceIds[i] = instanceId;
}
} catch {}
unchecked{++i;}
}
}
function getInstanceTokenIds(address creatorCore, uint256 instanceId) external view returns(uint256[] memory tokenIds) {
EditionInfo storage info = _getEditionInfo(creatorCore, instanceId);
uint256 creatorContractVersion;
tokenIds = new uint256[](info.totalSupply);
try IERC721CreatorCoreVersion(creatorCore).VERSION() returns(uint256 version) {
creatorContractVersion = version;
} catch {}
if (creatorContractVersion >= 3) {
uint256 tokenId = info.firstTokenId;
uint256 foundTokens;
while (foundTokens < info.totalSupply) {
try IERC721CreatorCore(creatorCore).tokenExtension(tokenId) returns(address tokenExtension) {
if (tokenExtension == address(this)) {
uint80 tokenData = IERC721CreatorCore(creatorCore).tokenData(tokenId);
if (instanceId == uint56(tokenData >> 24)) {
tokenIds[foundTokens] = tokenId;
unchecked{++foundTokens;}
}
}
} catch {}
unchecked{++tokenId;}
}
} else {
IndexRange[] memory indexRanges = _indexRanges[creatorCore][instanceId];
uint256 current;
for (uint256 i; i < indexRanges.length;) {
IndexRange memory currentIndex = indexRanges[i];
for (uint256 j; j < currentIndex.count;) {
tokenIds[current] = currentIndex.startIndex + j;
unchecked{++current; ++j;}
}
unchecked{++i;}
}
}
}
function tokenURI(address creatorCore, uint256 tokenId) external view override returns (string memory) {
uint256 creatorContractVersion;
try IERC721CreatorCoreVersion(creatorCore).VERSION() returns(uint256 version) {
creatorContractVersion = version;
} catch {}
uint256 instanceId;
uint256 index;
if (creatorContractVersion >= 3) {
uint80 tokenData = IERC721CreatorCore(creatorCore).tokenData(tokenId);
instanceId = uint56(tokenData >> 24);
if (instanceId == 0) revert InvalidToken();
index = uint256(tokenData & MAX_UINT_24);
} else {
(instanceId, index) = _tokenInstanceAndIndex(creatorCore, tokenId);
}
EditionInfo storage info = _getEditionInfo(creatorCore, instanceId);
string memory prefix = "";
if (info.storageProtocol == StorageProtocol.ARWEAVE) {
prefix = ARWEAVE_PREFIX;
} else if (info.storageProtocol == StorageProtocol.IPFS) {
prefix = IPFS_PREFIX;
}
return string(abi.encodePacked(prefix, info.location, "/", (index+1).toString()));
}
function mint(address creatorCore, uint256 instanceId, uint24 currentSupply, Recipient[] memory recipients) external override nonReentrant creatorAdminRequired(creatorCore) {
EditionInfo storage info = _getEditionInfo(creatorCore, instanceId);
if (currentSupply != info.totalSupply) revert InvalidInput();
_mintTokens(creatorCore, instanceId, info, recipients);
}
function _mintTokens(address creatorCore, uint256 instanceId, EditionInfo storage info, Recipient[] memory recipients) private {
if (recipients.length == 0) revert InvalidInput();
if (info.totalSupply+1 > info.maxSupply) revert TooManyRequested();
uint256[] memory tokenIdResults;
if (info.contractVersion >= 3) {
uint16 count = 0;
uint24 totalSupply_ = info.totalSupply;
uint24 maxSupply_ = info.maxSupply;
uint256 newMintIndex = totalSupply_;
for (uint256 i; i < recipients.length;) {
uint16 mintCount = recipients[i].count;
if (mintCount == 0) revert InvalidInput();
count += mintCount;
if (totalSupply_+count > maxSupply_) revert TooManyRequested();
uint80[] memory tokenDatas = new uint80[](mintCount);
for (uint256 j; j < mintCount;) {
tokenDatas[j] = uint56(instanceId) << 24 | uint24(newMintIndex+j);
unchecked {++j;}
}
tokenIdResults = IERC721CreatorCore(creatorCore).mintExtensionBatch(recipients[i].recipient, tokenDatas);
if (i == 0 && info.firstTokenId == 0) {
if (tokenIdResults[0] > MAX_UINT_192) revert InvalidInput();
info.firstTokenId = uint192(tokenIdResults[0]);
}
unchecked{newMintIndex += mintCount;}
unchecked{++i;}
}
info.totalSupply += count;
} else {
uint256 startIndex;
uint16 count = 0;
uint24 totalSupply_ = info.totalSupply;
uint24 maxSupply_ = info.maxSupply;
for (uint256 i; i < recipients.length;) {
if (recipients[i].count == 0) revert InvalidInput();
count += recipients[i].count;
if (totalSupply_+count > maxSupply_) revert TooManyRequested();
tokenIdResults = IERC721CreatorCore(creatorCore).mintExtensionBatch(recipients[i].recipient, recipients[i].count);
if (i == 0) {
startIndex = tokenIdResults[0];
if (info.firstTokenId == 0) {
if (startIndex > MAX_UINT_192) revert InvalidInput();
info.firstTokenId = uint192(startIndex);
}
}
unchecked{++i;}
}
_updateIndexRanges(creatorCore, instanceId, info, startIndex, count);
}
}
function _updateIndexRanges(address creatorCore, uint256 instanceId, EditionInfo storage info, uint256 startIndex, uint16 count) internal {
IndexRange[] storage indexRanges = _indexRanges[creatorCore][instanceId];
if (indexRanges.length == 0) {
indexRanges.push(IndexRange(startIndex, count));
} else {
IndexRange storage lastIndexRange = indexRanges[indexRanges.length-1];
if ((lastIndexRange.startIndex + lastIndexRange.count) == startIndex) {
lastIndexRange.count += count;
} else {
indexRanges.push(IndexRange(startIndex, count));
}
}
info.totalSupply += count;
}
function _tokenInstanceAndIndex(address creatorCore, uint256 tokenId) internal view returns(uint256, uint256) {
for (uint256 i; i < _creatorInstanceIds[creatorCore].length;) {
uint256 instanceId = _creatorInstanceIds[creatorCore][i];
IndexRange[] memory indexRanges = _indexRanges[creatorCore][instanceId];
uint256 offset;
for (uint j; j < indexRanges.length;) {
IndexRange memory currentIndex = indexRanges[j];
if (tokenId < currentIndex.startIndex) break;
if (tokenId >= currentIndex.startIndex && tokenId < currentIndex.startIndex + currentIndex.count) {
return (instanceId, tokenId - currentIndex.startIndex + offset);
}
offset += currentIndex.count;
unchecked{++j;}
}
unchecked{++i;}
}
revert InvalidToken();
}
}
文件 11 的 13: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);
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 * 8) < value ? 1 : 0);
}
}
}
文件 12 的 13: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;
}
}
文件 13 的 13:Strings.sol
pragma solidity ^0.8.0;
import "./math/Math.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 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);
}
}
{
"compilationTarget": {
"contracts/edition/ManifoldERC721Edition.sol": "ManifoldERC721Edition"
},
"evmVersion": "london",
"libraries": {},
"metadata": {
"bytecodeHash": "ipfs"
},
"optimizer": {
"enabled": true,
"runs": 1000000
},
"remappings": [
":@ensdomains/=node_modules/@ensdomains/",
":@manifoldxyz/=node_modules/@manifoldxyz/",
":@openzeppelin/=node_modules/@openzeppelin/",
":create2-helpers/=lib/create2-helpers/src/",
":create2-scripts/=lib/create2-helpers/script/",
":ds-test/=lib/forge-std/lib/ds-test/src/",
":erc4626-tests/=lib/operator-filter-registry/lib/openzeppelin-contracts/lib/erc4626-tests/",
":eth-gas-reporter/=node_modules/eth-gas-reporter/",
":forge-std/=lib/forge-std/src/",
":hardhat/=node_modules/hardhat/",
":murky/=lib/murky/src/",
":openzeppelin-contracts-upgradeable/=lib/operator-filter-registry/lib/openzeppelin-contracts-upgradeable/",
":openzeppelin-contracts/=lib/murky/lib/openzeppelin-contracts/",
":operator-filter-registry/=node_modules/operator-filter-registry/",
":truffle/=node_modules/truffle/"
]
}
[{"inputs":[],"name":"InvalidEdition","type":"error"},{"inputs":[],"name":"InvalidInput","type":"error"},{"inputs":[],"name":"InvalidToken","type":"error"},{"inputs":[],"name":"TooManyRequested","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"caller","type":"address"},{"indexed":false,"internalType":"address","name":"creatorCore","type":"address"},{"indexed":false,"internalType":"uint256","name":"series","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"maxSupply","type":"uint256"}],"name":"SeriesCreated","type":"event"},{"inputs":[{"internalType":"address","name":"creatorCore","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"},{"internalType":"uint24","name":"maxSupply_","type":"uint24"},{"internalType":"enum IManifoldERC721Edition.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"string","name":"location","type":"string"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"count","type":"uint16"}],"internalType":"struct IManifoldERC721Edition.Recipient[]","name":"recipients","type":"tuple[]"}],"name":"createSeries","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorCore","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"}],"name":"getEditionInfo","outputs":[{"components":[{"internalType":"uint192","name":"firstTokenId","type":"uint192"},{"internalType":"uint8","name":"contractVersion","type":"uint8"},{"internalType":"uint24","name":"totalSupply","type":"uint24"},{"internalType":"uint24","name":"maxSupply","type":"uint24"},{"internalType":"enum IManifoldERC721Edition.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"string","name":"location","type":"string"}],"internalType":"struct IManifoldERC721Edition.EditionInfo","name":"info","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorCore","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"getInstanceIdsForTokens","outputs":[{"internalType":"uint256[]","name":"instanceIds","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorCore","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"}],"name":"getInstanceTokenIds","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorCore","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"},{"internalType":"uint24","name":"currentSupply","type":"uint24"},{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"count","type":"uint16"}],"internalType":"struct IManifoldERC721Edition.Recipient[]","name":"recipients","type":"tuple[]"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorCore","type":"address"},{"internalType":"uint256","name":"instanceId","type":"uint256"},{"internalType":"enum IManifoldERC721Edition.StorageProtocol","name":"storageProtocol","type":"uint8"},{"internalType":"string","name":"location","type":"string"}],"name":"setTokenURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorCore","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]