Overview
TokenID
0
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract (WITH 0 Decimals)
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
TokenFactory
Compiler Version
v0.8.2+commit.661d1103
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./IFactoryERC721.sol"; import "./Token.sol"; import "./IUserTokenIdRegistry.sol"; //import "hardhat/console.sol"; /** * @title Dirty Robot's Summer Season Sale * An NFT powered by Ether Cards - https://ether.cards */ // interface IERC { // function transfer(address sender, uint256 amount) external; // function transferFrom(address sender, address to, uint256 id) external; // } contract TokenFactory is FactoryERC721, Ownable{ using Strings for string; event Transfer( address indexed from, address indexed to, uint256 indexed tokenId ); event ECRegistry(address); bool public auctionAllocated; uint public nextCardType; mapping(uint=>uint) public soldPerSeries; uint constant number_of_packs = 3; uint constant number_of_series = 13; // 4 x 3 + 1 uint constant number_of_sales = 8; uint constant public max_for_presale = 800; uint constant public max_for_mainsale = 3000; uint constant OG_ACCESS = 0; uint constant ALPHA_ACCESS = 1; uint constant FOUNDER_ACCESS = 2; uint constant MAINSALE_ACCESS = 3; uint constant AUCTION = 12; uint constant SUMMER_MONTAGE = 8; address immutable _registry; string public loeuf = "https://www.youtube.com/watch?v=VEQriHQpJFQ"; address public proxyRegistryAddress; address public nftAddress; string public baseURI = "https://client-metadata.ether.cards/api/dirtyrobot/collection/"; string _contractURI = "https://client-metadata.ether.cards/api/dirtyrobot/collection/contract"; uint public sold_in_presale; uint public sold_in_mainsale; constructor(address _proxyRegistryAddress, address _nftAddress, address __registry) { proxyRegistryAddress = _proxyRegistryAddress; nftAddress = _nftAddress; _registry = __registry; emit ECRegistry(__registry); fireTransferEvents(address(0), owner()); } function name() override external pure returns (string memory) { return "Dirty Robot\'s Summer Seasons Sale"; } function symbol() override external pure returns (string memory) { return "SUMMER"; } function supportsFactoryInterface() override public pure returns (bool) { return true; } function numOptions() override public pure returns (uint256) { return AUCTION+1; } function transferOwnership(address newOwner) override public onlyOwner { address _prevOwner = owner(); super.transferOwnership(newOwner); fireTransferEvents(_prevOwner, newOwner); } function fireTransferEvents(address _from, address _to) private { for (uint256 i = 0; i < numOptions(); i++) { emit Transfer(_from, _to, i); } } function mint(uint256 _optionId, address _toAddress) override public { // Must be sent from the owner proxy or owner. ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); assert( address(proxyRegistry.proxies(owner())) == _msgSender() || owner() == _msgSender() ); Token token = Token(nftAddress); if (_optionId == AUCTION) { // 24 require(!auctionAllocated, "Auction already closed"); auctionAllocated = true; token.mintTo(_toAddress,SUMMER_MONTAGE); return; } uint number_in_pack = number_in_packet(_optionId); require(_optionId < AUCTION, "Series does not exist"); uint256 permission = (_optionId / number_of_packs); if (permission == OG_ACCESS) { // 0-7 //console.log("OG",number_in_pack,_toAddress); is_registered_OG(_toAddress); check_presale_available(number_in_pack); } else if (permission == ALPHA_ACCESS) { // 8-15 is_registered_Alpha(_toAddress); check_presale_available(number_in_pack); } else if (permission == FOUNDER_ACCESS) { // 16-23 is_registered_Founder(_toAddress); check_presale_available(number_in_pack); } else { permission = MAINSALE_ACCESS; require(max_for_mainsale - sold_in_mainsale >= number_in_pack,"Not enough items left"); sold_in_mainsale += number_in_pack; } for (uint j = 0; j < number_in_pack; j++) { token.mintTo(_toAddress,nextCardType); nextCardType = (nextCardType + 1) % number_of_sales; } } function check_presale_available(uint num_to_buy) internal { require(max_for_presale - sold_in_presale >= num_to_buy,"Not enough presale pieces left"); sold_in_presale += num_to_buy; } function registry() internal view returns (IUserTokenIdRegistry) { return IUserTokenIdRegistry(_registry); } function is_registered_OG(address sender) internal view { uint16 _tokenId = registry().getTokenOrRevert(sender); require(_tokenId < 100,"Not qualified for this OG sale"); } function is_registered_Alpha(address sender) internal view { uint16 _tokenId = registry().getTokenOrRevert(sender); require(_tokenId < 1000,"Not qualified for this ALPHA sale"); } function is_registered_Founder(address sender) internal view { registry().getTokenOrRevert(sender); } function number_in_packet(uint256 _optionId) public view returns (uint256) { return 1 + (2 * (_optionId % number_of_packs)); } function canMint(uint256 _optionId) override public view returns (bool) { if (_optionId >= numOptions()) { return false; } if (_optionId == AUCTION) return !auctionAllocated; uint256 permission = (_optionId / number_of_packs); //console.log(_optionId, max_for_mainsale ,sold_in_mainsale , number_in_packet(_optionId)); if (permission <= FOUNDER_ACCESS) { return max_for_presale >= (sold_in_presale + number_in_packet(_optionId)); } return max_for_mainsale >= (sold_in_mainsale + number_in_packet(_optionId)); } function tokenURI(uint256 _optionId) override external view returns (string memory) { return string(abi.encodePacked(baseURI, Strings.toString(_optionId))); } function contractURI() public view returns (string memory) { return _contractURI; } function setContractURI(string memory _uri) external onlyOwner { _contractURI = _uri; } /** * Hack to get things to work automatically on OpenSea. * Use transferFrom so the frontend doesn't have to worry about different method names. */ function transferFrom( address _from, address _to, uint256 _tokenId ) public { mint(_tokenId, _to); } function setBaseURI(string memory _base) external onlyOwner { baseURI = _base; } /** * Hack to get things to work automatically on OpenSea. * Use isApprovedForAll so the frontend doesn't have to worry about different method names. */ function isApprovedForAll(address _owner, address _operator) public view returns (bool) { if (owner() == _owner && _owner == _operator) { return true; } ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if ( owner() == _owner && address(proxyRegistry.proxies(_owner)) == _operator ) { return true; } return false; } /** * Hack to get things to work automatically on OpenSea. * Use isApprovedForAll so the frontend doesn't have to worry about different method names. */ function ownerOf(uint256 _tokenId) public view returns (address _owner) { return owner(); } function retrieveERC20(address _tracker, uint256 amount) external onlyOwner { IERC(_tracker).transfer(_msgSender(), amount); } function retrieve721(address _tracker, uint256 id) external onlyOwner { IERC(_tracker).transferFrom(address(this), _msgSender(), id); } }
// SPDX-License-Identifier: MIT 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() { _setOwner(_msgSender()); } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { 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 { _setOwner(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"); _setOwner(newOwner); } function _setOwner(address newOwner) private { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef"; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { // Inspired by OraclizeAPI's implementation - MIT licence // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol if (value == 0) { return "0"; } uint256 temp = value; uint256 digits; while (temp != 0) { digits++; temp /= 10; } bytes memory buffer = new bytes(digits); while (value != 0) { digits -= 1; buffer[digits] = bytes1(uint8(48 + uint256(value % 10))); value /= 10; } return string(buffer); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { if (value == 0) { return "0x00"; } uint256 temp = value; uint256 length = 0; while (temp != 0) { length++; temp >>= 8; } return toHexString(value, length); } /** * @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] = _HEX_SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * This is a generic factory contract that can be used to mint tokens. The configuration * for minting is specified by an _optionId, which can be used to delineate various * ways of minting. */ interface FactoryERC721 { /** * Returns the name of this factory. */ function name() external view returns (string memory); /** * Returns the symbol for this factory. */ function symbol() external view returns (string memory); /** * Number of options the factory supports. */ function numOptions() external view returns (uint256); /** * @dev Returns whether the option ID can be minted. Can return false if the developer wishes to * restrict a total supply per option ID (or overall). */ function canMint(uint256 _optionId) external view returns (bool); /** * @dev Returns a URL specifying some metadata about the option. This metadata can be of the * same structure as the ERC721 metadata. */ function tokenURI(uint256 _optionId) external view returns (string memory); /** * Indicates that this is a factory contract. Ideally would use EIP 165 supportsInterface() */ function supportsFactoryInterface() external view returns (bool); /** * @dev Mints asset(s) in accordance to a specific address with a particular "option". This should be * callable only by the contract owner or the owner's Wyvern Proxy (later universal login will solve this). * Options should also be delineated 0 - (numOptions() - 1) for convenient indexing. * @param _optionId the option id * @param _toAddress address of the future owner of the asset(s) */ function mint(uint256 _optionId, address _toAddress) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./ERC721Tradable.sol"; /** * @title Dirty Robot's Seasons * An NFT powered by Ether Cards - https://ether.cards */ contract Token is ERC721Tradable { string _tokenURI = "https://client-metadata.ether.cards/api/dirtyrobot/"; string _contractURI = "https://client-metadata.ether.cards/api/dirtyrobot/contract"; string public loeuf = "https://www.youtube.com/watch?v=-wop47G2qeY"; uint256 constant public _sale_start = 1630422000; uint256 constant public _sale_end = _sale_start + 7 days; constructor(address _proxyRegistryAddress) ERC721Tradable("Dirty Robot Seasons", "SEASONS", _proxyRegistryAddress) {} function baseTokenURI() override public view returns (string memory) { return _tokenURI; } function setTokenURI(string memory _uri) external onlyOwner { _tokenURI = _uri; } function contractURI() public view returns (string memory) { return _contractURI; } function setContractURI(string memory _uri) external onlyOwner { _contractURI = _uri; } function _beforeTokenTransfer( address from, address to, uint256 _tokenId ) internal override { require( (block.timestamp > _sale_end) || (from == address(0)),"Tokens cannot be moved until the end of the sale"); super._beforeTokenTransfer(from,to,_tokenId); } /** * This is used instead of msg.sender as transactions won't be sent by the original token owner, but by OpenSea. */ }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; interface IUserTokenIdRegistry { function update(uint16 _id) external; function get(address _address) external view returns ( uint16 ); function getTokenOrRevert(address _address) external view returns ( uint16 ); }
// SPDX-License-Identifier: MIT 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 pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "./common/meta-transactions/ContentMixin.sol"; import "./common/meta-transactions/NativeMetaTransaction.sol"; interface IERC { function transfer(address sender, uint256 amount) external; function transferFrom(address sender, address to, uint256 id) external; } contract OwnableDelegateProxy {} contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; } /** * @title ERC721Tradable * ERC721Tradable - ERC721 contract that whitelists a trading address, and has minting functionality. */ abstract contract ERC721Tradable is ContextMixin, ERC721Enumerable, NativeMetaTransaction, Ownable { using SafeMath for uint256; address proxyRegistryAddress; mapping (address => bool) operators; mapping (uint256 => uint256) tokenToSeries; struct Series { string name; string baseURI; uint256 start; uint256 current; uint256 supply; } Series[] collections; event NewCollection(uint256 collection_id,string name,string baseURI,uint256 start,uint256 supply); constructor( string memory _name, string memory _symbol, address _proxyRegistryAddress ) ERC721(_name, _symbol) { proxyRegistryAddress = _proxyRegistryAddress; _initializeEIP712(_name); } modifier ownerOrOperator() { require(msgSender() == owner() || operators[msgSender()],"caller is neither the owner nor the operator"); _; } function setOperator(address _operator, bool status) external onlyOwner { if (status) { operators[_operator] = status; } else { delete operators[_operator]; } } function addSeries( string[] memory _names, string[] memory baseURIs, uint256[] memory _starts, uint256[] memory _supplys ) external onlyOwner { require (_names.length == baseURIs.length, "len 1 & 2 not equal"); require (_names.length == _starts.length, "len 1 & 3 not equal"); require (_names.length == _supplys.length, "len 1 & 4 not equal"); for (uint j = 0; j < _names.length; j++){ collections.push(Series(_names[j],baseURIs[j],_starts[j],0, _supplys[j])); emit NewCollection(collections.length-1,_names[j],baseURIs[j],_starts[j], _supplys[j]); } } /** * @dev Mints a token to an address with a tokenURI. * @param _to address of the future owner of the token */ function preMintTo(address _to, uint256[] memory _seriesz) public ownerOrOperator { for (uint j = 0; j < _seriesz.length; j++){ uint256 collection = _seriesz[j]; require(collection < collections.length, "Invalid Collection"); uint256 newTokenId = _getNextTokenId(collection); _mint(_to, newTokenId); tokenToSeries[newTokenId] = collection; } } /** * @dev Mints a token to an address with a tokenURI. * @param _to address of the future owner of the token */ function mintTo(address _to, uint256 collection) public ownerOrOperator { require(collection < collections.length, "Invalid Collection"); uint256 newTokenId = _getNextTokenId(collection); _mint(_to, newTokenId); tokenToSeries[newTokenId] = collection; } /** * @dev calculates the next token ID based on value of _currentTokenId * @return uint256 for the next token ID */ function _getNextTokenId(uint256 collection) private returns (uint256) { Series storage coll = collections[collection]; uint pointer = coll.current++; require(pointer < coll.supply, "No tokens available"); uint256 reply = coll.start + pointer; return reply; } /** * @dev increments the value of _currentTokenId */ function baseTokenURI() virtual public view returns (string memory); function seriesURI(uint256 collection) public view returns (string memory) { require(collection < collections.length, "Invalid Collection"); return collections[collection].baseURI; } function seriesStart(uint256 collection) internal view returns (uint256) { require(collection < collections.length, "Invalid Collection"); return collections[collection].start; } function seriesName(uint256 collection) public view returns (string memory) { require(collection < collections.length, "Invalid Collection"); return collections[collection].name; } function tokenURI(uint256 _tokenId) override public view returns (string memory) { require(_exists(_tokenId),"Token does not exist"); uint256 collection = tokenToSeries[_tokenId]; uint256 adjustedID = _tokenId - seriesStart(collection)+1; return string(abi.encodePacked(baseTokenURI(),seriesURI(collection),"/", Strings.toString(adjustedID))); } function tokenExists(uint256 _tokenId) external view returns (bool) { return _exists(_tokenId); } function numSeries() external view returns (uint256) { return collections.length; } function available(uint256 collectionId) external view returns (uint256) { require(collectionId < collections.length, "Invalid Collection"); Series memory coll = collections[collectionId]; return coll.supply - coll.current; } /** * Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. */ function isApprovedForAll(address _owner, address operator) override public view returns (bool) { // Whitelist OpenSea proxy contract for easy trading. ProxyRegistry proxyRegistry = ProxyRegistry(proxyRegistryAddress); if (address(proxyRegistry.proxies(_owner)) == operator) { return true; } return super.isApprovedForAll(_owner, operator); } /** * This is used instead of msg.sender as transactions won't be sent by the original token owner, but by OpenSea. */ function _msgSender() internal override view returns (address sender) { return ContextMixin.msgSender(); } function retrieveERC20(address _tracker, uint256 amount) external onlyOwner { IERC(_tracker).transfer(_msgSender(), amount); } function retrieve721(address _tracker, uint256 id) external onlyOwner { IERC(_tracker).transferFrom(address(this), _msgSender(), id); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata extension, but not including the Enumerable extension, which is available separately as * {ERC721Enumerable}. */ contract ERC721 is Context, ERC165, IERC721, IERC721Metadata { using Address for address; using Strings for uint256; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to owner address mapping(uint256 => address) private _owners; // Mapping owner address to token count mapping(address => uint256) private _balances; // Mapping from token ID to approved address mapping(uint256 => address) private _tokenApprovals; // Mapping from owner to operator approvals mapping(address => mapping(address => bool)) private _operatorApprovals; /** * @dev Initializes the contract by setting a `name` and a `symbol` to the token collection. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IERC721).interfaceId || interfaceId == type(IERC721Metadata).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view virtual override returns (uint256) { require(owner != address(0), "ERC721: balance query for the zero address"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _owners[tokenId]; require(owner != address(0), "ERC721: owner query for nonexistent token"); return owner; } /** * @dev See {IERC721Metadata-name}. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev See {IERC721Metadata-symbol}. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721Metadata: URI query for nonexistent token"); string memory baseURI = _baseURI(); return bytes(baseURI).length > 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ""; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ""; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721.ownerOf(tokenId); require(to != owner, "ERC721: approval to current owner"); require( _msgSender() == owner || isApprovedForAll(owner, _msgSender()), "ERC721: approve caller is not owner nor approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { require(_exists(tokenId), "ERC721: approved query for nonexistent token"); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { require(operator != _msgSender(), "ERC721: approve to caller"); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { //solhint-disable-next-line max-line-length require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _transfer(from, to, tokenId); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId ) public virtual override { safeTransferFrom(from, to, tokenId, ""); } /** * @dev See {IERC721-safeTransferFrom}. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes memory _data ) public virtual override { require(_isApprovedOrOwner(_msgSender(), tokenId), "ERC721: transfer caller is not owner nor approved"); _safeTransfer(from, to, tokenId, _data); } /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * `_data` is additional data, it has no specified format and it is sent in call to `to`. * * This internal function is equivalent to {safeTransferFrom}, and can be used to e.g. * implement alternative mechanisms to perform token transfer, such as signature-based. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeTransfer( address from, address to, uint256 tokenId, bytes memory _data ) internal virtual { _transfer(from, to, tokenId); require(_checkOnERC721Received(from, to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer"); } /** * @dev Returns whether `tokenId` exists. * * Tokens can be managed by their owner or approved accounts via {approve} or {setApprovalForAll}. * * Tokens start existing when they are minted (`_mint`), * and stop existing when they are burned (`_burn`). */ function _exists(uint256 tokenId) internal view virtual returns (bool) { return _owners[tokenId] != address(0); } /** * @dev Returns whether `spender` is allowed to manage `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _isApprovedOrOwner(address spender, uint256 tokenId) internal view virtual returns (bool) { require(_exists(tokenId), "ERC721: operator query for nonexistent token"); address owner = ERC721.ownerOf(tokenId); return (spender == owner || getApproved(tokenId) == spender || isApprovedForAll(owner, spender)); } /** * @dev Safely mints `tokenId` and transfers it to `to`. * * Requirements: * * - `tokenId` must not exist. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function _safeMint(address to, uint256 tokenId) internal virtual { _safeMint(to, tokenId, ""); } /** * @dev Same as {xref-ERC721-_safeMint-address-uint256-}[`_safeMint`], with an additional `data` parameter which is * forwarded in {IERC721Receiver-onERC721Received} to contract recipients. */ function _safeMint( address to, uint256 tokenId, bytes memory _data ) internal virtual { _mint(to, tokenId); require( _checkOnERC721Received(address(0), to, tokenId, _data), "ERC721: transfer to non ERC721Receiver implementer" ); } /** * @dev Mints `tokenId` and transfers it to `to`. * * WARNING: Usage of this method is discouraged, use {_safeMint} whenever possible * * Requirements: * * - `tokenId` must not exist. * - `to` cannot be the zero address. * * Emits a {Transfer} event. */ function _mint(address to, uint256 tokenId) internal virtual { require(to != address(0), "ERC721: mint to the zero address"); require(!_exists(tokenId), "ERC721: token already minted"); _beforeTokenTransfer(address(0), to, tokenId); _balances[to] += 1; _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId); // Clear approvals _approve(address(0), tokenId); _balances[owner] -= 1; delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); } /** * @dev Transfers `tokenId` from `from` to `to`. * As opposed to {transferFrom}, this imposes no restrictions on msg.sender. * * Requirements: * * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * * Emits a {Transfer} event. */ function _transfer( address from, address to, uint256 tokenId ) internal virtual { require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer of token that is not own"); require(to != address(0), "ERC721: transfer to the zero address"); _beforeTokenTransfer(from, to, tokenId); // Clear approvals from the previous owner _approve(address(0), tokenId); _balances[from] -= 1; _balances[to] += 1; _owners[tokenId] = to; emit Transfer(from, to, tokenId); } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve(address to, uint256 tokenId) internal virtual { _tokenApprovals[tokenId] = to; emit Approval(ERC721.ownerOf(tokenId), to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver.onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert("ERC721: transfer to non ERC721Receiver implementer"); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../ERC721.sol"; import "./IERC721Enumerable.sol"; /** * @dev This implements an optional extension of {ERC721} defined in the EIP that adds * enumerability of all the token ids in the contract as well as all token ids owned by each * account. */ abstract contract ERC721Enumerable is ERC721, IERC721Enumerable { // Mapping from owner to list of owned token IDs mapping(address => mapping(uint256 => uint256)) private _ownedTokens; // Mapping from token ID to index of the owner tokens list mapping(uint256 => uint256) private _ownedTokensIndex; // Array with all token ids, used for enumeration uint256[] private _allTokens; // Mapping from token id to position in the allTokens array mapping(uint256 => uint256) private _allTokensIndex; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override(IERC165, ERC721) returns (bool) { return interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view virtual override returns (uint256) { require(index < ERC721.balanceOf(owner), "ERC721Enumerable: owner index out of bounds"); return _ownedTokens[owner][index]; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _allTokens.length; } /** * @dev See {IERC721Enumerable-tokenByIndex}. */ function tokenByIndex(uint256 index) public view virtual override returns (uint256) { require(index < ERC721Enumerable.totalSupply(), "ERC721Enumerable: global index out of bounds"); return _allTokens[index]; } /** * @dev Hook that is called before any token transfer. This includes minting * and burning. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, ``from``'s `tokenId` will be burned. * - `from` cannot be the zero address. * - `to` cannot be the zero address. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override { super._beforeTokenTransfer(from, to, tokenId); if (from == address(0)) { _addTokenToAllTokensEnumeration(tokenId); } else if (from != to) { _removeTokenFromOwnerEnumeration(from, tokenId); } if (to == address(0)) { _removeTokenFromAllTokensEnumeration(tokenId); } else if (to != from) { _addTokenToOwnerEnumeration(to, tokenId); } } /** * @dev Private function to add a token to this extension's ownership-tracking data structures. * @param to address representing the new owner of the given token ID * @param tokenId uint256 ID of the token to be added to the tokens list of the given address */ function _addTokenToOwnerEnumeration(address to, uint256 tokenId) private { uint256 length = ERC721.balanceOf(to); _ownedTokens[to][length] = tokenId; _ownedTokensIndex[tokenId] = length; } /** * @dev Private function to add a token to this extension's token tracking data structures. * @param tokenId uint256 ID of the token to be added to the tokens list */ function _addTokenToAllTokensEnumeration(uint256 tokenId) private { _allTokensIndex[tokenId] = _allTokens.length; _allTokens.push(tokenId); } /** * @dev Private function to remove a token from this extension's ownership-tracking data structures. Note that * while the token is not assigned a new owner, the `_ownedTokensIndex` mapping is _not_ updated: this allows for * gas optimizations e.g. when performing a transfer operation (avoiding double writes). * This has O(1) time complexity, but alters the order of the _ownedTokens array. * @param from address representing the previous owner of the given token ID * @param tokenId uint256 ID of the token to be removed from the tokens list of the given address */ function _removeTokenFromOwnerEnumeration(address from, uint256 tokenId) private { // To prevent a gap in from's tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = ERC721.balanceOf(from) - 1; uint256 tokenIndex = _ownedTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary if (tokenIndex != lastTokenIndex) { uint256 lastTokenId = _ownedTokens[from][lastTokenIndex]; _ownedTokens[from][tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _ownedTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index } // This also deletes the contents at the last position of the array delete _ownedTokensIndex[tokenId]; delete _ownedTokens[from][lastTokenIndex]; } /** * @dev Private function to remove a token from this extension's token tracking data structures. * This has O(1) time complexity, but alters the order of the _allTokens array. * @param tokenId uint256 ID of the token to be removed from the tokens list */ function _removeTokenFromAllTokensEnumeration(uint256 tokenId) private { // To prevent a gap in the tokens array, we store the last token in the index of the token to delete, and // then delete the last slot (swap and pop). uint256 lastTokenIndex = _allTokens.length - 1; uint256 tokenIndex = _allTokensIndex[tokenId]; // When the token to delete is the last token, the swap operation is unnecessary. However, since this occurs so // rarely (when the last minted token is burnt) that we still do the swap here to avoid the gas cost of adding // an 'if' statement (like in _removeTokenFromOwnerEnumeration) uint256 lastTokenId = _allTokens[lastTokenIndex]; _allTokens[tokenIndex] = lastTokenId; // Move the last token to the slot of the to-delete token _allTokensIndex[lastTokenId] = tokenIndex; // Update the moved token's index // This also deletes the contents at the last position of the array delete _allTokensIndex[tokenId]; _allTokens.pop(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is no longer needed starting with Solidity 0.8. The compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract ContextMixin { function msgSender() internal view returns (address payable sender) { if (msg.sender == address(this)) { bytes memory array = msg.data; uint256 index = msg.data.length; assembly { // Load the 32 bytes word from memory with the address on the lower 20 bytes, and mask those. sender := and( mload(add(array, index)), 0xffffffffffffffffffffffffffffffffffffffff ) } } else { sender = payable(msg.sender); } return sender; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import {EIP712Base} from "./EIP712Base.sol"; contract NativeMetaTransaction is EIP712Base { using SafeMath for uint256; bytes32 private constant META_TRANSACTION_TYPEHASH = keccak256( bytes( "MetaTransaction(uint256 nonce,address from,bytes functionSignature)" ) ); event MetaTransactionExecuted( address userAddress, address payable relayerAddress, bytes functionSignature ); mapping(address => uint256) nonces; /* * Meta transaction structure. * No point of including value field here as if user is doing value transfer then he has the funds to pay for gas * He should call the desired function directly in that case. */ struct MetaTransaction { uint256 nonce; address from; bytes functionSignature; } function executeMetaTransaction( address userAddress, bytes memory functionSignature, bytes32 sigR, bytes32 sigS, uint8 sigV ) public payable returns (bytes memory) { MetaTransaction memory metaTx = MetaTransaction({ nonce: nonces[userAddress], from: userAddress, functionSignature: functionSignature }); require( verify(userAddress, metaTx, sigR, sigS, sigV), "Signer and signature do not match" ); // increase nonce for user (to avoid re-use) nonces[userAddress] = nonces[userAddress].add(1); emit MetaTransactionExecuted( userAddress, payable(msg.sender), functionSignature ); // Append userAddress and relayer address at the end to extract it from calling context (bool success, bytes memory returnData) = address(this).call( abi.encodePacked(functionSignature, userAddress) ); require(success, "Function call not successful"); return returnData; } function hashMetaTransaction(MetaTransaction memory metaTx) internal pure returns (bytes32) { return keccak256( abi.encode( META_TRANSACTION_TYPEHASH, metaTx.nonce, metaTx.from, keccak256(metaTx.functionSignature) ) ); } function getNonce(address user) public view returns (uint256 nonce) { nonce = nonces[user]; } function verify( address signer, MetaTransaction memory metaTx, bytes32 sigR, bytes32 sigS, uint8 sigV ) internal view returns (bool) { require(signer != address(0), "NativeMetaTransaction: INVALID_SIGNER"); return signer == ecrecover( toTypedMessageHash(hashMetaTransaction(metaTx)), sigV, sigR, sigS ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 tokenId ) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT 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 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 pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256 tokenId); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import {Initializable} from "./Initializable.sol"; contract EIP712Base is Initializable { struct EIP712Domain { string name; string version; address verifyingContract; bytes32 salt; } string constant public ERC712_VERSION = "1"; bytes32 internal constant EIP712_DOMAIN_TYPEHASH = keccak256( bytes( "EIP712Domain(string name,string version,address verifyingContract,bytes32 salt)" ) ); bytes32 internal domainSeperator; // supposed to be called once while initializing. // one of the contracts that inherits this contract follows proxy pattern // so it is not possible to do this in a constructor function _initializeEIP712( string memory name ) internal initializer { _setDomainSeperator(name); } function _setDomainSeperator(string memory name) internal { domainSeperator = keccak256( abi.encode( EIP712_DOMAIN_TYPEHASH, keccak256(bytes(name)), keccak256(bytes(ERC712_VERSION)), address(this), bytes32(getChainId()) ) ); } function getDomainSeperator() public view returns (bytes32) { return domainSeperator; } function getChainId() public view returns (uint256) { uint256 id; assembly { id := chainid() } return id; } /** * Accept message hash and returns hash message in EIP712 compatible form * So that it can be used to recover signer from signature signed using EIP712 formatted data * https://eips.ethereum.org/EIPS/eip-712 * "\\x19" makes the encoding deterministic * "\\x01" is the version byte to make it compatible to EIP-191 */ function toTypedMessageHash(bytes32 messageHash) internal view returns (bytes32) { return keccak256( abi.encodePacked("\x19\x01", getDomainSeperator(), messageHash) ); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; contract Initializable { bool inited = false; modifier initializer() { require(!inited, "already inited"); _; inited = true; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_proxyRegistryAddress","type":"address"},{"internalType":"address","name":"_nftAddress","type":"address"},{"internalType":"address","name":"__registry","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"","type":"address"}],"name":"ECRegistry","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[],"name":"auctionAllocated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"}],"name":"canMint","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"loeuf","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"max_for_mainsale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"max_for_presale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"},{"internalType":"address","name":"_toAddress","type":"address"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"nextCardType","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nftAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numOptions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"}],"name":"number_in_packet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"proxyRegistryAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tracker","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"retrieve721","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_tracker","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"retrieveERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_base","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_uri","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"soldPerSeries","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sold_in_mainsale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"sold_in_presale","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"supportsFactoryInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"uint256","name":"_optionId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
610100604052602b60a08181529062001c7160c03980516200002a916003916020909101906200023a565b506040518060600160405280603e815260200162001bed603e913980516200005b916006916020909101906200023a565b5060405180608001604052806046815260200162001c2b6046913980516200008c916007916020909101906200023a565b503480156200009a57600080fd5b5060405162001c9c38038062001c9c833981016040819052620000bd91620002fd565b620000c83362000165565b600480546001600160a01b038581166001600160a01b0319928316179092556005805485841692169190911790556001600160601b0319606083901b1660805260405190821681527f58d4a12725dc74336746361b6bd7a06b1a43a4704892200775a03e0e7cd9993c9060200160405180910390a16200015c6000620001566000546001600160a01b031690565b620001b5565b505050620003d2565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60005b620001c262000225565b811015620002205780826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48062000217816200039e565b915050620001b8565b505050565b600062000235600c600162000346565b905090565b828054620002489062000361565b90600052602060002090601f0160209004810192826200026c5760008555620002b7565b82601f106200028757805160ff1916838001178555620002b7565b82800160010185558215620002b7579182015b82811115620002b75782518255916020019190600101906200029a565b50620002c5929150620002c9565b5090565b5b80821115620002c55760008155600101620002ca565b80516001600160a01b0381168114620002f857600080fd5b919050565b60008060006060848603121562000312578283fd5b6200031d84620002e0565b92506200032d60208501620002e0565b91506200033d60408501620002e0565b90509250925092565b600082198211156200035c576200035c620003bc565b500190565b6002810460018216806200037657607f821691505b602082108114156200039857634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415620003b557620003b5620003bc565b5060010190565b634e487b7160e01b600052601160045260246000fd5b60805160601c6117ee620003ff60003960008181610d7001528181610edd0152610fda01526117ee6000f3fe608060405234801561001057600080fd5b50600436106101da5760003560e01c8063744ab55211610104578063a5b3abfb116100a2578063e8a3d48511610071578063e8a3d485146103cb578063e9744970146103d3578063e985e9c5146103dc578063f2fde38b146103ef576101da565b8063a5b3abfb1461038b578063c311c5231461039e578063c87b56dd146103a5578063cd7c0326146103b8576101da565b8063938e3d7b116100de578063938e3d7b1461033057806394bf804d1461034357806395d89b41146103565780639871a25314610378576101da565b8063744ab5521461030e57806380b46353146103165780638da5cb5b1461031f576101da565b80634b97aed91161017c5780635dd871a31161014b5780635dd871a3146102d85780636352211e146102eb5780636c0360eb146102fe578063715018a614610306576101da565b80634b97aed91461028957806355f804b3146102915780635b4dd60d146102a45780635bf8633a146102ad576101da565b80631ece93ca116101b85780631ece93ca1461024057806323b872dd146102495780632aaaa0d81461025c5780632abe738214610265576101da565b806306fdde03146101df5780630ccd5f17146101fd57806317fd1e2f1461022b575b600080fd5b6101e7610402565b6040516101f491906115dc565b60405180910390f35b61021d61020b3660046114de565b60026020526000908152604090205481565b6040519081526020016101f4565b61023e6102393660046113cb565b610422565b005b61021d60095481565b61023e61025736600461138b565b6104ba565b61021d61032081565b60005461027990600160a01b900460ff1681565b60405190151581526020016101f4565b61021d6104c9565b61023e61029f366004611412565b6104dc565b61021d610bb881565b6005546102c0906001600160a01b031681565b6040516001600160a01b0390911681526020016101f4565b6102796102e63660046114de565b61051d565b6102c06102f93660046114de565b6105b0565b6101e76105c4565b61023e610652565b6101e7610688565b61021d60085481565b6000546001600160a01b03166102c0565b61023e61033e366004611412565b610695565b61023e6103513660046114f6565b6106d2565b60408051808201909152600681526529aaa6a6a2a960d11b60208201526101e7565b61021d6103863660046114de565b610a5f565b61023e6103993660046113cb565b610a82565b6001610279565b6101e76103b33660046114de565b610ae5565b6004546102c0906001600160a01b031681565b6101e7610b19565b61021d60015481565b6102796103ea366004611353565b610bab565b61023e6103fd366004611330565b610cd3565b606060405180606001604052806021815260200161179860219139905090565b6000546001600160a01b031633146104555760405162461bcd60e51b815260040161044c9061160f565b60405180910390fd5b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044015b600060405180830381600087803b15801561049e57600080fd5b505af11580156104b2573d6000803e3d6000fd5b505050505050565b6104c481836106d2565b505050565b60006104d7600c6001611644565b905090565b6000546001600160a01b031633146105065760405162461bcd60e51b815260040161044c9061160f565b8051610519906006906020840190611297565b5050565b60006105276104c9565b8210610535575060006105ab565b600c8214156105525750600054600160a01b900460ff16156105ab565b600061055f60038461165c565b90506002811161058c5761057283610a5f565b60085461057f9190611644565b61032010159150506105ab565b61059583610a5f565b6009546105a29190611644565b610bb810159150505b919050565b600080546001600160a01b03165b92915050565b600680546105d1906116d6565b80601f01602080910402602001604051908101604052809291908181526020018280546105fd906116d6565b801561064a5780601f1061061f5761010080835404028352916020019161064a565b820191906000526020600020905b81548152906001019060200180831161062d57829003601f168201915b505050505081565b6000546001600160a01b0316331461067c5760405162461bcd60e51b815260040161044c9061160f565b6106866000610d1c565b565b600380546105d1906116d6565b6000546001600160a01b031633146106bf5760405162461bcd60e51b815260040161044c9061160f565b8051610519906007906020840190611297565b6004546001600160a01b0316336001600160a01b0316816001600160a01b031663c45527916107096000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561074857600080fd5b505afa15801561075c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078091906113f6565b6001600160a01b0316148061079f57506000546001600160a01b031633145b6107b957634e487b7160e01b600052600160045260246000fd5b6005546001600160a01b0316600c84141561089d57600054600160a01b900460ff16156108215760405162461bcd60e51b8152602060048201526016602482015275105d58dd1a5bdb88185b1c9958591e4818db1bdcd95960521b604482015260640161044c565b6000805460ff60a01b1916600160a01b1790556040516308934a5f60e31b81526001600160a01b0384811660048301526008602483015282169063449a52f890604401600060405180830381600087803b15801561087e57600080fd5b505af1158015610892573d6000803e3d6000fd5b505050505050610519565b60006108a885610a5f565b9050600c85106108f25760405162461bcd60e51b815260206004820152601560248201527414d95c9a595cc8191bd95cc81b9bdd08195e1a5cdd605a1b604482015260640161044c565b60006108ff60038761165c565b90508061091d5761090f85610d6c565b61091882610e60565b6109b4565b600181141561092f5761090f85610ed9565b60028114156109415761090f85610fd8565b6003905081600954610bb8610956919061168f565b101561099c5760405162461bcd60e51b8152602060048201526015602482015274139bdd08195b9bdd59da081a5d195b5cc81b19599d605a1b604482015260640161044c565b81600960008282546109ae9190611644565b90915550505b60005b82811015610a56576001546040516308934a5f60e31b81526001600160a01b03888116600483015260248201929092529085169063449a52f890604401600060405180830381600087803b158015610a0e57600080fd5b505af1158015610a22573d6000803e3d6000fd5b5050505060086001546001610a379190611644565b610a41919061172c565b60015580610a4e81611711565b9150506109b7565b50505050505050565b6000610a6c60038361172c565b610a77906002611670565b6105be906001611644565b6000546001600160a01b03163314610aac5760405162461bcd60e51b815260040161044c9061160f565b6040516323b872dd60e01b8152306004820152336024820152604481018290526001600160a01b038316906323b872dd90606401610484565b60606006610af283611074565b604051602001610b03929190611536565b6040516020818303038152906040529050919050565b606060078054610b28906116d6565b80601f0160208091040260200160405190810160405280929190818152602001828054610b54906116d6565b8015610ba15780601f10610b7657610100808354040283529160200191610ba1565b820191906000526020600020905b815481529060010190602001808311610b8457829003601f168201915b5050505050905090565b6000826001600160a01b0316610bc96000546001600160a01b031690565b6001600160a01b0316148015610bf05750816001600160a01b0316836001600160a01b0316145b15610bfd575060016105be565b6004546001600160a01b03908116908416610c206000546001600160a01b031690565b6001600160a01b0316148015610cba575060405163c455279160e01b81526001600160a01b038581166004830152808516919083169063c45527919060240160206040518083038186803b158015610c7757600080fd5b505afa158015610c8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610caf91906113f6565b6001600160a01b0316145b15610cc95760019150506105be565b5060009392505050565b6000546001600160a01b03163314610cfd5760405162461bcd60e51b815260040161044c9061160f565b6000546001600160a01b0316610d1282611197565b6105198183611232565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60007f0000000000000000000000000000000000000000000000000000000000000000604051633fb85ce360e21b81526001600160a01b038481166004830152919091169063fee1738c9060240160206040518083038186803b158015610dd257600080fd5b505afa158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a91906114bc565b905060648161ffff16106105195760405162461bcd60e51b815260206004820152601e60248201527f4e6f74207175616c696669656420666f722074686973204f472073616c650000604482015260640161044c565b80600854610320610e71919061168f565b1015610ebf5760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420656e6f7567682070726573616c6520706965636573206c6566740000604482015260640161044c565b8060086000828254610ed19190611644565b909155505050565b60007f0000000000000000000000000000000000000000000000000000000000000000604051633fb85ce360e21b81526001600160a01b038481166004830152919091169063fee1738c9060240160206040518083038186803b158015610f3f57600080fd5b505afa158015610f53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7791906114bc565b90506103e88161ffff16106105195760405162461bcd60e51b815260206004820152602160248201527f4e6f74207175616c696669656420666f72207468697320414c5048412073616c6044820152606560f81b606482015260840161044c565b7f0000000000000000000000000000000000000000000000000000000000000000604051633fb85ce360e21b81526001600160a01b038381166004830152919091169063fee1738c9060240160206040518083038186803b15801561103c57600080fd5b505afa158015611050573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051991906114bc565b60608161109957506040805180820190915260018152600360fc1b60208201526105ab565b8160005b81156110c357806110ad81611711565b91506110bc9050600a8361165c565b915061109d565b60008167ffffffffffffffff8111156110ec57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611116576020820181803683370190505b5090505b841561118f5761112b60018361168f565b9150611138600a8661172c565b611143906030611644565b60f81b81838151811061116657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611188600a8661165c565b945061111a565b949350505050565b6000546001600160a01b031633146111c15760405162461bcd60e51b815260040161044c9061160f565b6001600160a01b0381166112265760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161044c565b61122f81610d1c565b50565b60005b61123d6104c9565b8110156104c45780826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48061128f81611711565b915050611235565b8280546112a3906116d6565b90600052602060002090601f0160209004810192826112c5576000855561130b565b82601f106112de57805160ff191683800117855561130b565b8280016001018555821561130b579182015b8281111561130b5782518255916020019190600101906112f0565b5061131792915061131b565b5090565b5b80821115611317576000815560010161131c565b600060208284031215611341578081fd5b813561134c81611782565b9392505050565b60008060408385031215611365578081fd5b823561137081611782565b9150602083013561138081611782565b809150509250929050565b60008060006060848603121561139f578081fd5b83356113aa81611782565b925060208401356113ba81611782565b929592945050506040919091013590565b600080604083850312156113dd578182fd5b82356113e881611782565b946020939093013593505050565b600060208284031215611407578081fd5b815161134c81611782565b600060208284031215611423578081fd5b813567ffffffffffffffff8082111561143a578283fd5b818401915084601f83011261144d578283fd5b81358181111561145f5761145f61176c565b604051601f8201601f19908116603f011681019083821181831017156114875761148761176c565b8160405282815287602084870101111561149f578586fd5b826020860160208301379182016020019490945295945050505050565b6000602082840312156114cd578081fd5b815161ffff8116811461134c578182fd5b6000602082840312156114ef578081fd5b5035919050565b60008060408385031215611508578182fd5b82359150602083013561138081611782565b6000815161152c8185602086016116a6565b9290920192915050565b825460009081906002810460018083168061155257607f831692505b602080841082141561157257634e487b7160e01b87526022600452602487fd5b8180156115865760018114611597576115c3565b60ff198616895284890196506115c3565b60008b815260209020885b868110156115bb5781548b8201529085019083016115a2565b505084890196505b5050505050506115d3818561151a565b95945050505050565b60006020825282518060208401526115fb8160408501602087016116a6565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561165757611657611740565b500190565b60008261166b5761166b611756565b500490565b600081600019048311821515161561168a5761168a611740565b500290565b6000828210156116a1576116a1611740565b500390565b60005b838110156116c15781810151838201526020016116a9565b838111156116d0576000848401525b50505050565b6002810460018216806116ea57607f821691505b6020821081141561170b57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561172557611725611740565b5060010190565b60008261173b5761173b611756565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461122f57600080fdfe446972747920526f626f7427732053756d6d657220536561736f6e732053616c65a26469706673582212207c552fdf17a980f155c964f2376762a80bb8b68d1f3f5f0242512a614b58c55d64736f6c6343000802003368747470733a2f2f636c69656e742d6d657461646174612e65746865722e63617264732f6170692f6469727479726f626f742f636f6c6c656374696f6e2f68747470733a2f2f636c69656e742d6d657461646174612e65746865722e63617264732f6170692f6469727479726f626f742f636f6c6c656374696f6e2f636f6e747261637468747470733a2f2f7777772e796f75747562652e636f6d2f77617463683f763d56455172694851704a4651000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1000000000000000000000000922a6ac0f4438bf84b816987a6bbfee82aa02073000000000000000000000000b57fba975c89492b016e0215e819b4d489f0fbcd
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101da5760003560e01c8063744ab55211610104578063a5b3abfb116100a2578063e8a3d48511610071578063e8a3d485146103cb578063e9744970146103d3578063e985e9c5146103dc578063f2fde38b146103ef576101da565b8063a5b3abfb1461038b578063c311c5231461039e578063c87b56dd146103a5578063cd7c0326146103b8576101da565b8063938e3d7b116100de578063938e3d7b1461033057806394bf804d1461034357806395d89b41146103565780639871a25314610378576101da565b8063744ab5521461030e57806380b46353146103165780638da5cb5b1461031f576101da565b80634b97aed91161017c5780635dd871a31161014b5780635dd871a3146102d85780636352211e146102eb5780636c0360eb146102fe578063715018a614610306576101da565b80634b97aed91461028957806355f804b3146102915780635b4dd60d146102a45780635bf8633a146102ad576101da565b80631ece93ca116101b85780631ece93ca1461024057806323b872dd146102495780632aaaa0d81461025c5780632abe738214610265576101da565b806306fdde03146101df5780630ccd5f17146101fd57806317fd1e2f1461022b575b600080fd5b6101e7610402565b6040516101f491906115dc565b60405180910390f35b61021d61020b3660046114de565b60026020526000908152604090205481565b6040519081526020016101f4565b61023e6102393660046113cb565b610422565b005b61021d60095481565b61023e61025736600461138b565b6104ba565b61021d61032081565b60005461027990600160a01b900460ff1681565b60405190151581526020016101f4565b61021d6104c9565b61023e61029f366004611412565b6104dc565b61021d610bb881565b6005546102c0906001600160a01b031681565b6040516001600160a01b0390911681526020016101f4565b6102796102e63660046114de565b61051d565b6102c06102f93660046114de565b6105b0565b6101e76105c4565b61023e610652565b6101e7610688565b61021d60085481565b6000546001600160a01b03166102c0565b61023e61033e366004611412565b610695565b61023e6103513660046114f6565b6106d2565b60408051808201909152600681526529aaa6a6a2a960d11b60208201526101e7565b61021d6103863660046114de565b610a5f565b61023e6103993660046113cb565b610a82565b6001610279565b6101e76103b33660046114de565b610ae5565b6004546102c0906001600160a01b031681565b6101e7610b19565b61021d60015481565b6102796103ea366004611353565b610bab565b61023e6103fd366004611330565b610cd3565b606060405180606001604052806021815260200161179860219139905090565b6000546001600160a01b031633146104555760405162461bcd60e51b815260040161044c9061160f565b60405180910390fd5b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044015b600060405180830381600087803b15801561049e57600080fd5b505af11580156104b2573d6000803e3d6000fd5b505050505050565b6104c481836106d2565b505050565b60006104d7600c6001611644565b905090565b6000546001600160a01b031633146105065760405162461bcd60e51b815260040161044c9061160f565b8051610519906006906020840190611297565b5050565b60006105276104c9565b8210610535575060006105ab565b600c8214156105525750600054600160a01b900460ff16156105ab565b600061055f60038461165c565b90506002811161058c5761057283610a5f565b60085461057f9190611644565b61032010159150506105ab565b61059583610a5f565b6009546105a29190611644565b610bb810159150505b919050565b600080546001600160a01b03165b92915050565b600680546105d1906116d6565b80601f01602080910402602001604051908101604052809291908181526020018280546105fd906116d6565b801561064a5780601f1061061f5761010080835404028352916020019161064a565b820191906000526020600020905b81548152906001019060200180831161062d57829003601f168201915b505050505081565b6000546001600160a01b0316331461067c5760405162461bcd60e51b815260040161044c9061160f565b6106866000610d1c565b565b600380546105d1906116d6565b6000546001600160a01b031633146106bf5760405162461bcd60e51b815260040161044c9061160f565b8051610519906007906020840190611297565b6004546001600160a01b0316336001600160a01b0316816001600160a01b031663c45527916107096000546001600160a01b031690565b6040516001600160e01b031960e084901b1681526001600160a01b03909116600482015260240160206040518083038186803b15801561074857600080fd5b505afa15801561075c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061078091906113f6565b6001600160a01b0316148061079f57506000546001600160a01b031633145b6107b957634e487b7160e01b600052600160045260246000fd5b6005546001600160a01b0316600c84141561089d57600054600160a01b900460ff16156108215760405162461bcd60e51b8152602060048201526016602482015275105d58dd1a5bdb88185b1c9958591e4818db1bdcd95960521b604482015260640161044c565b6000805460ff60a01b1916600160a01b1790556040516308934a5f60e31b81526001600160a01b0384811660048301526008602483015282169063449a52f890604401600060405180830381600087803b15801561087e57600080fd5b505af1158015610892573d6000803e3d6000fd5b505050505050610519565b60006108a885610a5f565b9050600c85106108f25760405162461bcd60e51b815260206004820152601560248201527414d95c9a595cc8191bd95cc81b9bdd08195e1a5cdd605a1b604482015260640161044c565b60006108ff60038761165c565b90508061091d5761090f85610d6c565b61091882610e60565b6109b4565b600181141561092f5761090f85610ed9565b60028114156109415761090f85610fd8565b6003905081600954610bb8610956919061168f565b101561099c5760405162461bcd60e51b8152602060048201526015602482015274139bdd08195b9bdd59da081a5d195b5cc81b19599d605a1b604482015260640161044c565b81600960008282546109ae9190611644565b90915550505b60005b82811015610a56576001546040516308934a5f60e31b81526001600160a01b03888116600483015260248201929092529085169063449a52f890604401600060405180830381600087803b158015610a0e57600080fd5b505af1158015610a22573d6000803e3d6000fd5b5050505060086001546001610a379190611644565b610a41919061172c565b60015580610a4e81611711565b9150506109b7565b50505050505050565b6000610a6c60038361172c565b610a77906002611670565b6105be906001611644565b6000546001600160a01b03163314610aac5760405162461bcd60e51b815260040161044c9061160f565b6040516323b872dd60e01b8152306004820152336024820152604481018290526001600160a01b038316906323b872dd90606401610484565b60606006610af283611074565b604051602001610b03929190611536565b6040516020818303038152906040529050919050565b606060078054610b28906116d6565b80601f0160208091040260200160405190810160405280929190818152602001828054610b54906116d6565b8015610ba15780601f10610b7657610100808354040283529160200191610ba1565b820191906000526020600020905b815481529060010190602001808311610b8457829003601f168201915b5050505050905090565b6000826001600160a01b0316610bc96000546001600160a01b031690565b6001600160a01b0316148015610bf05750816001600160a01b0316836001600160a01b0316145b15610bfd575060016105be565b6004546001600160a01b03908116908416610c206000546001600160a01b031690565b6001600160a01b0316148015610cba575060405163c455279160e01b81526001600160a01b038581166004830152808516919083169063c45527919060240160206040518083038186803b158015610c7757600080fd5b505afa158015610c8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610caf91906113f6565b6001600160a01b0316145b15610cc95760019150506105be565b5060009392505050565b6000546001600160a01b03163314610cfd5760405162461bcd60e51b815260040161044c9061160f565b6000546001600160a01b0316610d1282611197565b6105198183611232565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60007f000000000000000000000000b57fba975c89492b016e0215e819b4d489f0fbcd604051633fb85ce360e21b81526001600160a01b038481166004830152919091169063fee1738c9060240160206040518083038186803b158015610dd257600080fd5b505afa158015610de6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0a91906114bc565b905060648161ffff16106105195760405162461bcd60e51b815260206004820152601e60248201527f4e6f74207175616c696669656420666f722074686973204f472073616c650000604482015260640161044c565b80600854610320610e71919061168f565b1015610ebf5760405162461bcd60e51b815260206004820152601e60248201527f4e6f7420656e6f7567682070726573616c6520706965636573206c6566740000604482015260640161044c565b8060086000828254610ed19190611644565b909155505050565b60007f000000000000000000000000b57fba975c89492b016e0215e819b4d489f0fbcd604051633fb85ce360e21b81526001600160a01b038481166004830152919091169063fee1738c9060240160206040518083038186803b158015610f3f57600080fd5b505afa158015610f53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f7791906114bc565b90506103e88161ffff16106105195760405162461bcd60e51b815260206004820152602160248201527f4e6f74207175616c696669656420666f72207468697320414c5048412073616c6044820152606560f81b606482015260840161044c565b7f000000000000000000000000b57fba975c89492b016e0215e819b4d489f0fbcd604051633fb85ce360e21b81526001600160a01b038381166004830152919091169063fee1738c9060240160206040518083038186803b15801561103c57600080fd5b505afa158015611050573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061051991906114bc565b60608161109957506040805180820190915260018152600360fc1b60208201526105ab565b8160005b81156110c357806110ad81611711565b91506110bc9050600a8361165c565b915061109d565b60008167ffffffffffffffff8111156110ec57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015611116576020820181803683370190505b5090505b841561118f5761112b60018361168f565b9150611138600a8661172c565b611143906030611644565b60f81b81838151811061116657634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350611188600a8661165c565b945061111a565b949350505050565b6000546001600160a01b031633146111c15760405162461bcd60e51b815260040161044c9061160f565b6001600160a01b0381166112265760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161044c565b61122f81610d1c565b50565b60005b61123d6104c9565b8110156104c45780826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a48061128f81611711565b915050611235565b8280546112a3906116d6565b90600052602060002090601f0160209004810192826112c5576000855561130b565b82601f106112de57805160ff191683800117855561130b565b8280016001018555821561130b579182015b8281111561130b5782518255916020019190600101906112f0565b5061131792915061131b565b5090565b5b80821115611317576000815560010161131c565b600060208284031215611341578081fd5b813561134c81611782565b9392505050565b60008060408385031215611365578081fd5b823561137081611782565b9150602083013561138081611782565b809150509250929050565b60008060006060848603121561139f578081fd5b83356113aa81611782565b925060208401356113ba81611782565b929592945050506040919091013590565b600080604083850312156113dd578182fd5b82356113e881611782565b946020939093013593505050565b600060208284031215611407578081fd5b815161134c81611782565b600060208284031215611423578081fd5b813567ffffffffffffffff8082111561143a578283fd5b818401915084601f83011261144d578283fd5b81358181111561145f5761145f61176c565b604051601f8201601f19908116603f011681019083821181831017156114875761148761176c565b8160405282815287602084870101111561149f578586fd5b826020860160208301379182016020019490945295945050505050565b6000602082840312156114cd578081fd5b815161ffff8116811461134c578182fd5b6000602082840312156114ef578081fd5b5035919050565b60008060408385031215611508578182fd5b82359150602083013561138081611782565b6000815161152c8185602086016116a6565b9290920192915050565b825460009081906002810460018083168061155257607f831692505b602080841082141561157257634e487b7160e01b87526022600452602487fd5b8180156115865760018114611597576115c3565b60ff198616895284890196506115c3565b60008b815260209020885b868110156115bb5781548b8201529085019083016115a2565b505084890196505b5050505050506115d3818561151a565b95945050505050565b60006020825282518060208401526115fb8160408501602087016116a6565b601f01601f19169190910160400192915050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b6000821982111561165757611657611740565b500190565b60008261166b5761166b611756565b500490565b600081600019048311821515161561168a5761168a611740565b500290565b6000828210156116a1576116a1611740565b500390565b60005b838110156116c15781810151838201526020016116a9565b838111156116d0576000848401525b50505050565b6002810460018216806116ea57607f821691505b6020821081141561170b57634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561172557611725611740565b5060010190565b60008261173b5761173b611756565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b038116811461122f57600080fdfe446972747920526f626f7427732053756d6d657220536561736f6e732053616c65a26469706673582212207c552fdf17a980f155c964f2376762a80bb8b68d1f3f5f0242512a614b58c55d64736f6c63430008020033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1000000000000000000000000922a6ac0f4438bf84b816987a6bbfee82aa02073000000000000000000000000b57fba975c89492b016e0215e819b4d489f0fbcd
-----Decoded View---------------
Arg [0] : _proxyRegistryAddress (address): 0xa5409ec958C83C3f309868babACA7c86DCB077c1
Arg [1] : _nftAddress (address): 0x922A6ac0F4438Bf84B816987a6bBfee82Aa02073
Arg [2] : __registry (address): 0xB57fba975C89492B016e0215E819B4d489F0fbcD
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1
Arg [1] : 000000000000000000000000922a6ac0f4438bf84b816987a6bbfee82aa02073
Arg [2] : 000000000000000000000000b57fba975c89492b016e0215e819b4d489f0fbcd
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.