Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 305 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Mint | 19072434 | 211 days ago | IN | 0 ETH | 0.09975551 | ||||
Mint | 19067198 | 212 days ago | IN | 0 ETH | 0.02683864 | ||||
Mint | 19067157 | 212 days ago | IN | 0 ETH | 0.05862213 | ||||
Mint | 19067093 | 212 days ago | IN | 0 ETH | 0.02656738 | ||||
Mint | 19067068 | 212 days ago | IN | 0 ETH | 0.05355364 | ||||
Mint | 19067061 | 212 days ago | IN | 0 ETH | 0.0484723 | ||||
Mint | 19067045 | 212 days ago | IN | 0 ETH | 0.04362728 | ||||
Mint | 19067000 | 212 days ago | IN | 0 ETH | 0.06079132 | ||||
Mint | 19066972 | 212 days ago | IN | 0 ETH | 0.03660102 | ||||
Mint | 19066966 | 212 days ago | IN | 0 ETH | 0.03276994 | ||||
Mint | 19066955 | 212 days ago | IN | 0 ETH | 0.02557076 | ||||
Mint | 19066843 | 212 days ago | IN | 0 ETH | 0.02114011 | ||||
Mint | 19065354 | 212 days ago | IN | 0 ETH | 0.02993314 | ||||
Mint1155 | 19065116 | 212 days ago | IN | 0 ETH | 0.037692 | ||||
Mint | 19063006 | 212 days ago | IN | 0 ETH | 0.01494925 | ||||
Mint | 19058055 | 213 days ago | IN | 0 ETH | 0.10871784 | ||||
Mint | 19053805 | 214 days ago | IN | 0 ETH | 0.01378504 | ||||
Mint | 19053799 | 214 days ago | IN | 0 ETH | 0.00873828 | ||||
Mint | 19053764 | 214 days ago | IN | 0 ETH | 0.01081463 | ||||
Mint | 19053729 | 214 days ago | IN | 0 ETH | 0.22124274 | ||||
Mint | 19052018 | 214 days ago | IN | 0 ETH | 0.03427129 | ||||
Mint | 19050999 | 214 days ago | IN | 0 ETH | 0.11151421 | ||||
Mint | 19050406 | 214 days ago | IN | 0 ETH | 0.10733208 | ||||
Mint | 19050176 | 214 days ago | IN | 0 ETH | 0.06632364 | ||||
Mint | 19047781 | 215 days ago | IN | 0 ETH | 0.03235854 |
Latest 25 internal transactions (View All)
Advanced mode:
Loading...
Loading
Contract Name:
Efficax
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 1000 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@manifoldxyz/libraries-solidity/contracts/access/AdminControl.sol"; import "@manifoldxyz/creator-core-solidity/contracts/core/IERC721CreatorCore.sol"; import "@manifoldxyz/creator-core-solidity/contracts/core/IERC1155CreatorCore.sol"; import "@manifoldxyz/creator-core-solidity/contracts/extensions/ICreatorExtensionTokenURI.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "./libraries/Base64.sol"; import "./libraries/SSTORE2.sol"; contract Efficax is AdminControl, ICreatorExtensionTokenURI{ struct Token { string metadata; string mimeType; address[] chunks; } struct EditionOptions { string metadata; string mimeType; uint quantity; } /** * @notice The mapping that contains the token data for a given creator contract & token id. */ mapping(address => mapping(uint256 => Token)) public tokenData; /** * @notice A modifier for checking that the sender of the transaction has admin permissions on the Creator Contract they are trying to do something with * * Shamelessly borrowed from the Manifold claim page extension. * * @param creatorContractAddress The Manifold Creator Contract in question */ modifier creatorAdminRequired(address creatorContractAddress) { AdminControl creatorCoreContract = AdminControl(creatorContractAddress); require(creatorCoreContract.isAdmin(msg.sender), 'Wallet is not an administrator for contract'); _; } /** @notice Mints a token with `metadata` of type `mimeType` and image `image` @param creatorContractAddress The Manifold contract to mint to @param options minting details: quantity, metadata, mimeType - quantity The number of editions to mint - metadata The string metadata for the token, expressed as a JSON with no opening or closing bracket, e.g. `"name": "hello!","description": "world!"` - mimeType The mime type for `image` @param image The image data, split into bytes of max len 24576 (EVM contract limit) */ function mint1155( address creatorContractAddress, EditionOptions calldata options, bytes[] calldata image ) external creatorAdminRequired(creatorContractAddress) { address[] memory dest = new address[](1); uint256[] memory quantities = new uint256[](1); string[] memory uris = new string[](1); dest[0] = msg.sender; quantities[0] = options.quantity; uint256[] memory tokenIds = IERC1155CreatorCore(creatorContractAddress).mintExtensionNew(dest, quantities, uris); uint256 tokenId = tokenIds[0]; tokenData[creatorContractAddress][tokenId].metadata = options.metadata; tokenData[creatorContractAddress][tokenId].mimeType = options.mimeType; // loop through the image array, appending a new byte array // to the chunks. This is because the contract storage limit // is 24576 but we actually get much further than that before // running out of gas in the block. for (uint8 i = 0; i < image.length; i++) { tokenData[creatorContractAddress][tokenId].chunks.push(SSTORE2.write(image[i])); } } /** @notice Mints a token with `metadata` of type `mimeType` and image `image` @param creatorContractAddress The Manifold contract to mint to @param image The image data, split into bytes of max len 24576 (EVM contract limit) @param metadata The string metadata for the token, expressed as a JSON with no opening or closing bracket, e.g. `"name": "hello!","description": "world!"` @param mimeType The mime type for `image` */ function mint( address creatorContractAddress, bytes[] calldata image, string calldata metadata, string calldata mimeType ) external creatorAdminRequired(creatorContractAddress) { uint256 tokenId = IERC721CreatorCore(creatorContractAddress).mintExtension(msg.sender); tokenData[creatorContractAddress][tokenId].metadata = metadata; tokenData[creatorContractAddress][tokenId].mimeType = mimeType; // loop through the image array, appending a new byte array // to the chunks. This is because the contract storage limit // is 24576 but we actually get much further than that before // running out of gas in the block. for (uint8 i = 0; i < image.length; i++) { tokenData[creatorContractAddress][tokenId].chunks.push(SSTORE2.write(image[i])); } } /** @notice Updates a token with `metadata` of type `mimeType` and image `image`. @param creatorContractAddress The Manifold contract to mint to @param tokenId the token to update the data for @param image The image data, split into bytes of max len 24576 (EVM contract limit) @param metadata The string metadata for the token, expressed as a JSON with no opening or closing bracket, e.g. `"name": "hello!","description": "world!"` @param mimeType The mime type for `image` */ function updateToken( address creatorContractAddress, uint256 tokenId, bytes[] calldata image, string calldata metadata, string calldata mimeType ) external creatorAdminRequired(creatorContractAddress) { if (bytes(metadata).length > 0) { tokenData[creatorContractAddress][tokenId].metadata = metadata; } if (bytes(mimeType).length > 0) { tokenData[creatorContractAddress][tokenId].mimeType = mimeType; } if (image.length > 0) { delete tokenData[creatorContractAddress][tokenId].chunks; for (uint8 i = 0; i < image.length; i++) { tokenData[creatorContractAddress][tokenId].chunks.push(SSTORE2.write(image[i])); } } } /** @notice Appends chunks of binary data to the chunks for a given token. If your image won't fit in a single "mint" transaction, you can use this to add data to it. @param creatorContractAddress The Manifold contract to mint to @param tokenId The token to add data to @param chunks The chunks of data to add, max length for each individual chunk is 24576 bytes (EVM contract limit) */ function appendChunks( address creatorContractAddress, uint256 tokenId, bytes[] calldata chunks ) external creatorAdminRequired(creatorContractAddress) { for (uint8 i = 0; i < chunks.length; i++) { tokenData[creatorContractAddress][tokenId].chunks.push(SSTORE2.write(chunks[i])); } } /** * @notice what are you doing here? this is an internal function! * @dev packs token data by converting it to base64 and attaching the mime type * * @param creatorContractAddress the contract address containing the token * @param tokenId the token id to pack */ function _pack(address creatorContractAddress, uint256 tokenId) internal view returns (string memory) { string memory image = string( abi.encodePacked( "data:", tokenData[creatorContractAddress][tokenId].mimeType, ";base64," ) ); bytes memory data; for (uint8 i = 0; i < tokenData[creatorContractAddress][tokenId].chunks.length; i++) { data = abi.encodePacked( data, SSTORE2.read(tokenData[creatorContractAddress][tokenId].chunks[i]) ); } image = string( abi.encodePacked( image, Base64.encode(data) ) ); return image; } function tokenURI(address creatorContractAddress, uint256 tokenId) external view override returns (string memory) { require(tokenData[creatorContractAddress][tokenId].chunks.length != 0, "Token metadata doesn't exist here"); return string( abi.encodePacked( 'data:application/json;utf8,{', tokenData[creatorContractAddress][tokenId].metadata, ', "image": "', _pack(creatorContractAddress, tokenId), '"}' ) ); } function supportsInterface(bytes4 interfaceId) public view virtual override(AdminControl, IERC165) returns (bool) { return interfaceId == type(ICreatorExtensionTokenURI).interfaceId || AdminControl.supportsInterface(interfaceId) || super.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz 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"; /** * @dev Core creator implementation */ abstract contract CreatorCore is ReentrancyGuard, ICreatorCore, ERC165 { using Strings for uint256; using EnumerableSet for EnumerableSet.AddressSet; using AddressUpgradeable for address; uint256 internal _tokenCount = 0; // Base approve transfers address location address internal _approveTransferBase; // Track registered extensions data EnumerableSet.AddressSet internal _extensions; EnumerableSet.AddressSet internal _blacklistedExtensions; // The baseURI for a given extension mapping (address => string) private _extensionBaseURI; mapping (address => bool) private _extensionBaseURIIdentical; // The prefix for any tokens with a uri configured mapping (address => string) private _extensionURIPrefix; // Mapping for individual token URIs mapping (uint256 => string) internal _tokenURIs; // Royalty configurations struct RoyaltyConfig { address payable receiver; uint16 bps; } mapping (address => RoyaltyConfig[]) internal _extensionRoyalty; mapping (uint256 => RoyaltyConfig[]) internal _tokenRoyalty; bytes4 private constant _CREATOR_CORE_V1 = 0x28f10a21; /** * External interface identifiers for royalties */ /** * @dev CreatorCore * * bytes4(keccak256('getRoyalties(uint256)')) == 0xbb3bafd6 * * => 0xbb3bafd6 = 0xbb3bafd6 */ bytes4 private constant _INTERFACE_ID_ROYALTIES_CREATORCORE = 0xbb3bafd6; /** * @dev Rarible: RoyaltiesV1 * * bytes4(keccak256('getFeeRecipients(uint256)')) == 0xb9c4d9fb * bytes4(keccak256('getFeeBps(uint256)')) == 0x0ebd4c7f * * => 0xb9c4d9fb ^ 0x0ebd4c7f = 0xb7799584 */ bytes4 private constant _INTERFACE_ID_ROYALTIES_RARIBLE = 0xb7799584; /** * @dev Foundation * * bytes4(keccak256('getFees(uint256)')) == 0xd5a06d4c * * => 0xd5a06d4c = 0xd5a06d4c */ bytes4 private constant _INTERFACE_ID_ROYALTIES_FOUNDATION = 0xd5a06d4c; /** * @dev EIP-2981 * * bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a * * => 0x2a55205a = 0x2a55205a */ bytes4 private constant _INTERFACE_ID_ROYALTIES_EIP2981 = 0x2a55205a; /** * @dev See {IERC165-supportsInterface}. */ 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; } /** * @dev Only allows registered extensions to call the specified function */ function requireExtension() internal view { require(_extensions.contains(msg.sender), "Must be registered extension"); } /** * @dev Only allows non-blacklisted extensions */ function requireNonBlacklist(address extension) internal view { require(!_blacklistedExtensions.contains(extension), "Extension blacklisted"); } /** * @dev See {ICreatorCore-getExtensions}. */ 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; } /** * @dev Register an extension */ 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); } /** * @dev See {ICreatorCore-setApproveTransferExtension}. */ function setApproveTransferExtension(bool enabled) external override { requireExtension(); _setApproveTransferExtension(msg.sender, enabled); } /** * @dev Set whether or not tokens minted by the extension defers transfer approvals to the extension */ function _setApproveTransferExtension(address extension, bool enabled) internal virtual; /** * @dev Unregister an extension */ function _unregisterExtension(address extension) internal { emit ExtensionUnregistered(extension, msg.sender); _extensions.remove(extension); } /** * @dev Blacklist an 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); } } /** * @dev Set base token uri for an extension */ function _setBaseTokenURIExtension(string calldata uri, bool identical) internal { _extensionBaseURI[msg.sender] = uri; _extensionBaseURIIdentical[msg.sender] = identical; } /** * @dev Set token uri prefix for an extension */ function _setTokenURIPrefixExtension(string calldata prefix) internal { _extensionURIPrefix[msg.sender] = prefix; } /** * @dev Set token uri for a token of an extension */ function _setTokenURIExtension(uint256 tokenId, string calldata uri) internal { require(_tokenExtension(tokenId) == msg.sender, "Invalid token"); _tokenURIs[tokenId] = uri; } /** * @dev Set base token uri for tokens with no extension */ function _setBaseTokenURI(string calldata uri) internal { _extensionBaseURI[address(0)] = uri; } /** * @dev Set token uri prefix for tokens with no extension */ function _setTokenURIPrefix(string calldata prefix) internal { _extensionURIPrefix[address(0)] = prefix; } /** * @dev Set token uri for a token with no extension */ function _setTokenURI(uint256 tokenId, string calldata uri) internal { require(tokenId > 0 && tokenId <= _tokenCount && _tokenExtension(tokenId) == address(0), "Invalid token"); _tokenURIs[tokenId] = uri; } /** * @dev Retrieve a token's 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]; } } /** * Helper to get royalties for a token */ function _getRoyalties(uint256 tokenId) view internal returns (address payable[] memory receivers, uint256[] memory bps) { // Get token level royalties RoyaltyConfig[] memory royalties = _tokenRoyalty[tokenId]; if (royalties.length == 0) { // Get extension specific royalties address extension = _tokenExtension(tokenId); if (extension != address(0)) { if (ERC165Checker.supportsInterface(extension, type(ICreatorExtensionRoyalties).interfaceId)) { (receivers, bps) = ICreatorExtensionRoyalties(extension).getRoyalties(address(this), tokenId); // Extension override exists, just return that if (receivers.length > 0) return (receivers, bps); } royalties = _extensionRoyalty[extension]; } } if (royalties.length == 0) { // Get the default royalty 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; } } } } /** * Helper to get royalty receivers for a token */ function _getRoyaltyReceivers(uint256 tokenId) view internal returns (address payable[] memory recievers) { (recievers, ) = _getRoyalties(tokenId); } /** * Helper to get royalty basis points for a token */ 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); } /** * Set royalties for a token */ 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); } /** * Set royalties for all tokens of an extension */ 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); } } /** * Helper function to check that royalties provided are valid */ 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"); } /** * Helper function to set 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; } } } /** * @dev Set the base contract's approve transfer contract location */ function _setApproveTransferBase(address extension) internal { _approveTransferBase = extension; emit ApproveTransferUpdated(extension); } /** * @dev See {ICreatorCore-getApproveTransfer}. */ function getApproveTransfer() external view override returns (address) { return _approveTransferBase; } /** * @dev Get the extension for the given token */ function _tokenExtension(uint256 tokenId) internal virtual view returns(address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Core creator interface */ 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); /** * @dev gets address of all extensions */ function getExtensions() external view returns (address[] memory); /** * @dev add an extension. Can only be called by contract owner or admin. * extension address must point to a contract implementing ICreatorExtension. * Returns True if newly added, False if already added. */ function registerExtension(address extension, string calldata baseURI) external; /** * @dev add an extension. Can only be called by contract owner or admin. * extension address must point to a contract implementing ICreatorExtension. * Returns True if newly added, False if already added. */ function registerExtension(address extension, string calldata baseURI, bool baseURIIdentical) external; /** * @dev add an extension. Can only be called by contract owner or admin. * Returns True if removed, False if already removed. */ function unregisterExtension(address extension) external; /** * @dev blacklist an extension. Can only be called by contract owner or admin. * This function will destroy all ability to reference the metadata of any tokens created * by the specified extension. It will also unregister the extension if needed. * Returns True if removed, False if already removed. */ function blacklistExtension(address extension) external; /** * @dev set the baseTokenURI of an extension. Can only be called by extension. */ function setBaseTokenURIExtension(string calldata uri) external; /** * @dev set the baseTokenURI of an extension. Can only be called by extension. * For tokens with no uri configured, tokenURI will return "uri+tokenId" */ function setBaseTokenURIExtension(string calldata uri, bool identical) external; /** * @dev set the common prefix of an extension. Can only be called by extension. * If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI" * Useful if you want to use ipfs/arweave */ function setTokenURIPrefixExtension(string calldata prefix) external; /** * @dev set the tokenURI of a token extension. Can only be called by extension that minted token. */ function setTokenURIExtension(uint256 tokenId, string calldata uri) external; /** * @dev set the tokenURI of a token extension for multiple tokens. Can only be called by extension that minted token. */ function setTokenURIExtension(uint256[] memory tokenId, string[] calldata uri) external; /** * @dev set the baseTokenURI for tokens with no extension. Can only be called by owner/admin. * For tokens with no uri configured, tokenURI will return "uri+tokenId" */ function setBaseTokenURI(string calldata uri) external; /** * @dev set the common prefix for tokens with no extension. Can only be called by owner/admin. * If configured, and a token has a uri set, tokenURI will return "prefixURI+tokenURI" * Useful if you want to use ipfs/arweave */ function setTokenURIPrefix(string calldata prefix) external; /** * @dev set the tokenURI of a token with no extension. Can only be called by owner/admin. */ function setTokenURI(uint256 tokenId, string calldata uri) external; /** * @dev set the tokenURI of multiple tokens with no extension. Can only be called by owner/admin. */ function setTokenURI(uint256[] memory tokenIds, string[] calldata uris) external; /** * @dev set a permissions contract for an extension. Used to control minting. */ function setMintPermissions(address extension, address permissions) external; /** * @dev Configure so transfers of tokens created by the caller (must be extension) gets approval * from the extension before transferring */ function setApproveTransferExtension(bool enabled) external; /** * @dev get the extension of a given token */ function tokenExtension(uint256 tokenId) external view returns (address); /** * @dev Set default royalties */ function setRoyalties(address payable[] calldata receivers, uint256[] calldata basisPoints) external; /** * @dev Set royalties of a token */ function setRoyalties(uint256 tokenId, address payable[] calldata receivers, uint256[] calldata basisPoints) external; /** * @dev Set royalties of an extension */ function setRoyaltiesExtension(address extension, address payable[] calldata receivers, uint256[] calldata basisPoints) external; /** * @dev Get royalites of a token. Returns list of receivers and basisPoints */ function getRoyalties(uint256 tokenId) external view returns (address payable[] memory, uint256[] memory); // Royalty support for various other standards 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); /** * @dev Set the default approve transfer contract location. */ function setApproveTransfer(address extension) external; /** * @dev Get the default approve transfer contract location. */ function getApproveTransfer() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "./CreatorCore.sol"; /** * @dev Core ERC1155 creator interface */ interface IERC1155CreatorCore is ICreatorCore { /** * @dev mint a token with no extension. Can only be called by an admin. * * @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients) * @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array * @param uris - If no elements, all tokens use the default uri. * If any element is an empty string, the corresponding token uses the default uri. * * * Requirements: If to is a multi-element array, then uris must be empty or single element array * If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size * If to is a single element array, uris must be empty or the same length as amounts * * Examples: * mintBaseNew(['0x....1', '0x....2'], [1], []) * Mints a single new token, and gives 1 each to '0x....1' and '0x....2'. Token uses default uri. * * mintBaseNew(['0x....1', '0x....2'], [1, 2], []) * Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'. Token uses default uri. * * mintBaseNew(['0x....1'], [1, 2], ["", "http://token2.com"]) * Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second. 1st token uses default uri, second uses "http://token2.com". * * @return Returns list of tokenIds minted */ function mintBaseNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory); /** * @dev batch mint existing token with no extension. Can only be called by an admin. * * @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients) * @param tokenIds - Can be a single element array (all recipients get the same token) or a multi-element array * @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array * * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays * * Examples: * mintBaseExisting(['0x....1', '0x....2'], [1], [10]) * Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'. * * mintBaseExisting(['0x....1', '0x....2'], [1, 2], [10, 20]) * Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'. * * mintBaseExisting(['0x....1'], [1, 2], [10, 20]) * Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'. * * mintBaseExisting(['0x....1', '0x....2'], [1], [10, 20]) * Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'. * */ function mintBaseExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external; /** * @dev mint a token from an extension. Can only be called by a registered extension. * * @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients) * @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array * @param uris - If no elements, all tokens use the default uri. * If any element is an empty string, the corresponding token uses the default uri. * * * Requirements: If to is a multi-element array, then uris must be empty or single element array * If to is a multi-element array, then amounts must be a single element array or a multi-element array of the same size * If to is a single element array, uris must be empty or the same length as amounts * * Examples: * mintExtensionNew(['0x....1', '0x....2'], [1], []) * Mints a single new token, and gives 1 each to '0x....1' and '0x....2'. Token uses default uri. * * mintExtensionNew(['0x....1', '0x....2'], [1, 2], []) * Mints a single new token, and gives 1 to '0x....1' and 2 to '0x....2'. Token uses default uri. * * mintExtensionNew(['0x....1'], [1, 2], ["", "http://token2.com"]) * Mints two new tokens to '0x....1'. 1 of the first token, 2 of the second. 1st token uses default uri, second uses "http://token2.com". * * @return Returns list of tokenIds minted */ function mintExtensionNew(address[] calldata to, uint256[] calldata amounts, string[] calldata uris) external returns (uint256[] memory); /** * @dev batch mint existing token from extension. Can only be called by a registered extension. * * @param to - Can be a single element array (all tokens go to same address) or multi-element array (single token to many recipients) * @param tokenIds - Can be a single element array (all recipients get the same token) or a multi-element array * @param amounts - Can be a single element array (all recipients get the same amount) or a multi-element array * * Requirements: If any of the parameters are multi-element arrays, they need to be the same length as other multi-element arrays * * Examples: * mintExtensionExisting(['0x....1', '0x....2'], [1], [10]) * Mints 10 of tokenId 1 to each of '0x....1' and '0x....2'. * * mintExtensionExisting(['0x....1', '0x....2'], [1, 2], [10, 20]) * Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 2 to '0x....2'. * * mintExtensionExisting(['0x....1'], [1, 2], [10, 20]) * Mints 10 of tokenId 1 and 20 of tokenId 2 to '0x....1'. * * mintExtensionExisting(['0x....1', '0x....2'], [1], [10, 20]) * Mints 10 of tokenId 1 to '0x....1' and 20 of tokenId 1 to '0x....2'. * */ function mintExtensionExisting(address[] calldata to, uint256[] calldata tokenIds, uint256[] calldata amounts) external; /** * @dev burn tokens. Can only be called by token owner or approved address. * On burn, calls back to the registered extension's onBurn method */ function burn(address account, uint256[] calldata tokenIds, uint256[] calldata amounts) external; /** * @dev Total amount of tokens in with a given tokenId. */ function totalSupply(uint256 tokenId) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "./ICreatorCore.sol"; /** * @dev Core ERC721 creator interface */ interface IERC721CreatorCore is ICreatorCore { /** * @dev mint a token with no extension. Can only be called by an admin. * Returns tokenId minted */ function mintBase(address to) external returns (uint256); /** * @dev mint a token with no extension. Can only be called by an admin. * Returns tokenId minted */ function mintBase(address to, string calldata uri) external returns (uint256); /** * @dev batch mint a token with no extension. Can only be called by an admin. * Returns tokenId minted */ function mintBaseBatch(address to, uint16 count) external returns (uint256[] memory); /** * @dev batch mint a token with no extension. Can only be called by an admin. * Returns tokenId minted */ function mintBaseBatch(address to, string[] calldata uris) external returns (uint256[] memory); /** * @dev mint a token. Can only be called by a registered extension. * Returns tokenId minted */ function mintExtension(address to) external returns (uint256); /** * @dev mint a token. Can only be called by a registered extension. * Returns tokenId minted */ function mintExtension(address to, string calldata uri) external returns (uint256); /** * @dev mint a token. Can only be called by a registered extension. * Returns tokenId minted */ function mintExtension(address to, uint80 data) external returns (uint256); /** * @dev batch mint a token. Can only be called by a registered extension. * Returns tokenIds minted */ function mintExtensionBatch(address to, uint16 count) external returns (uint256[] memory); /** * @dev batch mint a token. Can only be called by a registered extension. * Returns tokenId minted */ function mintExtensionBatch(address to, string[] calldata uris) external returns (uint256[] memory); /** * @dev batch mint a token. Can only be called by a registered extension. * Returns tokenId minted */ function mintExtensionBatch(address to, uint80[] calldata data) external returns (uint256[] memory); /** * @dev burn a token. Can only be called by token owner or approved address. * On burn, calls back to the registered extension's onBurn method */ function burn(uint256 tokenId) external; /** * @dev get token data */ function tokenData(uint256 tokenId) external view returns (uint80); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Implement this if you want your extension to have overloadable royalties */ interface ICreatorExtensionRoyalties is IERC165 { /** * Get the royalties for a given creator/tokenId */ function getRoyalties(address creator, uint256 tokenId) external view returns (address payable[] memory, uint256[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Implement this if you want your extension to have overloadable URI's */ interface ICreatorExtensionTokenURI is IERC165 { /** * Get the uri for a given creator/tokenId */ function tokenURI(address creator, uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz 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; // Track registered admins EnumerableSet.AddressSet private _admins; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IAdminControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Only allows approved admins to call the specified function */ modifier adminRequired() { require(owner() == msg.sender || _admins.contains(msg.sender), "AdminControl: Must be owner or admin"); _; } /** * @dev See {IAdminControl-getAdmins}. */ 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; } /** * @dev See {IAdminControl-approveAdmin}. */ function approveAdmin(address admin) external override onlyOwner { if (!_admins.contains(admin)) { emit AdminApproved(admin, msg.sender); _admins.add(admin); } } /** * @dev See {IAdminControl-revokeAdmin}. */ function revokeAdmin(address admin) external override onlyOwner { if (_admins.contains(admin)) { emit AdminRevoked(admin, msg.sender); _admins.remove(admin); } } /** * @dev See {IAdminControl-isAdmin}. */ function isAdmin(address admin) public override view returns (bool) { return (owner() == admin || _admins.contains(admin)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Interface for admin control */ interface IAdminControl is IERC165 { event AdminApproved(address indexed account, address indexed sender); event AdminRevoked(address indexed account, address indexed sender); /** * @dev gets address of all admins */ function getAdmins() external view returns (address[] memory); /** * @dev add an admin. Can only be called by contract owner. */ function approveAdmin(address admin) external; /** * @dev remove an admin. Can only be called by contract owner. */ function revokeAdmin(address admin) external; /** * @dev checks whether or not given address is an admin * Returns True if they are */ function isAdmin(address admin) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ 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"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ 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"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ 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); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ 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); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ 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 { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.2) (utils/introspection/ERC165Checker.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Library used to query support of an interface declared via {IERC165}. * * Note that these functions return the actual result of the query: they do not * `revert` if an interface is not supported. It is up to the caller to decide * what to do in these cases. */ library ERC165Checker { // As per the EIP-165 spec, no interface should ever match 0xffffffff bytes4 private constant _INTERFACE_ID_INVALID = 0xffffffff; /** * @dev Returns true if `account` supports the {IERC165} interface. */ function supportsERC165(address account) internal view returns (bool) { // Any contract that implements ERC165 must explicitly indicate support of // InterfaceId_ERC165 and explicitly indicate non-support of InterfaceId_Invalid return supportsERC165InterfaceUnchecked(account, type(IERC165).interfaceId) && !supportsERC165InterfaceUnchecked(account, _INTERFACE_ID_INVALID); } /** * @dev Returns true if `account` supports the interface defined by * `interfaceId`. Support for {IERC165} itself is queried automatically. * * See {IERC165-supportsInterface}. */ function supportsInterface(address account, bytes4 interfaceId) internal view returns (bool) { // query support of both ERC165 as per the spec and support of _interfaceId return supportsERC165(account) && supportsERC165InterfaceUnchecked(account, interfaceId); } /** * @dev Returns a boolean array where each value corresponds to the * interfaces passed in and whether they're supported or not. This allows * you to batch check interfaces for a contract where your expectation * is that some interfaces may not be supported. * * See {IERC165-supportsInterface}. * * _Available since v3.4._ */ function getSupportedInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool[] memory) { // an array of booleans corresponding to interfaceIds and whether they're supported or not bool[] memory interfaceIdsSupported = new bool[](interfaceIds.length); // query support of ERC165 itself if (supportsERC165(account)) { // query support of each interface in interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { interfaceIdsSupported[i] = supportsERC165InterfaceUnchecked(account, interfaceIds[i]); } } return interfaceIdsSupported; } /** * @dev Returns true if `account` supports all the interfaces defined in * `interfaceIds`. Support for {IERC165} itself is queried automatically. * * Batch-querying can lead to gas savings by skipping repeated checks for * {IERC165} support. * * See {IERC165-supportsInterface}. */ function supportsAllInterfaces(address account, bytes4[] memory interfaceIds) internal view returns (bool) { // query support of ERC165 itself if (!supportsERC165(account)) { return false; } // query support of each interface in interfaceIds for (uint256 i = 0; i < interfaceIds.length; i++) { if (!supportsERC165InterfaceUnchecked(account, interfaceIds[i])) { return false; } } // all interfaces supported return true; } /** * @notice Query if a contract implements an interface, does not check ERC165 support * @param account The address of the contract to query for support of an interface * @param interfaceId The interface identifier, as specified in ERC-165 * @return true if the contract at account indicates support of the interface with * identifier interfaceId, false otherwise * @dev Assumes that account contains a contract that supports ERC165, otherwise * the behavior of this method is undefined. This precondition can be checked * with {supportsERC165}. * * Some precompiled contracts will falsely indicate support for a given interface, so caution * should be exercised when using this function. * * Interface identification is specified in ERC-165. */ function supportsERC165InterfaceUnchecked(address account, bytes4 interfaceId) internal view returns (bool) { // prepare call bytes memory encodedParams = abi.encodeWithSelector(IERC165.supportsInterface.selector, interfaceId); // perform static call 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; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ 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; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. 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); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ 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); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 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; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ 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); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 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; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ 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); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ 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; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ 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); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// [MIT License] /// @title Base64 /// @notice Provides a function for encoding some bytes in base64 /// @author Brecht Devos <[email protected]> library Base64 { bytes internal constant TABLE = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; /// @notice Encodes some bytes to the base64 representation function encode(bytes memory data) internal pure returns (string memory) { uint256 len = data.length; if (len == 0) return ""; // multiply by 4/3 rounded up uint256 encodedLen = 4 * ((len + 2) / 3); // Add some extra buffer at the end bytes memory result = new bytes(encodedLen + 32); bytes memory table = TABLE; assembly { let tablePtr := add(table, 1) let resultPtr := add(result, 32) for { let i := 0 } lt(i, len) { } { i := add(i, 3) let input := and(mload(add(data, i)), 0xffffff) let out := mload(add(tablePtr, and(shr(18, input), 0x3F))) out := shl(8, out) out := add( out, and(mload(add(tablePtr, and(shr(12, input), 0x3F))), 0xFF) ) out := shl(8, out) out := add( out, and(mload(add(tablePtr, and(shr(6, input), 0x3F))), 0xFF) ) out := shl(8, out) out := add( out, and(mload(add(tablePtr, and(input, 0x3F))), 0xFF) ) out := shl(224, out) mstore(resultPtr, out) resultPtr := add(resultPtr, 4) } switch mod(len, 3) case 1 { mstore(sub(resultPtr, 2), shl(240, 0x3d3d)) } case 2 { mstore(sub(resultPtr, 1), shl(248, 0x3d)) } mstore(result, encodedLen) } return string(result); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; library Bytecode { error InvalidCodeAtRange(uint256 _size, uint256 _start, uint256 _end); /** @notice Generate a creation code that results on a contract with `_code` as bytecode @param _code The returning value of the resulting `creationCode` @return creationCode (constructor) for new contract */ function creationCodeFor(bytes memory _code) internal pure returns (bytes memory) { /* 0x00 0x63 0x63XXXXXX PUSH4 _code.length size 0x01 0x80 0x80 DUP1 size size 0x02 0x60 0x600e PUSH1 14 14 size size 0x03 0x60 0x6000 PUSH1 00 0 14 size size 0x04 0x39 0x39 CODECOPY size 0x05 0x60 0x6000 PUSH1 00 0 size 0x06 0xf3 0xf3 RETURN <CODE> */ return abi.encodePacked( hex"63", uint32(_code.length), hex"80_60_0E_60_00_39_60_00_F3", _code ); } /** @notice Returns the size of the code on a given address @param _addr Address that may or may not contain code @return size of the code on the given `_addr` */ function codeSize(address _addr) internal view returns (uint256 size) { assembly { size := extcodesize(_addr) } } /** @notice Returns the code of a given address @dev It will fail if `_end < _start` @param _addr Address that may or may not contain code @param _start number of bytes of code to skip on read @param _end index before which to end extraction @return oCode read from `_addr` deployed bytecode Forked from: https://gist.github.com/KardanovIR/fe98661df9338c842b4a30306d507fbd */ function codeAt(address _addr, uint256 _start, uint256 _end) internal view returns (bytes memory oCode) { uint256 csize = codeSize(_addr); if (csize == 0) return bytes(""); if (_start > csize) return bytes(""); if (_end < _start) revert InvalidCodeAtRange(csize, _start, _end); unchecked { uint256 reqSize = _end - _start; uint256 maxSize = csize - _start; uint256 size = maxSize < reqSize ? maxSize : reqSize; assembly { // allocate output byte array - this could also be done without assembly // by using o_code = new bytes(size) oCode := mload(0x40) // new "memory end" including padding mstore(0x40, add(oCode, and(add(add(size, 0x20), 0x1f), not(0x1f)))) // store length in memory mstore(oCode, size) // actually retrieve the code, this needs assembly extcodecopy(_addr, add(oCode, 0x20), _start, size) } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./Bytecode.sol"; /** @title A key-value storage with auto-generated keys for storing chunks of data with a lower write & read cost. @author Agustin Aguilar <[email protected]> Readme: https://github.com/0xsequence/sstore2#readme */ library SSTORE2 { error WriteError(); /** @notice Stores `_data` and returns `pointer` as key for later retrieval @dev The pointer is a contract address with `_data` as code @param _data to be written @return pointer Pointer to the written `_data` */ function write(bytes memory _data) internal returns (address pointer) { // Append 00 to _data so contract can't be called // Build init code bytes memory code = Bytecode.creationCodeFor( abi.encodePacked( hex'00', _data ) ); // Deploy contract using create assembly { pointer := create(0, add(code, 32), mload(code)) } // Address MUST be non-zero if (pointer == address(0)) revert WriteError(); } /** @notice Reads the contents of the `_pointer` code as data, skips the first byte @dev The function is intended for reading pointers generated by `write` @param _pointer to be read @return data read from `_pointer` contract */ function read(address _pointer) internal view returns (bytes memory) { return Bytecode.codeAt(_pointer, 1, type(uint256).max); } /** @notice Reads the contents of the `_pointer` code as data, skips the first byte @dev The function is intended for reading pointers generated by `write` @param _pointer to be read @param _start number of bytes to skip @return data read from `_pointer` contract */ function read(address _pointer, uint256 _start) internal view returns (bytes memory) { return Bytecode.codeAt(_pointer, _start + 1, type(uint256).max); } /** @notice Reads the contents of the `_pointer` code as data, skips the first byte @dev The function is intended for reading pointers generated by `write` @param _pointer to be read @param _start number of bytes to skip @param _end index before which to end extraction @return data read from `_pointer` contract */ function read(address _pointer, uint256 _start, uint256 _end) internal view returns (bytes memory) { return Bytecode.codeAt(_pointer, _start + 1, _end + 1); } }
{ "optimizer": { "enabled": true, "runs": 1000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"_size","type":"uint256"},{"internalType":"uint256","name":"_start","type":"uint256"},{"internalType":"uint256","name":"_end","type":"uint256"}],"name":"InvalidCodeAtRange","type":"error"},{"inputs":[],"name":"WriteError","type":"error"},{"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":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes[]","name":"chunks","type":"bytes[]"}],"name":"appendChunks","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"admin","type":"address"}],"name":"approveAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getAdmins","outputs":[{"internalType":"address[]","name":"admins","type":"address[]"}],"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":"creatorContractAddress","type":"address"},{"internalType":"bytes[]","name":"image","type":"bytes[]"},{"internalType":"string","name":"metadata","type":"string"},{"internalType":"string","name":"mimeType","type":"string"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"components":[{"internalType":"string","name":"metadata","type":"string"},{"internalType":"string","name":"mimeType","type":"string"},{"internalType":"uint256","name":"quantity","type":"uint256"}],"internalType":"struct Efficax.EditionOptions","name":"options","type":"tuple"},{"internalType":"bytes[]","name":"image","type":"bytes[]"}],"name":"mint1155","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","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":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"tokenData","outputs":[{"internalType":"string","name":"metadata","type":"string"},{"internalType":"string","name":"mimeType","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"creatorContractAddress","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes[]","name":"image","type":"bytes[]"},{"internalType":"string","name":"metadata","type":"string"},{"internalType":"string","name":"mimeType","type":"string"}],"name":"updateToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6122e28061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063715018a61161008c5780638da5cb5b116100665780638da5cb5b146101c9578063e16f4ae7146101e4578063e9dc6375146101f7578063f2fde38b1461021757600080fd5b8063715018a61461019b5780637b00b0e0146101a3578063804c4004146101b657600080fd5b80632d345670116100c85780632d3456701461014b57806331ae450b146101605780634a170398146101755780636d73e6691461018857600080fd5b806301ffc9a7146100ef57806324ba43281461011757806324d7806c14610138575b600080fd5b6101026100fd3660046118a5565b61022a565b60405190151581526020015b60405180910390f35b61012a6101253660046118eb565b61027d565b60405161010e929190611971565b61010261014636600461199f565b6103b4565b61015e61015936600461199f565b6103ed565b005b61016861044b565b60405161010e91906119fe565b61015e610183366004611a9f565b6104fa565b61015e61019636600461199f565b61076b565b61015e6107c3565b61015e6101b1366004611b53565b6107d7565b61015e6101c4366004611bad565b61094b565b6000546040516001600160a01b03909116815260200161010e565b61015e6101f2366004611c58565b610baf565b61020a6102053660046118eb565b610f32565b60405161010e9190611ccb565b61015e61022536600461199f565b611023565b60006001600160e01b031982167fe9dc63750000000000000000000000000000000000000000000000000000000014806102685750610268826110b0565b806102775750610277826110b0565b92915050565b60036020908152600092835260408084209091529082529020805481906102a390611cde565b80601f01602080910402602001604051908101604052809291908181526020018280546102cf90611cde565b801561031c5780601f106102f15761010080835404028352916020019161031c565b820191906000526020600020905b8154815290600101906020018083116102ff57829003601f168201915b50505050509080600101805461033190611cde565b80601f016020809104026020016040519081016040528092919081815260200182805461035d90611cde565b80156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b5050505050905082565b6000816001600160a01b03166103d26000546001600160a01b031690565b6001600160a01b031614806102775750610277600183611117565b6103f561113c565b610400600182611117565b156104485760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a3610446600182611196565b505b50565b606061045760016111ab565b67ffffffffffffffff81111561046f5761046f611d13565b604051908082528060200260200182016040528015610498578160200160208202803683370190505b50905060005b6104a860016111ab565b8110156104f6576104ba6001826111b5565b8282815181106104cc576104cc611d29565b6001600160a01b0390921660209283029190910190910152806104ee81611d55565b91505061049e565b5090565b604051630935e01b60e21b8152336004820152889081906001600160a01b038216906324d7806c9060240160206040518083038186803b15801561053d57600080fd5b505afa158015610551573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105759190611d70565b6105da5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084015b60405180910390fd5b8415610610576001600160a01b038a1660009081526003602090815260408083208c8452909152902061060e9087876117f6565b505b8215610649576001600160a01b038a1660009081526003602090815260408083208c845290915290206106479060010185856117f6565b505b861561075f576001600160a01b038a1660009081526003602090815260408083208c8452909152812061068191600290910190611876565b60005b60ff811688111561075d576001600160a01b038b1660009081526003602090815260408083208d845290915290206002016107198a8a60ff85168181106106cd576106cd611d29565b90506020028101906106df9190611d92565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506111c192505050565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061075581611dd9565b915050610684565b505b50505050505050505050565b61077361113c565b61077e600182611117565b6104485760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a361044660018261123f565b6107cb61113c565b6107d56000611254565b565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c9060240160206040518083038186803b15801561081a57600080fd5b505afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108529190611d70565b6108b25760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084016105d1565b60005b60ff8116841115610942576001600160a01b038716600090815260036020908152604080832089845290915290206002016108fe868660ff85168181106106cd576106cd611d29565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061093a81611dd9565b9150506108b5565b50505050505050565b604051630935e01b60e21b8152336004820152879081906001600160a01b038216906324d7806c9060240160206040518083038186803b15801561098e57600080fd5b505afa1580156109a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c69190611d70565b610a265760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084016105d1565b6040517f2928ca580000000000000000000000000000000000000000000000000000000081523360048201526000906001600160a01b038b1690632928ca5890602401602060405180830381600087803b158015610a8357600080fd5b505af1158015610a97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abb9190611df9565b6001600160a01b038b1660009081526003602090815260408083208484529091529020909150610aec9088886117f6565b506001600160a01b038a1660009081526003602090815260408083208484529091529020610b1e9060010186866117f6565b5060005b60ff811689111561075d576001600160a01b038b1660009081526003602090815260408083208584529091529020600201610b6b8b8b60ff85168181106106cd576106cd611d29565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b0390921691909117905580610ba781611dd9565b915050610b22565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c9060240160206040518083038186803b158015610bf257600080fd5b505afa158015610c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2a9190611d70565b610c8a5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084016105d1565b60408051600180825281830190925260009160208083019080368337505060408051600180825281830190925292935060009291506020808301908036833750506040805160018082528183019092529293506000929150602082015b6060815260200190600190039081610ce75790505090503383600081518110610d1257610d12611d29565b60200260200101906001600160a01b031690816001600160a01b031681525050876040013582600081518110610d4a57610d4a611d29565b60209081029190910101526040517f8c6e84720000000000000000000000000000000000000000000000000000000081526000906001600160a01b038b1690638c6e847290610da190879087908790600401611e12565b600060405180830381600087803b158015610dbb57600080fd5b505af1158015610dcf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610df79190810190611ebd565b9050600081600081518110610e0e57610e0e611d29565b60209081029190910101519050610e258a80611d92565b6001600160a01b038d1660009081526003602090815260408083208684529091529020610e539290916117f6565b50610e6160208b018b611d92565b6001600160a01b038d1660009081526003602090815260408083208684529091529020610e93926001909101916117f6565b5060005b60ff8116891115610f24576001600160a01b038c1660009081526003602090815260408083208584529091529020600201610ee08b8b60ff85168181106106cd576106cd611d29565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b0390921691909117905580610f1c81611dd9565b915050610e97565b505050505050505050505050565b6001600160a01b0382166000908152600360209081526040808320848452909152902060020154606090610fce5760405162461bcd60e51b815260206004820152602160248201527f546f6b656e206d6574616461746120646f65736e27742065786973742068657260448201527f650000000000000000000000000000000000000000000000000000000000000060648201526084016105d1565b6001600160a01b03831660009081526003602090815260408083208584529091529020610ffb84846112a4565b60405160200161100c929190612015565b604051602081830303815290604052905092915050565b61102b61113c565b6001600160a01b0381166110a75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105d1565b61044881611254565b60006001600160e01b031982167f553e757e00000000000000000000000000000000000000000000000000000000148061027757507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610277565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b6000546001600160a01b031633146107d55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d1565b6000611135836001600160a01b0384166113e7565b6000610277825490565b600061113583836114da565b6000806111ec836040516020016111d891906120b3565b604051602081830303815290604052611504565b90508051602082016000f091506001600160a01b038216611239576040517f08d4abb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50919050565b6000611135836001600160a01b038416611530565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038216600090815260036020908152604080832084845282528083209051606093926112db9260010191016120d9565b6040516020818303038152906040529050606060005b6001600160a01b038616600090815260036020908152604080832088845290915290206002015460ff821610156113b2576001600160a01b038616600090815260036020908152604080832088845290915290206002018054839161137d9160ff851690811061136357611363611d29565b6000918252602090912001546001600160a01b031661157f565b60405160200161138e929190612138565b604051602081830303815290604052915080806113aa90611dd9565b9150506112f1565b50816113bd8261158f565b6040516020016113ce929190612138565b60408051808303601f1901815291905295945050505050565b600081815260018301602052604081205480156114d057600061140b600183612167565b855490915060009061141f90600190612167565b905081811461148457600086600001828154811061143f5761143f611d29565b906000526020600020015490508087600001848154811061146257611462611d29565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806114955761149561217e565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610277565b6000915050610277565b60008260000182815481106114f1576114f1611d29565b9060005260206000200154905092915050565b606081518260405160200161151a929190612194565b6040516020818303038152906040529050919050565b600081815260018301602052604081205461157757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610277565b506000610277565b606061027782600160001961172c565b8051606090806115af575050604080516020810190915260008152919050565b600060036115be836002612213565b6115c8919061222b565b6115d390600461224d565b905060006115e2826020612213565b67ffffffffffffffff8111156115fa576115fa611d13565b6040519080825280601f01601f191660200182016040528015611624576020820181803683370190505b509050600060405180606001604052806040815260200161226d604091399050600181016020830160005b868110156116b0576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b83526004909201910161164f565b5060038606600181146116ca57600281146116f65761171e565b7f3d3d00000000000000000000000000000000000000000000000000000000000060011983015261171e565b7f3d000000000000000000000000000000000000000000000000000000000000006000198301525b505050918152949350505050565b6060833b8061174b575050604080516020810190915260008152611135565b80841115611769575050604080516020810190915260008152611135565b838310156117b4576040517f2c4a89fa0000000000000000000000000000000000000000000000000000000081526004810182905260248101859052604481018490526064016105d1565b83830384820360008282106117c957826117cb565b815b60408051603f8301601f19168101909152818152955090508087602087018a3c505050509392505050565b82805461180290611cde565b90600052602060002090601f016020900481019282611824576000855561186a565b82601f1061183d5782800160ff1982351617855561186a565b8280016001018555821561186a579182015b8281111561186a57823582559160200191906001019061184f565b506104f6929150611890565b508054600082559060005260206000209081019061044891905b5b808211156104f65760008155600101611891565b6000602082840312156118b757600080fd5b81356001600160e01b03198116811461113557600080fd5b80356001600160a01b03811681146118e657600080fd5b919050565b600080604083850312156118fe57600080fd5b611907836118cf565b946020939093013593505050565b60005b83811015611930578181015183820152602001611918565b8381111561193f576000848401525b50505050565b6000815180845261195d816020860160208601611915565b601f01601f19169290920160200192915050565b6040815260006119846040830185611945565b82810360208401526119968185611945565b95945050505050565b6000602082840312156119b157600080fd5b611135826118cf565b600081518084526020808501945080840160005b838110156119f35781516001600160a01b0316875295820195908201906001016119ce565b509495945050505050565b60208152600061113560208301846119ba565b60008083601f840112611a2357600080fd5b50813567ffffffffffffffff811115611a3b57600080fd5b6020830191508360208260051b8501011115611a5657600080fd5b9250929050565b60008083601f840112611a6f57600080fd5b50813567ffffffffffffffff811115611a8757600080fd5b602083019150836020828501011115611a5657600080fd5b60008060008060008060008060a0898b031215611abb57600080fd5b611ac4896118cf565b975060208901359650604089013567ffffffffffffffff80821115611ae857600080fd5b611af48c838d01611a11565b909850965060608b0135915080821115611b0d57600080fd5b611b198c838d01611a5d565b909650945060808b0135915080821115611b3257600080fd5b50611b3f8b828c01611a5d565b999c989b5096995094979396929594505050565b60008060008060608587031215611b6957600080fd5b611b72856118cf565b935060208501359250604085013567ffffffffffffffff811115611b9557600080fd5b611ba187828801611a11565b95989497509550505050565b60008060008060008060006080888a031215611bc857600080fd5b611bd1886118cf565b9650602088013567ffffffffffffffff80821115611bee57600080fd5b611bfa8b838c01611a11565b909850965060408a0135915080821115611c1357600080fd5b611c1f8b838c01611a5d565b909650945060608a0135915080821115611c3857600080fd5b50611c458a828b01611a5d565b989b979a50959850939692959293505050565b60008060008060608587031215611c6e57600080fd5b611c77856118cf565b9350602085013567ffffffffffffffff80821115611c9457600080fd5b9086019060608289031215611ca857600080fd5b90935060408601359080821115611cbe57600080fd5b50611ba187828801611a11565b6020815260006111356020830184611945565b600181811c90821680611cf257607f821691505b6020821081141561123957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611d6957611d69611d3f565b5060010190565b600060208284031215611d8257600080fd5b8151801515811461113557600080fd5b6000808335601e19843603018112611da957600080fd5b83018035915067ffffffffffffffff821115611dc457600080fd5b602001915036819003821315611a5657600080fd5b600060ff821660ff811415611df057611df0611d3f565b60010192915050565b600060208284031215611e0b57600080fd5b5051919050565b606081526000611e2560608301866119ba565b82810360208481019190915285518083528682019282019060005b81811015611e5c57845183529383019391830191600101611e40565b5050848103604086015285518082528282019350600581901b8201830183880160005b83811015611ead57601f19858403018752611e9b838351611945565b96860196925090850190600101611e7f565b50909a9950505050505050505050565b60006020808385031215611ed057600080fd5b825167ffffffffffffffff80821115611ee857600080fd5b818501915085601f830112611efc57600080fd5b815181811115611f0e57611f0e611d13565b8060051b604051601f19603f83011681018181108582111715611f3357611f33611d13565b604052918252848201925083810185019188831115611f5157600080fd5b938501935b82851015611f6f57845184529385019392850192611f56565b98975050505050505050565b8054600090600181811c9080831680611f9557607f831692505b6020808410821415611fb757634e487b7160e01b600052602260045260246000fd5b818015611fcb5760018114611fdc57612009565b60ff19861689528489019650612009565b60008881526020902060005b868110156120015781548b820152908501908301611fe8565b505084890196505b50505050505092915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b0000000081526000612047601c830185611f7b565b7f2c2022696d616765223a202200000000000000000000000000000000000000008152835161207d81600c840160208801611915565b7f227d000000000000000000000000000000000000000000000000000000000000600c9290910191820152600e01949350505050565b60008152600082516120cc816001850160208701611915565b9190910160010192915050565b7f646174613a0000000000000000000000000000000000000000000000000000008152600061210b6005830184611f7b565b7f3b6261736536342c00000000000000000000000000000000000000000000000081526008019392505050565b6000835161214a818460208801611915565b83519083019061215e818360208801611915565b01949350505050565b60008282101561217957612179611d3f565b500390565b634e487b7160e01b600052603160045260246000fd5b7f630000000000000000000000000000000000000000000000000000000000000081526001600160e01b03198360e01b1660018201527f80600e6000396000f3000000000000000000000000000000000000000000000060058201526000825161220581600e850160208701611915565b91909101600e019392505050565b6000821982111561222657612226611d3f565b500190565b60008261224857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561226757612267611d3f565b50029056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212201d1cc423ee72cc0a351b82a2f3db78c096874b26c119a4f9a2ae159528ac1f2a64736f6c63430008090033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100ea5760003560e01c8063715018a61161008c5780638da5cb5b116100665780638da5cb5b146101c9578063e16f4ae7146101e4578063e9dc6375146101f7578063f2fde38b1461021757600080fd5b8063715018a61461019b5780637b00b0e0146101a3578063804c4004146101b657600080fd5b80632d345670116100c85780632d3456701461014b57806331ae450b146101605780634a170398146101755780636d73e6691461018857600080fd5b806301ffc9a7146100ef57806324ba43281461011757806324d7806c14610138575b600080fd5b6101026100fd3660046118a5565b61022a565b60405190151581526020015b60405180910390f35b61012a6101253660046118eb565b61027d565b60405161010e929190611971565b61010261014636600461199f565b6103b4565b61015e61015936600461199f565b6103ed565b005b61016861044b565b60405161010e91906119fe565b61015e610183366004611a9f565b6104fa565b61015e61019636600461199f565b61076b565b61015e6107c3565b61015e6101b1366004611b53565b6107d7565b61015e6101c4366004611bad565b61094b565b6000546040516001600160a01b03909116815260200161010e565b61015e6101f2366004611c58565b610baf565b61020a6102053660046118eb565b610f32565b60405161010e9190611ccb565b61015e61022536600461199f565b611023565b60006001600160e01b031982167fe9dc63750000000000000000000000000000000000000000000000000000000014806102685750610268826110b0565b806102775750610277826110b0565b92915050565b60036020908152600092835260408084209091529082529020805481906102a390611cde565b80601f01602080910402602001604051908101604052809291908181526020018280546102cf90611cde565b801561031c5780601f106102f15761010080835404028352916020019161031c565b820191906000526020600020905b8154815290600101906020018083116102ff57829003601f168201915b50505050509080600101805461033190611cde565b80601f016020809104026020016040519081016040528092919081815260200182805461035d90611cde565b80156103aa5780601f1061037f576101008083540402835291602001916103aa565b820191906000526020600020905b81548152906001019060200180831161038d57829003601f168201915b5050505050905082565b6000816001600160a01b03166103d26000546001600160a01b031690565b6001600160a01b031614806102775750610277600183611117565b6103f561113c565b610400600182611117565b156104485760405133906001600160a01b038316907f7c0c3c84c67c85fcac635147348bfe374c24a1a93d0366d1cfe9d8853cbf89d590600090a3610446600182611196565b505b50565b606061045760016111ab565b67ffffffffffffffff81111561046f5761046f611d13565b604051908082528060200260200182016040528015610498578160200160208202803683370190505b50905060005b6104a860016111ab565b8110156104f6576104ba6001826111b5565b8282815181106104cc576104cc611d29565b6001600160a01b0390921660209283029190910190910152806104ee81611d55565b91505061049e565b5090565b604051630935e01b60e21b8152336004820152889081906001600160a01b038216906324d7806c9060240160206040518083038186803b15801561053d57600080fd5b505afa158015610551573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105759190611d70565b6105da5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084015b60405180910390fd5b8415610610576001600160a01b038a1660009081526003602090815260408083208c8452909152902061060e9087876117f6565b505b8215610649576001600160a01b038a1660009081526003602090815260408083208c845290915290206106479060010185856117f6565b505b861561075f576001600160a01b038a1660009081526003602090815260408083208c8452909152812061068191600290910190611876565b60005b60ff811688111561075d576001600160a01b038b1660009081526003602090815260408083208d845290915290206002016107198a8a60ff85168181106106cd576106cd611d29565b90506020028101906106df9190611d92565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506111c192505050565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061075581611dd9565b915050610684565b505b50505050505050505050565b61077361113c565b61077e600182611117565b6104485760405133906001600160a01b038316907f7e1a1a08d52e4ba0e21554733d66165fd5151f99460116223d9e3a608eec5cb190600090a361044660018261123f565b6107cb61113c565b6107d56000611254565b565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c9060240160206040518083038186803b15801561081a57600080fd5b505afa15801561082e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108529190611d70565b6108b25760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084016105d1565b60005b60ff8116841115610942576001600160a01b038716600090815260036020908152604080832089845290915290206002016108fe868660ff85168181106106cd576106cd611d29565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b039092169190911790558061093a81611dd9565b9150506108b5565b50505050505050565b604051630935e01b60e21b8152336004820152879081906001600160a01b038216906324d7806c9060240160206040518083038186803b15801561098e57600080fd5b505afa1580156109a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109c69190611d70565b610a265760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084016105d1565b6040517f2928ca580000000000000000000000000000000000000000000000000000000081523360048201526000906001600160a01b038b1690632928ca5890602401602060405180830381600087803b158015610a8357600080fd5b505af1158015610a97573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610abb9190611df9565b6001600160a01b038b1660009081526003602090815260408083208484529091529020909150610aec9088886117f6565b506001600160a01b038a1660009081526003602090815260408083208484529091529020610b1e9060010186866117f6565b5060005b60ff811689111561075d576001600160a01b038b1660009081526003602090815260408083208584529091529020600201610b6b8b8b60ff85168181106106cd576106cd611d29565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b0390921691909117905580610ba781611dd9565b915050610b22565b604051630935e01b60e21b8152336004820152849081906001600160a01b038216906324d7806c9060240160206040518083038186803b158015610bf257600080fd5b505afa158015610c06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c2a9190611d70565b610c8a5760405162461bcd60e51b815260206004820152602b60248201527f57616c6c6574206973206e6f7420616e2061646d696e6973747261746f72206660448201526a1bdc8818dbdb9d1c9858dd60aa1b60648201526084016105d1565b60408051600180825281830190925260009160208083019080368337505060408051600180825281830190925292935060009291506020808301908036833750506040805160018082528183019092529293506000929150602082015b6060815260200190600190039081610ce75790505090503383600081518110610d1257610d12611d29565b60200260200101906001600160a01b031690816001600160a01b031681525050876040013582600081518110610d4a57610d4a611d29565b60209081029190910101526040517f8c6e84720000000000000000000000000000000000000000000000000000000081526000906001600160a01b038b1690638c6e847290610da190879087908790600401611e12565b600060405180830381600087803b158015610dbb57600080fd5b505af1158015610dcf573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052610df79190810190611ebd565b9050600081600081518110610e0e57610e0e611d29565b60209081029190910101519050610e258a80611d92565b6001600160a01b038d1660009081526003602090815260408083208684529091529020610e539290916117f6565b50610e6160208b018b611d92565b6001600160a01b038d1660009081526003602090815260408083208684529091529020610e93926001909101916117f6565b5060005b60ff8116891115610f24576001600160a01b038c1660009081526003602090815260408083208584529091529020600201610ee08b8b60ff85168181106106cd576106cd611d29565b81546001810183556000928352602090922090910180546001600160a01b0319166001600160a01b0390921691909117905580610f1c81611dd9565b915050610e97565b505050505050505050505050565b6001600160a01b0382166000908152600360209081526040808320848452909152902060020154606090610fce5760405162461bcd60e51b815260206004820152602160248201527f546f6b656e206d6574616461746120646f65736e27742065786973742068657260448201527f650000000000000000000000000000000000000000000000000000000000000060648201526084016105d1565b6001600160a01b03831660009081526003602090815260408083208584529091529020610ffb84846112a4565b60405160200161100c929190612015565b604051602081830303815290604052905092915050565b61102b61113c565b6001600160a01b0381166110a75760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016105d1565b61044881611254565b60006001600160e01b031982167f553e757e00000000000000000000000000000000000000000000000000000000148061027757507f01ffc9a7000000000000000000000000000000000000000000000000000000006001600160e01b0319831614610277565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b6000546001600160a01b031633146107d55760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016105d1565b6000611135836001600160a01b0384166113e7565b6000610277825490565b600061113583836114da565b6000806111ec836040516020016111d891906120b3565b604051602081830303815290604052611504565b90508051602082016000f091506001600160a01b038216611239576040517f08d4abb600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50919050565b6000611135836001600160a01b038416611530565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160a01b038216600090815260036020908152604080832084845282528083209051606093926112db9260010191016120d9565b6040516020818303038152906040529050606060005b6001600160a01b038616600090815260036020908152604080832088845290915290206002015460ff821610156113b2576001600160a01b038616600090815260036020908152604080832088845290915290206002018054839161137d9160ff851690811061136357611363611d29565b6000918252602090912001546001600160a01b031661157f565b60405160200161138e929190612138565b604051602081830303815290604052915080806113aa90611dd9565b9150506112f1565b50816113bd8261158f565b6040516020016113ce929190612138565b60408051808303601f1901815291905295945050505050565b600081815260018301602052604081205480156114d057600061140b600183612167565b855490915060009061141f90600190612167565b905081811461148457600086600001828154811061143f5761143f611d29565b906000526020600020015490508087600001848154811061146257611462611d29565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806114955761149561217e565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610277565b6000915050610277565b60008260000182815481106114f1576114f1611d29565b9060005260206000200154905092915050565b606081518260405160200161151a929190612194565b6040516020818303038152906040529050919050565b600081815260018301602052604081205461157757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610277565b506000610277565b606061027782600160001961172c565b8051606090806115af575050604080516020810190915260008152919050565b600060036115be836002612213565b6115c8919061222b565b6115d390600461224d565b905060006115e2826020612213565b67ffffffffffffffff8111156115fa576115fa611d13565b6040519080825280601f01601f191660200182016040528015611624576020820181803683370190505b509050600060405180606001604052806040815260200161226d604091399050600181016020830160005b868110156116b0576003818a01810151603f601282901c8116860151600c83901c8216870151600684901c831688015192909316870151600891821b60ff94851601821b92841692909201901b91160160e01b83526004909201910161164f565b5060038606600181146116ca57600281146116f65761171e565b7f3d3d00000000000000000000000000000000000000000000000000000000000060011983015261171e565b7f3d000000000000000000000000000000000000000000000000000000000000006000198301525b505050918152949350505050565b6060833b8061174b575050604080516020810190915260008152611135565b80841115611769575050604080516020810190915260008152611135565b838310156117b4576040517f2c4a89fa0000000000000000000000000000000000000000000000000000000081526004810182905260248101859052604481018490526064016105d1565b83830384820360008282106117c957826117cb565b815b60408051603f8301601f19168101909152818152955090508087602087018a3c505050509392505050565b82805461180290611cde565b90600052602060002090601f016020900481019282611824576000855561186a565b82601f1061183d5782800160ff1982351617855561186a565b8280016001018555821561186a579182015b8281111561186a57823582559160200191906001019061184f565b506104f6929150611890565b508054600082559060005260206000209081019061044891905b5b808211156104f65760008155600101611891565b6000602082840312156118b757600080fd5b81356001600160e01b03198116811461113557600080fd5b80356001600160a01b03811681146118e657600080fd5b919050565b600080604083850312156118fe57600080fd5b611907836118cf565b946020939093013593505050565b60005b83811015611930578181015183820152602001611918565b8381111561193f576000848401525b50505050565b6000815180845261195d816020860160208601611915565b601f01601f19169290920160200192915050565b6040815260006119846040830185611945565b82810360208401526119968185611945565b95945050505050565b6000602082840312156119b157600080fd5b611135826118cf565b600081518084526020808501945080840160005b838110156119f35781516001600160a01b0316875295820195908201906001016119ce565b509495945050505050565b60208152600061113560208301846119ba565b60008083601f840112611a2357600080fd5b50813567ffffffffffffffff811115611a3b57600080fd5b6020830191508360208260051b8501011115611a5657600080fd5b9250929050565b60008083601f840112611a6f57600080fd5b50813567ffffffffffffffff811115611a8757600080fd5b602083019150836020828501011115611a5657600080fd5b60008060008060008060008060a0898b031215611abb57600080fd5b611ac4896118cf565b975060208901359650604089013567ffffffffffffffff80821115611ae857600080fd5b611af48c838d01611a11565b909850965060608b0135915080821115611b0d57600080fd5b611b198c838d01611a5d565b909650945060808b0135915080821115611b3257600080fd5b50611b3f8b828c01611a5d565b999c989b5096995094979396929594505050565b60008060008060608587031215611b6957600080fd5b611b72856118cf565b935060208501359250604085013567ffffffffffffffff811115611b9557600080fd5b611ba187828801611a11565b95989497509550505050565b60008060008060008060006080888a031215611bc857600080fd5b611bd1886118cf565b9650602088013567ffffffffffffffff80821115611bee57600080fd5b611bfa8b838c01611a11565b909850965060408a0135915080821115611c1357600080fd5b611c1f8b838c01611a5d565b909650945060608a0135915080821115611c3857600080fd5b50611c458a828b01611a5d565b989b979a50959850939692959293505050565b60008060008060608587031215611c6e57600080fd5b611c77856118cf565b9350602085013567ffffffffffffffff80821115611c9457600080fd5b9086019060608289031215611ca857600080fd5b90935060408601359080821115611cbe57600080fd5b50611ba187828801611a11565b6020815260006111356020830184611945565b600181811c90821680611cf257607f821691505b6020821081141561123957634e487b7160e01b600052602260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415611d6957611d69611d3f565b5060010190565b600060208284031215611d8257600080fd5b8151801515811461113557600080fd5b6000808335601e19843603018112611da957600080fd5b83018035915067ffffffffffffffff821115611dc457600080fd5b602001915036819003821315611a5657600080fd5b600060ff821660ff811415611df057611df0611d3f565b60010192915050565b600060208284031215611e0b57600080fd5b5051919050565b606081526000611e2560608301866119ba565b82810360208481019190915285518083528682019282019060005b81811015611e5c57845183529383019391830191600101611e40565b5050848103604086015285518082528282019350600581901b8201830183880160005b83811015611ead57601f19858403018752611e9b838351611945565b96860196925090850190600101611e7f565b50909a9950505050505050505050565b60006020808385031215611ed057600080fd5b825167ffffffffffffffff80821115611ee857600080fd5b818501915085601f830112611efc57600080fd5b815181811115611f0e57611f0e611d13565b8060051b604051601f19603f83011681018181108582111715611f3357611f33611d13565b604052918252848201925083810185019188831115611f5157600080fd5b938501935b82851015611f6f57845184529385019392850192611f56565b98975050505050505050565b8054600090600181811c9080831680611f9557607f831692505b6020808410821415611fb757634e487b7160e01b600052602260045260246000fd5b818015611fcb5760018114611fdc57612009565b60ff19861689528489019650612009565b60008881526020902060005b868110156120015781548b820152908501908301611fe8565b505084890196505b50505050505092915050565b7f646174613a6170706c69636174696f6e2f6a736f6e3b757466382c7b0000000081526000612047601c830185611f7b565b7f2c2022696d616765223a202200000000000000000000000000000000000000008152835161207d81600c840160208801611915565b7f227d000000000000000000000000000000000000000000000000000000000000600c9290910191820152600e01949350505050565b60008152600082516120cc816001850160208701611915565b9190910160010192915050565b7f646174613a0000000000000000000000000000000000000000000000000000008152600061210b6005830184611f7b565b7f3b6261736536342c00000000000000000000000000000000000000000000000081526008019392505050565b6000835161214a818460208801611915565b83519083019061215e818360208801611915565b01949350505050565b60008282101561217957612179611d3f565b500390565b634e487b7160e01b600052603160045260246000fd5b7f630000000000000000000000000000000000000000000000000000000000000081526001600160e01b03198360e01b1660018201527f80600e6000396000f3000000000000000000000000000000000000000000000060058201526000825161220581600e850160208701611915565b91909101600e019392505050565b6000821982111561222657612226611d3f565b500190565b60008261224857634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561226757612267611d3f565b50029056fe4142434445464748494a4b4c4d4e4f505152535455565758595a6162636465666768696a6b6c6d6e6f707172737475767778797a303132333435363738392b2fa26469706673582212201d1cc423ee72cc0a351b82a2f3db78c096874b26c119a4f9a2ae159528ac1f2a64736f6c63430008090033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.