ERC-721
Overview
Max Total Supply
384 VIKING
Holders
48
Market
Volume (24H)
N/A
Min Price (24H)
N/A
Max Price (24H)
N/A
Other Info
Token Contract
Balance
12 VIKINGLoading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Name:
ERC721FullFeaturedCollection
Compiler Version
v0.8.9+commit.e5eed63a
Optimization Enabled:
Yes with 5 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "../../../common/meta-transactions/ERC2771ContextOwnable.sol"; import "../extensions/ERC721CollectionMetadataExtension.sol"; import "../extensions/ERC721PrefixedMetadataExtension.sol"; import "../extensions/ERC721AutoIdMinterExtension.sol"; import "../extensions/ERC721OwnerMintExtension.sol"; import "../extensions/ERC721PreSaleExtension.sol"; import "../extensions/ERC721PublicSaleExtension.sol"; import "../extensions/ERC721SimpleProceedsExtension.sol"; import "../extensions/ERC721RoleBasedMintExtension.sol"; import "../extensions/ERC721RoyaltyExtension.sol"; import "../extensions/ERC721BulkifyExtension.sol"; import "../extensions/ERC721OpenSeaNoGasExtension.sol"; contract ERC721FullFeaturedCollection is Ownable, ERC165Storage, ERC721, ERC2771ContextOwnable, ERC721CollectionMetadataExtension, ERC721PrefixedMetadataExtension, ERC721AutoIdMinterExtension, ERC721OwnerMintExtension, ERC721PreSaleExtension, ERC721PublicSaleExtension, ERC721SimpleProceedsExtension, ERC721RoleBasedMintExtension, ERC721RoyaltyExtension, ERC721OpenSeaNoGasExtension, ERC721BulkifyExtension { struct Config { string name; string symbol; string contractURI; string placeholderURI; uint256 maxSupply; uint256 preSalePrice; uint256 preSaleMaxMintPerWallet; uint256 publicSalePrice; uint256 publicSaleMaxMintPerTx; address defaultRoyaltyAddress; uint16 defaultRoyaltyBps; address openSeaProxyRegistryAddress; address openSeaExchangeAddress; address trustedForwarder; } constructor(Config memory config) ERC721(config.name, config.symbol) ERC721CollectionMetadataExtension(config.contractURI) ERC721PrefixedMetadataExtension(config.placeholderURI) ERC721AutoIdMinterExtension(config.maxSupply) ERC721PreSaleExtension( config.preSalePrice, config.preSaleMaxMintPerWallet ) ERC721PublicSaleExtension( config.publicSalePrice, config.publicSaleMaxMintPerTx ) ERC721RoyaltyExtension( config.defaultRoyaltyAddress, config.defaultRoyaltyBps ) ERC721OpenSeaNoGasExtension( config.openSeaProxyRegistryAddress, config.openSeaExchangeAddress ) ERC2771ContextOwnable(config.trustedForwarder) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); } function _msgSender() internal view virtual override(ERC2771ContextOwnable, Context) returns (address sender) { return super._msgSender(); } function _msgData() internal view virtual override(ERC2771ContextOwnable, Context) returns (bytes calldata) { return super._msgData(); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override( ERC165Storage, ERC721, ERC721CollectionMetadataExtension, ERC721PrefixedMetadataExtension, ERC721AutoIdMinterExtension, ERC721PreSaleExtension, ERC721PublicSaleExtension, ERC721SimpleProceedsExtension, ERC721OwnerMintExtension, ERC721RoleBasedMintExtension, ERC721RoyaltyExtension, ERC721OpenSeaNoGasExtension, ERC721BulkifyExtension ) returns (bool) { return ERC721.supportsInterface(interfaceId) || ERC165Storage.supportsInterface(interfaceId); } /** * Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. */ function isApprovedForAll(address owner, address operator) public view override(ERC721, ERC721OpenSeaNoGasExtension) returns (bool) { return super.isApprovedForAll(owner, operator); } function tokenURI(uint256 _tokenId) public view virtual override(ERC721, ERC721PrefixedMetadataExtension) returns (string memory) { return ERC721PrefixedMetadataExtension.tokenURI(_tokenId); } function getInfo() external view returns ( uint256 _maxSupply, uint256 _totalSupply, uint256 _senderBalance, uint256 _preSalePrice, uint256 _preSaleMaxMintPerWallet, uint256 _preSaleAlreadyClaimed, bool _preSaleActive, uint256 _publicSalePrice, uint256 _publicSaleMaxMintPerTx, bool _publicSaleActive ) { uint256 balance = 0; if (_msgSender() != address(0)) { balance = this.balanceOf(_msgSender()); } return ( maxSupply, this.totalSupply(), balance, preSalePrice, preSaleMaxMintPerWallet, preSaleAllowlistClaimed[_msgSender()], preSaleStatus, publicSalePrice, publicSaleMaxMintPerTx, publicSaleStatus ); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; interface ERC721AutoIdMinterExtensionInterface { function setMaxSupply(uint256 newValue) external; function freezeMaxSupply() external; function totalSupply() external view returns (uint256); } /** * @dev Extension to add minting capability with an auto incremented ID for each token and a maximum supply setting. */ abstract contract ERC721AutoIdMinterExtension is Ownable, ERC165Storage, ERC721, ERC721AutoIdMinterExtensionInterface { using SafeMath for uint256; uint256 public maxSupply; bool internal _maxSupplyFrozen; uint256 internal _currentTokenId = 0; constructor(uint256 _maxSupply) { maxSupply = _maxSupply; _registerInterface( type(ERC721AutoIdMinterExtensionInterface).interfaceId ); } // ADMIN function setMaxSupply(uint256 newValue) external onlyOwner { require(!_maxSupplyFrozen, "BASE_URI_FROZEN"); maxSupply = newValue; } function freezeMaxSupply() external onlyOwner { _maxSupplyFrozen = true; } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, ERC721) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } function totalSupply() public view returns (uint256) { return _currentTokenId; } // INTERNAL function _mintTo(address to, uint256 count) internal { require(totalSupply() + count <= maxSupply, "EXCEEDS_MAX_SUPPLY"); for (uint256 i = 0; i < count; i++) { uint256 newTokenId = _getNextTokenId(); _safeMint(to, newTokenId); _incrementTokenId(); } } /** * Calculates the next token ID based on value of _currentTokenId * @return uint256 for the next token ID */ function _getNextTokenId() internal view returns (uint256) { return _currentTokenId.add(1); } /** * Increments the value of _currentTokenId */ function _incrementTokenId() internal { _currentTokenId++; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev 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 { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) 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 generally not needed starting with Solidity 0.8, since 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 subtraction 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 // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; import "./IERC721.sol"; import "./IERC721Receiver.sol"; import "./extensions/IERC721Metadata.sol"; import "../../utils/Address.sol"; import "../../utils/Context.sol"; import "../../utils/Strings.sol"; import "../../utils/introspection/ERC165.sol"; /** * @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 overridden 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 { _setApprovalForAll(_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 || isApprovedForAll(owner, spender) || getApproved(tokenId) == 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); _afterTokenTransfer(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); _afterTokenTransfer(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 from incorrect owner"); 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); _afterTokenTransfer(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 Approve `operator` to operate on all of `owner` tokens * * Emits a {ApprovalForAll} event. */ function _setApprovalForAll( address owner, address operator, bool approved ) internal virtual { require(owner != operator, "ERC721: approve to caller"); _operatorApprovals[owner][operator] = approved; emit ApprovalForAll(owner, operator, approved); } /** * @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 {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 tokenId ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165Storage.sol) pragma solidity ^0.8.0; import "./ERC165.sol"; /** * @dev Storage based implementation of the {IERC165} interface. * * Contracts may inherit from this and call {_registerInterface} to declare * their support of an interface. */ abstract contract ERC165Storage is ERC165 { /** * @dev Mapping of interface ids to whether or not it's supported. */ mapping(bytes4 => bool) private _supportedInterfaces; /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return super.supportsInterface(interfaceId) || _supportedInterfaces[interfaceId]; } /** * @dev Registers the contract as an implementer of the interface defined by * `interfaceId`. Support of the actual ERC165 interface is automatic and * registering its interface id is not required. * * See {IERC165-supportsInterface}. * * Requirements: * * - `interfaceId` cannot be the ERC165 invalid interface (`0xffffffff`). */ function _registerInterface(bytes4 interfaceId) internal virtual { require(interfaceId != 0xffffffff, "ERC165: invalid interface id"); _supportedInterfaces[interfaceId] = true; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721.sol) 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`. * * 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; /** * @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 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 the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) 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 `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) 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 // OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @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 * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return 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 // OpenZeppelin Contracts v4.4.1 (utils/Strings.sol) 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 // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "../../../common/meta-transactions/ERC2771ContextOwnable.sol"; import "../extensions/ERC721CollectionMetadataExtension.sol"; import "../extensions/ERC721PrefixedMetadataExtension.sol"; import "../extensions/ERC721AutoIdMinterExtension.sol"; import "../extensions/ERC721OwnerMintExtension.sol"; contract ERC721SimplePrefixedCollection is Ownable, ERC165Storage, ERC2771ContextOwnable, ERC721, ERC721CollectionMetadataExtension, ERC721PrefixedMetadataExtension, ERC721AutoIdMinterExtension, ERC721OwnerMintExtension { struct Config { string name; string symbol; string contractURI; string placeholderURI; uint256 maxSupply; address trustedForwarder; } constructor(Config memory config) ERC721(config.name, config.symbol) ERC721CollectionMetadataExtension(config.contractURI) ERC721PrefixedMetadataExtension(config.placeholderURI) ERC721AutoIdMinterExtension(maxSupply) ERC2771ContextOwnable(config.trustedForwarder) {} function _msgSender() internal view virtual override(ERC2771ContextOwnable, Context) returns (address sender) { return super._msgSender(); } function _msgData() internal view virtual override(ERC2771ContextOwnable, Context) returns (bytes calldata) { return super._msgData(); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override( ERC165Storage, ERC721, ERC721AutoIdMinterExtension, ERC721CollectionMetadataExtension, ERC721OwnerMintExtension, ERC721PrefixedMetadataExtension ) returns (bool) { return ERC721.supportsInterface(interfaceId) || ERC165Storage.supportsInterface(interfaceId); } function tokenURI(uint256 _tokenId) public view virtual override(ERC721, ERC721PrefixedMetadataExtension) returns (string memory) { return ERC721PrefixedMetadataExtension.tokenURI(_tokenId); } function getInfo() external view returns ( uint256 _maxSupply, uint256 _totalSupply, uint256 _senderBalance ) { uint256 balance = 0; if (_msgSender() != address(0)) { balance = this.balanceOf(_msgSender()); } return (maxSupply, this.totalSupply(), balance); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; /** * @dev Context variant with ERC2771 support. */ abstract contract ERC2771ContextOwnable is Context, Ownable { address public _trustedForwarder; /// @custom:oz-upgrades-unsafe-allow constructor constructor(address trustedForwarder) { _trustedForwarder = trustedForwarder; } function setTrustedForwarder(address trustedForwarder) public onlyOwner { _trustedForwarder = trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == _trustedForwarder; } function _msgSender() internal view virtual override returns (address sender) { if (isTrustedForwarder(msg.sender)) { // The assembly code is more direct than the Solidity version using `abi.decode`. assembly { sender := shr(96, calldataload(sub(calldatasize(), 20))) } } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { if (isTrustedForwarder(msg.sender)) { return msg.data[:msg.data.length - 20]; } else { return super._msgData(); } } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; interface ERC721CollectionMetadataExtensionInterface { function setContractURI(string memory newValue) external; function contractURI() external view returns (string memory); } /** * @dev Extension to allow configuring contract-level collection metadata URI. */ abstract contract ERC721CollectionMetadataExtension is Ownable, ERC165Storage, ERC721CollectionMetadataExtensionInterface { string private _contractURI; constructor(string memory contractURI_) { _contractURI = contractURI_; _registerInterface( type(ERC721CollectionMetadataExtensionInterface).interfaceId ); } // ADMIN function setContractURI(string memory newValue) external onlyOwner { _contractURI = newValue; } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } function contractURI() public view returns (string memory) { return _contractURI; } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; interface ERC721PrefixedMetadataExtensionInterface { function setPlaceholderURI(string memory newValue) external; function setBaseURI(string memory newValue) external; function freezeBaseURI() external; function baseTokenURI() external view returns (string memory); function placeholderURI() external view returns (string memory); function tokenURI(uint256 _tokenId) external view returns (string memory); } /** * @dev Extension to allow configuring tokens metadata URI. * In this extension tokens will have a shared token URI prefix, * therefore on tokenURI() token's ID will be appended to the base URI. * It also allows configuring a fallback "placeholder" URI when prefix is not set yet. */ abstract contract ERC721PrefixedMetadataExtension is Ownable, ERC165Storage, ERC721, ERC721PrefixedMetadataExtensionInterface { string private _placeholderURI; string private _baseTokenURI; bool private _baseURIFrozen; constructor(string memory placeholderURI_) { _placeholderURI = placeholderURI_; _registerInterface( type(ERC721PrefixedMetadataExtensionInterface).interfaceId ); } // ADMIN function setPlaceholderURI(string memory newValue) external onlyOwner { _placeholderURI = newValue; } function setBaseURI(string memory newValue) external onlyOwner { require(!_baseURIFrozen, "BASE_URI_FROZEN"); _baseTokenURI = newValue; } function freezeBaseURI() external onlyOwner { _baseURIFrozen = true; } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, ERC721) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } function baseTokenURI() public view returns (string memory) { return _baseTokenURI; } function placeholderURI() public view returns (string memory) { return _placeholderURI; } function tokenURI(uint256 _tokenId) public view virtual override(ERC721, ERC721PrefixedMetadataExtensionInterface) returns (string memory) { return bytes(_baseTokenURI).length > 0 ? string( abi.encodePacked(_baseTokenURI, Strings.toString(_tokenId)) ) : _placeholderURI; } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "./ERC721AutoIdMinterExtension.sol"; interface ERC721OwnerMintExtensionInterface { function mintByOwner(address to, uint256 count) external; } /** * @dev Extension to allow owner to mint directly without paying. */ abstract contract ERC721OwnerMintExtension is Ownable, ERC165Storage, ERC721AutoIdMinterExtension, ERC721OwnerMintExtensionInterface { constructor() { _registerInterface(type(ERC721OwnerMintExtensionInterface).interfaceId); } // ADMIN function mintByOwner(address to, uint256 count) external onlyOwner { _mintTo(to, count); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, ERC721AutoIdMinterExtension) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "../../../common/meta-transactions/ERC2771ContextOwnable.sol"; import "../extensions/ERC721CollectionMetadataExtension.sol"; import "../extensions/ERC721PerTokenMetadataExtension.sol"; import "../extensions/ERC721OneOfOneMintExtension.sol"; import "../extensions/ERC721AutoIdMinterExtension.sol"; import "../extensions/ERC721OwnerMintExtension.sol"; import "../extensions/ERC721RoyaltyExtension.sol"; import "../extensions/ERC721OpenSeaNoGasExtension.sol"; contract ERC721OneOfOneCollection is Ownable, ERC165Storage, ERC2771ContextOwnable, ERC721, ERC721AutoIdMinterExtension, ERC721CollectionMetadataExtension, ERC721OwnerMintExtension, ERC721PerTokenMetadataExtension, ERC721OneOfOneMintExtension, ERC721RoyaltyExtension, ERC721OpenSeaNoGasExtension { struct Config { string name; string symbol; string contractURI; uint256 maxSupply; address defaultRoyaltyAddress; uint16 defaultRoyaltyBps; address openSeaProxyRegistryAddress; address openSeaExchangeAddress; address trustedForwarder; } constructor(Config memory config) ERC721(config.name, config.symbol) ERC721CollectionMetadataExtension(config.contractURI) ERC721PerTokenMetadataExtension() ERC721OneOfOneMintExtension() ERC721AutoIdMinterExtension(config.maxSupply) ERC721RoyaltyExtension( config.defaultRoyaltyAddress, config.defaultRoyaltyBps ) ERC721OpenSeaNoGasExtension( config.openSeaProxyRegistryAddress, config.openSeaExchangeAddress ) ERC2771ContextOwnable(config.trustedForwarder) { _setupRole(DEFAULT_ADMIN_ROLE, _msgSender()); _setupRole(MINTER_ROLE, _msgSender()); } function _burn(uint256 tokenId) internal virtual override(ERC721, ERC721OneOfOneMintExtension, ERC721URIStorage) { return ERC721OneOfOneMintExtension._burn(tokenId); } function _msgSender() internal view virtual override(ERC2771ContextOwnable, Context) returns (address sender) { return super._msgSender(); } function _msgData() internal view virtual override(ERC2771ContextOwnable, Context) returns (bytes calldata) { return super._msgData(); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override( ERC165Storage, ERC721, ERC721AutoIdMinterExtension, ERC721CollectionMetadataExtension, ERC721OwnerMintExtension, ERC721OneOfOneMintExtension, ERC721PerTokenMetadataExtension, ERC721RoyaltyExtension, ERC721OpenSeaNoGasExtension ) returns (bool) { return ERC721.supportsInterface(interfaceId) || ERC165Storage.supportsInterface(interfaceId); } /** * Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. */ function isApprovedForAll(address owner, address operator) public view override(ERC721, ERC721OpenSeaNoGasExtension) returns (bool) { return super.isApprovedForAll(owner, operator); } function tokenURI(uint256 _tokenId) public view virtual override(ERC721, ERC721OneOfOneMintExtension, ERC721URIStorage) returns (string memory) { return ERC721OneOfOneMintExtension.tokenURI(_tokenId); } function getInfo() external view returns ( uint256 _maxSupply, uint256 _totalSupply, uint256 _senderBalance ) { uint256 balance = 0; if (_msgSender() != address(0)) { balance = this.balanceOf(_msgSender()); } return (maxSupply, this.totalSupply(), balance); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Strings.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721URIStorage.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; interface ERC721PerTokenMetadataExtensionInterface { function freezeTokenURIs(uint256 _lastFrozenTokenId) external; function setTokenURI(uint256 tokenId, string memory tokenURI) external; } /** * @dev Extension to allow configuring collection and tokens metadata URI. * In this extension each token will have a different independent token URI set by contract owner. * To enable true self-custody for token owners, an admin can freeze URIs using a token ID pointer that can only be increased. */ abstract contract ERC721PerTokenMetadataExtension is Ownable, ERC165Storage, ERC721URIStorage, ERC721PerTokenMetadataExtensionInterface { uint256 public lastFrozenTokenId; constructor() { _registerInterface( type(ERC721PerTokenMetadataExtensionInterface).interfaceId ); } // ADMIN function freezeTokenURIs(uint256 _lastFrozenTokenId) external onlyOwner { require(_lastFrozenTokenId > lastFrozenTokenId, "CANNOT_UNFREEZE"); lastFrozenTokenId = _lastFrozenTokenId; } function setTokenURI(uint256 tokenId, string memory tokenURI) external onlyOwner { require(tokenId > lastFrozenTokenId, "FROZEN_TOKEN"); _setTokenURI(tokenId, tokenURI); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, ERC721) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "./ERC721AutoIdMinterExtension.sol"; import "./ERC721PerTokenMetadataExtension.sol"; interface ERC721OneOfOneMintExtensionInterface { function mintWithTokenURIsByOwner( address to, uint256 count, string[] memory tokenURIs ) external; function mintWithTokenURIsByRole( address to, uint256 count, string[] memory tokenURIs ) external; function tokenURI(uint256 tokenId) external view returns (string memory); } /** * @dev Extension to allow owner to mint 1-of-1 NFTs by providing dedicated metadata URI for each token. */ abstract contract ERC721OneOfOneMintExtension is Ownable, ERC165Storage, AccessControl, ERC721AutoIdMinterExtension, ERC721PerTokenMetadataExtension, ERC721OneOfOneMintExtensionInterface { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); constructor() { _registerInterface( type(ERC721OneOfOneMintExtensionInterface).interfaceId ); } // ADMIN function mintWithTokenURIsByOwner( address to, uint256 count, string[] memory tokenURIs ) external onlyOwner { uint256 startingTokenId = _getNextTokenId(); _mintTo(to, count); for (uint256 i = 0; i < count; i++) { _setTokenURI(startingTokenId + i, tokenURIs[i]); } } function mintWithTokenURIsByRole( address to, uint256 count, string[] memory tokenURIs ) external { require(hasRole(MINTER_ROLE, _msgSender()), "NOT_MINTER_ROLE"); uint256 startingTokenId = _getNextTokenId(); _mintTo(to, count); for (uint256 i = 0; i < count; i++) { _setTokenURI(startingTokenId + i, tokenURIs[i]); } } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override( ERC165Storage, AccessControl, ERC721AutoIdMinterExtension, ERC721PerTokenMetadataExtension ) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } function tokenURI(uint256 tokenId) public view virtual override(ERC721, ERC721URIStorage, ERC721OneOfOneMintExtensionInterface) returns (string memory) { return ERC721URIStorage.tokenURI(tokenId); } function _burn(uint256 tokenId) internal virtual override(ERC721, ERC721URIStorage) { return ERC721URIStorage._burn(tokenId); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@manifoldxyz/royalty-registry-solidity/contracts/overrides/IRoyaltyOverride.sol"; import "@manifoldxyz/royalty-registry-solidity/contracts/overrides/RoyaltyOverrideCore.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "../../../misc/rarible/IRoyalties.sol"; import "../../../misc/rarible/LibPart.sol"; import "../../../misc/rarible/LibRoyaltiesV2.sol"; interface ERC721RoyaltyExtensionInterface { function setTokenRoyalties( IEIP2981RoyaltyOverride.TokenRoyaltyConfig[] calldata royaltyConfigs ) external; function setDefaultRoyalty( IEIP2981RoyaltyOverride.TokenRoyalty calldata royalty ) external; function getRaribleV2Royalties(uint256 id) external view returns (LibPart.Part[] memory result); } /** * @dev Extension to signal configured royalty to famous marketplaces as well as ERC2981. * * This extension currently supports Standard ERC2981, Rarible. * Note that OpenSea is supported via Flair metadata feature. */ abstract contract ERC721RoyaltyExtension is Ownable, ERC165Storage, EIP2981RoyaltyOverrideCore, IRoyalties, ERC721RoyaltyExtensionInterface { constructor(address defaultRoyaltyReceiver, uint16 defaultRoyaltyBps) { TokenRoyalty memory royalty = TokenRoyalty( defaultRoyaltyReceiver, defaultRoyaltyBps ); _setDefaultRoyalty(royalty); _registerInterface(type(ERC721RoyaltyExtensionInterface).interfaceId); _registerInterface(type(IEIP2981).interfaceId); _registerInterface(type(IEIP2981RoyaltyOverride).interfaceId); _registerInterface(LibRoyaltiesV2._INTERFACE_ID_ROYALTIES); } function setTokenRoyalties(TokenRoyaltyConfig[] calldata royaltyConfigs) external override(IEIP2981RoyaltyOverride, ERC721RoyaltyExtensionInterface) onlyOwner { _setTokenRoyalties(royaltyConfigs); } function setDefaultRoyalty(TokenRoyalty calldata royalty) external override(IEIP2981RoyaltyOverride, ERC721RoyaltyExtensionInterface) onlyOwner { _setDefaultRoyalty(royalty); } function getRaribleV2Royalties(uint256 id) external view override(IRoyalties, ERC721RoyaltyExtensionInterface) returns (LibPart.Part[] memory result) { result = new LibPart.Part[](1); result[0].account = payable(defaultRoyalty.recipient); result[0].value = defaultRoyalty.bps; id; // avoid unused param warning } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, EIP2981RoyaltyOverrideCore) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "../../../misc/opensea/ProxyRegistry.sol"; interface ERC721OpenSeaNoGasExtensionInterface { function setOpenSeaProxyRegistryAddress(address addr) external; function setOpenSeaExchangeAddress(address addr) external; function isApprovedForAll(address owner, address operator) external view returns (bool); } /** * @dev Extension that automatically approves OpenSea to avoid having users to "Approve" your collection before trading. */ abstract contract ERC721OpenSeaNoGasExtension is Ownable, ERC165Storage, ERC721, ERC721OpenSeaNoGasExtensionInterface { address internal _openSeaProxyRegistryAddress; address private _openSeaExchangeAddress; constructor( address openSeaProxyRegistryAddress, address openSeaExchangeAddress ) { _openSeaProxyRegistryAddress = openSeaProxyRegistryAddress; _openSeaExchangeAddress = openSeaExchangeAddress; _registerInterface( type(ERC721OpenSeaNoGasExtensionInterface).interfaceId ); } // ADMIN function setOpenSeaProxyRegistryAddress(address addr) external onlyOwner { _openSeaProxyRegistryAddress = addr; } function setOpenSeaExchangeAddress(address addr) external onlyOwner { _openSeaExchangeAddress = addr; } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, ERC721) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } /** * Override isApprovedForAll to whitelist user's OpenSea proxy accounts to enable gas-less listings. */ function isApprovedForAll(address owner, address operator) public view virtual override(ERC721, ERC721OpenSeaNoGasExtensionInterface) returns (bool) { if (_openSeaProxyRegistryAddress != address(0)) { // Whitelist OpenSea proxy contract for easy trading. ProxyRegistry proxyRegistry = ProxyRegistry( _openSeaProxyRegistryAddress ); if (address(proxyRegistry.proxies(owner)) == operator) { return true; } } if (_openSeaExchangeAddress != address(0)) { // If OpenSea's ERC721 exchange address is detected, auto-approve if (operator == address(_openSeaExchangeAddress)) { return true; } } return super.isApprovedForAll(owner, operator); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; import "../ERC721.sol"; /** * @dev ERC721 token with storage based token URI management. */ abstract contract ERC721URIStorage is ERC721 { using Strings for uint256; // Optional mapping for token URIs mapping(uint256 => string) private _tokenURIs; /** * @dev See {IERC721Metadata-tokenURI}. */ function tokenURI(uint256 tokenId) public view virtual override returns (string memory) { require(_exists(tokenId), "ERC721URIStorage: URI query for nonexistent token"); string memory _tokenURI = _tokenURIs[tokenId]; string memory base = _baseURI(); // If there is no base URI, return the token URI. if (bytes(base).length == 0) { return _tokenURI; } // If both are set, concatenate the baseURI and tokenURI (via abi.encodePacked). if (bytes(_tokenURI).length > 0) { return string(abi.encodePacked(base, _tokenURI)); } return super.tokenURI(tokenId); } /** * @dev Sets `_tokenURI` as the tokenURI of `tokenId`. * * Requirements: * * - `tokenId` must exist. */ function _setTokenURI(uint256 tokenId, string memory _tokenURI) internal virtual { require(_exists(tokenId), "ERC721URIStorage: URI set of nonexistent token"); _tokenURIs[tokenId] = _tokenURI; } /** * @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 override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (access/AccessControl.sol) pragma solidity ^0.8.0; import "./IAccessControl.sol"; import "../utils/Context.sol"; import "../utils/Strings.sol"; import "../utils/introspection/ERC165.sol"; /** * @dev Contract module that allows children to implement role-based access * control mechanisms. This is a lightweight version that doesn't allow enumerating role * members except through off-chain means by accessing the contract event logs. Some * applications may benefit from on-chain enumerability, for those cases see * {AccessControlEnumerable}. * * Roles are referred to by their `bytes32` identifier. These should be exposed * in the external API and be unique. The best way to achieve this is by * using `public constant` hash digests: * * ``` * bytes32 public constant MY_ROLE = keccak256("MY_ROLE"); * ``` * * Roles can be used to represent a set of permissions. To restrict access to a * function call, use {hasRole}: * * ``` * function foo() public { * require(hasRole(MY_ROLE, msg.sender)); * ... * } * ``` * * Roles can be granted and revoked dynamically via the {grantRole} and * {revokeRole} functions. Each role has an associated admin role, and only * accounts that have a role's admin role can call {grantRole} and {revokeRole}. * * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means * that only accounts with this role will be able to grant or revoke other * roles. More complex role relationships can be created by using * {_setRoleAdmin}. * * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to * grant and revoke this role. Extra precautions should be taken to secure * accounts that have been granted it. */ abstract contract AccessControl is Context, IAccessControl, ERC165 { struct RoleData { mapping(address => bool) members; bytes32 adminRole; } mapping(bytes32 => RoleData) private _roles; bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00; /** * @dev Modifier that checks that an account has a specific role. Reverts * with a standardized message including the required role. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ * * _Available since v4.1._ */ modifier onlyRole(bytes32 role) { _checkRole(role); _; } /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) public view virtual override returns (bool) { return _roles[role].members[account]; } /** * @dev Revert with a standard message if `_msgSender()` is missing `role`. * Overriding this function changes the behavior of the {onlyRole} modifier. * * Format of the revert message is described in {_checkRole}. * * _Available since v4.6._ */ function _checkRole(bytes32 role) internal view virtual { _checkRole(role, _msgSender()); } /** * @dev Revert with a standard message if `account` is missing `role`. * * The format of the revert reason is given by the following regular expression: * * /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/ */ function _checkRole(bytes32 role, address account) internal view virtual { if (!hasRole(role, account)) { revert( string( abi.encodePacked( "AccessControl: account ", Strings.toHexString(uint160(account), 20), " is missing role ", Strings.toHexString(uint256(role), 32) ) ) ); } } /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) { return _roles[role].adminRole; } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _grantRole(role, account); } /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) { _revokeRole(role, account); } /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been revoked `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) public virtual override { require(account == _msgSender(), "AccessControl: can only renounce roles for self"); _revokeRole(role, account); } /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. Note that unlike {grantRole}, this function doesn't perform any * checks on the calling account. * * [WARNING] * ==== * This function should only be called from the constructor when setting * up the initial roles for the system. * * Using this function in any other way is effectively circumventing the admin * system imposed by {AccessControl}. * ==== * * NOTE: This function is deprecated in favor of {_grantRole}. */ function _setupRole(bytes32 role, address account) internal virtual { _grantRole(role, account); } /** * @dev Sets `adminRole` as ``role``'s admin role. * * Emits a {RoleAdminChanged} event. */ function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual { bytes32 previousAdminRole = getRoleAdmin(role); _roles[role].adminRole = adminRole; emit RoleAdminChanged(role, previousAdminRole, adminRole); } /** * @dev Grants `role` to `account`. * * Internal function without access restriction. */ function _grantRole(bytes32 role, address account) internal virtual { if (!hasRole(role, account)) { _roles[role].members[account] = true; emit RoleGranted(role, account, _msgSender()); } } /** * @dev Revokes `role` from `account`. * * Internal function without access restriction. */ function _revokeRole(bytes32 role, address account) internal virtual { if (hasRole(role, account)) { _roles[role].members[account] = false; emit RoleRevoked(role, account, _msgSender()); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol) pragma solidity ^0.8.0; /** * @dev External interface of AccessControl declared to support ERC165 detection. */ interface IAccessControl { /** * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole` * * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite * {RoleAdminChanged} not being emitted signaling this. * * _Available since v3.1._ */ event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole); /** * @dev Emitted when `account` is granted `role`. * * `sender` is the account that originated the contract call, an admin role * bearer except when using {AccessControl-_setupRole}. */ event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Emitted when `account` is revoked `role`. * * `sender` is the account that originated the contract call: * - if using `revokeRole`, it is the admin role bearer * - if using `renounceRole`, it is the role bearer (i.e. `account`) */ event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender); /** * @dev Returns `true` if `account` has been granted `role`. */ function hasRole(bytes32 role, address account) external view returns (bool); /** * @dev Returns the admin role that controls `role`. See {grantRole} and * {revokeRole}. * * To change a role's admin, use {AccessControl-_setRoleAdmin}. */ function getRoleAdmin(bytes32 role) external view returns (bytes32); /** * @dev Grants `role` to `account`. * * If `account` had not been already granted `role`, emits a {RoleGranted} * event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function grantRole(bytes32 role, address account) external; /** * @dev Revokes `role` from `account`. * * If `account` had been granted `role`, emits a {RoleRevoked} event. * * Requirements: * * - the caller must have ``role``'s admin role. */ function revokeRole(bytes32 role, address account) external; /** * @dev Revokes `role` from the calling account. * * Roles are often managed via {grantRole} and {revokeRole}: this function's * purpose is to provide a mechanism for accounts to lose their privileges * if they are compromised (such as when a trusted device is misplaced). * * If the calling account had been granted `role`, emits a {RoleRevoked} * event. * * Requirements: * * - the caller must be `account`. */ function renounceRole(bytes32 role, address account) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * Simple EIP2981 reference override implementation */ interface IEIP2981RoyaltyOverride is IERC165 { event TokenRoyaltyRemoved(uint256 tokenId); event TokenRoyaltySet(uint256 tokenId, address recipient, uint16 bps); event DefaultRoyaltySet(address recipient, uint16 bps); struct TokenRoyalty { address recipient; uint16 bps; } struct TokenRoyaltyConfig { uint256 tokenId; address recipient; uint16 bps; } /** * @dev Set per token royalties. Passing a recipient of address(0) will delete any existing configuration */ function setTokenRoyalties(TokenRoyaltyConfig[] calldata royalties) external; /** * @dev Get the number of token specific overrides. Used to enumerate over all configurations */ function getTokenRoyaltiesCount() external view returns(uint256); /** * @dev Get a token royalty configuration by index. Use in conjunction with getTokenRoyaltiesCount to get all per token configurations */ function getTokenRoyaltyByIndex(uint256 index) external view returns(TokenRoyaltyConfig memory); /** * @dev Set a default royalty configuration. Will be used if no token specific configuration is set */ function setDefaultRoyalty(TokenRoyalty calldata royalty) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /// @author: manifold.xyz import "@openzeppelin/contracts/utils/introspection/ERC165.sol"; import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol"; import "./IRoyaltyOverride.sol"; import "../specs/IEIP2981.sol"; /** * Simple EIP2981 reference override implementation */ abstract contract EIP2981RoyaltyOverrideCore is IEIP2981, IEIP2981RoyaltyOverride, ERC165 { using EnumerableSet for EnumerableSet.UintSet; TokenRoyalty public defaultRoyalty; mapping(uint256 => TokenRoyalty) private _tokenRoyalties; EnumerableSet.UintSet private _tokensWithRoyalties; function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) { return interfaceId == type(IEIP2981).interfaceId || interfaceId == type(IEIP2981RoyaltyOverride).interfaceId || super.supportsInterface(interfaceId); } /** * @dev Sets token royalties. When you override this in the implementation contract * ensure that you access restrict it to the contract owner or admin */ function _setTokenRoyalties(TokenRoyaltyConfig[] memory royaltyConfigs) internal { for (uint i = 0; i < royaltyConfigs.length; i++) { TokenRoyaltyConfig memory royaltyConfig = royaltyConfigs[i]; require(royaltyConfig.bps < 10000, "Invalid bps"); if (royaltyConfig.recipient == address(0)) { delete _tokenRoyalties[royaltyConfig.tokenId]; _tokensWithRoyalties.remove(royaltyConfig.tokenId); emit TokenRoyaltyRemoved(royaltyConfig.tokenId); } else { _tokenRoyalties[royaltyConfig.tokenId] = TokenRoyalty(royaltyConfig.recipient, royaltyConfig.bps); _tokensWithRoyalties.add(royaltyConfig.tokenId); emit TokenRoyaltySet(royaltyConfig.tokenId, royaltyConfig.recipient, royaltyConfig.bps); } } } /** * @dev Sets default royalty. When you override this in the implementation contract * ensure that you access restrict it to the contract owner or admin */ function _setDefaultRoyalty(TokenRoyalty memory royalty) internal { require(royalty.bps < 10000, "Invalid bps"); defaultRoyalty = TokenRoyalty(royalty.recipient, royalty.bps); emit DefaultRoyaltySet(royalty.recipient, royalty.bps); } /** * @dev See {IEIP2981RoyaltyOverride-getTokenRoyaltiesCount}. */ function getTokenRoyaltiesCount() external override view returns(uint256) { return _tokensWithRoyalties.length(); } /** * @dev See {IEIP2981RoyaltyOverride-getTokenRoyaltyByIndex}. */ function getTokenRoyaltyByIndex(uint256 index) external override view returns(TokenRoyaltyConfig memory) { uint256 tokenId = _tokensWithRoyalties.at(index); TokenRoyalty memory royalty = _tokenRoyalties[tokenId]; return TokenRoyaltyConfig(tokenId, royalty.recipient, royalty.bps); } /** * @dev See {IEIP2981RoyaltyOverride-royaltyInfo}. */ function royaltyInfo(uint256 tokenId, uint256 value) public override view returns (address, uint256) { if (_tokenRoyalties[tokenId].recipient != address(0)) { return (_tokenRoyalties[tokenId].recipient, value*_tokenRoyalties[tokenId].bps/10000); } if (defaultRoyalty.recipient != address(0) && defaultRoyalty.bps != 0) { return (defaultRoyalty.recipient, value*defaultRoyalty.bps/10000); } return (address(0), 0); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; pragma abicoder v2; import "./LibPart.sol"; interface IRoyalties { function getRaribleV2Royalties(uint256 id) external view returns (LibPart.Part[] memory); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; library LibPart { bytes32 public constant TYPE_HASH = keccak256("Part(address account,uint96 value)"); struct Part { address payable account; uint96 value; } function hash(Part memory part) internal pure returns (bytes32) { return keccak256(abi.encode(TYPE_HASH, part.account, part.value)); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; library LibRoyaltiesV2 { /* * bytes4(keccak256('getRaribleV2Royalties(uint256)')) == 0xcad96cca */ bytes4 constant _INTERFACE_ID_ROYALTIES = 0xcad96cca; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/structs/EnumerableSet.sol) pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { return _values(set._inner); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * EIP-2981 */ interface IEIP2981 { /** * bytes4(keccak256("royaltyInfo(uint256,uint256)")) == 0x2a55205a * * => 0x2a55205a = 0x2a55205a */ function royaltyInfo(uint256 tokenId, uint256 value) external view returns (address, uint256); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; contract OwnableDelegateProxy {} contract ProxyRegistry { mapping(address => OwnableDelegateProxy) public proxies; }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "./ERC721AutoIdMinterExtension.sol"; interface ERC721PreSaleExtensionInterface { function setPreSalePrice(uint256 newValue) external; function setPreSaleMaxMintPerWallet(uint256 newValue) external; function setAllowlistMerkleRoot(bytes32 newRoot) external; function togglePreSaleStatus(bool isActive) external; function onPreSaleAllowList(address minter, bytes32[] calldata proof) external view returns (bool); function mintPreSale(uint256 count, bytes32[] calldata proof) external payable; } /** * @dev Extension to provide pre-sale capabilities for certain collectors to mint for a specific price. */ abstract contract ERC721PreSaleExtension is ERC165Storage, ERC721AutoIdMinterExtension, ReentrancyGuard, ERC721PreSaleExtensionInterface { uint256 public preSalePrice; uint256 public preSaleMaxMintPerWallet; bytes32 public preSaleAllowlistMerkleRoot; bool public preSaleStatus; mapping(address => uint256) internal preSaleAllowlistClaimed; constructor(uint256 _preSalePrice, uint256 _preSaleMaxMintPerWallet) { preSalePrice = _preSalePrice; preSaleMaxMintPerWallet = _preSaleMaxMintPerWallet; _registerInterface(type(ERC721PreSaleExtensionInterface).interfaceId); } // ADMIN function setPreSalePrice(uint256 newValue) external onlyOwner { preSalePrice = newValue; } function setPreSaleMaxMintPerWallet(uint256 newValue) external onlyOwner { preSaleMaxMintPerWallet = newValue; } function setAllowlistMerkleRoot(bytes32 newRoot) external onlyOwner { preSaleAllowlistMerkleRoot = newRoot; } function togglePreSaleStatus(bool isActive) external onlyOwner { preSaleStatus = isActive; } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, ERC721AutoIdMinterExtension) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } function onPreSaleAllowList(address minter, bytes32[] calldata proof) external view returns (bool) { return MerkleProof.verify( proof, preSaleAllowlistMerkleRoot, _generateMerkleLeaf(minter) ); } function mintPreSale(uint256 count, bytes32[] calldata proof) external payable nonReentrant { require(preSaleStatus, "PRE_SALE_NOT_ACTIVE"); address to = _msgSender(); require( MerkleProof.verify( proof, preSaleAllowlistMerkleRoot, _generateMerkleLeaf(to) ), "PRE_SALE_WRONG_PROOF" ); require( preSaleAllowlistClaimed[to] + count <= preSaleMaxMintPerWallet, "PRE_SALE_LIMIT" ); require(preSalePrice * count <= msg.value, "INSUFFICIENT_AMOUNT"); preSaleAllowlistClaimed[to] += count; _mintTo(to, count); } // INTERNAL function _generateMerkleLeaf(address account) internal pure returns (bytes32) { return keccak256(abi.encodePacked(account)); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "./ERC721AutoIdMinterExtension.sol"; interface ERC721PublicSaleExtensionInterface { function setPublicSalePrice(uint256 newValue) external; function setPublicSaleMaxMintPerTx(uint256 newValue) external; function togglePublicSaleStatus(bool isActive) external; function mintPublicSale(address to, uint256 count) external payable; } /** * @dev Extension to provide pre-sale and public-sale capabilities for colelctors to mint for a specific price. */ abstract contract ERC721PublicSaleExtension is Ownable, ERC165Storage, ERC721AutoIdMinterExtension, ReentrancyGuard, ERC721PublicSaleExtensionInterface { uint256 public publicSalePrice; uint256 public publicSaleMaxMintPerTx; bool public publicSaleStatus; constructor(uint256 _publicSalePrice, uint256 _publicSaleMaxMintPerTx) { publicSalePrice = _publicSalePrice; publicSaleMaxMintPerTx = _publicSaleMaxMintPerTx; _registerInterface( type(ERC721PublicSaleExtensionInterface).interfaceId ); } // ADMIN function setPublicSalePrice(uint256 newValue) external onlyOwner { publicSalePrice = newValue; } function setPublicSaleMaxMintPerTx(uint256 newValue) external onlyOwner { publicSaleMaxMintPerTx = newValue; } function togglePublicSaleStatus(bool isActive) external onlyOwner { publicSaleStatus = isActive; } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, ERC721AutoIdMinterExtension) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } function mintPublicSale(address to, uint256 count) external payable nonReentrant { require(publicSaleStatus, "PRE_SALE_NOT_ACTIVE"); require(count <= publicSaleMaxMintPerTx, "PUBLIC_SALE_LIMIT"); require(publicSalePrice * count <= msg.value, "INSUFFICIENT_AMOUNT"); _mintTo(to, count); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; interface ERC721SimpleProceedsExtensionInterface { function withdraw() external; } /** * @dev Extension to allow contract owner to withdraw all the funds directly. */ abstract contract ERC721SimpleProceedsExtension is Ownable, ERC165Storage, ERC721SimpleProceedsExtensionInterface { constructor() { _registerInterface( type(ERC721SimpleProceedsExtensionInterface).interfaceId ); } // ADMIN function withdraw() external onlyOwner { uint256 balance = address(this).balance; payable(this.owner()).transfer(balance); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "./ERC721AutoIdMinterExtension.sol"; interface ERC721RoleBasedMintExtensionInterface { function mintByRole(address to, uint256 count) external; } /** * @dev Extension to allow holders of a OpenZepplin-based role to mint directly. */ abstract contract ERC721RoleBasedMintExtension is ERC165Storage, ERC721AutoIdMinterExtension, AccessControl, ERC721RoleBasedMintExtensionInterface { bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); constructor() { _registerInterface( type(ERC721RoleBasedMintExtensionInterface).interfaceId ); } // ADMIN function mintByRole(address to, uint256 count) external { require(hasRole(MINTER_ROLE, _msgSender()), "NOT_MINTER_ROLE"); _mintTo(to, count); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, AccessControl, ERC721AutoIdMinterExtension) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; interface ERC721BulkifyExtensionInterface { function transferFromBulk( address from, address to, uint256[] memory tokenIds ) external; } /** * @dev Extension to add bulk operations to a standard ERC721 contract. */ abstract contract ERC721BulkifyExtension is Context, ERC165Storage, ERC721, ERC721BulkifyExtensionInterface { constructor() { _registerInterface(type(ERC721BulkifyExtensionInterface).interfaceId); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, ERC721) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } /** * Useful for when user wants to return tokens to get a refund, * or when they want to transfer lots of tokens by paying gas fee only once. */ function transferFromBulk( address from, address to, uint256[] memory tokenIds ) public virtual { for (uint256 i = 0; i < tokenIds.length; i++) { require(_isApprovedOrOwner(_msgSender(), tokenIds[i]), "NOT_OWNER"); _transfer(from, to, tokenIds[i]); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Trees proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { bytes32 proofElement = proof[i]; if (computedHash <= proofElement) { // Hash(current computed hash + current element of the proof) computedHash = _efficientHash(computedHash, proofElement); } else { // Hash(current element of the proof + current computed hash) computedHash = _efficientHash(proofElement, computedHash); } } return computedHash; } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "../extensions/ERC20RoleBasedLockingExtension.sol"; contract ERC20LockableToken is ERC165Storage, AccessControl, ERC20, ERC20Burnable, Pausable, ERC20RoleBasedLockingExtension { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); struct Config { string name; string symbol; } constructor(Config memory config) ERC20(config.name, config.symbol) { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(PAUSER_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender); } // ADMIN function pause() public onlyRole(PAUSER_ROLE) { _pause(); } function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) { _mint(to, amount); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, AccessControl, ERC20RoleBasedLockingExtension) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override(ERC20, ERC20RoleBasedLockingExtension) whenNotPaused { ERC20RoleBasedLockingExtension._beforeTokenTransfer(from, to, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { require(!paused(), "Pausable: paused"); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { require(paused(), "Pausable: not paused"); _; } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; import "./IERC20.sol"; import "./extensions/IERC20Metadata.sol"; import "../../utils/Context.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * The default value of {decimals} is 18. To select a different value for * {decimals} you should overload it. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the value {ERC20} uses, unless this function is * overridden; * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom( address from, address to, uint256 amount ) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `sender` to `recipient`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer( address from, address to, uint256 amount ) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; } _balances[to] += amount; emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; _balances[account] += amount; emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; } _totalSupply -= amount; emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve( address owner, address spender, uint256 amount ) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance( address owner, address spender, uint256 amount ) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens 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 amount ) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been 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 _afterTokenTransfer( address from, address to, uint256 amount ) internal virtual {} }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/extensions/ERC20Burnable.sol) pragma solidity ^0.8.0; import "../ERC20.sol"; import "../../../utils/Context.sol"; /** * @dev Extension of {ERC20} that allows token holders to destroy both their own * tokens and those that they have an allowance for, in a way that can be * recognized off-chain (via event analysis). */ abstract contract ERC20Burnable is Context, ERC20 { /** * @dev Destroys `amount` tokens from the caller. * * See {ERC20-_burn}. */ function burn(uint256 amount) public virtual { _burn(_msgSender(), amount); } /** * @dev Destroys `amount` tokens from `account`, deducting from the caller's * allowance. * * See {ERC20-_burn} and {ERC20-allowance}. * * Requirements: * * - the caller must have allowance for ``accounts``'s tokens of at least * `amount`. */ function burnFrom(address account, uint256 amount) public virtual { _spendAllowance(account, _msgSender(), amount); _burn(account, amount); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/AccessControl.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; interface ERC20RoleBasedLockingExtensionInterface { function lockForAll() external; function unlockForAll() external; function canTransfer(address) external view returns (bool); } /** * @dev Extension to allow locking transfers and only allow certain addresses do to transfers. */ abstract contract ERC20RoleBasedLockingExtension is ERC165Storage, AccessControl, ERC20, ERC20RoleBasedLockingExtensionInterface { bytes32 public constant TRANSFER_ROLE = keccak256("TRANSFER_ROLE"); constructor() { _registerInterface( type(ERC20RoleBasedLockingExtensionInterface).interfaceId ); _grantRole(TRANSFER_ROLE, msg.sender); } // ADMIN function lockForAll() external { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "NOT_ADMIN"); _revokeRole(TRANSFER_ROLE, address(0)); } function unlockForAll() external { require(hasRole(DEFAULT_ADMIN_ROLE, _msgSender()), "NOT_ADMIN"); _grantRole(TRANSFER_ROLE, address(0)); } // PUBLIC function canTransfer(address operator) external view override returns (bool) { return hasRole(TRANSFER_ROLE, operator); } function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, AccessControl) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal virtual override { require( hasRole(TRANSFER_ROLE, address(0)) || hasRole(TRANSFER_ROLE, _msgSender()), "TRANSFER_LOCKED" ); super._beforeTokenTransfer(from, to, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/AccessControl.sol"; contract ERC20BasicToken is ERC20, ERC20Burnable, Pausable, AccessControl { bytes32 public constant PAUSER_ROLE = keccak256("PAUSER_ROLE"); bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); struct Config { string name; string symbol; } constructor(Config memory config) ERC20(config.name, config.symbol) { _grantRole(DEFAULT_ADMIN_ROLE, msg.sender); _grantRole(PAUSER_ROLE, msg.sender); _grantRole(MINTER_ROLE, msg.sender); } function pause() public onlyRole(PAUSER_ROLE) { _pause(); } function unpause() public onlyRole(PAUSER_ROLE) { _unpause(); } function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) { _mint(to, amount); } function _beforeTokenTransfer( address from, address to, uint256 amount ) internal override whenNotPaused { super._beforeTokenTransfer(from, to, amount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) 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); /** * @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 // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/ERC721Enumerable.sol) 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: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC721/ERC721.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Enumerable.sol"; contract TestERC721 is ERC721("FlairTest", "FTS"), ERC721Enumerable { function supportsInterface(bytes4 interfaceId) public view virtual override(ERC721, ERC721Enumerable) returns (bool) { return super.supportsInterface(interfaceId); } function _beforeTokenTransfer( address from, address to, uint256 tokenId ) internal virtual override(ERC721, ERC721Enumerable) { return super._beforeTokenTransfer(from, to, tokenId); } function mintExact(address to, uint256 tokenId) public returns (bool) { _mint(to, tokenId); return true; } function mintBulk(address to, uint256 total) public returns (bool) { for (uint256 i = 0; i < total; i++) { _mint(to, totalSupply()); } return true; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; import "../Strings.sol"; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } else if (error == RecoverError.InvalidSignatureV) { revert("ECDSA: invalid signature 'v' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { // Check the signature length // - case 65: r,s,v signature (standard) // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._ if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else if (signature.length == 64) { bytes32 r; bytes32 vs; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. assembly { r := mload(add(signature, 0x20)) vs := mload(add(signature, 0x40)) } return tryRecover(hash, r, vs); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover( bytes32 hash, bytes32 r, bytes32 vs ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } if (v != 27 && v != 28) { return (address(0), RecoverError.InvalidSignatureV); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover( bytes32 hash, uint8 v, bytes32 r, bytes32 s ) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) { // 32 is the length in bytes of hash, // enforced by the type signature above return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash)); } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol) pragma solidity ^0.8.0; import "./ECDSA.sol"; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * _Available since v3.4._ */ abstract contract EIP712 { /* solhint-disable var-name-mixedcase */ // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _CACHED_DOMAIN_SEPARATOR; uint256 private immutable _CACHED_CHAIN_ID; address private immutable _CACHED_THIS; bytes32 private immutable _HASHED_NAME; bytes32 private immutable _HASHED_VERSION; bytes32 private immutable _TYPE_HASH; /* solhint-enable var-name-mixedcase */ /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { bytes32 hashedName = keccak256(bytes(name)); bytes32 hashedVersion = keccak256(bytes(version)); bytes32 typeHash = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)" ); _HASHED_NAME = hashedName; _HASHED_VERSION = hashedVersion; _CACHED_CHAIN_ID = block.chainid; _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion); _CACHED_THIS = address(this); _TYPE_HASH = typeHash; } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) { return _CACHED_DOMAIN_SEPARATOR; } else { return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION); } } function _buildDomainSeparator( bytes32 typeHash, bytes32 nameHash, bytes32 versionHash ) private view returns (bytes32) { return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.9; import {SafeMath} from "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "@openzeppelin/contracts/utils/Context.sol"; abstract contract NativeMetaTransaction is Context, EIP712 { 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 _msgSender() internal view override returns (address 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 = msg.sender; } return sender; } 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( _hashTypedDataV4(hashMetaTransaction(metaTx)), sigV, sigR, sigS ); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/utils/Context.sol"; import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; contract UnorderedForwarder is EIP712, ReentrancyGuard { using ECDSA for bytes32; struct MetaTransaction { address from; address to; uint256 value; uint256 minGasPrice; uint256 maxGasPrice; uint256 expiresAt; uint256 nonce; bytes data; } bytes32 private constant _TYPEHASH = keccak256( "MetaTransaction(address from,address to,uint256 value,uint256 minGasPrice,uint256 maxGasPrice,uint256 expiresAt,uint256 nonce,bytes data)" ); mapping(bytes32 => uint256) mtxHashToExecutedBlockNumber; constructor() EIP712("UnorderedForwarder", "0.0.1") {} /// @dev Refunds up to `msg.value` leftover ETH at the end of the call. modifier refundsAttachedEth() { _; uint256 remainingBalance = msg.value > address(this).balance ? address(this).balance : msg.value; if (remainingBalance > 0) { payable(msg.sender).transfer(remainingBalance); } } /// @dev Ensures that the ETH balance of `this` does not go below the /// initial ETH balance before the call (excluding ETH attached to the call). modifier doesNotReduceEthBalance() { uint256 initialBalance = address(this).balance - msg.value; _; require(initialBalance <= address(this).balance, "FWD_ETH_LEAK"); } function verify(MetaTransaction calldata mtx, bytes calldata signature) public view returns (bytes32 mtxHash) { mtxHash = _hashTypedDataV4( keccak256( abi.encode( _TYPEHASH, mtx.from, mtx.to, mtx.value, mtx.minGasPrice, mtx.maxGasPrice, mtx.expiresAt, mtx.nonce, keccak256(mtx.data) ) ) ); // Must not be expired. require(mtx.expiresAt > block.timestamp, "FWD_EXPIRED"); // Must be signed by the signer. require( mtxHash.recover(signature) == mtx.from, "FWD_INVALID_SIGNATURE" ); // Transaction must not have been already executed. require(mtxHashToExecutedBlockNumber[mtxHash] == 0, "FWD_REPLAYED"); return mtxHash; } function execute(MetaTransaction calldata mtx, bytes calldata signature) public payable nonReentrant doesNotReduceEthBalance refundsAttachedEth returns (bytes memory) { return _execute(mtx, signature); } function batchExecute( MetaTransaction[] calldata mtxs, bytes[] calldata signatures ) public payable nonReentrant doesNotReduceEthBalance refundsAttachedEth returns (bytes[] memory returnResults) { require(mtxs.length == signatures.length, "FWD_MISMATCH_SIGNATURES"); returnResults = new bytes[](mtxs.length); for (uint256 i = 0; i < mtxs.length; ++i) { returnResults[i] = _execute(mtxs[i], signatures[i]); } } function _execute(MetaTransaction calldata mtx, bytes calldata signature) internal returns (bytes memory) { // Must have a valid gas price. require( mtx.minGasPrice <= tx.gasprice && tx.gasprice <= mtx.maxGasPrice, "FWD_INVALID_GAS" ); // Must have enough ETH. require(mtx.value <= address(this).balance, "FWD_INVALID_VALUE"); bytes32 mtxHash = verify(mtx, signature); mtxHashToExecutedBlockNumber[mtxHash] = block.number; (bool success, bytes memory returndata) = mtx.to.call{value: mtx.value}( abi.encodePacked(mtx.data, mtx.from) ); require(success, "FWD_CALL_FAILED"); return returndata; } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "../core/ERC721BaseDistributor.sol"; contract ERC721HolderVestedDistributor is Ownable, Initializable, ERC721BaseDistributor { using Address for address; using Address for address payable; string public constant name = "ERC721 Vested Distributor"; string public constant version = "0.1"; struct Config { address claimToken; address ticketToken; uint256 vestingRate; uint256 vestingTimeUnit; uint256 claimStart; uint256 claimEnd; } uint256 public vestingRate; uint256 public vestingTimeUnit; uint256 public claimStart; uint256 public claimEnd; /* INTERNAL */ constructor(Config memory config) { initialize(msg.sender, config); } // To enable factory cloning function initialize(address owner, Config memory config) public initializer { Ownable._transferOwnership(owner); ERC721BaseDistributor._setup(config.claimToken, config.ticketToken); vestingRate = config.vestingRate; vestingTimeUnit = config.vestingTimeUnit; claimStart = config.claimStart; claimEnd = config.claimEnd; } /* PUBLIC */ function setVestingRate(uint256 newValue) public onlyOwner { vestingRate = newValue; } function setVestingTimeUnit(uint256 newValue) public onlyOwner { vestingTimeUnit = newValue; } function setClaimStart(uint256 newValue) public onlyOwner { claimStart = newValue; } function setClaimEnd(uint256 newValue) public onlyOwner { claimEnd = newValue; } function _beforeClaim(uint256 ticketTokenId) internal view override { require(claimStart < block.timestamp, "DISTRIBUTOR/NOT_STARTED"); require( entitlements[ticketTokenId].lastClaimedAt < block.timestamp - vestingTimeUnit, "DISTRIBUTOR/TOO_EARLY" ); } function getTotalReleasedBulk(uint256[] calldata ticketTokenIds) public view returns (uint256) { uint256 totalReleased = 0; for (uint256 i = 0; i < ticketTokenIds.length; i++) { totalReleased += calculateReleasedAmount(ticketTokenIds[i]); } return totalReleased; } function calculateClaimableAmount(uint256 ticketTokenId) public view override returns (uint256 claimableAmount) { claimableAmount = calculateClaimableAmountUntil( claimEnd > 0 && block.timestamp > claimEnd ? claimEnd : block.timestamp ) - entitlements[ticketTokenId].totalClaimed; } function calculateClaimableAmountUntil(uint256 calcUntil) public view returns (uint256) { if (calcUntil < claimStart) { return 0; } return vestingRate * // Intentionally rounded down: ((calcUntil - claimStart) / vestingTimeUnit); } function calculateReleasedAmount(uint256 ticketTokenId) public view returns (uint256 releasedAmount) { releasedAmount = calculateReleasedAmountUntil( claimEnd > 0 && block.timestamp > claimEnd ? claimEnd : block.timestamp ) - entitlements[ticketTokenId].totalClaimed; } function calculateReleasedAmountUntil(uint256 calcUntil) public view returns (uint256) { return ((calcUntil - claimStart) * vestingRate) / vestingTimeUnit; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.2; import "../../utils/Address.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ``` * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. * @custom:oz-retyped-from bool */ uint8 private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint8 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`. */ modifier initializer() { bool isTopLevelCall = _setInitializedVersion(1); if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original * initialization step. This is essential to configure modules that are added through upgrades and that require * initialization. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. */ modifier reinitializer(uint8 version) { bool isTopLevelCall = _setInitializedVersion(version); if (isTopLevelCall) { _initializing = true; } _; if (isTopLevelCall) { _initializing = false; emit Initialized(version); } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. */ function _disableInitializers() internal virtual { _setInitializedVersion(type(uint8).max); } function _setInitializedVersion(uint8 version) private returns (bool) { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, and for the lowest level // of initializers, because in other contexts the contract may have been reentered. if (_initializing) { require( version == 1 && !Address.isContract(address(this)), "Initializable: contract is already initialized" ); return false; } else { require(_initialized < version, "Initializable: contract is already initialized"); _initialized = version; return true; } } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; abstract contract ERC721BaseDistributor is Ownable, ReentrancyGuard { using Address for address; using Address for address payable; struct Entitlement { uint256 totalClaimed; uint256 lastClaimedAt; } // Config address public claimToken; address public ticketToken; // Map of ticket token ID -> entitlement mapping(uint256 => Entitlement) public entitlements; // Total amount claimed by all holders uint256 public streamTotalClaimed; /* EVENTS */ event Claim(address claimer, uint256 ticketTokenId, uint256 releasedAmount); event ClaimBulk( address claimer, uint256[] ticketTokenIds, uint256 releasedAmount ); function _setup(address _claimToken, address _ticketToken) internal { claimToken = _claimToken; ticketToken = _ticketToken; } /* PUBLIC */ receive() external payable { require(msg.value > 0); require(ticketToken == address(0)); } function claim(uint256 ticketTokenId) public nonReentrant { /* CHECKS */ _beforeClaim(ticketTokenId); require( IERC721(ticketToken).ownerOf(ticketTokenId) == _msgSender(), "DISTRIBUTOR/NOT_NFT_OWNER" ); uint256 claimableAmount = calculateClaimableAmount(ticketTokenId); require(claimableAmount > 0, "DISTRIBUTOR/NOTHING_TO_CLAIM"); /* EFFECTS */ entitlements[ticketTokenId].totalClaimed += claimableAmount; entitlements[ticketTokenId].lastClaimedAt = block.timestamp; streamTotalClaimed += claimableAmount; /* INTERACTIONS */ if (claimToken == address(0)) { payable(address(_msgSender())).sendValue(claimableAmount); } else { IERC20(claimToken).transfer(_msgSender(), claimableAmount); } /* LOGS */ emit Claim(_msgSender(), ticketTokenId, claimableAmount); } function claimBulk(uint256[] calldata ticketTokenIds) public nonReentrant { uint256 totalClaimableAmount; for (uint256 i = 0; i < ticketTokenIds.length; i++) { _beforeClaim(ticketTokenIds[i]); /* CHECKS */ require( IERC721(ticketToken).ownerOf(ticketTokenIds[i]) == _msgSender(), "DISTRIBUTOR/NOT_NFT_OWNER" ); /* EFFECTS */ uint256 claimableAmount = calculateClaimableAmount( ticketTokenIds[i] ); if (claimableAmount > 0) { entitlements[ticketTokenIds[i]].totalClaimed += claimableAmount; entitlements[ticketTokenIds[i]].lastClaimedAt = block.timestamp; totalClaimableAmount += claimableAmount; } } streamTotalClaimed += totalClaimableAmount; /* INTERACTIONS */ if (claimToken == address(0)) { payable(address(_msgSender())).sendValue(totalClaimableAmount); } else { IERC20(claimToken).transfer(_msgSender(), totalClaimableAmount); } /* LOGS */ emit ClaimBulk(_msgSender(), ticketTokenIds, totalClaimableAmount); } /* READ ONLY */ function streamTotalSupply() public view returns (uint256) { return streamTotalClaimed + IERC20(claimToken).balanceOf(address(this)); } function getTotalClaimedBulk(uint256[] calldata ticketTokenIds) public view returns (uint256) { uint256 totalClaimed = 0; for (uint256 i = 0; i < ticketTokenIds.length; i++) { totalClaimed += entitlements[ticketTokenIds[i]].totalClaimed; } return totalClaimed; } function getTotalClaimableBulk(uint256[] calldata ticketTokenIds) public view returns (uint256) { uint256 totalClaimable = 0; for (uint256 i = 0; i < ticketTokenIds.length; i++) { totalClaimable += calculateClaimableAmount(ticketTokenIds[i]); } return totalClaimable; } function calculateClaimableAmount(uint256 ticketTokenId) public view virtual returns (uint256 claimableAmount); // INTERNAL function _beforeClaim(uint256 ticketTokenId) internal virtual; }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/utils/Address.sol"; import "@openzeppelin/contracts/utils/Counters.sol"; import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; import "@openzeppelin/contracts/proxy/utils/Initializable.sol"; import "../core/ERC721BaseDistributor.sol"; contract ERC721HolderSplitDistributor is Ownable, Initializable, ERC721BaseDistributor { using Address for address; using Address for address payable; string public constant name = "ERC721 Equal-share Distributor"; string public constant version = "0.1"; struct Config { address claimToken; address ticketToken; } /* INTERNAL */ constructor(Config memory config) { initialize(msg.sender, config); } function initialize(address owner, Config memory config) public initializer { Ownable._transferOwnership(owner); ERC721BaseDistributor._setup(config.claimToken, config.ticketToken); } // PUBLIC function calculateClaimableAmount(uint256 ticketTokenId) public view override returns (uint256 claimableAmount) { claimableAmount = 0; // TODO implement } // INTERNAL function _beforeClaim(uint256 ticketTokenId) internal view override { // TODO implement } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/introspection/ERC165Storage.sol"; import "./ERC721AutoIdMinterExtension.sol"; interface ERC721FreeMintExtensionInterface { function mintFree(address to, uint256 count) external; } /** * @dev Extension to allow anyone to mint directly without paying. */ abstract contract ERC721FreeMintExtension is ERC165Storage, ERC721AutoIdMinterExtension, ERC721FreeMintExtensionInterface { constructor() { _registerInterface(type(ERC721FreeMintExtensionInterface).interfaceId); } // PUBLIC function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165Storage, ERC721AutoIdMinterExtension) returns (bool) { return ERC165Storage.supportsInterface(interfaceId); } function mintFree(address to, uint256 count) external { _mintTo(to, count); } }
// SPDX-License-Identifier: AGPL-3.0 pragma solidity ^0.8.9; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; contract TestERC20 is ERC20("FlairTest", "FTS") { function mint(address to, uint256 amount) public { _mint(to, amount); } }
{ "optimizer": { "enabled": true, "runs": 5 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"contractURI","type":"string"},{"internalType":"string","name":"placeholderURI","type":"string"},{"internalType":"uint256","name":"maxSupply","type":"uint256"},{"internalType":"uint256","name":"preSalePrice","type":"uint256"},{"internalType":"uint256","name":"preSaleMaxMintPerWallet","type":"uint256"},{"internalType":"uint256","name":"publicSalePrice","type":"uint256"},{"internalType":"uint256","name":"publicSaleMaxMintPerTx","type":"uint256"},{"internalType":"address","name":"defaultRoyaltyAddress","type":"address"},{"internalType":"uint16","name":"defaultRoyaltyBps","type":"uint16"},{"internalType":"address","name":"openSeaProxyRegistryAddress","type":"address"},{"internalType":"address","name":"openSeaExchangeAddress","type":"address"},{"internalType":"address","name":"trustedForwarder","type":"address"}],"internalType":"struct ERC721FullFeaturedCollection.Config","name":"config","type":"tuple"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"approved","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"approved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint16","name":"bps","type":"uint16"}],"name":"DefaultRoyaltySet","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":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"TokenRoyaltyRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"address","name":"recipient","type":"address"},{"indexed":false,"internalType":"uint16","name":"bps","type":"uint16"}],"name":"TokenRoyaltySet","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":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MINTER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_trustedForwarder","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseTokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"contractURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultRoyalty","outputs":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"bps","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"freezeBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"freezeMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInfo","outputs":[{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_totalSupply","type":"uint256"},{"internalType":"uint256","name":"_senderBalance","type":"uint256"},{"internalType":"uint256","name":"_preSalePrice","type":"uint256"},{"internalType":"uint256","name":"_preSaleMaxMintPerWallet","type":"uint256"},{"internalType":"uint256","name":"_preSaleAlreadyClaimed","type":"uint256"},{"internalType":"bool","name":"_preSaleActive","type":"bool"},{"internalType":"uint256","name":"_publicSalePrice","type":"uint256"},{"internalType":"uint256","name":"_publicSaleMaxMintPerTx","type":"uint256"},{"internalType":"bool","name":"_publicSaleActive","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getRaribleV2Royalties","outputs":[{"components":[{"internalType":"address payable","name":"account","type":"address"},{"internalType":"uint96","name":"value","type":"uint96"}],"internalType":"struct LibPart.Part[]","name":"result","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenRoyaltiesCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"index","type":"uint256"}],"name":"getTokenRoyaltyByIndex","outputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"bps","type":"uint16"}],"internalType":"struct IEIP2981RoyaltyOverride.TokenRoyaltyConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"mintByOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"mintByRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"count","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"mintPreSale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"count","type":"uint256"}],"name":"mintPublicSale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"minter","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"onPreSaleAllowList","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"placeholderURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preSaleAllowlistMerkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preSaleMaxMintPerWallet","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preSalePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"preSaleStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleMaxMintPerTx","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSalePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleStatus","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"royaltyInfo","outputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"_data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"newRoot","type":"bytes32"}],"name":"setAllowlistMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newValue","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newValue","type":"string"}],"name":"setContractURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"bps","type":"uint16"}],"internalType":"struct IEIP2981RoyaltyOverride.TokenRoyalty","name":"royalty","type":"tuple"}],"name":"setDefaultRoyalty","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setMaxSupply","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setOpenSeaExchangeAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"setOpenSeaProxyRegistryAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"newValue","type":"string"}],"name":"setPlaceholderURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPreSaleMaxMintPerWallet","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPreSalePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPublicSaleMaxMintPerTx","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"setPublicSalePrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"address","name":"recipient","type":"address"},{"internalType":"uint16","name":"bps","type":"uint16"}],"internalType":"struct IEIP2981RoyaltyOverride.TokenRoyaltyConfig[]","name":"royaltyConfigs","type":"tuple[]"}],"name":"setTokenRoyalties","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"trustedForwarder","type":"address"}],"name":"setTrustedForwarder","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"isActive","type":"bool"}],"name":"togglePreSaleStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bool","name":"isActive","type":"bool"}],"name":"togglePublicSaleStatus","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"name":"transferFromBulk","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526000600f553480156200001657600080fd5b50604051620049fd380380620049fd83398101604081905262000039916200078d565b61016081015161018082015161012083015161014084015160e085015161010086015160a087015160c0880151608089015160608a015160408b01516101a08c01518c5160208e01516200009662000090620002e0565b620002fc565b8151620000ab906002906020850190620005ad565b508051620000c1906003906020840190620005ad565b5050600880546001600160a01b0319166001600160a01b039390931692909217909155508051620000fa906009906020840190620005ad565b506200010d633d96f4ff60e11b6200034c565b5080516200012390600a906020840190620005ad565b506200013663e91f76a560e01b6200034c565b50600d8190556200014e6330f487b560e11b6200034c565b5062000161631aa1577160e11b6200034c565b6001601055601182905560128190556200018263209680f760e11b6200034c565b505060168290556017819055620001a06317e0bac360e31b6200034c565b50620001b59050633ccfd60b60e01b6200034c565b620001c7631a056e7160e01b6200034c565b604080518082019091526001600160a01b038316815261ffff82166020820152620001f281620003d4565b62000204633a47bf5160e11b6200034c565b6200021663152a902d60e11b6200034c565b6200022863c69dbd8f60e01b6200034c565b6200023a63656cb66560e11b6200034c565b5050601e80546001600160a01b038086166001600160a01b031992831617909255601f805492851692909116919091179055506200027f638d29851f60e01b6200034c565b5062000294905063059fb6f760e01b6200034c565b620002aa6000620002a4620002e0565b620004ba565b620002d97f9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6620002a4620002e0565b5062000959565b6000620002f7620004ca60201b620020df1760201c565b905090565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6001600160e01b03198082161415620003ac5760405162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e746572666163652069640000000060448201526064015b60405180910390fd5b6001600160e01b0319166000908152600160208190526040909120805460ff19169091179055565b612710816020015161ffff16106200041d5760405162461bcd60e51b815260206004820152600b60248201526a496e76616c69642062707360a81b6044820152606401620003a3565b60408051808201825282516001600160a01b03168082526020808501805161ffff1691909301819052601a8054600160a01b9092026001600160b01b03199092169092171790558251905191517f2c5ea6e4103e78cb101e796fb2dace540362fc542cbff5145eaa24af7dd8fe4192620004af92916001600160a01b0392909216825261ffff16602082015260400190565b60405180910390a150565b620004c6828262000503565b5050565b6008546000906001600160a01b0316331415620004ee575060131936013560601c90565b620002f7620005a960201b620021011760201c565b60008281526019602090815260408083206001600160a01b038516845290915290205460ff16620004c65760008281526019602090815260408083206001600160a01b03851684529091529020805460ff1916600117905562000565620002e0565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b3390565b828054620005bb906200091c565b90600052602060002090601f016020900481019282620005df57600085556200062a565b82601f10620005fa57805160ff19168380011785556200062a565b828001600101855582156200062a579182015b828111156200062a5782518255916020019190600101906200060d565b50620006389291506200063c565b5090565b5b808211156200063857600081556001016200063d565b634e487b7160e01b600052604160045260246000fd5b6040516101c081016001600160401b03811182821017156200068f576200068f62000653565b60405290565b604051601f8201601f191681016001600160401b0381118282101715620006c057620006c062000653565b604052919050565b600082601f830112620006da57600080fd5b81516001600160401b03811115620006f657620006f662000653565b60206200070c601f8301601f1916820162000695565b82815285828487010111156200072157600080fd5b60005b838110156200074157858101830151828201840152820162000724565b83811115620007535760008385840101525b5095945050505050565b80516001600160a01b03811681146200077557600080fd5b919050565b805161ffff811681146200077557600080fd5b600060208284031215620007a057600080fd5b81516001600160401b0380821115620007b857600080fd5b908301906101c08286031215620007ce57600080fd5b620007d862000669565b825182811115620007e857600080fd5b620007f687828601620006c8565b8252506020830151828111156200080c57600080fd5b6200081a87828601620006c8565b6020830152506040830151828111156200083357600080fd5b6200084187828601620006c8565b6040830152506060830151828111156200085a57600080fd5b6200086887828601620006c8565b6060830152506080830151608082015260a083015160a082015260c083015160c082015260e083015160e0820152610100915081830151828201526101209150620008b58284016200075d565b828201526101409150620008cb8284016200077a565b828201526101609150620008e18284016200075d565b828201526101809150620008f78284016200075d565b828201526101a091506200090d8284016200075d565b91810191909152949350505050565b600181811c908216806200093157607f821691505b602082108114156200095357634e487b7160e01b600052602260045260246000fd5b50919050565b61409480620009696000396000f3fe6080604052600436106102ff5760003560e01c806301ffc9a714610304578063059fb6f7146103395780630653aca51461035b57806306fdde03146103aa578063081812fc146103cc57806308abf026146103f9578063095ea7b314610419578063167446071461043957806318160ddd1461044e5780631a056e711461046d57806323b872dd1461048d578063248a9ca3146104ad5780632a55205a146104cd5780632d8e85b01461050c5780632f2ff15d1461052c5780633542aee21461054c5780633574a2dd1461056c57806336568abe1461058c5780633acf404d146105ac5780633c0e8f2c146105c25780633ccfd60b146105e257806342842e0e146105f7578063464bd640146106175780634f972f5f146106315780635136dcc71461065157806355f804b31461067157806356c022bb14610691578063572b6c05146106b15780635a9b0b89146106d15780636352211e146107345780636c079cfc146107545780636f8b44b01461077457806370a0823114610794578063715018a6146107b45780637313cba9146107c95780637885fdc7146107de578063791a2519146108195780637d7eee42146108395780637e980342146108595780638da5cb5b1461086e57806391d1485414610883578063938e3d7b146108a357806395d89b41146108c35780639b6860c8146108d85780639e6b2c5b146108ee578063a217fddf14610901578063a22cb46514610916578063aaeaca4814610936578063b27c6f2d1461094c578063b6c693e514610962578063b88d4fde1461097c578063c87b56dd1461099c578063cad96cca146109bc578063d5391393146109e9578063d547741f14610a0b578063d547cfb714610a2b578063d5abeb0114610a40578063d79ff99d14610a56578063da74222814610a69578063e3b9a7e514610a89578063e757c17d14610aa9578063e7bc820814610abf578063e8a3d48514610ad4578063e985e9c514610ae9578063ef60ceaf14610b09578063f2fde38b14610b29578063f74bbf5914610b49578063f95df41414610b69575b600080fd5b34801561031057600080fd5b5061032461031f36600461345f565b610b89565b60405190151581526020015b60405180910390f35b34801561034557600080fd5b506103596103543660046134d7565b610ba9565b005b34801561036757600080fd5b5061037b6103763660046135a3565b610c58565b60408051825181526020808401516001600160a01b0316908201529181015161ffff1690820152606001610330565b3480156103b657600080fd5b506103bf610cdd565b6040516103309190613614565b3480156103d857600080fd5b506103ec6103e73660046135a3565b610d6f565b6040516103309190613627565b34801561040557600080fd5b5061035961041436600461363b565b610df7565b34801561042557600080fd5b50610359610434366004613658565b610e58565b34801561044557600080fd5b50610359610f7b565b34801561045a57600080fd5b50600f545b604051908152602001610330565b34801561047957600080fd5b50610359610488366004613658565b610fc9565b34801561049957600080fd5b506103596104a8366004613684565b61102f565b3480156104b957600080fd5b5061045f6104c83660046135a3565b611067565b3480156104d957600080fd5b506104ed6104e83660046136c5565b61107c565b604080516001600160a01b039093168352602083019190915201610330565b34801561051857600080fd5b506103596105273660046136fc565b611141565b34801561053857600080fd5b50610359610547366004613717565b611193565b34801561055857600080fd5b50610359610567366004613658565b6111af565b34801561057857600080fd5b5061035961058736600461379e565b6111ee565b34801561059857600080fd5b506103596105a7366004613717565b611240565b3480156105b857600080fd5b5061045f60135481565b3480156105ce57600080fd5b506103596105dd3660046135a3565b6112ca565b3480156105ee57600080fd5b5061035961130e565b34801561060357600080fd5b50610359610612366004613684565b6113fb565b34801561062357600080fd5b506014546103249060ff1681565b34801561063d57600080fd5b5061035961064c3660046136fc565b611416565b34801561065d57600080fd5b5061035961066c3660046137e6565b611468565b34801561067d57600080fd5b5061035961068c36600461379e565b611502565b34801561069d57600080fd5b506008546103ec906001600160a01b031681565b3480156106bd57600080fd5b506103246106cc36600461363b565b611577565b3480156106dd57600080fd5b506106e661158b565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925260a0860152151560c085015260e0840152610100830152151561012082015261014001610330565b34801561074057600080fd5b506103ec61074f3660046135a3565b61171a565b34801561076057600080fd5b5061035961076f36600461363b565b611791565b34801561078057600080fd5b5061035961078f3660046135a3565b6117f2565b3480156107a057600080fd5b5061045f6107af36600461363b565b611859565b3480156107c057600080fd5b506103596118e0565b3480156107d557600080fd5b506103bf61192b565b3480156107ea57600080fd5b50601a5461080b906001600160a01b03811690600160a01b900461ffff1682565b60405161033092919061385a565b34801561082557600080fd5b506103596108343660046135a3565b61193a565b34801561084557600080fd5b506103596108543660046135a3565b61197e565b34801561086557600080fd5b5061045f6119c2565b34801561087a57600080fd5b506103ec6119d3565b34801561088f57600080fd5b5061032461089e366004613717565b6119e2565b3480156108af57600080fd5b506103596108be36600461379e565b611a0d565b3480156108cf57600080fd5b506103bf611a5f565b3480156108e457600080fd5b5061045f60165481565b6103596108fc3660046138bb565b611a6e565b34801561090d57600080fd5b5061045f600081565b34801561092257600080fd5b50610359610931366004613906565b611c26565b34801561094257600080fd5b5061045f60125481565b34801561095857600080fd5b5061045f60175481565b34801561096e57600080fd5b506018546103249060ff1681565b34801561098857600080fd5b5061035961099736600461393b565b611c38565b3480156109a857600080fd5b506103bf6109b73660046135a3565b611c71565b3480156109c857600080fd5b506109dc6109d73660046135a3565b611c7c565b60405161033091906139ba565b3480156109f557600080fd5b5061045f60008051602061401f83398151915281565b348015610a1757600080fd5b50610359610a26366004613717565b611d37565b348015610a3757600080fd5b506103bf611d53565b348015610a4c57600080fd5b5061045f600d5481565b610359610a64366004613658565b611d62565b348015610a7557600080fd5b50610359610a8436600461363b565b611e32565b348015610a9557600080fd5b50610324610aa4366004613a1b565b611e93565b348015610ab557600080fd5b5061045f60115481565b348015610acb57600080fd5b50610359611ee1565b348015610ae057600080fd5b506103bf611f2f565b348015610af557600080fd5b50610324610b04366004613a56565b611f3e565b348015610b1557600080fd5b50610359610b24366004613a84565b611f51565b348015610b3557600080fd5b50610359610b4436600461363b565b611faa565b348015610b5557600080fd5b50610359610b643660046135a3565b612057565b348015610b7557600080fd5b50610359610b843660046135a3565b61209b565b6000610b9482612105565b80610ba35750610ba382612140565b92915050565b60005b8151811015610c5257610bdf610bc061217c565b838381518110610bd257610bd2613a9c565b6020026020010151612186565b610c1c5760405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b60448201526064015b60405180910390fd5b610c408484848481518110610c3357610c33613a9c565b602002602001015161224f565b80610c4a81613ac8565b915050610bac565b50505050565b6040805160608101825260008082526020820181905291810182905290610c80601c846123d9565b6000818152601b60209081526040918290208251808401845290546001600160a01b03808216835261ffff600160a01b90920482168385019081528551606081018752968752925116928501929092525116908201529392505050565b606060028054610cec90613ae3565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1890613ae3565b8015610d655780601f10610d3a57610100808354040283529160200191610d65565b820191906000526020600020905b815481529060010190602001808311610d4857829003601f168201915b5050505050905090565b6000610d7a826123e5565b610ddb5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c13565b506000908152600660205260409020546001600160a01b031690565b610dff61217c565b6001600160a01b0316610e106119d3565b6001600160a01b031614610e365760405162461bcd60e51b8152600401610c1390613b18565b601e80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e638261171a565b9050806001600160a01b0316836001600160a01b03161415610ed15760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c13565b806001600160a01b0316610ee361217c565b6001600160a01b03161480610eff5750610eff81610b0461217c565b610f6c5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610c13565b610f768383612402565b505050565b610f8361217c565b6001600160a01b0316610f946119d3565b6001600160a01b031614610fba5760405162461bcd60e51b8152600401610c1390613b18565b600e805460ff19166001179055565b610fe360008051602061401f83398151915261089e61217c565b6110215760405162461bcd60e51b815260206004820152600f60248201526e4e4f545f4d494e5445525f524f4c4560881b6044820152606401610c13565b61102b8282612470565b5050565b61104061103a61217c565b82612186565b61105c5760405162461bcd60e51b8152600401610c1390613b4d565b610f7683838361224f565b60009081526019602052604090206001015490565b6000828152601b602052604081205481906001600160a01b0316156110e1576000848152601b60205260409020546001600160a01b03811690612710906110ce90600160a01b900461ffff1686613b9e565b6110d89190613bd3565b9150915061113a565b601a546001600160a01b0316158015906111075750601a54600160a01b900461ffff1615155b1561113357601a546001600160a01b03811690612710906110ce90600160a01b900461ffff1686613b9e565b5060009050805b9250929050565b61114961217c565b6001600160a01b031661115a6119d3565b6001600160a01b0316146111805760405162461bcd60e51b8152600401610c1390613b18565b6018805460ff1916911515919091179055565b61119c82611067565b6111a581612506565b610f768383612517565b6111b761217c565b6001600160a01b03166111c86119d3565b6001600160a01b0316146110215760405162461bcd60e51b8152600401610c1390613b18565b6111f661217c565b6001600160a01b03166112076119d3565b6001600160a01b03161461122d5760405162461bcd60e51b8152600401610c1390613b18565b805161102b90600a9060208401906133b0565b61124861217c565b6001600160a01b0316816001600160a01b0316146112c05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c13565b61102b828261259e565b6112d261217c565b6001600160a01b03166112e36119d3565b6001600160a01b0316146113095760405162461bcd60e51b8152600401610c1390613b18565b601755565b61131661217c565b6001600160a01b03166113276119d3565b6001600160a01b03161461134d5760405162461bcd60e51b8152600401610c1390613b18565b6000479050306001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561138b57600080fd5b505afa15801561139f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c39190613be7565b6001600160a01b03166108fc829081150290604051600060405180830381858888f1935050505015801561102b573d6000803e3d6000fd5b610f7683838360405180602001604052806000815250611c38565b61141e61217c565b6001600160a01b031661142f6119d3565b6001600160a01b0316146114555760405162461bcd60e51b8152600401610c1390613b18565b6014805460ff1916911515919091179055565b61147061217c565b6001600160a01b03166114816119d3565b6001600160a01b0316146114a75760405162461bcd60e51b8152600401610c1390613b18565b61102b8282808060200260200160405190810160405280939291908181526020016000905b828210156114f8576114e960608302860136819003810190613c16565b815260200190600101906114cc565b5050505050612623565b61150a61217c565b6001600160a01b031661151b6119d3565b6001600160a01b0316146115415760405162461bcd60e51b8152600401610c1390613b18565b600c5460ff16156115645760405162461bcd60e51b8152600401610c1390613c7c565b805161102b90600b9060208401906133b0565b6008546001600160a01b0391821691161490565b600080808080808080808080806115a061217c565b6001600160a01b03161461162b57306370a082316115bc61217c565b6040518263ffffffff1660e01b81526004016115d89190613627565b60206040518083038186803b1580156115f057600080fd5b505afa158015611604573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116289190613ca5565b90505b600d54306001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561166757600080fd5b505afa15801561167b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061169f9190613ca5565b82601154601254601560006116b261217c565b6001600160a01b03166001600160a01b0316815260200190815260200160002054601460009054906101000a900460ff16601654601754601860009054906101000a900460ff169a509a509a509a509a509a509a509a509a509a505090919293949596979899565b6000818152600460205260408120546001600160a01b031680610ba35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c13565b61179961217c565b6001600160a01b03166117aa6119d3565b6001600160a01b0316146117d05760405162461bcd60e51b8152600401610c1390613b18565b601f80546001600160a01b0319166001600160a01b0392909216919091179055565b6117fa61217c565b6001600160a01b031661180b6119d3565b6001600160a01b0316146118315760405162461bcd60e51b8152600401610c1390613b18565b600e5460ff16156118545760405162461bcd60e51b8152600401610c1390613c7c565b600d55565b60006001600160a01b0382166118c45760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c13565b506001600160a01b031660009081526005602052604090205490565b6118e861217c565b6001600160a01b03166118f96119d3565b6001600160a01b03161461191f5760405162461bcd60e51b8152600401610c1390613b18565b61192960006127ca565b565b6060600a8054610cec90613ae3565b61194261217c565b6001600160a01b03166119536119d3565b6001600160a01b0316146119795760405162461bcd60e51b8152600401610c1390613b18565b601655565b61198661217c565b6001600160a01b03166119976119d3565b6001600160a01b0316146119bd5760405162461bcd60e51b8152600401610c1390613b18565b601155565b60006119ce601c61281a565b905090565b6000546001600160a01b031690565b60009182526019602090815260408084206001600160a01b0393909316845291905290205460ff1690565b611a1561217c565b6001600160a01b0316611a266119d3565b6001600160a01b031614611a4c5760405162461bcd60e51b8152600401610c1390613b18565b805161102b9060099060208401906133b0565b606060038054610cec90613ae3565b60026010541415611a915760405162461bcd60e51b8152600401610c1390613cbe565b600260105560145460ff16611ab85760405162461bcd60e51b8152600401610c1390613cf5565b6000611ac261217c565b9050611b0d838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506013549150611b08905084612824565b61285e565b611b505760405162461bcd60e51b8152602060048201526014602482015273282922afa9a0a622afaba927a723afa82927a7a360611b6044820152606401610c13565b6012546001600160a01b038216600090815260156020526040902054611b77908690613d22565b1115611bb65760405162461bcd60e51b815260206004820152600e60248201526d14149157d4d0531157d31253525560921b6044820152606401610c13565b3484601154611bc59190613b9e565b1115611be35760405162461bcd60e51b8152600401610c1390613d3a565b6001600160a01b03811660009081526015602052604081208054869290611c0b908490613d22565b90915550611c1b90508185612470565b505060016010555050565b61102b611c3161217c565b8383612874565b611c49611c4361217c565b83612186565b611c655760405162461bcd60e51b8152600401610c1390613b4d565b610c528484848461293f565b6060610ba382612972565b604080516001808252818301909252606091816020015b6040805180820190915260008082526020820152815260200190600190039081611c93575050601a5481519192506001600160a01b0316908290600090611cdc57611cdc613a9c565b60209081029190910101516001600160a01b03919091169052601a548151600160a01b90910461ffff16908290600090611d1857611d18613a9c565b6020908102919091018101516001600160601b03909216910152919050565b611d4082611067565b611d4981612506565b610f76838361259e565b6060600b8054610cec90613ae3565b60026010541415611d855760405162461bcd60e51b8152600401610c1390613cbe565b600260105560185460ff16611dac5760405162461bcd60e51b8152600401610c1390613cf5565b601754811115611df25760405162461bcd60e51b8152602060048201526011602482015270141550931250d7d4d0531157d312535255607a1b6044820152606401610c13565b3481601654611e019190613b9e565b1115611e1f5760405162461bcd60e51b8152600401610c1390613d3a565b611e298282612470565b50506001601055565b611e3a61217c565b6001600160a01b0316611e4b6119d3565b6001600160a01b031614611e715760405162461bcd60e51b8152600401610c1390613b18565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6000611ed9838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506013549150611b08905087612824565b949350505050565b611ee961217c565b6001600160a01b0316611efa6119d3565b6001600160a01b031614611f205760405162461bcd60e51b8152600401610c1390613b18565b600c805460ff19166001179055565b606060098054610cec90613ae3565b6000611f4a8383612a4b565b9392505050565b611f5961217c565b6001600160a01b0316611f6a6119d3565b6001600160a01b031614611f905760405162461bcd60e51b8152600401610c1390613b18565b611fa7611fa236839003830183613d67565b612b5c565b50565b611fb261217c565b6001600160a01b0316611fc36119d3565b6001600160a01b031614611fe95760405162461bcd60e51b8152600401610c1390613b18565b6001600160a01b03811661204e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c13565b611fa7816127ca565b61205f61217c565b6001600160a01b03166120706119d3565b6001600160a01b0316146120965760405162461bcd60e51b8152600401610c1390613b18565b601255565b6120a361217c565b6001600160a01b03166120b46119d3565b6001600160a01b0316146120da5760405162461bcd60e51b8152600401610c1390613b18565b601355565b60006120ea33611577565b156120fc575060131936013560601c90565b503390565b3390565b60006001600160e01b031982166380ac58cd60e01b1480610b9457506001600160e01b03198216635b5e139f60e01b1480610ba35750610ba3825b60006301ffc9a760e01b6001600160e01b031983161480610ba35750506001600160e01b03191660009081526001602052604090205460ff1690565b60006119ce6120df565b6000612191826123e5565b6121f25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c13565b60006121fd8361171a565b9050806001600160a01b0316846001600160a01b0316148061222457506122248185611f3e565b80611ed95750836001600160a01b031661223d84610d6f565b6001600160a01b031614949350505050565b826001600160a01b03166122628261171a565b6001600160a01b0316146122c65760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610c13565b6001600160a01b0382166123285760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c13565b612333600082612402565b6001600160a01b038316600090815260056020526040812080546001929061235c908490613dc3565b90915550506001600160a01b038216600090815260056020526040812080546001929061238a908490613d22565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915184939187169160008051602061403f83398151915291a4505050565b6000611f4a8383612c07565b6000908152600460205260409020546001600160a01b0316151590565b600081815260066020526040902080546001600160a01b0319166001600160a01b03841690811790915581906124378261171a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600d548161247d600f5490565b6124879190613d22565b11156124ca5760405162461bcd60e51b8152602060048201526012602482015271455843454544535f4d41585f535550504c5960701b6044820152606401610c13565b60005b81811015610f765760006124df612c31565b90506124eb8482612c42565b6124f3612c5c565b50806124fe81613ac8565b9150506124cd565b611fa78161251261217c565b612c73565b61252182826119e2565b61102b5760008281526019602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561255a61217c565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6125a882826119e2565b1561102b5760008281526019602090815260408083206001600160a01b03851684529091529020805460ff191690556125df61217c565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60005b815181101561102b57600082828151811061264357612643613a9c565b60200260200101519050612710816040015161ffff16106126765760405162461bcd60e51b8152600401610c1390613dda565b60208101516001600160a01b03166126ef5780516000908152601b6020526040902080546001600160b01b031916905580516126b490601c90612cd7565b5080516040519081527fa2870857763bd9ae76c957f869f16b31c18dd3bb4c7b4d3a4496dc5c57c657f99060200160405180910390a16127b7565b6040805180820182526020808401516001600160a01b0390811683528484015161ffff90811683850190815286516000908152601b90945294909220925183549451909216600160a01b026001600160b01b0319909416911617919091179055805161275d90601c90612ce3565b50805160208083015160408085015181519485526001600160a01b039092169284019290925261ffff1682820152517f389b70fb0887f01e83784eb1c4c589f740eca53b00ed0f45e41db5d079719abb9181900360600190a15b50806127c281613ac8565b915050612626565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610ba3825490565b6040516001600160601b0319606083901b166020820152600090603401604051602081830303815290604052805190602001209050919050565b60008261286b8584612cef565b14949350505050565b816001600160a01b0316836001600160a01b031614156128d25760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610c13565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61294a84848461224f565b61295684848484612d63565b610c525760405162461bcd60e51b8152600401610c1390613dff565b60606000600b805461298390613ae3565b905011612a1a57600a805461299790613ae3565b80601f01602080910402602001604051908101604052809291908181526020018280546129c390613ae3565b8015612a105780601f106129e557610100808354040283529160200191612a10565b820191906000526020600020905b8154815290600101906020018083116129f357829003601f168201915b5050505050610ba3565b600b612a2583612e77565b604051602001612a36929190613e6d565b60405160208183030381529060405292915050565b601e546000906001600160a01b031615612aff57601e5460405163c455279160e01b81526001600160a01b0391821691841690829063c455279190612a94908890600401613627565b60206040518083038186803b158015612aac57600080fd5b505afa158015612ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae49190613be7565b6001600160a01b03161415612afd576001915050610ba3565b505b601f546001600160a01b031615612b2e57601f546001600160a01b0383811691161415612b2e57506001610ba3565b6001600160a01b0380841660009081526007602090815260408083209386168352929052205460ff16611f4a565b612710816020015161ffff1610612b855760405162461bcd60e51b8152600401610c1390613dda565b60408051808201825282516001600160a01b03168082526020808501805161ffff1691909301819052601a80546001600160b01b031916909217600160a01b9091021790558251905191517f2c5ea6e4103e78cb101e796fb2dace540362fc542cbff5145eaa24af7dd8fe4192612bfc929161385a565b60405180910390a150565b6000826000018281548110612c1e57612c1e613a9c565b9060005260206000200154905092915050565b600f546000906119ce906001612f74565b61102b828260405180602001604052806000815250612f80565b600f8054906000612c6c83613ac8565b9190505550565b612c7d82826119e2565b61102b57612c95816001600160a01b03166014612fb3565b612ca0836020612fb3565b604051602001612cb1929190613f14565b60408051601f198184030181529082905262461bcd60e51b8252610c1391600401613614565b6000611f4a838361314e565b6000611f4a8383613241565b600081815b8451811015612d5b576000858281518110612d1157612d11613a9c565b60200260200101519050808311612d375760008381526020829052604090209250612d48565b600081815260208490526040902092505b5080612d5381613ac8565b915050612cf4565b509392505050565b60006001600160a01b0384163b15612e6c57836001600160a01b031663150b7a02612d8c61217c565b8786866040518563ffffffff1660e01b8152600401612dae9493929190613f83565b602060405180830381600087803b158015612dc857600080fd5b505af1925050508015612df8575060408051601f3d908101601f19168201909252612df591810190613fc0565b60015b612e52573d808015612e26576040519150601f19603f3d011682016040523d82523d6000602084013e612e2b565b606091505b508051612e4a5760405162461bcd60e51b8152600401610c1390613dff565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ed9565b506001949350505050565b606081612e9b5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612ec55780612eaf81613ac8565b9150612ebe9050600a83613bd3565b9150612e9f565b6000816001600160401b03811115612edf57612edf613491565b6040519080825280601f01601f191660200182016040528015612f09576020820181803683370190505b5090505b8415611ed957612f1e600183613dc3565b9150612f2b600a86613fdd565b612f36906030613d22565b60f81b818381518110612f4b57612f4b613a9c565b60200101906001600160f81b031916908160001a905350612f6d600a86613bd3565b9450612f0d565b6000611f4a8284613d22565b612f8a8383613290565b612f976000848484612d63565b610f765760405162461bcd60e51b8152600401610c1390613dff565b60606000612fc2836002613b9e565b612fcd906002613d22565b6001600160401b03811115612fe457612fe4613491565b6040519080825280601f01601f19166020018201604052801561300e576020820181803683370190505b509050600360fc1b8160008151811061302957613029613a9c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061305857613058613a9c565b60200101906001600160f81b031916908160001a905350600061307c846002613b9e565b613087906001613d22565b90505b60018111156130ff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106130bb576130bb613a9c565b1a60f81b8282815181106130d1576130d1613a9c565b60200101906001600160f81b031916908160001a90535060049490941c936130f881613ff1565b905061308a565b508315611f4a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c13565b60008181526001830160205260408120548015613237576000613172600183613dc3565b855490915060009061318690600190613dc3565b90508181146131eb5760008660000182815481106131a6576131a6613a9c565b90600052602060002001549050808760000184815481106131c9576131c9613a9c565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806131fc576131fc614008565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610ba3565b6000915050610ba3565b600081815260018301602052604081205461328857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ba3565b506000610ba3565b6001600160a01b0382166132e65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c13565b6132ef816123e5565b1561333b5760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610c13565b6001600160a01b0382166000908152600560205260408120805460019290613364908490613d22565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b038616908117909155905183929060008051602061403f833981519152908290a45050565b8280546133bc90613ae3565b90600052602060002090601f0160209004810192826133de5760008555613424565b82601f106133f757805160ff1916838001178555613424565b82800160010185558215613424579182015b82811115613424578251825591602001919060010190613409565b50613430929150613434565b5090565b5b808211156134305760008155600101613435565b6001600160e01b031981168114611fa757600080fd5b60006020828403121561347157600080fd5b8135611f4a81613449565b6001600160a01b0381168114611fa757600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156134cf576134cf613491565b604052919050565b6000806000606084860312156134ec57600080fd5b83356134f78161347c565b92506020848101356135088161347c565b925060408501356001600160401b038082111561352457600080fd5b818701915087601f83011261353857600080fd5b81358181111561354a5761354a613491565b8060051b915061355b8483016134a7565b818152918301840191848101908a84111561357557600080fd5b938501935b838510156135935784358252938501939085019061357a565b8096505050505050509250925092565b6000602082840312156135b557600080fd5b5035919050565b60005b838110156135d75781810151838201526020016135bf565b83811115610c525750506000910152565b600081518084526136008160208601602086016135bc565b601f01601f19169290920160200192915050565b602081526000611f4a60208301846135e8565b6001600160a01b0391909116815260200190565b60006020828403121561364d57600080fd5b8135611f4a8161347c565b6000806040838503121561366b57600080fd5b82356136768161347c565b946020939093013593505050565b60008060006060848603121561369957600080fd5b83356136a48161347c565b925060208401356136b48161347c565b929592945050506040919091013590565b600080604083850312156136d857600080fd5b50508035926020909101359150565b803580151581146136f757600080fd5b919050565b60006020828403121561370e57600080fd5b611f4a826136e7565b6000806040838503121561372a57600080fd5b82359150602083013561373c8161347c565b809150509250929050565b60006001600160401b0383111561376057613760613491565b613773601f8401601f19166020016134a7565b905082815283838301111561378757600080fd5b828260208301376000602084830101529392505050565b6000602082840312156137b057600080fd5b81356001600160401b038111156137c657600080fd5b8201601f810184136137d757600080fd5b611ed984823560208401613747565b600080602083850312156137f957600080fd5b82356001600160401b038082111561381057600080fd5b818501915085601f83011261382457600080fd5b81358181111561383357600080fd5b86602060608302850101111561384857600080fd5b60209290920196919550909350505050565b6001600160a01b0392909216825261ffff16602082015260400190565b60008083601f84011261388957600080fd5b5081356001600160401b038111156138a057600080fd5b6020830191508360208260051b850101111561113a57600080fd5b6000806000604084860312156138d057600080fd5b8335925060208401356001600160401b038111156138ed57600080fd5b6138f986828701613877565b9497909650939450505050565b6000806040838503121561391957600080fd5b82356139248161347c565b9150613932602084016136e7565b90509250929050565b6000806000806080858703121561395157600080fd5b843561395c8161347c565b9350602085013561396c8161347c565b92506040850135915060608501356001600160401b0381111561398e57600080fd5b8501601f8101871361399f57600080fd5b6139ae87823560208401613747565b91505092959194509250565b602080825282518282018190526000919060409081850190868401855b82811015613a0e57815180516001600160a01b031685528601516001600160601b03168685015292840192908501906001016139d7565b5091979650505050505050565b600080600060408486031215613a3057600080fd5b8335613a3b8161347c565b925060208401356001600160401b038111156138ed57600080fd5b60008060408385031215613a6957600080fd5b8235613a748161347c565b9150602083013561373c8161347c565b600060408284031215613a9657600080fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415613adc57613adc613ab2565b5060010190565b600181811c90821680613af757607f821691505b60208210811415613a9657634e487b7160e01b600052602260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000816000190483118215151615613bb857613bb8613ab2565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613be257613be2613bbd565b500490565b600060208284031215613bf957600080fd5b8151611f4a8161347c565b803561ffff811681146136f757600080fd5b600060608284031215613c2857600080fd5b604051606081016001600160401b0381118282101715613c4a57613c4a613491565b604052823581526020830135613c5f8161347c565b6020820152613c7060408401613c04565b60408201529392505050565b6020808252600f908201526e2120a9a2afaaa924afa32927ad22a760891b604082015260600190565b600060208284031215613cb757600080fd5b5051919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601390820152725052455f53414c455f4e4f545f41435449564560681b604082015260600190565b60008219821115613d3557613d35613ab2565b500190565b602080825260139082015272125394d551919250d251539517d05353d55395606a1b604082015260600190565b600060408284031215613d7957600080fd5b604080519081016001600160401b0381118282101715613d9b57613d9b613491565b6040528235613da98161347c565b8152613db760208401613c04565b60208201529392505050565b600082821015613dd557613dd5613ab2565b500390565b6020808252600b908201526a496e76616c69642062707360a81b604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008151613e638185602086016135bc565b9290920192915050565b600080845481600182811c915080831680613e8957607f831692505b6020808410821415613ea957634e487b7160e01b86526022600452602486fd5b818015613ebd5760018114613ece57613efb565b60ff19861689528489019650613efb565b60008b81526020902060005b86811015613ef35781548b820152908501908301613eda565b505084890196505b505050505050613f0b8185613e51565b95945050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613f468160178501602088016135bc565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613f778160288401602088016135bc565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613fb6908301846135e8565b9695505050505050565b600060208284031215613fd257600080fd5b8151611f4a81613449565b600082613fec57613fec613bbd565b500690565b60008161400057614000613ab2565b506000190190565b634e487b7160e01b600052603160045260246000fdfe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204c50278aff7a50ffce7485a083beeaa431c2ddc4579db6983a18baceb2e3f22664736f6c63430008090033000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000138800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000790d99f0d48660a0a93eca2a5b0635fe84b0899700000000000000000000000000000000000000000000000000000000000002bc000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b56696b696e6720546f776e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000656494b494e4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d5877356d43354675455a35383257367167795a36553352556e647541756e637776435369413938623136674800000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d51674e33614c6241423972697a484e635234476b347a76346338624c445564697452647835706b38435476470000000000000000000000
Deployed Bytecode
0x6080604052600436106102ff5760003560e01c806301ffc9a714610304578063059fb6f7146103395780630653aca51461035b57806306fdde03146103aa578063081812fc146103cc57806308abf026146103f9578063095ea7b314610419578063167446071461043957806318160ddd1461044e5780631a056e711461046d57806323b872dd1461048d578063248a9ca3146104ad5780632a55205a146104cd5780632d8e85b01461050c5780632f2ff15d1461052c5780633542aee21461054c5780633574a2dd1461056c57806336568abe1461058c5780633acf404d146105ac5780633c0e8f2c146105c25780633ccfd60b146105e257806342842e0e146105f7578063464bd640146106175780634f972f5f146106315780635136dcc71461065157806355f804b31461067157806356c022bb14610691578063572b6c05146106b15780635a9b0b89146106d15780636352211e146107345780636c079cfc146107545780636f8b44b01461077457806370a0823114610794578063715018a6146107b45780637313cba9146107c95780637885fdc7146107de578063791a2519146108195780637d7eee42146108395780637e980342146108595780638da5cb5b1461086e57806391d1485414610883578063938e3d7b146108a357806395d89b41146108c35780639b6860c8146108d85780639e6b2c5b146108ee578063a217fddf14610901578063a22cb46514610916578063aaeaca4814610936578063b27c6f2d1461094c578063b6c693e514610962578063b88d4fde1461097c578063c87b56dd1461099c578063cad96cca146109bc578063d5391393146109e9578063d547741f14610a0b578063d547cfb714610a2b578063d5abeb0114610a40578063d79ff99d14610a56578063da74222814610a69578063e3b9a7e514610a89578063e757c17d14610aa9578063e7bc820814610abf578063e8a3d48514610ad4578063e985e9c514610ae9578063ef60ceaf14610b09578063f2fde38b14610b29578063f74bbf5914610b49578063f95df41414610b69575b600080fd5b34801561031057600080fd5b5061032461031f36600461345f565b610b89565b60405190151581526020015b60405180910390f35b34801561034557600080fd5b506103596103543660046134d7565b610ba9565b005b34801561036757600080fd5b5061037b6103763660046135a3565b610c58565b60408051825181526020808401516001600160a01b0316908201529181015161ffff1690820152606001610330565b3480156103b657600080fd5b506103bf610cdd565b6040516103309190613614565b3480156103d857600080fd5b506103ec6103e73660046135a3565b610d6f565b6040516103309190613627565b34801561040557600080fd5b5061035961041436600461363b565b610df7565b34801561042557600080fd5b50610359610434366004613658565b610e58565b34801561044557600080fd5b50610359610f7b565b34801561045a57600080fd5b50600f545b604051908152602001610330565b34801561047957600080fd5b50610359610488366004613658565b610fc9565b34801561049957600080fd5b506103596104a8366004613684565b61102f565b3480156104b957600080fd5b5061045f6104c83660046135a3565b611067565b3480156104d957600080fd5b506104ed6104e83660046136c5565b61107c565b604080516001600160a01b039093168352602083019190915201610330565b34801561051857600080fd5b506103596105273660046136fc565b611141565b34801561053857600080fd5b50610359610547366004613717565b611193565b34801561055857600080fd5b50610359610567366004613658565b6111af565b34801561057857600080fd5b5061035961058736600461379e565b6111ee565b34801561059857600080fd5b506103596105a7366004613717565b611240565b3480156105b857600080fd5b5061045f60135481565b3480156105ce57600080fd5b506103596105dd3660046135a3565b6112ca565b3480156105ee57600080fd5b5061035961130e565b34801561060357600080fd5b50610359610612366004613684565b6113fb565b34801561062357600080fd5b506014546103249060ff1681565b34801561063d57600080fd5b5061035961064c3660046136fc565b611416565b34801561065d57600080fd5b5061035961066c3660046137e6565b611468565b34801561067d57600080fd5b5061035961068c36600461379e565b611502565b34801561069d57600080fd5b506008546103ec906001600160a01b031681565b3480156106bd57600080fd5b506103246106cc36600461363b565b611577565b3480156106dd57600080fd5b506106e661158b565b604080519a8b5260208b0199909952978901969096526060880194909452608087019290925260a0860152151560c085015260e0840152610100830152151561012082015261014001610330565b34801561074057600080fd5b506103ec61074f3660046135a3565b61171a565b34801561076057600080fd5b5061035961076f36600461363b565b611791565b34801561078057600080fd5b5061035961078f3660046135a3565b6117f2565b3480156107a057600080fd5b5061045f6107af36600461363b565b611859565b3480156107c057600080fd5b506103596118e0565b3480156107d557600080fd5b506103bf61192b565b3480156107ea57600080fd5b50601a5461080b906001600160a01b03811690600160a01b900461ffff1682565b60405161033092919061385a565b34801561082557600080fd5b506103596108343660046135a3565b61193a565b34801561084557600080fd5b506103596108543660046135a3565b61197e565b34801561086557600080fd5b5061045f6119c2565b34801561087a57600080fd5b506103ec6119d3565b34801561088f57600080fd5b5061032461089e366004613717565b6119e2565b3480156108af57600080fd5b506103596108be36600461379e565b611a0d565b3480156108cf57600080fd5b506103bf611a5f565b3480156108e457600080fd5b5061045f60165481565b6103596108fc3660046138bb565b611a6e565b34801561090d57600080fd5b5061045f600081565b34801561092257600080fd5b50610359610931366004613906565b611c26565b34801561094257600080fd5b5061045f60125481565b34801561095857600080fd5b5061045f60175481565b34801561096e57600080fd5b506018546103249060ff1681565b34801561098857600080fd5b5061035961099736600461393b565b611c38565b3480156109a857600080fd5b506103bf6109b73660046135a3565b611c71565b3480156109c857600080fd5b506109dc6109d73660046135a3565b611c7c565b60405161033091906139ba565b3480156109f557600080fd5b5061045f60008051602061401f83398151915281565b348015610a1757600080fd5b50610359610a26366004613717565b611d37565b348015610a3757600080fd5b506103bf611d53565b348015610a4c57600080fd5b5061045f600d5481565b610359610a64366004613658565b611d62565b348015610a7557600080fd5b50610359610a8436600461363b565b611e32565b348015610a9557600080fd5b50610324610aa4366004613a1b565b611e93565b348015610ab557600080fd5b5061045f60115481565b348015610acb57600080fd5b50610359611ee1565b348015610ae057600080fd5b506103bf611f2f565b348015610af557600080fd5b50610324610b04366004613a56565b611f3e565b348015610b1557600080fd5b50610359610b24366004613a84565b611f51565b348015610b3557600080fd5b50610359610b4436600461363b565b611faa565b348015610b5557600080fd5b50610359610b643660046135a3565b612057565b348015610b7557600080fd5b50610359610b843660046135a3565b61209b565b6000610b9482612105565b80610ba35750610ba382612140565b92915050565b60005b8151811015610c5257610bdf610bc061217c565b838381518110610bd257610bd2613a9c565b6020026020010151612186565b610c1c5760405162461bcd60e51b81526020600482015260096024820152682727aa2fa7aba722a960b91b60448201526064015b60405180910390fd5b610c408484848481518110610c3357610c33613a9c565b602002602001015161224f565b80610c4a81613ac8565b915050610bac565b50505050565b6040805160608101825260008082526020820181905291810182905290610c80601c846123d9565b6000818152601b60209081526040918290208251808401845290546001600160a01b03808216835261ffff600160a01b90920482168385019081528551606081018752968752925116928501929092525116908201529392505050565b606060028054610cec90613ae3565b80601f0160208091040260200160405190810160405280929190818152602001828054610d1890613ae3565b8015610d655780601f10610d3a57610100808354040283529160200191610d65565b820191906000526020600020905b815481529060010190602001808311610d4857829003601f168201915b5050505050905090565b6000610d7a826123e5565b610ddb5760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a20617070726f76656420717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c13565b506000908152600660205260409020546001600160a01b031690565b610dff61217c565b6001600160a01b0316610e106119d3565b6001600160a01b031614610e365760405162461bcd60e51b8152600401610c1390613b18565b601e80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610e638261171a565b9050806001600160a01b0316836001600160a01b03161415610ed15760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b6064820152608401610c13565b806001600160a01b0316610ee361217c565b6001600160a01b03161480610eff5750610eff81610b0461217c565b610f6c5760405162461bcd60e51b815260206004820152603860248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776044820152771b995c881b9bdc88185c1c1c9bdd995908199bdc88185b1b60421b6064820152608401610c13565b610f768383612402565b505050565b610f8361217c565b6001600160a01b0316610f946119d3565b6001600160a01b031614610fba5760405162461bcd60e51b8152600401610c1390613b18565b600e805460ff19166001179055565b610fe360008051602061401f83398151915261089e61217c565b6110215760405162461bcd60e51b815260206004820152600f60248201526e4e4f545f4d494e5445525f524f4c4560881b6044820152606401610c13565b61102b8282612470565b5050565b61104061103a61217c565b82612186565b61105c5760405162461bcd60e51b8152600401610c1390613b4d565b610f7683838361224f565b60009081526019602052604090206001015490565b6000828152601b602052604081205481906001600160a01b0316156110e1576000848152601b60205260409020546001600160a01b03811690612710906110ce90600160a01b900461ffff1686613b9e565b6110d89190613bd3565b9150915061113a565b601a546001600160a01b0316158015906111075750601a54600160a01b900461ffff1615155b1561113357601a546001600160a01b03811690612710906110ce90600160a01b900461ffff1686613b9e565b5060009050805b9250929050565b61114961217c565b6001600160a01b031661115a6119d3565b6001600160a01b0316146111805760405162461bcd60e51b8152600401610c1390613b18565b6018805460ff1916911515919091179055565b61119c82611067565b6111a581612506565b610f768383612517565b6111b761217c565b6001600160a01b03166111c86119d3565b6001600160a01b0316146110215760405162461bcd60e51b8152600401610c1390613b18565b6111f661217c565b6001600160a01b03166112076119d3565b6001600160a01b03161461122d5760405162461bcd60e51b8152600401610c1390613b18565b805161102b90600a9060208401906133b0565b61124861217c565b6001600160a01b0316816001600160a01b0316146112c05760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610c13565b61102b828261259e565b6112d261217c565b6001600160a01b03166112e36119d3565b6001600160a01b0316146113095760405162461bcd60e51b8152600401610c1390613b18565b601755565b61131661217c565b6001600160a01b03166113276119d3565b6001600160a01b03161461134d5760405162461bcd60e51b8152600401610c1390613b18565b6000479050306001600160a01b0316638da5cb5b6040518163ffffffff1660e01b815260040160206040518083038186803b15801561138b57600080fd5b505afa15801561139f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113c39190613be7565b6001600160a01b03166108fc829081150290604051600060405180830381858888f1935050505015801561102b573d6000803e3d6000fd5b610f7683838360405180602001604052806000815250611c38565b61141e61217c565b6001600160a01b031661142f6119d3565b6001600160a01b0316146114555760405162461bcd60e51b8152600401610c1390613b18565b6014805460ff1916911515919091179055565b61147061217c565b6001600160a01b03166114816119d3565b6001600160a01b0316146114a75760405162461bcd60e51b8152600401610c1390613b18565b61102b8282808060200260200160405190810160405280939291908181526020016000905b828210156114f8576114e960608302860136819003810190613c16565b815260200190600101906114cc565b5050505050612623565b61150a61217c565b6001600160a01b031661151b6119d3565b6001600160a01b0316146115415760405162461bcd60e51b8152600401610c1390613b18565b600c5460ff16156115645760405162461bcd60e51b8152600401610c1390613c7c565b805161102b90600b9060208401906133b0565b6008546001600160a01b0391821691161490565b600080808080808080808080806115a061217c565b6001600160a01b03161461162b57306370a082316115bc61217c565b6040518263ffffffff1660e01b81526004016115d89190613627565b60206040518083038186803b1580156115f057600080fd5b505afa158015611604573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116289190613ca5565b90505b600d54306001600160a01b03166318160ddd6040518163ffffffff1660e01b815260040160206040518083038186803b15801561166757600080fd5b505afa15801561167b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061169f9190613ca5565b82601154601254601560006116b261217c565b6001600160a01b03166001600160a01b0316815260200190815260200160002054601460009054906101000a900460ff16601654601754601860009054906101000a900460ff169a509a509a509a509a509a509a509a509a509a505090919293949596979899565b6000818152600460205260408120546001600160a01b031680610ba35760405162461bcd60e51b815260206004820152602960248201527f4552433732313a206f776e657220717565727920666f72206e6f6e657869737460448201526832b73a103a37b5b2b760b91b6064820152608401610c13565b61179961217c565b6001600160a01b03166117aa6119d3565b6001600160a01b0316146117d05760405162461bcd60e51b8152600401610c1390613b18565b601f80546001600160a01b0319166001600160a01b0392909216919091179055565b6117fa61217c565b6001600160a01b031661180b6119d3565b6001600160a01b0316146118315760405162461bcd60e51b8152600401610c1390613b18565b600e5460ff16156118545760405162461bcd60e51b8152600401610c1390613c7c565b600d55565b60006001600160a01b0382166118c45760405162461bcd60e51b815260206004820152602a60248201527f4552433732313a2062616c616e636520717565727920666f7220746865207a65604482015269726f206164647265737360b01b6064820152608401610c13565b506001600160a01b031660009081526005602052604090205490565b6118e861217c565b6001600160a01b03166118f96119d3565b6001600160a01b03161461191f5760405162461bcd60e51b8152600401610c1390613b18565b61192960006127ca565b565b6060600a8054610cec90613ae3565b61194261217c565b6001600160a01b03166119536119d3565b6001600160a01b0316146119795760405162461bcd60e51b8152600401610c1390613b18565b601655565b61198661217c565b6001600160a01b03166119976119d3565b6001600160a01b0316146119bd5760405162461bcd60e51b8152600401610c1390613b18565b601155565b60006119ce601c61281a565b905090565b6000546001600160a01b031690565b60009182526019602090815260408084206001600160a01b0393909316845291905290205460ff1690565b611a1561217c565b6001600160a01b0316611a266119d3565b6001600160a01b031614611a4c5760405162461bcd60e51b8152600401610c1390613b18565b805161102b9060099060208401906133b0565b606060038054610cec90613ae3565b60026010541415611a915760405162461bcd60e51b8152600401610c1390613cbe565b600260105560145460ff16611ab85760405162461bcd60e51b8152600401610c1390613cf5565b6000611ac261217c565b9050611b0d838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506013549150611b08905084612824565b61285e565b611b505760405162461bcd60e51b8152602060048201526014602482015273282922afa9a0a622afaba927a723afa82927a7a360611b6044820152606401610c13565b6012546001600160a01b038216600090815260156020526040902054611b77908690613d22565b1115611bb65760405162461bcd60e51b815260206004820152600e60248201526d14149157d4d0531157d31253525560921b6044820152606401610c13565b3484601154611bc59190613b9e565b1115611be35760405162461bcd60e51b8152600401610c1390613d3a565b6001600160a01b03811660009081526015602052604081208054869290611c0b908490613d22565b90915550611c1b90508185612470565b505060016010555050565b61102b611c3161217c565b8383612874565b611c49611c4361217c565b83612186565b611c655760405162461bcd60e51b8152600401610c1390613b4d565b610c528484848461293f565b6060610ba382612972565b604080516001808252818301909252606091816020015b6040805180820190915260008082526020820152815260200190600190039081611c93575050601a5481519192506001600160a01b0316908290600090611cdc57611cdc613a9c565b60209081029190910101516001600160a01b03919091169052601a548151600160a01b90910461ffff16908290600090611d1857611d18613a9c565b6020908102919091018101516001600160601b03909216910152919050565b611d4082611067565b611d4981612506565b610f76838361259e565b6060600b8054610cec90613ae3565b60026010541415611d855760405162461bcd60e51b8152600401610c1390613cbe565b600260105560185460ff16611dac5760405162461bcd60e51b8152600401610c1390613cf5565b601754811115611df25760405162461bcd60e51b8152602060048201526011602482015270141550931250d7d4d0531157d312535255607a1b6044820152606401610c13565b3481601654611e019190613b9e565b1115611e1f5760405162461bcd60e51b8152600401610c1390613d3a565b611e298282612470565b50506001601055565b611e3a61217c565b6001600160a01b0316611e4b6119d3565b6001600160a01b031614611e715760405162461bcd60e51b8152600401610c1390613b18565b600880546001600160a01b0319166001600160a01b0392909216919091179055565b6000611ed9838380806020026020016040519081016040528093929190818152602001838360200280828437600092019190915250506013549150611b08905087612824565b949350505050565b611ee961217c565b6001600160a01b0316611efa6119d3565b6001600160a01b031614611f205760405162461bcd60e51b8152600401610c1390613b18565b600c805460ff19166001179055565b606060098054610cec90613ae3565b6000611f4a8383612a4b565b9392505050565b611f5961217c565b6001600160a01b0316611f6a6119d3565b6001600160a01b031614611f905760405162461bcd60e51b8152600401610c1390613b18565b611fa7611fa236839003830183613d67565b612b5c565b50565b611fb261217c565b6001600160a01b0316611fc36119d3565b6001600160a01b031614611fe95760405162461bcd60e51b8152600401610c1390613b18565b6001600160a01b03811661204e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610c13565b611fa7816127ca565b61205f61217c565b6001600160a01b03166120706119d3565b6001600160a01b0316146120965760405162461bcd60e51b8152600401610c1390613b18565b601255565b6120a361217c565b6001600160a01b03166120b46119d3565b6001600160a01b0316146120da5760405162461bcd60e51b8152600401610c1390613b18565b601355565b60006120ea33611577565b156120fc575060131936013560601c90565b503390565b3390565b60006001600160e01b031982166380ac58cd60e01b1480610b9457506001600160e01b03198216635b5e139f60e01b1480610ba35750610ba3825b60006301ffc9a760e01b6001600160e01b031983161480610ba35750506001600160e01b03191660009081526001602052604090205460ff1690565b60006119ce6120df565b6000612191826123e5565b6121f25760405162461bcd60e51b815260206004820152602c60248201527f4552433732313a206f70657261746f7220717565727920666f72206e6f6e657860448201526b34b9ba32b73a103a37b5b2b760a11b6064820152608401610c13565b60006121fd8361171a565b9050806001600160a01b0316846001600160a01b0316148061222457506122248185611f3e565b80611ed95750836001600160a01b031661223d84610d6f565b6001600160a01b031614949350505050565b826001600160a01b03166122628261171a565b6001600160a01b0316146122c65760405162461bcd60e51b815260206004820152602560248201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060448201526437bbb732b960d91b6064820152608401610c13565b6001600160a01b0382166123285760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610c13565b612333600082612402565b6001600160a01b038316600090815260056020526040812080546001929061235c908490613dc3565b90915550506001600160a01b038216600090815260056020526040812080546001929061238a908490613d22565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b03868116918217909255915184939187169160008051602061403f83398151915291a4505050565b6000611f4a8383612c07565b6000908152600460205260409020546001600160a01b0316151590565b600081815260066020526040902080546001600160a01b0319166001600160a01b03841690811790915581906124378261171a565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b600d548161247d600f5490565b6124879190613d22565b11156124ca5760405162461bcd60e51b8152602060048201526012602482015271455843454544535f4d41585f535550504c5960701b6044820152606401610c13565b60005b81811015610f765760006124df612c31565b90506124eb8482612c42565b6124f3612c5c565b50806124fe81613ac8565b9150506124cd565b611fa78161251261217c565b612c73565b61252182826119e2565b61102b5760008281526019602090815260408083206001600160a01b03851684529091529020805460ff1916600117905561255a61217c565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6125a882826119e2565b1561102b5760008281526019602090815260408083206001600160a01b03851684529091529020805460ff191690556125df61217c565b6001600160a01b0316816001600160a01b0316837ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b60405160405180910390a45050565b60005b815181101561102b57600082828151811061264357612643613a9c565b60200260200101519050612710816040015161ffff16106126765760405162461bcd60e51b8152600401610c1390613dda565b60208101516001600160a01b03166126ef5780516000908152601b6020526040902080546001600160b01b031916905580516126b490601c90612cd7565b5080516040519081527fa2870857763bd9ae76c957f869f16b31c18dd3bb4c7b4d3a4496dc5c57c657f99060200160405180910390a16127b7565b6040805180820182526020808401516001600160a01b0390811683528484015161ffff90811683850190815286516000908152601b90945294909220925183549451909216600160a01b026001600160b01b0319909416911617919091179055805161275d90601c90612ce3565b50805160208083015160408085015181519485526001600160a01b039092169284019290925261ffff1682820152517f389b70fb0887f01e83784eb1c4c589f740eca53b00ed0f45e41db5d079719abb9181900360600190a15b50806127c281613ac8565b915050612626565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6000610ba3825490565b6040516001600160601b0319606083901b166020820152600090603401604051602081830303815290604052805190602001209050919050565b60008261286b8584612cef565b14949350505050565b816001600160a01b0316836001600160a01b031614156128d25760405162461bcd60e51b815260206004820152601960248201527822a9219b99189d1030b8383937bb32903a379031b0b63632b960391b6044820152606401610c13565b6001600160a01b03838116600081815260076020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b61294a84848461224f565b61295684848484612d63565b610c525760405162461bcd60e51b8152600401610c1390613dff565b60606000600b805461298390613ae3565b905011612a1a57600a805461299790613ae3565b80601f01602080910402602001604051908101604052809291908181526020018280546129c390613ae3565b8015612a105780601f106129e557610100808354040283529160200191612a10565b820191906000526020600020905b8154815290600101906020018083116129f357829003601f168201915b5050505050610ba3565b600b612a2583612e77565b604051602001612a36929190613e6d565b60405160208183030381529060405292915050565b601e546000906001600160a01b031615612aff57601e5460405163c455279160e01b81526001600160a01b0391821691841690829063c455279190612a94908890600401613627565b60206040518083038186803b158015612aac57600080fd5b505afa158015612ac0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ae49190613be7565b6001600160a01b03161415612afd576001915050610ba3565b505b601f546001600160a01b031615612b2e57601f546001600160a01b0383811691161415612b2e57506001610ba3565b6001600160a01b0380841660009081526007602090815260408083209386168352929052205460ff16611f4a565b612710816020015161ffff1610612b855760405162461bcd60e51b8152600401610c1390613dda565b60408051808201825282516001600160a01b03168082526020808501805161ffff1691909301819052601a80546001600160b01b031916909217600160a01b9091021790558251905191517f2c5ea6e4103e78cb101e796fb2dace540362fc542cbff5145eaa24af7dd8fe4192612bfc929161385a565b60405180910390a150565b6000826000018281548110612c1e57612c1e613a9c565b9060005260206000200154905092915050565b600f546000906119ce906001612f74565b61102b828260405180602001604052806000815250612f80565b600f8054906000612c6c83613ac8565b9190505550565b612c7d82826119e2565b61102b57612c95816001600160a01b03166014612fb3565b612ca0836020612fb3565b604051602001612cb1929190613f14565b60408051601f198184030181529082905262461bcd60e51b8252610c1391600401613614565b6000611f4a838361314e565b6000611f4a8383613241565b600081815b8451811015612d5b576000858281518110612d1157612d11613a9c565b60200260200101519050808311612d375760008381526020829052604090209250612d48565b600081815260208490526040902092505b5080612d5381613ac8565b915050612cf4565b509392505050565b60006001600160a01b0384163b15612e6c57836001600160a01b031663150b7a02612d8c61217c565b8786866040518563ffffffff1660e01b8152600401612dae9493929190613f83565b602060405180830381600087803b158015612dc857600080fd5b505af1925050508015612df8575060408051601f3d908101601f19168201909252612df591810190613fc0565b60015b612e52573d808015612e26576040519150601f19603f3d011682016040523d82523d6000602084013e612e2b565b606091505b508051612e4a5760405162461bcd60e51b8152600401610c1390613dff565b805181602001fd5b6001600160e01b031916630a85bd0160e11b149050611ed9565b506001949350505050565b606081612e9b5750506040805180820190915260018152600360fc1b602082015290565b8160005b8115612ec55780612eaf81613ac8565b9150612ebe9050600a83613bd3565b9150612e9f565b6000816001600160401b03811115612edf57612edf613491565b6040519080825280601f01601f191660200182016040528015612f09576020820181803683370190505b5090505b8415611ed957612f1e600183613dc3565b9150612f2b600a86613fdd565b612f36906030613d22565b60f81b818381518110612f4b57612f4b613a9c565b60200101906001600160f81b031916908160001a905350612f6d600a86613bd3565b9450612f0d565b6000611f4a8284613d22565b612f8a8383613290565b612f976000848484612d63565b610f765760405162461bcd60e51b8152600401610c1390613dff565b60606000612fc2836002613b9e565b612fcd906002613d22565b6001600160401b03811115612fe457612fe4613491565b6040519080825280601f01601f19166020018201604052801561300e576020820181803683370190505b509050600360fc1b8160008151811061302957613029613a9c565b60200101906001600160f81b031916908160001a905350600f60fb1b8160018151811061305857613058613a9c565b60200101906001600160f81b031916908160001a905350600061307c846002613b9e565b613087906001613d22565b90505b60018111156130ff576f181899199a1a9b1b9c1cb0b131b232b360811b85600f16601081106130bb576130bb613a9c565b1a60f81b8282815181106130d1576130d1613a9c565b60200101906001600160f81b031916908160001a90535060049490941c936130f881613ff1565b905061308a565b508315611f4a5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610c13565b60008181526001830160205260408120548015613237576000613172600183613dc3565b855490915060009061318690600190613dc3565b90508181146131eb5760008660000182815481106131a6576131a6613a9c565b90600052602060002001549050808760000184815481106131c9576131c9613a9c565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806131fc576131fc614008565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610ba3565b6000915050610ba3565b600081815260018301602052604081205461328857508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ba3565b506000610ba3565b6001600160a01b0382166132e65760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610c13565b6132ef816123e5565b1561333b5760405162461bcd60e51b815260206004820152601c60248201527b115490cdcc8c4e881d1bdad95b88185b1c9958591e481b5a5b9d195960221b6044820152606401610c13565b6001600160a01b0382166000908152600560205260408120805460019290613364908490613d22565b909155505060008181526004602052604080822080546001600160a01b0319166001600160a01b038616908117909155905183929060008051602061403f833981519152908290a45050565b8280546133bc90613ae3565b90600052602060002090601f0160209004810192826133de5760008555613424565b82601f106133f757805160ff1916838001178555613424565b82800160010185558215613424579182015b82811115613424578251825591602001919060010190613409565b50613430929150613434565b5090565b5b808211156134305760008155600101613435565b6001600160e01b031981168114611fa757600080fd5b60006020828403121561347157600080fd5b8135611f4a81613449565b6001600160a01b0381168114611fa757600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b03811182821017156134cf576134cf613491565b604052919050565b6000806000606084860312156134ec57600080fd5b83356134f78161347c565b92506020848101356135088161347c565b925060408501356001600160401b038082111561352457600080fd5b818701915087601f83011261353857600080fd5b81358181111561354a5761354a613491565b8060051b915061355b8483016134a7565b818152918301840191848101908a84111561357557600080fd5b938501935b838510156135935784358252938501939085019061357a565b8096505050505050509250925092565b6000602082840312156135b557600080fd5b5035919050565b60005b838110156135d75781810151838201526020016135bf565b83811115610c525750506000910152565b600081518084526136008160208601602086016135bc565b601f01601f19169290920160200192915050565b602081526000611f4a60208301846135e8565b6001600160a01b0391909116815260200190565b60006020828403121561364d57600080fd5b8135611f4a8161347c565b6000806040838503121561366b57600080fd5b82356136768161347c565b946020939093013593505050565b60008060006060848603121561369957600080fd5b83356136a48161347c565b925060208401356136b48161347c565b929592945050506040919091013590565b600080604083850312156136d857600080fd5b50508035926020909101359150565b803580151581146136f757600080fd5b919050565b60006020828403121561370e57600080fd5b611f4a826136e7565b6000806040838503121561372a57600080fd5b82359150602083013561373c8161347c565b809150509250929050565b60006001600160401b0383111561376057613760613491565b613773601f8401601f19166020016134a7565b905082815283838301111561378757600080fd5b828260208301376000602084830101529392505050565b6000602082840312156137b057600080fd5b81356001600160401b038111156137c657600080fd5b8201601f810184136137d757600080fd5b611ed984823560208401613747565b600080602083850312156137f957600080fd5b82356001600160401b038082111561381057600080fd5b818501915085601f83011261382457600080fd5b81358181111561383357600080fd5b86602060608302850101111561384857600080fd5b60209290920196919550909350505050565b6001600160a01b0392909216825261ffff16602082015260400190565b60008083601f84011261388957600080fd5b5081356001600160401b038111156138a057600080fd5b6020830191508360208260051b850101111561113a57600080fd5b6000806000604084860312156138d057600080fd5b8335925060208401356001600160401b038111156138ed57600080fd5b6138f986828701613877565b9497909650939450505050565b6000806040838503121561391957600080fd5b82356139248161347c565b9150613932602084016136e7565b90509250929050565b6000806000806080858703121561395157600080fd5b843561395c8161347c565b9350602085013561396c8161347c565b92506040850135915060608501356001600160401b0381111561398e57600080fd5b8501601f8101871361399f57600080fd5b6139ae87823560208401613747565b91505092959194509250565b602080825282518282018190526000919060409081850190868401855b82811015613a0e57815180516001600160a01b031685528601516001600160601b03168685015292840192908501906001016139d7565b5091979650505050505050565b600080600060408486031215613a3057600080fd5b8335613a3b8161347c565b925060208401356001600160401b038111156138ed57600080fd5b60008060408385031215613a6957600080fd5b8235613a748161347c565b9150602083013561373c8161347c565b600060408284031215613a9657600080fd5b50919050565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000600019821415613adc57613adc613ab2565b5060010190565b600181811c90821680613af757607f821691505b60208210811415613a9657634e487b7160e01b600052602260045260246000fd5b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b60208082526031908201527f4552433732313a207472616e736665722063616c6c6572206973206e6f74206f6040820152701ddb995c881b9bdc88185c1c1c9bdd9959607a1b606082015260800190565b6000816000190483118215151615613bb857613bb8613ab2565b500290565b634e487b7160e01b600052601260045260246000fd5b600082613be257613be2613bbd565b500490565b600060208284031215613bf957600080fd5b8151611f4a8161347c565b803561ffff811681146136f757600080fd5b600060608284031215613c2857600080fd5b604051606081016001600160401b0381118282101715613c4a57613c4a613491565b604052823581526020830135613c5f8161347c565b6020820152613c7060408401613c04565b60408201529392505050565b6020808252600f908201526e2120a9a2afaaa924afa32927ad22a760891b604082015260600190565b600060208284031215613cb757600080fd5b5051919050565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020808252601390820152725052455f53414c455f4e4f545f41435449564560681b604082015260600190565b60008219821115613d3557613d35613ab2565b500190565b602080825260139082015272125394d551919250d251539517d05353d55395606a1b604082015260600190565b600060408284031215613d7957600080fd5b604080519081016001600160401b0381118282101715613d9b57613d9b613491565b6040528235613da98161347c565b8152613db760208401613c04565b60208201529392505050565b600082821015613dd557613dd5613ab2565b500390565b6020808252600b908201526a496e76616c69642062707360a81b604082015260600190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b60008151613e638185602086016135bc565b9290920192915050565b600080845481600182811c915080831680613e8957607f831692505b6020808410821415613ea957634e487b7160e01b86526022600452602486fd5b818015613ebd5760018114613ece57613efb565b60ff19861689528489019650613efb565b60008b81526020902060005b86811015613ef35781548b820152908501908301613eda565b505084890196505b505050505050613f0b8185613e51565b95945050505050565b76020b1b1b2b9b9a1b7b73a3937b61d1030b1b1b7bab73a1604d1b815260008351613f468160178501602088016135bc565b7001034b99036b4b9b9b4b733903937b6329607d1b6017918401918201528351613f778160288401602088016135bc565b01602801949350505050565b6001600160a01b0385811682528416602082015260408101839052608060608201819052600090613fb6908301846135e8565b9695505050505050565b600060208284031215613fd257600080fd5b8151611f4a81613449565b600082613fec57613fec613bbd565b500690565b60008161400057614000613ab2565b506000190190565b634e487b7160e01b600052603160045260246000fdfe9f2df0fed2c77648de5860a4cc508cd0818c85b8b8a1ab4ceeef8d981c8956a6ddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa26469706673582212204c50278aff7a50ffce7485a083beeaa431c2ddc4579db6983a18baceb2e3f22664736f6c63430008090033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000001c00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000024000000000000000000000000000000000000000000000000000000000000002a0000000000000000000000000000000000000000000000000000000000000138800000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000002386f26fc10000000000000000000000000000000000000000000000000000000000000000000a000000000000000000000000790d99f0d48660a0a93eca2a5b0635fe84b0899700000000000000000000000000000000000000000000000000000000000002bc000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000b56696b696e6720546f776e000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000656494b494e4700000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d5877356d43354675455a35383257367167795a36553352556e647541756e637776435369413938623136674800000000000000000000000000000000000000000000000000000000000000000000000000000000000035697066733a2f2f516d51674e33614c6241423972697a484e635234476b347a76346338624c445564697452647835706b38435476470000000000000000000000
-----Decoded View---------------
Arg [0] : config (tuple): System.Collections.Generic.List`1[Nethereum.ABI.FunctionEncoding.ParameterOutput]
-----Encoded View---------------
25 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000020
Arg [1] : 00000000000000000000000000000000000000000000000000000000000001c0
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000200
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000240
Arg [4] : 00000000000000000000000000000000000000000000000000000000000002a0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000001388
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [8] : 000000000000000000000000000000000000000000000000002386f26fc10000
Arg [9] : 000000000000000000000000000000000000000000000000000000000000000a
Arg [10] : 000000000000000000000000790d99f0d48660a0a93eca2a5b0635fe84b08997
Arg [11] : 00000000000000000000000000000000000000000000000000000000000002bc
Arg [12] : 000000000000000000000000a5409ec958c83c3f309868babaca7c86dcb077c1
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [15] : 000000000000000000000000000000000000000000000000000000000000000b
Arg [16] : 56696b696e6720546f776e000000000000000000000000000000000000000000
Arg [17] : 0000000000000000000000000000000000000000000000000000000000000006
Arg [18] : 56494b494e470000000000000000000000000000000000000000000000000000
Arg [19] : 0000000000000000000000000000000000000000000000000000000000000035
Arg [20] : 697066733a2f2f516d5877356d43354675455a35383257367167795a36553352
Arg [21] : 556e647541756e63777643536941393862313667480000000000000000000000
Arg [22] : 0000000000000000000000000000000000000000000000000000000000000035
Arg [23] : 697066733a2f2f516d51674e33614c6241423972697a484e635234476b347a76
Arg [24] : 346338624c445564697452647835706b38435476470000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ 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.