Overview
TokenID
290
Total Transfers
-
Market
Onchain Market Cap
$0.00
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
# | Exchange | Pair | Price | 24H Volume | % Volume |
---|
Contract Source Code Verified (Exact Match)
Contract Name:
Collection
Compiler Version
v0.8.17+commit.8df45f5f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// File @openzeppelin/contracts/utils/[email protected] // 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; } } // File @openzeppelin/contracts/access/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } } // File @openzeppelin/contracts/utils/introspection/[email protected] // 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); } // File @openzeppelin/contracts/token/ERC721/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; /** * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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); } // File @openzeppelin/contracts/token/ERC721/extensions/[email protected] // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; /** * @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); } // File @openzeppelin/contracts/token/ERC721/[email protected] // 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); } // File @openzeppelin/contracts/utils/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library 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 functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev 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) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } // File @openzeppelin/contracts/utils/introspection/[email protected] // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; /** * @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; } } // File @openzeppelin/contracts/utils/math/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // тЖТ `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // тЖТ `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } } // File @openzeppelin/contracts/utils/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } } // File @openzeppelin/contracts/token/ERC721/[email protected] // OpenZeppelin Contracts (last updated v4.8.2) (token/ERC721/ERC721.sol) pragma solidity ^0.8.0; /** * @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: address zero is not a valid owner"); return _balances[owner]; } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view virtual override returns (address) { address owner = _ownerOf(tokenId); require(owner != address(0), "ERC721: invalid token ID"); 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) { _requireMinted(tokenId); 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 token owner or approved for all" ); _approve(to, tokenId); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view virtual override returns (address) { _requireMinted(tokenId); 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: caller is not token owner or 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: caller is not token owner or 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 the owner of the `tokenId`. Does NOT revert if token doesn't exist */ function _ownerOf(uint256 tokenId) internal view virtual returns (address) { return _owners[tokenId]; } /** * @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 _ownerOf(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) { 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, 1); // Check that tokenId was not minted by `_beforeTokenTransfer` hook require(!_exists(tokenId), "ERC721: token already minted"); unchecked { // Will not overflow unless all 2**256 token ids are minted to the same owner. // Given that tokens are minted one by one, it is impossible in practice that // this ever happens. Might change if we allow batch minting. // The ERC fails to describe this case. _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(address(0), to, tokenId); _afterTokenTransfer(address(0), to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * This is an internal function that does not check if the sender is authorized to operate on the token. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { address owner = ERC721.ownerOf(tokenId); _beforeTokenTransfer(owner, address(0), tokenId, 1); // Update ownership in case tokenId was transferred by `_beforeTokenTransfer` hook owner = ERC721.ownerOf(tokenId); // Clear approvals delete _tokenApprovals[tokenId]; unchecked { // Cannot overflow, as that would require more tokens to be burned/transferred // out than the owner initially received through minting and transferring in. _balances[owner] -= 1; } delete _owners[tokenId]; emit Transfer(owner, address(0), tokenId); _afterTokenTransfer(owner, address(0), tokenId, 1); } /** * @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, 1); // Check that tokenId was not transferred by `_beforeTokenTransfer` hook require(ERC721.ownerOf(tokenId) == from, "ERC721: transfer from incorrect owner"); // Clear approvals from the previous owner delete _tokenApprovals[tokenId]; unchecked { // `_balances[from]` cannot overflow for the same reason as described in `_burn`: // `from`'s balance is the number of token held, which is at least one before the current // transfer. // `_balances[to]` could overflow in the conditions described in `_mint`. That would require // all 2**256 token ids to be minted, which in practice is impossible. _balances[from] -= 1; _balances[to] += 1; } _owners[tokenId] = to; emit Transfer(from, to, tokenId); _afterTokenTransfer(from, to, tokenId, 1); } /** * @dev Approve `to` to operate on `tokenId` * * Emits an {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 an {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 Reverts if the `tokenId` has not been minted yet. */ function _requireMinted(uint256 tokenId) internal view virtual { require(_exists(tokenId), "ERC721: invalid token ID"); } /** * @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 { /// @solidity memory-safe-assembly assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens will be transferred to `to`. * - When `from` is zero, the tokens will be minted for `to`. * - When `to` is zero, ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} /** * @dev Hook that is called after any token transfer. This includes minting and burning. If {ERC721Consecutive} is * used, the hook may be called as part of a consecutive (batch) mint, as indicated by `batchSize` greater than 1. * * Calling conditions: * * - When `from` and `to` are both non-zero, ``from``'s tokens were transferred to `to`. * - When `from` is zero, the tokens were minted for `to`. * - When `to` is zero, ``from``'s tokens were burned. * - `from` and `to` are never both zero. * - `batchSize` is non-zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer( address from, address to, uint256 firstTokenId, uint256 batchSize ) internal virtual {} /** * @dev Unsafe write access to the balances, used by extensions that "mint" tokens using an {ownerOf} override. * * WARNING: Anyone calling this MUST ensure that the balances remain consistent with the ownership. The invariant * being that for any address `a` the value returned by `balanceOf(a)` must be equal to the number of tokens such * that `ownerOf(tokenId)` is `a`. */ // solhint-disable-next-line func-name-mixedcase function __unsafe_increaseBalance(address account, uint256 amount) internal { _balances[account] += amount; } } // File @openzeppelin/contracts/token/ERC721/extensions/[email protected] // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC721/extensions/ERC721URIStorage.sol) pragma solidity ^0.8.0; /** * @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) { _requireMinted(tokenId); 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 See {ERC721-_burn}. This override additionally checks to see if a * token-specific URI was set for the token, and if so, it deletes the token URI from * the storage mapping. */ function _burn(uint256 tokenId) internal virtual override { super._burn(tokenId); if (bytes(_tokenURIs[tokenId]).length != 0) { delete _tokenURIs[tokenId]; } } } // File @openzeppelin/contracts/security/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } } // File @openzeppelin/contracts/utils/structs/[email protected] // OpenZeppelin Contracts (last updated v4.8.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping(bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; if (lastIndex != toDeleteIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastValue; // Update the index for the moved value set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex } // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } } // File prb-math/contracts/[email protected] pragma solidity >=0.8.4; /// @notice Emitted when the result overflows uint256. error PRBMath__MulDivFixedPointOverflow(uint256 prod1); /// @notice Emitted when the result overflows uint256. error PRBMath__MulDivOverflow(uint256 prod1, uint256 denominator); /// @notice Emitted when one of the inputs is type(int256).min. error PRBMath__MulDivSignedInputTooSmall(); /// @notice Emitted when the intermediary absolute result overflows int256. error PRBMath__MulDivSignedOverflow(uint256 rAbs); /// @notice Emitted when the input is MIN_SD59x18. error PRBMathSD59x18__AbsInputTooSmall(); /// @notice Emitted when ceiling a number overflows SD59x18. error PRBMathSD59x18__CeilOverflow(int256 x); /// @notice Emitted when one of the inputs is MIN_SD59x18. error PRBMathSD59x18__DivInputTooSmall(); /// @notice Emitted when one of the intermediary unsigned results overflows SD59x18. error PRBMathSD59x18__DivOverflow(uint256 rAbs); /// @notice Emitted when the input is greater than 133.084258667509499441. error PRBMathSD59x18__ExpInputTooBig(int256 x); /// @notice Emitted when the input is greater than 192. error PRBMathSD59x18__Exp2InputTooBig(int256 x); /// @notice Emitted when flooring a number underflows SD59x18. error PRBMathSD59x18__FloorUnderflow(int256 x); /// @notice Emitted when converting a basic integer to the fixed-point format overflows SD59x18. error PRBMathSD59x18__FromIntOverflow(int256 x); /// @notice Emitted when converting a basic integer to the fixed-point format underflows SD59x18. error PRBMathSD59x18__FromIntUnderflow(int256 x); /// @notice Emitted when the product of the inputs is negative. error PRBMathSD59x18__GmNegativeProduct(int256 x, int256 y); /// @notice Emitted when multiplying the inputs overflows SD59x18. error PRBMathSD59x18__GmOverflow(int256 x, int256 y); /// @notice Emitted when the input is less than or equal to zero. error PRBMathSD59x18__LogInputTooSmall(int256 x); /// @notice Emitted when one of the inputs is MIN_SD59x18. error PRBMathSD59x18__MulInputTooSmall(); /// @notice Emitted when the intermediary absolute result overflows SD59x18. error PRBMathSD59x18__MulOverflow(uint256 rAbs); /// @notice Emitted when the intermediary absolute result overflows SD59x18. error PRBMathSD59x18__PowuOverflow(uint256 rAbs); /// @notice Emitted when the input is negative. error PRBMathSD59x18__SqrtNegativeInput(int256 x); /// @notice Emitted when the calculating the square root overflows SD59x18. error PRBMathSD59x18__SqrtOverflow(int256 x); /// @notice Emitted when addition overflows UD60x18. error PRBMathUD60x18__AddOverflow(uint256 x, uint256 y); /// @notice Emitted when ceiling a number overflows UD60x18. error PRBMathUD60x18__CeilOverflow(uint256 x); /// @notice Emitted when the input is greater than 133.084258667509499441. error PRBMathUD60x18__ExpInputTooBig(uint256 x); /// @notice Emitted when the input is greater than 192. error PRBMathUD60x18__Exp2InputTooBig(uint256 x); /// @notice Emitted when converting a basic integer to the fixed-point format format overflows UD60x18. error PRBMathUD60x18__FromUintOverflow(uint256 x); /// @notice Emitted when multiplying the inputs overflows UD60x18. error PRBMathUD60x18__GmOverflow(uint256 x, uint256 y); /// @notice Emitted when the input is less than 1. error PRBMathUD60x18__LogInputTooSmall(uint256 x); /// @notice Emitted when the calculating the square root overflows UD60x18. error PRBMathUD60x18__SqrtOverflow(uint256 x); /// @notice Emitted when subtraction underflows UD60x18. error PRBMathUD60x18__SubUnderflow(uint256 x, uint256 y); /// @dev Common mathematical functions used in both PRBMathSD59x18 and PRBMathUD60x18. Note that this shared library /// does not always assume the signed 59.18-decimal fixed-point or the unsigned 60.18-decimal fixed-point /// representation. When it does not, it is explicitly mentioned in the NatSpec documentation. library PRBMath { /// STRUCTS /// struct SD59x18 { int256 value; } struct UD60x18 { uint256 value; } /// STORAGE /// /// @dev How many trailing decimals can be represented. uint256 internal constant SCALE = 1e18; /// @dev Largest power of two divisor of SCALE. uint256 internal constant SCALE_LPOTD = 262144; /// @dev SCALE inverted mod 2^256. uint256 internal constant SCALE_INVERSE = 78156646155174841979727994598816262306175212592076161876661_508869554232690281; /// FUNCTIONS /// /// @notice Calculates the binary exponent of x using the binary fraction method. /// @dev Has to use 192.64-bit fixed-point numbers. /// See https://ethereum.stackexchange.com/a/96594/24693. /// @param x The exponent as an unsigned 192.64-bit fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function exp2(uint256 x) internal pure returns (uint256 result) { unchecked { // Start from 0.5 in the 192.64-bit fixed-point format. result = 0x800000000000000000000000000000000000000000000000; // Multiply the result by root(2, 2^-i) when the bit at position i is 1. None of the intermediary results overflows // because the initial result is 2^191 and all magic factors are less than 2^65. if (x & 0x8000000000000000 > 0) { result = (result * 0x16A09E667F3BCC909) >> 64; } if (x & 0x4000000000000000 > 0) { result = (result * 0x1306FE0A31B7152DF) >> 64; } if (x & 0x2000000000000000 > 0) { result = (result * 0x1172B83C7D517ADCE) >> 64; } if (x & 0x1000000000000000 > 0) { result = (result * 0x10B5586CF9890F62A) >> 64; } if (x & 0x800000000000000 > 0) { result = (result * 0x1059B0D31585743AE) >> 64; } if (x & 0x400000000000000 > 0) { result = (result * 0x102C9A3E778060EE7) >> 64; } if (x & 0x200000000000000 > 0) { result = (result * 0x10163DA9FB33356D8) >> 64; } if (x & 0x100000000000000 > 0) { result = (result * 0x100B1AFA5ABCBED61) >> 64; } if (x & 0x80000000000000 > 0) { result = (result * 0x10058C86DA1C09EA2) >> 64; } if (x & 0x40000000000000 > 0) { result = (result * 0x1002C605E2E8CEC50) >> 64; } if (x & 0x20000000000000 > 0) { result = (result * 0x100162F3904051FA1) >> 64; } if (x & 0x10000000000000 > 0) { result = (result * 0x1000B175EFFDC76BA) >> 64; } if (x & 0x8000000000000 > 0) { result = (result * 0x100058BA01FB9F96D) >> 64; } if (x & 0x4000000000000 > 0) { result = (result * 0x10002C5CC37DA9492) >> 64; } if (x & 0x2000000000000 > 0) { result = (result * 0x1000162E525EE0547) >> 64; } if (x & 0x1000000000000 > 0) { result = (result * 0x10000B17255775C04) >> 64; } if (x & 0x800000000000 > 0) { result = (result * 0x1000058B91B5BC9AE) >> 64; } if (x & 0x400000000000 > 0) { result = (result * 0x100002C5C89D5EC6D) >> 64; } if (x & 0x200000000000 > 0) { result = (result * 0x10000162E43F4F831) >> 64; } if (x & 0x100000000000 > 0) { result = (result * 0x100000B1721BCFC9A) >> 64; } if (x & 0x80000000000 > 0) { result = (result * 0x10000058B90CF1E6E) >> 64; } if (x & 0x40000000000 > 0) { result = (result * 0x1000002C5C863B73F) >> 64; } if (x & 0x20000000000 > 0) { result = (result * 0x100000162E430E5A2) >> 64; } if (x & 0x10000000000 > 0) { result = (result * 0x1000000B172183551) >> 64; } if (x & 0x8000000000 > 0) { result = (result * 0x100000058B90C0B49) >> 64; } if (x & 0x4000000000 > 0) { result = (result * 0x10000002C5C8601CC) >> 64; } if (x & 0x2000000000 > 0) { result = (result * 0x1000000162E42FFF0) >> 64; } if (x & 0x1000000000 > 0) { result = (result * 0x10000000B17217FBB) >> 64; } if (x & 0x800000000 > 0) { result = (result * 0x1000000058B90BFCE) >> 64; } if (x & 0x400000000 > 0) { result = (result * 0x100000002C5C85FE3) >> 64; } if (x & 0x200000000 > 0) { result = (result * 0x10000000162E42FF1) >> 64; } if (x & 0x100000000 > 0) { result = (result * 0x100000000B17217F8) >> 64; } if (x & 0x80000000 > 0) { result = (result * 0x10000000058B90BFC) >> 64; } if (x & 0x40000000 > 0) { result = (result * 0x1000000002C5C85FE) >> 64; } if (x & 0x20000000 > 0) { result = (result * 0x100000000162E42FF) >> 64; } if (x & 0x10000000 > 0) { result = (result * 0x1000000000B17217F) >> 64; } if (x & 0x8000000 > 0) { result = (result * 0x100000000058B90C0) >> 64; } if (x & 0x4000000 > 0) { result = (result * 0x10000000002C5C860) >> 64; } if (x & 0x2000000 > 0) { result = (result * 0x1000000000162E430) >> 64; } if (x & 0x1000000 > 0) { result = (result * 0x10000000000B17218) >> 64; } if (x & 0x800000 > 0) { result = (result * 0x1000000000058B90C) >> 64; } if (x & 0x400000 > 0) { result = (result * 0x100000000002C5C86) >> 64; } if (x & 0x200000 > 0) { result = (result * 0x10000000000162E43) >> 64; } if (x & 0x100000 > 0) { result = (result * 0x100000000000B1721) >> 64; } if (x & 0x80000 > 0) { result = (result * 0x10000000000058B91) >> 64; } if (x & 0x40000 > 0) { result = (result * 0x1000000000002C5C8) >> 64; } if (x & 0x20000 > 0) { result = (result * 0x100000000000162E4) >> 64; } if (x & 0x10000 > 0) { result = (result * 0x1000000000000B172) >> 64; } if (x & 0x8000 > 0) { result = (result * 0x100000000000058B9) >> 64; } if (x & 0x4000 > 0) { result = (result * 0x10000000000002C5D) >> 64; } if (x & 0x2000 > 0) { result = (result * 0x1000000000000162E) >> 64; } if (x & 0x1000 > 0) { result = (result * 0x10000000000000B17) >> 64; } if (x & 0x800 > 0) { result = (result * 0x1000000000000058C) >> 64; } if (x & 0x400 > 0) { result = (result * 0x100000000000002C6) >> 64; } if (x & 0x200 > 0) { result = (result * 0x10000000000000163) >> 64; } if (x & 0x100 > 0) { result = (result * 0x100000000000000B1) >> 64; } if (x & 0x80 > 0) { result = (result * 0x10000000000000059) >> 64; } if (x & 0x40 > 0) { result = (result * 0x1000000000000002C) >> 64; } if (x & 0x20 > 0) { result = (result * 0x10000000000000016) >> 64; } if (x & 0x10 > 0) { result = (result * 0x1000000000000000B) >> 64; } if (x & 0x8 > 0) { result = (result * 0x10000000000000006) >> 64; } if (x & 0x4 > 0) { result = (result * 0x10000000000000003) >> 64; } if (x & 0x2 > 0) { result = (result * 0x10000000000000001) >> 64; } if (x & 0x1 > 0) { result = (result * 0x10000000000000001) >> 64; } // We're doing two things at the same time: // // 1. Multiply the result by 2^n + 1, where "2^n" is the integer part and the one is added to account for // the fact that we initially set the result to 0.5. This is accomplished by subtracting from 191 // rather than 192. // 2. Convert the result to the unsigned 60.18-decimal fixed-point format. // // This works because 2^(191-ip) = 2^ip / 2^191, where "ip" is the integer part "2^n". result *= SCALE; result >>= (191 - (x >> 64)); } } /// @notice Finds the zero-based index of the first one in the binary representation of x. /// @dev See the note on msb in the "Find First Set" Wikipedia article https://en.wikipedia.org/wiki/Find_first_set /// @param x The uint256 number for which to find the index of the most significant bit. /// @return msb The index of the most significant bit as an uint256. function mostSignificantBit(uint256 x) internal pure returns (uint256 msb) { if (x >= 2**128) { x >>= 128; msb += 128; } if (x >= 2**64) { x >>= 64; msb += 64; } if (x >= 2**32) { x >>= 32; msb += 32; } if (x >= 2**16) { x >>= 16; msb += 16; } if (x >= 2**8) { x >>= 8; msb += 8; } if (x >= 2**4) { x >>= 4; msb += 4; } if (x >= 2**2) { x >>= 2; msb += 2; } if (x >= 2**1) { // No need to shift x any more. msb += 1; } } /// @notice Calculates floor(x*y├╖denominator) with full precision. /// /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv. /// /// Requirements: /// - The denominator cannot be zero. /// - The result must fit within uint256. /// /// Caveats: /// - This function does not work with fixed-point numbers. /// /// @param x The multiplicand as an uint256. /// @param y The multiplier as an uint256. /// @param denominator The divisor as an uint256. /// @return result The result as an uint256. function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { unchecked { result = prod0 / denominator; } return result; } // Make sure the result is less than 2^256. Also prevents denominator == 0. if (prod1 >= denominator) { revert PRBMath__MulDivOverflow(prod1, denominator); } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. unchecked { // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 lpotdod = denominator & (~denominator + 1); assembly { // Divide denominator by lpotdod. denominator := div(denominator, lpotdod) // Divide [prod1 prod0] by lpotdod. prod0 := div(prod0, lpotdod) // Flip lpotdod such that it is 2^256 / lpotdod. If lpotdod is zero, then it becomes one. lpotdod := add(div(sub(0, lpotdod), lpotdod), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * lpotdod; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /// @notice Calculates floor(x*y├╖1e18) with full precision. /// /// @dev Variant of "mulDiv" with constant folding, i.e. in which the denominator is always 1e18. Before returning the /// final result, we add 1 if (x * y) % SCALE >= HALF_SCALE. Without this, 6.6e-19 would be truncated to 0 instead of /// being rounded to 1e-18. See "Listing 6" and text above it at https://accu.org/index.php/journals/1717. /// /// Requirements: /// - The result must fit within uint256. /// /// Caveats: /// - The body is purposely left uncommented; see the NatSpec comments in "PRBMath.mulDiv" to understand how this works. /// - It is assumed that the result can never be type(uint256).max when x and y solve the following two equations: /// 1. x * y = type(uint256).max * SCALE /// 2. (x * y) % SCALE >= SCALE / 2 /// /// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number. /// @param y The multiplier as an unsigned 60.18-decimal fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function mulDivFixedPoint(uint256 x, uint256 y) internal pure returns (uint256 result) { uint256 prod0; uint256 prod1; assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } if (prod1 >= SCALE) { revert PRBMath__MulDivFixedPointOverflow(prod1); } uint256 remainder; uint256 roundUpUnit; assembly { remainder := mulmod(x, y, SCALE) roundUpUnit := gt(remainder, 499999999999999999) } if (prod1 == 0) { unchecked { result = (prod0 / SCALE) + roundUpUnit; return result; } } assembly { result := add( mul( or( div(sub(prod0, remainder), SCALE_LPOTD), mul(sub(prod1, gt(remainder, prod0)), add(div(sub(0, SCALE_LPOTD), SCALE_LPOTD), 1)) ), SCALE_INVERSE ), roundUpUnit ) } } /// @notice Calculates floor(x*y├╖denominator) with full precision. /// /// @dev An extension of "mulDiv" for signed numbers. Works by computing the signs and the absolute values separately. /// /// Requirements: /// - None of the inputs can be type(int256).min. /// - The result must fit within int256. /// /// @param x The multiplicand as an int256. /// @param y The multiplier as an int256. /// @param denominator The divisor as an int256. /// @return result The result as an int256. function mulDivSigned( int256 x, int256 y, int256 denominator ) internal pure returns (int256 result) { if (x == type(int256).min || y == type(int256).min || denominator == type(int256).min) { revert PRBMath__MulDivSignedInputTooSmall(); } // Get hold of the absolute values of x, y and the denominator. uint256 ax; uint256 ay; uint256 ad; unchecked { ax = x < 0 ? uint256(-x) : uint256(x); ay = y < 0 ? uint256(-y) : uint256(y); ad = denominator < 0 ? uint256(-denominator) : uint256(denominator); } // Compute the absolute value of (x*y)├╖denominator. The result must fit within int256. uint256 rAbs = mulDiv(ax, ay, ad); if (rAbs > uint256(type(int256).max)) { revert PRBMath__MulDivSignedOverflow(rAbs); } // Get the signs of x, y and the denominator. uint256 sx; uint256 sy; uint256 sd; assembly { sx := sgt(x, sub(0, 1)) sy := sgt(y, sub(0, 1)) sd := sgt(denominator, sub(0, 1)) } // XOR over sx, sy and sd. This is checking whether there are one or three negative signs in the inputs. // If yes, the result should be negative. result = sx ^ sy ^ sd == 0 ? -int256(rAbs) : int256(rAbs); } /// @notice Calculates the square root of x, rounding down. /// @dev Uses the Babylonian method https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method. /// /// Caveats: /// - This function does not work with fixed-point numbers. /// /// @param x The uint256 number for which to calculate the square root. /// @return result The result as an uint256. function sqrt(uint256 x) internal pure returns (uint256 result) { if (x == 0) { return 0; } // Set the initial guess to the least power of two that is greater than or equal to sqrt(x). uint256 xAux = uint256(x); result = 1; if (xAux >= 0x100000000000000000000000000000000) { xAux >>= 128; result <<= 64; } if (xAux >= 0x10000000000000000) { xAux >>= 64; result <<= 32; } if (xAux >= 0x100000000) { xAux >>= 32; result <<= 16; } if (xAux >= 0x10000) { xAux >>= 16; result <<= 8; } if (xAux >= 0x100) { xAux >>= 8; result <<= 4; } if (xAux >= 0x10) { xAux >>= 4; result <<= 2; } if (xAux >= 0x8) { result <<= 1; } // The operations can never overflow because the result is max 2^127 when it enters this block. unchecked { result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; result = (result + x / result) >> 1; // Seven iterations should be enough uint256 roundedDownResult = x / result; return result >= roundedDownResult ? roundedDownResult : result; } } } // File prb-math/contracts/[email protected] pragma solidity >=0.8.4; /// @title PRBMathUD60x18 /// @author Paul Razvan Berg /// @notice Smart contract library for advanced fixed-point math that works with uint256 numbers considered to have 18 /// trailing decimals. We call this number representation unsigned 60.18-decimal fixed-point, since there can be up to 60 /// digits in the integer part and up to 18 decimals in the fractional part. The numbers are bound by the minimum and the /// maximum values permitted by the Solidity type uint256. library PRBMathUD60x18 { /// @dev Half the SCALE number. uint256 internal constant HALF_SCALE = 5e17; /// @dev log2(e) as an unsigned 60.18-decimal fixed-point number. uint256 internal constant LOG2_E = 1_442695040888963407; /// @dev The maximum value an unsigned 60.18-decimal fixed-point number can have. uint256 internal constant MAX_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_584007913129639935; /// @dev The maximum whole value an unsigned 60.18-decimal fixed-point number can have. uint256 internal constant MAX_WHOLE_UD60x18 = 115792089237316195423570985008687907853269984665640564039457_000000000000000000; /// @dev How many trailing decimals can be represented. uint256 internal constant SCALE = 1e18; /// @notice Calculates the arithmetic average of x and y, rounding down. /// @param x The first operand as an unsigned 60.18-decimal fixed-point number. /// @param y The second operand as an unsigned 60.18-decimal fixed-point number. /// @return result The arithmetic average as an unsigned 60.18-decimal fixed-point number. function avg(uint256 x, uint256 y) internal pure returns (uint256 result) { // The operations can never overflow. unchecked { // The last operand checks if both x and y are odd and if that is the case, we add 1 to the result. We need // to do this because if both numbers are odd, the 0.5 remainder gets truncated twice. result = (x >> 1) + (y >> 1) + (x & y & 1); } } /// @notice Yields the least unsigned 60.18 decimal fixed-point number greater than or equal to x. /// /// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional counterparts. /// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions. /// /// Requirements: /// - x must be less than or equal to MAX_WHOLE_UD60x18. /// /// @param x The unsigned 60.18-decimal fixed-point number to ceil. /// @param result The least integer greater than or equal to x, as an unsigned 60.18-decimal fixed-point number. function ceil(uint256 x) internal pure returns (uint256 result) { if (x > MAX_WHOLE_UD60x18) { revert PRBMathUD60x18__CeilOverflow(x); } assembly { // Equivalent to "x % SCALE" but faster. let remainder := mod(x, SCALE) // Equivalent to "SCALE - remainder" but faster. let delta := sub(SCALE, remainder) // Equivalent to "x + delta * (remainder > 0 ? 1 : 0)" but faster. result := add(x, mul(delta, gt(remainder, 0))) } } /// @notice Divides two unsigned 60.18-decimal fixed-point numbers, returning a new unsigned 60.18-decimal fixed-point number. /// /// @dev Uses mulDiv to enable overflow-safe multiplication and division. /// /// Requirements: /// - The denominator cannot be zero. /// /// @param x The numerator as an unsigned 60.18-decimal fixed-point number. /// @param y The denominator as an unsigned 60.18-decimal fixed-point number. /// @param result The quotient as an unsigned 60.18-decimal fixed-point number. function div(uint256 x, uint256 y) internal pure returns (uint256 result) { result = PRBMath.mulDiv(x, SCALE, y); } /// @notice Returns Euler's number as an unsigned 60.18-decimal fixed-point number. /// @dev See https://en.wikipedia.org/wiki/E_(mathematical_constant). function e() internal pure returns (uint256 result) { result = 2_718281828459045235; } /// @notice Calculates the natural exponent of x. /// /// @dev Based on the insight that e^x = 2^(x * log2(e)). /// /// Requirements: /// - All from "log2". /// - x must be less than 133.084258667509499441. /// /// @param x The exponent as an unsigned 60.18-decimal fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function exp(uint256 x) internal pure returns (uint256 result) { // Without this check, the value passed to "exp2" would be greater than 192. if (x >= 133_084258667509499441) { revert PRBMathUD60x18__ExpInputTooBig(x); } // Do the fixed-point multiplication inline to save gas. unchecked { uint256 doubleScaleProduct = x * LOG2_E; result = exp2((doubleScaleProduct + HALF_SCALE) / SCALE); } } /// @notice Calculates the binary exponent of x using the binary fraction method. /// /// @dev See https://ethereum.stackexchange.com/q/79903/24693. /// /// Requirements: /// - x must be 192 or less. /// - The result must fit within MAX_UD60x18. /// /// @param x The exponent as an unsigned 60.18-decimal fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function exp2(uint256 x) internal pure returns (uint256 result) { // 2^192 doesn't fit within the 192.64-bit format used internally in this function. if (x >= 192e18) { revert PRBMathUD60x18__Exp2InputTooBig(x); } unchecked { // Convert x to the 192.64-bit fixed-point format. uint256 x192x64 = (x << 64) / SCALE; // Pass x to the PRBMath.exp2 function, which uses the 192.64-bit fixed-point number representation. result = PRBMath.exp2(x192x64); } } /// @notice Yields the greatest unsigned 60.18 decimal fixed-point number less than or equal to x. /// @dev Optimized for fractional value inputs, because for every whole value there are (1e18 - 1) fractional counterparts. /// See https://en.wikipedia.org/wiki/Floor_and_ceiling_functions. /// @param x The unsigned 60.18-decimal fixed-point number to floor. /// @param result The greatest integer less than or equal to x, as an unsigned 60.18-decimal fixed-point number. function floor(uint256 x) internal pure returns (uint256 result) { assembly { // Equivalent to "x % SCALE" but faster. let remainder := mod(x, SCALE) // Equivalent to "x - remainder * (remainder > 0 ? 1 : 0)" but faster. result := sub(x, mul(remainder, gt(remainder, 0))) } } /// @notice Yields the excess beyond the floor of x. /// @dev Based on the odd function definition https://en.wikipedia.org/wiki/Fractional_part. /// @param x The unsigned 60.18-decimal fixed-point number to get the fractional part of. /// @param result The fractional part of x as an unsigned 60.18-decimal fixed-point number. function frac(uint256 x) internal pure returns (uint256 result) { assembly { result := mod(x, SCALE) } } /// @notice Converts a number from basic integer form to unsigned 60.18-decimal fixed-point representation. /// /// @dev Requirements: /// - x must be less than or equal to MAX_UD60x18 divided by SCALE. /// /// @param x The basic integer to convert. /// @param result The same number in unsigned 60.18-decimal fixed-point representation. function fromUint(uint256 x) internal pure returns (uint256 result) { unchecked { if (x > MAX_UD60x18 / SCALE) { revert PRBMathUD60x18__FromUintOverflow(x); } result = x * SCALE; } } /// @notice Calculates geometric mean of x and y, i.e. sqrt(x * y), rounding down. /// /// @dev Requirements: /// - x * y must fit within MAX_UD60x18, lest it overflows. /// /// @param x The first operand as an unsigned 60.18-decimal fixed-point number. /// @param y The second operand as an unsigned 60.18-decimal fixed-point number. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function gm(uint256 x, uint256 y) internal pure returns (uint256 result) { if (x == 0) { return 0; } unchecked { // Checking for overflow this way is faster than letting Solidity do it. uint256 xy = x * y; if (xy / x != y) { revert PRBMathUD60x18__GmOverflow(x, y); } // We don't need to multiply by the SCALE here because the x*y product had already picked up a factor of SCALE // during multiplication. See the comments within the "sqrt" function. result = PRBMath.sqrt(xy); } } /// @notice Calculates 1 / x, rounding toward zero. /// /// @dev Requirements: /// - x cannot be zero. /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the inverse. /// @return result The inverse as an unsigned 60.18-decimal fixed-point number. function inv(uint256 x) internal pure returns (uint256 result) { unchecked { // 1e36 is SCALE * SCALE. result = 1e36 / x; } } /// @notice Calculates the natural logarithm of x. /// /// @dev Based on the insight that ln(x) = log2(x) / log2(e). /// /// Requirements: /// - All from "log2". /// /// Caveats: /// - All from "log2". /// - This doesn't return exactly 1 for 2.718281828459045235, for that we would need more fine-grained precision. /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the natural logarithm. /// @return result The natural logarithm as an unsigned 60.18-decimal fixed-point number. function ln(uint256 x) internal pure returns (uint256 result) { // Do the fixed-point multiplication inline to save gas. This is overflow-safe because the maximum value that log2(x) // can return is 196205294292027477728. unchecked { result = (log2(x) * SCALE) / LOG2_E; } } /// @notice Calculates the common logarithm of x. /// /// @dev First checks if x is an exact power of ten and it stops if yes. If it's not, calculates the common /// logarithm based on the insight that log10(x) = log2(x) / log2(10). /// /// Requirements: /// - All from "log2". /// /// Caveats: /// - All from "log2". /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the common logarithm. /// @return result The common logarithm as an unsigned 60.18-decimal fixed-point number. function log10(uint256 x) internal pure returns (uint256 result) { if (x < SCALE) { revert PRBMathUD60x18__LogInputTooSmall(x); } // Note that the "mul" in this block is the assembly multiplication operation, not the "mul" function defined // in this contract. // prettier-ignore assembly { switch x case 1 { result := mul(SCALE, sub(0, 18)) } case 10 { result := mul(SCALE, sub(1, 18)) } case 100 { result := mul(SCALE, sub(2, 18)) } case 1000 { result := mul(SCALE, sub(3, 18)) } case 10000 { result := mul(SCALE, sub(4, 18)) } case 100000 { result := mul(SCALE, sub(5, 18)) } case 1000000 { result := mul(SCALE, sub(6, 18)) } case 10000000 { result := mul(SCALE, sub(7, 18)) } case 100000000 { result := mul(SCALE, sub(8, 18)) } case 1000000000 { result := mul(SCALE, sub(9, 18)) } case 10000000000 { result := mul(SCALE, sub(10, 18)) } case 100000000000 { result := mul(SCALE, sub(11, 18)) } case 1000000000000 { result := mul(SCALE, sub(12, 18)) } case 10000000000000 { result := mul(SCALE, sub(13, 18)) } case 100000000000000 { result := mul(SCALE, sub(14, 18)) } case 1000000000000000 { result := mul(SCALE, sub(15, 18)) } case 10000000000000000 { result := mul(SCALE, sub(16, 18)) } case 100000000000000000 { result := mul(SCALE, sub(17, 18)) } case 1000000000000000000 { result := 0 } case 10000000000000000000 { result := SCALE } case 100000000000000000000 { result := mul(SCALE, 2) } case 1000000000000000000000 { result := mul(SCALE, 3) } case 10000000000000000000000 { result := mul(SCALE, 4) } case 100000000000000000000000 { result := mul(SCALE, 5) } case 1000000000000000000000000 { result := mul(SCALE, 6) } case 10000000000000000000000000 { result := mul(SCALE, 7) } case 100000000000000000000000000 { result := mul(SCALE, 8) } case 1000000000000000000000000000 { result := mul(SCALE, 9) } case 10000000000000000000000000000 { result := mul(SCALE, 10) } case 100000000000000000000000000000 { result := mul(SCALE, 11) } case 1000000000000000000000000000000 { result := mul(SCALE, 12) } case 10000000000000000000000000000000 { result := mul(SCALE, 13) } case 100000000000000000000000000000000 { result := mul(SCALE, 14) } case 1000000000000000000000000000000000 { result := mul(SCALE, 15) } case 10000000000000000000000000000000000 { result := mul(SCALE, 16) } case 100000000000000000000000000000000000 { result := mul(SCALE, 17) } case 1000000000000000000000000000000000000 { result := mul(SCALE, 18) } case 10000000000000000000000000000000000000 { result := mul(SCALE, 19) } case 100000000000000000000000000000000000000 { result := mul(SCALE, 20) } case 1000000000000000000000000000000000000000 { result := mul(SCALE, 21) } case 10000000000000000000000000000000000000000 { result := mul(SCALE, 22) } case 100000000000000000000000000000000000000000 { result := mul(SCALE, 23) } case 1000000000000000000000000000000000000000000 { result := mul(SCALE, 24) } case 10000000000000000000000000000000000000000000 { result := mul(SCALE, 25) } case 100000000000000000000000000000000000000000000 { result := mul(SCALE, 26) } case 1000000000000000000000000000000000000000000000 { result := mul(SCALE, 27) } case 10000000000000000000000000000000000000000000000 { result := mul(SCALE, 28) } case 100000000000000000000000000000000000000000000000 { result := mul(SCALE, 29) } case 1000000000000000000000000000000000000000000000000 { result := mul(SCALE, 30) } case 10000000000000000000000000000000000000000000000000 { result := mul(SCALE, 31) } case 100000000000000000000000000000000000000000000000000 { result := mul(SCALE, 32) } case 1000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 33) } case 10000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 34) } case 100000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 35) } case 1000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 36) } case 10000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 37) } case 100000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 38) } case 1000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 39) } case 10000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 40) } case 100000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 41) } case 1000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 42) } case 10000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 43) } case 100000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 44) } case 1000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 45) } case 10000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 46) } case 100000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 47) } case 1000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 48) } case 10000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 49) } case 100000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 50) } case 1000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 51) } case 10000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 52) } case 100000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 53) } case 1000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 54) } case 10000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 55) } case 100000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 56) } case 1000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 57) } case 10000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 58) } case 100000000000000000000000000000000000000000000000000000000000000000000000000000 { result := mul(SCALE, 59) } default { result := MAX_UD60x18 } } if (result == MAX_UD60x18) { // Do the fixed-point division inline to save gas. The denominator is log2(10). unchecked { result = (log2(x) * SCALE) / 3_321928094887362347; } } } /// @notice Calculates the binary logarithm of x. /// /// @dev Based on the iterative approximation algorithm. /// https://en.wikipedia.org/wiki/Binary_logarithm#Iterative_approximation /// /// Requirements: /// - x must be greater than or equal to SCALE, otherwise the result would be negative. /// /// Caveats: /// - The results are nor perfectly accurate to the last decimal, due to the lossy precision of the iterative approximation. /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the binary logarithm. /// @return result The binary logarithm as an unsigned 60.18-decimal fixed-point number. function log2(uint256 x) internal pure returns (uint256 result) { if (x < SCALE) { revert PRBMathUD60x18__LogInputTooSmall(x); } unchecked { // Calculate the integer part of the logarithm and add it to the result and finally calculate y = x * 2^(-n). uint256 n = PRBMath.mostSignificantBit(x / SCALE); // The integer part of the logarithm as an unsigned 60.18-decimal fixed-point number. The operation can't overflow // because n is maximum 255 and SCALE is 1e18. result = n * SCALE; // This is y = x * 2^(-n). uint256 y = x >> n; // If y = 1, the fractional part is zero. if (y == SCALE) { return result; } // Calculate the fractional part via the iterative approximation. // The "delta >>= 1" part is equivalent to "delta /= 2", but shifting bits is faster. for (uint256 delta = HALF_SCALE; delta > 0; delta >>= 1) { y = (y * y) / SCALE; // Is y^2 > 2 and so in the range [2,4)? if (y >= 2 * SCALE) { // Add the 2^(-m) factor to the logarithm. result += delta; // Corresponds to z/2 on Wikipedia. y >>= 1; } } } } /// @notice Multiplies two unsigned 60.18-decimal fixed-point numbers together, returning a new unsigned 60.18-decimal /// fixed-point number. /// @dev See the documentation for the "PRBMath.mulDivFixedPoint" function. /// @param x The multiplicand as an unsigned 60.18-decimal fixed-point number. /// @param y The multiplier as an unsigned 60.18-decimal fixed-point number. /// @return result The product as an unsigned 60.18-decimal fixed-point number. function mul(uint256 x, uint256 y) internal pure returns (uint256 result) { result = PRBMath.mulDivFixedPoint(x, y); } /// @notice Returns PI as an unsigned 60.18-decimal fixed-point number. function pi() internal pure returns (uint256 result) { result = 3_141592653589793238; } /// @notice Raises x to the power of y. /// /// @dev Based on the insight that x^y = 2^(log2(x) * y). /// /// Requirements: /// - All from "exp2", "log2" and "mul". /// /// Caveats: /// - All from "exp2", "log2" and "mul". /// - Assumes 0^0 is 1. /// /// @param x Number to raise to given power y, as an unsigned 60.18-decimal fixed-point number. /// @param y Exponent to raise x to, as an unsigned 60.18-decimal fixed-point number. /// @return result x raised to power y, as an unsigned 60.18-decimal fixed-point number. function pow(uint256 x, uint256 y) internal pure returns (uint256 result) { if (x == 0) { result = y == 0 ? SCALE : uint256(0); } else { result = exp2(mul(log2(x), y)); } } /// @notice Raises x (unsigned 60.18-decimal fixed-point number) to the power of y (basic unsigned integer) using the /// famous algorithm "exponentiation by squaring". /// /// @dev See https://en.wikipedia.org/wiki/Exponentiation_by_squaring /// /// Requirements: /// - The result must fit within MAX_UD60x18. /// /// Caveats: /// - All from "mul". /// - Assumes 0^0 is 1. /// /// @param x The base as an unsigned 60.18-decimal fixed-point number. /// @param y The exponent as an uint256. /// @return result The result as an unsigned 60.18-decimal fixed-point number. function powu(uint256 x, uint256 y) internal pure returns (uint256 result) { // Calculate the first iteration of the loop in advance. result = y & 1 > 0 ? x : SCALE; // Equivalent to "for(y /= 2; y > 0; y /= 2)" but faster. for (y >>= 1; y > 0; y >>= 1) { x = PRBMath.mulDivFixedPoint(x, x); // Equivalent to "y % 2 == 1" but faster. if (y & 1 > 0) { result = PRBMath.mulDivFixedPoint(result, x); } } } /// @notice Returns 1 as an unsigned 60.18-decimal fixed-point number. function scale() internal pure returns (uint256 result) { result = SCALE; } /// @notice Calculates the square root of x, rounding down. /// @dev Uses the Babylonian method https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method. /// /// Requirements: /// - x must be less than MAX_UD60x18 / SCALE. /// /// @param x The unsigned 60.18-decimal fixed-point number for which to calculate the square root. /// @return result The result as an unsigned 60.18-decimal fixed-point . function sqrt(uint256 x) internal pure returns (uint256 result) { unchecked { if (x > MAX_UD60x18 / SCALE) { revert PRBMathUD60x18__SqrtOverflow(x); } // Multiply x by the SCALE to account for the factor of SCALE that is picked up when multiplying two unsigned // 60.18-decimal fixed-point numbers together (in this case, those two numbers are both the square root). result = PRBMath.sqrt(x * SCALE); } } /// @notice Converts a unsigned 60.18-decimal fixed-point number to basic integer form, rounding down in the process. /// @param x The unsigned 60.18-decimal fixed-point number to convert. /// @return result The same number in basic integer form. function toUint(uint256 x) internal pure returns (uint256 result) { unchecked { result = x / SCALE; } } } // File contracts/Collection.sol pragma solidity ^0.8.17; /// @title Collection contract with minting and returning nft's /// @author GeometricalDominator contract Collection is ERC721URIStorage, Ownable, ReentrancyGuard{ using PRBMathUD60x18 for uint256; using EnumerableSet for EnumerableSet.UintSet; // opennzeplin EnumerableSet implemintation using Strings for uint; // openzeppelin Strings implementation event NftsMinted(address indexed _from, uint256 indexed _amount, uint256 _price); event MetadataUpdate(uint256 _tokenId); uint256 private immutable i_maxSupply; uint256 private s_minMintFee; uint256 private s_tokenIdCounter = 0; uint256 private s_nftInCirculation = 0; uint256 private s_tempPrice; address private s_vaultContract; string private s_baseUri; mapping (uint256 => uint256) private s_tokenIdToPrice; mapping (uint256 => bool) private s_isLast; EnumerableSet.UintSet private s_returnedTokensSet; // opennzeplin EnumerableSet constructor(uint256 _maxSupply, uint256 _MinMintFee, address _vaultContract, string memory _name, string memory _symbol) ERC721(_name, _symbol) { i_maxSupply = _maxSupply; s_minMintFee = _MinMintFee; s_vaultContract = _vaultContract; s_tempPrice = s_minMintFee; } /** * @dev function to mint nft or to transfer returned nft's if they exist's */ function safeMint(address _to, uint256 _amount) external payable nonReentrant() { if((s_tokenIdCounter + _amount - s_returnedTokensSet.length()) > i_maxSupply) { revert("There are no tokens left to be minted"); } if (_amount > 8) { revert("Maximum 8 NFTs per mint"); } else if (_amount <= 0){ revert("Mininimum 1 NFT per mint"); } uint256 actPrice = getActualMintPrice(_amount); if (actPrice > msg.value) { revert("Not enough eth"); } for (uint i = 0; i < _amount; i++) { if (s_returnedTokensSet.length() > 0){ uint256 tokenId = s_returnedTokensSet.at(s_returnedTokensSet.length()-1); super._transfer(address(this), msg.sender, tokenId); s_returnedTokensSet.remove(tokenId); emit MetadataUpdate(tokenId); s_nftInCirculation++; } else { uint256 actTokenPrice = getPriceForNextToken(); s_tokenIdCounter++; uint256 tokenId = s_tokenIdCounter; s_tokenIdToPrice[tokenId] = actTokenPrice; s_nftInCirculation++; _safeMint(_to, tokenId); approve(s_vaultContract, tokenId); } } (bool success, ) = s_vaultContract.call{value: msg.value}(""); if (!success) { revert("Tx failed by vault call"); } emit NftsMinted(msg.sender, _amount, msg.value); } /** * @dev function for returning nft, can be called only by vault */ function returnNft(address _from, uint256 _tokenId) external onlyVault() { super._requireMinted(_tokenId); if(_from != super.ownerOf(_tokenId)){ revert("Not NFT owner"); } s_returnedTokensSet.add(_tokenId); super._transfer(_from, address(this), _tokenId); if (s_tokenIdToPrice[_tokenId] > s_tempPrice) { s_tempPrice = s_tokenIdToPrice[_tokenId]; } s_nftInCirculation--; emit MetadataUpdate(_tokenId); } function setLast(uint256 _tokenId) external onlyVault() { s_isLast[_tokenId] = true; } function totalSupply() external view returns(uint256) { return s_nftInCirculation - balanceOf(address(0x000000000000000000000000000000000000dEaD)); } function burnNft(uint256 _tokenId) external nonReentrant() { emit MetadataUpdate(_tokenId); if (s_tokenIdToPrice[_tokenId] > s_tempPrice) { s_tempPrice = s_tokenIdToPrice[_tokenId]; } ERC721._burn(_tokenId); s_nftInCirculation--; s_tokenIdToPrice[_tokenId] = 0; } function transferToken(address _from, address _to, uint256 _tokenId) external { super._transfer(_from, _to, _tokenId); } function tokenURI(uint256 _tokenId) public view override returns (string memory) { if (_ownerOf(_tokenId) == address(0) || _ownerOf(_tokenId) == address(0x000000000000000000000000000000000000dEaD)) { return string.concat("https://", s_baseUri, "/burned.json"); } else if (_ownerOf(_tokenId) == address(this)) { return string.concat("https://", s_baseUri, "/returned.json"); } else if (s_isLast[_tokenId] == true) { return string.concat("https://", s_baseUri, "/last/", (_tokenId).toString(), ".json"); } else { return string.concat("https://", s_baseUri, "/", (_tokenId).toString(), ".json"); } } function setBaseUri(string memory _URI) external onlyOwner() { s_baseUri = _URI; } function setVaultContract(address _contractAddress) external onlyOwner() { s_vaultContract = _contractAddress; } function exists(uint256 _tokenId) external view returns(bool){ return _ownerOf(_tokenId) != address(0); } function getPriceForNextToken() public view returns(uint256){ uint256 lastPrice; if (s_tokenIdCounter == 0) { lastPrice = s_minMintFee; } else { lastPrice = s_tokenIdToPrice[s_tokenIdCounter]; } if (s_returnedTokensSet.length() > 0) { lastPrice == s_tempPrice; } if (lastPrice < s_minMintFee) { lastPrice = s_tempPrice; } uint256 count = s_tokenIdCounter; count++; uint256 e1 = 1000425986000000000; uint256 e2 = 1002100000000000000; uint256 d = 450e18; uint256 k = e2.pow(count * 1e18 - 1e18) - 1e18; uint256 price = lastPrice + ((e1.pow(count*k)-1e18)*k)/d; return price; } function getActualMintPrice(uint256 _amount) public view returns(uint256) { if (_amount > 8) { revert("Maximum 8 NFTs per mint"); } else if (_amount < 1) { revert("Minimum 1 NFT per mint"); } uint256 m_returns = s_returnedTokensSet.length(); uint256 lastPrice; uint256 totalPrice; uint256 count = s_tokenIdCounter; if (s_tokenIdCounter > 1 ) { lastPrice = s_tokenIdToPrice[s_tokenIdCounter]; } else { lastPrice = s_minMintFee; } if (m_returns > 0) { lastPrice = s_tempPrice; } if (lastPrice < s_minMintFee) { lastPrice = s_tempPrice; } for (uint i = 0; i < _amount; i++) { ++count; uint256 e1 = 1000425986000000000; uint256 e2 = 1002100000000000000; uint256 d = 450e18; uint256 k = e2.pow(count * 1e18 - 1e18) - 1e18; lastPrice = lastPrice + ((e1.pow(count*k)-1e18)*k)/d; if (m_returns > 0) { m_returns - 1; count - 1; } totalPrice = totalPrice + lastPrice; } return totalPrice; } function getRetrurnedTokensAmount() public view returns (uint256 _amount) { return ERC721.balanceOf(address(this)); } function getMaxSupply() public view returns (uint256) { return i_maxSupply; } function getTokenIdToPrice(uint256 _tokenId) public view returns (uint256) { return s_tokenIdToPrice[_tokenId]; } function getTokenIsLast(uint256 _tokenId) public view returns (bool) { return s_isLast[_tokenId]; } function getMinMintFee() public view returns (uint256) { return s_minMintFee; } function getTokenCounter() public view returns (uint256) { return s_tokenIdCounter; } function getNftInCirulation() public view returns (uint256) { return s_nftInCirculation; } function getVaultContract() public view returns (address) { return s_vaultContract; } modifier onlyVault { require(msg.sender == s_vaultContract, "Caller not a Vault"); _; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"_maxSupply","type":"uint256"},{"internalType":"uint256","name":"_MinMintFee","type":"uint256"},{"internalType":"address","name":"_vaultContract","type":"address"},{"internalType":"string","name":"_name","type":"string"},{"internalType":"string","name":"_symbol","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"PRBMathUD60x18__Exp2InputTooBig","type":"error"},{"inputs":[{"internalType":"uint256","name":"x","type":"uint256"}],"name":"PRBMathUD60x18__LogInputTooSmall","type":"error"},{"inputs":[{"internalType":"uint256","name":"prod1","type":"uint256"}],"name":"PRBMath__MulDivFixedPointOverflow","type":"error"},{"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":"uint256","name":"_tokenId","type":"uint256"}],"name":"MetadataUpdate","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"_from","type":"address"},{"indexed":true,"internalType":"uint256","name":"_amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"_price","type":"uint256"}],"name":"NftsMinted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"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":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"burnNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"exists","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"getActualMintPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMaxSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getMinMintFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getNftInCirulation","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getPriceForNextToken","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRetrurnedTokensAmount","outputs":[{"internalType":"uint256","name":"_amount","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getTokenCounter","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getTokenIdToPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"getTokenIsLast","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getVaultContract","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"returnNft","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"safeMint","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"approved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_URI","type":"string"}],"name":"setBaseUri","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"setLast","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_contractAddress","type":"address"}],"name":"setVaultContract","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"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":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_from","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_tokenId","type":"uint256"}],"name":"transferToken","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60a06040526000600a556000600b553480156200001b57600080fd5b506040516200361f3803806200361f8339810160408190526200003e91620001d0565b818160006200004e8382620002fe565b5060016200005d8282620002fe565b5050506200007a62000074620000b560201b60201c565b620000b9565b505060016008556080929092526009819055600d80546001600160a01b0319166001600160a01b0390931692909217909155600c55620003ca565b3390565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200013357600080fd5b81516001600160401b03808211156200015057620001506200010b565b604051601f8301601f19908116603f011681019082821181831017156200017b576200017b6200010b565b816040528381526020925086838588010111156200019857600080fd5b600091505b83821015620001bc57858201830151818301840152908201906200019d565b600093810190920192909252949350505050565b600080600080600060a08688031215620001e957600080fd5b85516020870151604088015191965094506001600160a01b03811681146200021057600080fd5b60608701519093506001600160401b03808211156200022e57600080fd5b6200023c89838a0162000121565b935060808801519150808211156200025357600080fd5b50620002628882890162000121565b9150509295509295909350565b600181811c908216806200028457607f821691505b602082108103620002a557634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002f957600081815260208120601f850160051c81016020861015620002d45750805b601f850160051c820191505b81811015620002f557828155600101620002e0565b5050505b505050565b81516001600160401b038111156200031a576200031a6200010b565b62000332816200032b84546200026f565b84620002ab565b602080601f8311600181146200036a5760008415620003515750858301515b600019600386901b1c1916600185901b178555620002f5565b600085815260208120601f198616915b828110156200039b578886015182559484019460019091019084016200037a565b5085821015620003ba5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051613232620003ed600039600081816103a20152610e5b01526132326000f3fe6080604052600436106102045760003560e01c806370a0823111610118578063a1448194116100a0578063e985e9c51161006f578063e985e9c5146105ee578063f2fde38b1461060e578063f5471fa01461062e578063f5537ede14610643578063f9fde9bd1461066357600080fd5b8063a14481941461057b578063a22cb4651461058e578063b88d4fde146105ae578063c87b56dd146105ce57600080fd5b806395d89b41116100e757806395d89b41146104f357806396f4ada6146105085780639a758180146105285780639d0848db1461053d578063a0bcfc7f1461055b57600080fd5b806370a0823114610473578063715018a6146104935780638da5cb5b146104a857806390e72fb7146104c657600080fd5b8063344ad1c71161019b5780634f558e791161016a5780634f558e79146103c65780635be56326146103fe5780635c57bb891461041e5780636352211e1461043e5780636e02007d1461045e57600080fd5b8063344ad1c71461033e5780633d5efefe1461035357806342842e0e146103735780634c0f38c21461039357600080fd5b80630cf9d3e0116101d75780630cf9d3e0146102ba578063111d0593146102d957806318160ddd1461030957806323b872dd1461031e57600080fd5b806301ffc9a71461020957806306fdde031461023e578063081812fc14610260578063095ea7b314610298575b600080fd5b34801561021557600080fd5b50610229610224366004612a1e565b610683565b60405190151581526020015b60405180910390f35b34801561024a57600080fd5b506102536106d5565b6040516102359190612a8b565b34801561026c57600080fd5b5061028061027b366004612a9e565b610767565b6040516001600160a01b039091168152602001610235565b3480156102a457600080fd5b506102b86102b3366004612ace565b61078e565b005b3480156102c657600080fd5b506009545b604051908152602001610235565b3480156102e557600080fd5b506102296102f4366004612a9e565b60009081526010602052604090205460ff1690565b34801561031557600080fd5b506102cb6108a8565b34801561032a57600080fd5b506102b8610339366004612af8565b6108c7565b34801561034a57600080fd5b506102cb6108f8565b34801561035f57600080fd5b506102b861036e366004612a9e565b610903565b34801561037f57600080fd5b506102b861038e366004612af8565b6109a3565b34801561039f57600080fd5b507f00000000000000000000000000000000000000000000000000000000000000006102cb565b3480156103d257600080fd5b506102296103e1366004612a9e565b6000908152600260205260409020546001600160a01b0316151590565b34801561040a57600080fd5b506102cb610419366004612a9e565b6109be565b34801561042a57600080fd5b506102b8610439366004612a9e565b610bae565b34801561044a57600080fd5b50610280610459366004612a9e565b610c18565b34801561046a57600080fd5b50600a546102cb565b34801561047f57600080fd5b506102cb61048e366004612b34565b610c78565b34801561049f57600080fd5b506102b8610cfe565b3480156104b457600080fd5b506007546001600160a01b0316610280565b3480156104d257600080fd5b506102cb6104e1366004612a9e565b6000908152600f602052604090205490565b3480156104ff57600080fd5b50610253610d12565b34801561051457600080fd5b506102b8610523366004612b34565b610d21565b34801561053457600080fd5b506102cb610d4b565b34801561054957600080fd5b50600d546001600160a01b0316610280565b34801561056757600080fd5b506102b8610576366004612bdb565b610e39565b6102b8610589366004612ace565b610e51565b34801561059a57600080fd5b506102b86105a9366004612c24565b6111ec565b3480156105ba57600080fd5b506102b86105c9366004612c60565b6111f7565b3480156105da57600080fd5b506102536105e9366004612a9e565b61122f565b3480156105fa57600080fd5b50610229610609366004612cdc565b611325565b34801561061a57600080fd5b506102b8610629366004612b34565b611353565b34801561063a57600080fd5b50600b546102cb565b34801561064f57600080fd5b506102b861065e366004612af8565b6108ed565b34801561066f57600080fd5b506102b861067e366004612ace565b6113c9565b60006001600160e01b031982166380ac58cd60e01b14806106b457506001600160e01b03198216635b5e139f60e01b145b806106cf57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546106e490612d0f565b80601f016020809104026020016040519081016040528092919081815260200182805461071090612d0f565b801561075d5780601f106107325761010080835404028352916020019161075d565b820191906000526020600020905b81548152906001019060200180831161074057829003601f168201915b5050505050905090565b600061077282611508565b506000908152600460205260409020546001600160a01b031690565b600061079982610c18565b9050806001600160a01b0316836001600160a01b03160361080b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061082757506108278133611325565b6108995760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610802565b6108a38383611567565b505050565b60006108b561dead610c78565b600b546108c29190612d5f565b905090565b6108d133826115d5565b6108ed5760405162461bcd60e51b815260040161080290612d72565b6108a3838383611634565b60006108c230610c78565b61090b611798565b6040518181527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a1600c546000828152600f60205260409020541115610969576000818152600f6020526040902054600c555b610972816117f1565b600b805490600061098283612dbf565b90915550506000818152600f60205260408120556109a06001600855565b50565b6108a3838383604051806020016040528060008152506111f7565b60006008821115610a0b5760405162461bcd60e51b815260206004820152601760248201527613585e1a5b5d5b480e081391951cc81c195c881b5a5b9d604a1b6044820152606401610802565b6001821015610a555760405162461bcd60e51b8152602060048201526016602482015275135a5b9a5b5d5b480c48139195081c195c881b5a5b9d60521b6044820152606401610802565b6000610a616011611886565b600a5490915060009081906001811115610a8e57600a546000908152600f60205260409020549250610a94565b60095492505b8315610aa057600c5492505b600954831015610ab057600c5492505b60005b86811015610ba357610ac482612dd6565b9150670de23a223f999400670de82ca4016b40006818650127cc3dc800006000670de0b6b3a7640000610b0c81610afb8982612def565b610b059190612d5f565b8590611890565b610b169190612d5f565b90508181670de0b6b3a7640000610b37610b30838b612def565b8890611890565b610b419190612d5f565b610b4b9190612def565b610b559190612e06565b610b5f9089612e28565b97508815610b8057610b7260018a612d5f565b50610b7e600187612d5f565b505b610b8a8888612e28565b9650505050508080610b9b90612dd6565b915050610ab3565b509095945050505050565b600d546001600160a01b03163314610bfd5760405162461bcd60e51b815260206004820152601260248201527110d85b1b195c881b9bdd08184815985d5b1d60721b6044820152606401610802565b6000908152601060205260409020805460ff19166001179055565b6000818152600260205260408120546001600160a01b0316806106cf5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610802565b60006001600160a01b038216610ce25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610802565b506001600160a01b031660009081526003602052604090205490565b610d066118d9565b610d106000611933565b565b6060600180546106e490612d0f565b610d296118d9565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b600080600a54600003610d615750600954610d75565b50600a546000908152600f60205260409020545b6000610d816011611886565b5050600954811015610d925750600c545b600a5480610d9f81612dd6565b9150670de23a223f9994009050670de82ca4016b40006818650127cc3dc800006000670de0b6b3a7640000610dd881610afb8882612def565b610de29190612d5f565b905060008282670de0b6b3a7640000610e05610dfe838b612def565b8990611890565b610e0f9190612d5f565b610e199190612def565b610e239190612e06565b610e2d9088612e28565b98975050505050505050565b610e416118d9565b600e610e4d8282612e89565b5050565b610e59611798565b7f0000000000000000000000000000000000000000000000000000000000000000610e846011611886565b82600a54610e929190612e28565b610e9c9190612d5f565b1115610ef85760405162461bcd60e51b815260206004820152602560248201527f546865726520617265206e6f20746f6b656e73206c65667420746f206265206d6044820152641a5b9d195960da1b6064820152608401610802565b6008811115610f435760405162461bcd60e51b815260206004820152601760248201527613585e1a5b5d5b480e081391951cc81c195c881b5a5b9d604a1b6044820152606401610802565b60008111610f935760405162461bcd60e51b815260206004820152601860248201527f4d696e696e696d756d2031204e465420706572206d696e7400000000000000006044820152606401610802565b6000610f9e826109be565b905034811115610fe15760405162461bcd60e51b815260206004820152600e60248201526d09cdee840cadcdeeaced040cae8d60931b6044820152606401610802565b60005b82811015611105576000610ff86011611886565b1115611088576000611021600161100f6011611886565b6110199190612d5f565b601190611985565b905061102e303383611634565b611039601182611991565b506040518181527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a1600b805490600061107d83612dd6565b9190505550506110f3565b6000611092610d4b565b600a805491925060006110a483612dd6565b9091555050600a546000818152600f60205260408120839055600b8054916110cb83612dd6565b91905055506110da868261199d565b600d546110f0906001600160a01b03168261078e565b50505b806110fd81612dd6565b915050610fe4565b50600d546040516000916001600160a01b03169034908381818185875af1925050503d8060008114611153576040519150601f19603f3d011682016040523d82523d6000602084013e611158565b606091505b50509050806111a95760405162461bcd60e51b815260206004820152601760248201527f5478206661696c6564206279207661756c742063616c6c0000000000000000006044820152606401610802565b604051348152839033907fee6c19dda6d0905f248e9d0333edd087f5c5d40b005fa077e46390c19228107d9060200160405180910390a35050610e4d6001600855565b610e4d3383836119b7565b61120133836115d5565b61121d5760405162461bcd60e51b815260040161080290612d72565b61122984848484611a85565b50505050565b6000818152600260205260409020546060906001600160a01b0316158061126e57506000828152600260205260409020546001600160a01b031661dead145b1561129b57600e6040516020016112859190612fbc565b6040516020818303038152906040529050919050565b600082815260026020526040902054306001600160a01b03909116036112cd57600e6040516020016112859190612ff5565b60008281526010602052604090205460ff16151560010361130457600e6112f383611ab8565b604051602001611285929190613030565b600e61130f83611ab8565b60405160200161128592919061308a565b919050565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61135b6118d9565b6001600160a01b0381166113c05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610802565b6109a081611933565b600d546001600160a01b031633146114185760405162461bcd60e51b815260206004820152601260248201527110d85b1b195c881b9bdd08184815985d5b1d60721b6044820152606401610802565b61142181611508565b61142a81610c18565b6001600160a01b0316826001600160a01b03161461147a5760405162461bcd60e51b815260206004820152600d60248201526c2737ba1027232a1037bbb732b960991b6044820152606401610802565b611485601182611b4b565b50611491823083611634565b600c546000828152600f602052604090205411156114bc576000818152600f6020526040902054600c555b600b80549060006114cc83612dbf565b90915550506040518181527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b6000818152600260205260409020546001600160a01b03166109a05760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610802565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061159c82610c18565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806115e183610c18565b9050806001600160a01b0316846001600160a01b0316148061160857506116088185611325565b8061162c5750836001600160a01b031661162184610767565b6001600160a01b0316145b949350505050565b826001600160a01b031661164782610c18565b6001600160a01b03161461166d5760405162461bcd60e51b8152600401610802906130df565b6001600160a01b0382166116cf5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610802565b826001600160a01b03166116e282610c18565b6001600160a01b0316146117085760405162461bcd60e51b8152600401610802906130df565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6002600854036117ea5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610802565b6002600855565b60006117fc82610c18565b905061180782610c18565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006106cf825490565b6000826000036118b85781156118a75760006118b1565b670de0b6b3a76400005b90506106cf565b6118d26118cd6118c785611b57565b84611c0d565b611c19565b9392505050565b6007546001600160a01b03163314610d105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610802565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006118d28383611c5f565b60006118d28383611c89565b610e4d828260405180602001604052806000815250611d7c565b816001600160a01b0316836001600160a01b031603611a185760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610802565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611a90848484611634565b611a9c84848484611daf565b6112295760405162461bcd60e51b815260040161080290613124565b60606000611ac583611eb0565b600101905060008167ffffffffffffffff811115611ae557611ae5612b4f565b6040519080825280601f01601f191660200182016040528015611b0f576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611b1957509392505050565b60006118d28383611f88565b6000670de0b6b3a7640000821015611b8557604051633621413760e21b815260048101839052602401610802565b6000611b9a670de0b6b3a76400008404611fd7565b670de0b6b3a764000081029250905082811c670de0b6b3a763ffff198101611bc3575050919050565b6706f05b59d3b200005b8015611c0557670de0b6b3a7640000828002049150671bc16d674ec800008210611bfd579283019260019190911c905b60011c611bcd565b505050919050565b60006118d283836120bb565b6000680a688906bd8b0000008210611c4757604051634a4f26f160e01b815260048101839052602401610802565b670de0b6b3a7640000604083901b046118d281612181565b6000826000018281548110611c7657611c76613176565b9060005260206000200154905092915050565b60008181526001830160205260408120548015611d72576000611cad600183612d5f565b8554909150600090611cc190600190612d5f565b9050818114611d26576000866000018281548110611ce157611ce1613176565b9060005260206000200154905080876000018481548110611d0457611d04613176565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611d3757611d3761318c565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106cf565b60009150506106cf565b611d86838361287d565b611d936000848484611daf565b6108a35760405162461bcd60e51b815260040161080290613124565b60006001600160a01b0384163b15611ea557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611df39033908990889088906004016131a2565b6020604051808303816000875af1925050508015611e2e575060408051601f3d908101601f19168201909252611e2b918101906131df565b60015b611e8b573d808015611e5c576040519150601f19603f3d011682016040523d82523d6000602084013e611e61565b606091505b508051600003611e835760405162461bcd60e51b815260040161080290613124565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061162c565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310611eef5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611f1b576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611f3957662386f26fc10000830492506010015b6305f5e1008310611f51576305f5e100830492506008015b6127108310611f6557612710830492506004015b60648310611f77576064830492506002015b600a83106106cf5760010192915050565b6000818152600183016020526040812054611fcf575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106cf565b5060006106cf565b6000600160801b8210611ff757608091821c91611ff49082612e28565b90505b68010000000000000000821061201a57604091821c916120179082612e28565b90505b640100000000821061203957602091821c916120369082612e28565b90505b62010000821061205657601091821c916120539082612e28565b90505b610100821061207257600891821c9161206f9082612e28565b90505b6010821061208d57600491821c9161208a9082612e28565b90505b600482106120a857600291821c916120a59082612e28565b90505b60028210611320576106cf600182612e28565b60008080600019848609848602925082811083820303915050670de0b6b3a764000081106120ff5760405163698d9a0160e11b815260048101829052602401610802565b600080670de0b6b3a764000086880991506706f05b59d3b1ffff821190508260000361213d5780670de0b6b3a76400008504019450505050506106cf565b620400008285030493909111909103600160ee1b02919091177faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac106690201905092915050565b600160bf1b6780000000000000008216156121a55768016a09e667f3bcc9090260401c5b6740000000000000008216156121c4576801306fe0a31b7152df0260401c5b6720000000000000008216156121e3576801172b83c7d517adce0260401c5b6710000000000000008216156122025768010b5586cf9890f62a0260401c5b670800000000000000821615612221576801059b0d31585743ae0260401c5b67040000000000000082161561224057680102c9a3e778060ee70260401c5b67020000000000000082161561225f5768010163da9fb33356d80260401c5b67010000000000000082161561227e57680100b1afa5abcbed610260401c5b668000000000000082161561229c5768010058c86da1c09ea20260401c5b66400000000000008216156122ba576801002c605e2e8cec500260401c5b66200000000000008216156122d857680100162f3904051fa10260401c5b66100000000000008216156122f6576801000b175effdc76ba0260401c5b660800000000000082161561231457680100058ba01fb9f96d0260401c5b66040000000000008216156123325768010002c5cc37da94920260401c5b6602000000000000821615612350576801000162e525ee05470260401c5b660100000000000082161561236e5768010000b17255775c040260401c5b6580000000000082161561238b576801000058b91b5bc9ae0260401c5b654000000000008216156123a857680100002c5c89d5ec6d0260401c5b652000000000008216156123c55768010000162e43f4f8310260401c5b651000000000008216156123e257680100000b1721bcfc9a0260401c5b650800000000008216156123ff5768010000058b90cf1e6e0260401c5b6504000000000082161561241c576801000002c5c863b73f0260401c5b6502000000000082161561243957680100000162e430e5a20260401c5b65010000000000821615612456576801000000b1721835510260401c5b64800000000082161561247257680100000058b90c0b490260401c5b64400000000082161561248e5768010000002c5c8601cc0260401c5b6420000000008216156124aa576801000000162e42fff00260401c5b6410000000008216156124c65768010000000b17217fbb0260401c5b6408000000008216156124e2576801000000058b90bfce0260401c5b6404000000008216156124fe57680100000002c5c85fe30260401c5b64020000000082161561251a5768010000000162e42ff10260401c5b64010000000082161561253657680100000000b17217f80260401c5b63800000008216156125515768010000000058b90bfc0260401c5b634000000082161561256c576801000000002c5c85fe0260401c5b632000000082161561258757680100000000162e42ff0260401c5b63100000008216156125a2576801000000000b17217f0260401c5b63080000008216156125bd57680100000000058b90c00260401c5b63040000008216156125d85768010000000002c5c8600260401c5b63020000008216156125f3576801000000000162e4300260401c5b630100000082161561260e5768010000000000b172180260401c5b62800000821615612628576801000000000058b90c0260401c5b6240000082161561264257680100000000002c5c860260401c5b6220000082161561265c5768010000000000162e430260401c5b6210000082161561267657680100000000000b17210260401c5b620800008216156126905768010000000000058b910260401c5b620400008216156126aa576801000000000002c5c80260401c5b620200008216156126c457680100000000000162e40260401c5b620100008216156126de576801000000000000b1720260401c5b6180008216156126f757680100000000000058b90260401c5b6140008216156127105768010000000000002c5d0260401c5b612000821615612729576801000000000000162e0260401c5b6110008216156127425768010000000000000b170260401c5b61080082161561275b576801000000000000058c0260401c5b61040082161561277457680100000000000002c60260401c5b61020082161561278d57680100000000000001630260401c5b6101008216156127a657680100000000000000b10260401c5b60808216156127be57680100000000000000590260401c5b60408216156127d6576801000000000000002c0260401c5b60208216156127ee57680100000000000000160260401c5b6010821615612806576801000000000000000b0260401c5b600882161561281e57680100000000000000060260401c5b600482161561283657680100000000000000030260401c5b600282161561284e57680100000000000000010260401c5b600182161561286657680100000000000000010260401c5b670de0b6b3a76400000260409190911c60bf031c90565b6001600160a01b0382166128d35760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610802565b6000818152600260205260409020546001600160a01b0316156129385760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610802565b6000818152600260205260409020546001600160a01b03161561299d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610802565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160e01b0319811681146109a057600080fd5b600060208284031215612a3057600080fd5b81356118d281612a08565b60005b83811015612a56578181015183820152602001612a3e565b50506000910152565b60008151808452612a77816020860160208601612a3b565b601f01601f19169290920160200192915050565b6020815260006118d26020830184612a5f565b600060208284031215612ab057600080fd5b5035919050565b80356001600160a01b038116811461132057600080fd5b60008060408385031215612ae157600080fd5b612aea83612ab7565b946020939093013593505050565b600080600060608486031215612b0d57600080fd5b612b1684612ab7565b9250612b2460208501612ab7565b9150604084013590509250925092565b600060208284031215612b4657600080fd5b6118d282612ab7565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612b8057612b80612b4f565b604051601f8501601f19908116603f01168101908282118183101715612ba857612ba8612b4f565b81604052809350858152868686011115612bc157600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612bed57600080fd5b813567ffffffffffffffff811115612c0457600080fd5b8201601f81018413612c1557600080fd5b61162c84823560208401612b65565b60008060408385031215612c3757600080fd5b612c4083612ab7565b915060208301358015158114612c5557600080fd5b809150509250929050565b60008060008060808587031215612c7657600080fd5b612c7f85612ab7565b9350612c8d60208601612ab7565b925060408501359150606085013567ffffffffffffffff811115612cb057600080fd5b8501601f81018713612cc157600080fd5b612cd087823560208401612b65565b91505092959194509250565b60008060408385031215612cef57600080fd5b612cf883612ab7565b9150612d0660208401612ab7565b90509250929050565b600181811c90821680612d2357607f821691505b602082108103612d4357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106cf576106cf612d49565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b600081612dce57612dce612d49565b506000190190565b600060018201612de857612de8612d49565b5060010190565b80820281158282048414176106cf576106cf612d49565b600082612e2357634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156106cf576106cf612d49565b601f8211156108a357600081815260208120601f850160051c81016020861015612e625750805b601f850160051c820191505b81811015612e8157828155600101612e6e565b505050505050565b815167ffffffffffffffff811115612ea357612ea3612b4f565b612eb781612eb18454612d0f565b84612e3b565b602080601f831160018114612eec5760008415612ed45750858301515b600019600386901b1c1916600185901b178555612e81565b600085815260208120601f198616915b82811015612f1b57888601518255948401946001909101908401612efc565b5085821015612f395787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008154612f5681612d0f565b60018281168015612f6e5760018114612f8357612fb2565b60ff1984168752821515830287019450612fb2565b8560005260208060002060005b85811015612fa95781548a820152908401908201612f90565b50505082870194505b5050505092915050565b6768747470733a2f2f60c01b81526000612fd96008830184612f49565b6b17b13ab93732b2173539b7b760a11b8152600c019392505050565b6768747470733a2f2f60c01b815260006130126008830184612f49565b6d17b932ba3ab93732b2173539b7b760911b8152600e019392505050565b6768747470733a2f2f60c01b8152600061304d6008830185612f49565b652f6c6173742f60d01b8152835161306c816006840160208801612a3b565b64173539b7b760d91b60069290910191820152600b01949350505050565b6768747470733a2f2f60c01b815260006130a76008830185612f49565b602f60f81b815283516130c1816001840160208801612a3b565b64173539b7b760d91b60019290910191820152600601949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906131d590830184612a5f565b9695505050505050565b6000602082840312156131f157600080fd5b81516118d281612a0856fea2646970667358221220245f00bbfdf6a55246ce13b0266c37852c6595e758cab6bbf60b76e1921122fb64736f6c634300081100330000000000000000000000000000000000000000000000000000000000000457000000000000000000000000000000000000000000000000001c6bf52634000000000000000000000000000054178d0b564881cd0cf4dee4bccf528207b2b30d00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000017537472616e6765204c6f6f6b696e6720537069646572730000000000000000000000000000000000000000000000000000000000000000000000000000000003534c530000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x6080604052600436106102045760003560e01c806370a0823111610118578063a1448194116100a0578063e985e9c51161006f578063e985e9c5146105ee578063f2fde38b1461060e578063f5471fa01461062e578063f5537ede14610643578063f9fde9bd1461066357600080fd5b8063a14481941461057b578063a22cb4651461058e578063b88d4fde146105ae578063c87b56dd146105ce57600080fd5b806395d89b41116100e757806395d89b41146104f357806396f4ada6146105085780639a758180146105285780639d0848db1461053d578063a0bcfc7f1461055b57600080fd5b806370a0823114610473578063715018a6146104935780638da5cb5b146104a857806390e72fb7146104c657600080fd5b8063344ad1c71161019b5780634f558e791161016a5780634f558e79146103c65780635be56326146103fe5780635c57bb891461041e5780636352211e1461043e5780636e02007d1461045e57600080fd5b8063344ad1c71461033e5780633d5efefe1461035357806342842e0e146103735780634c0f38c21461039357600080fd5b80630cf9d3e0116101d75780630cf9d3e0146102ba578063111d0593146102d957806318160ddd1461030957806323b872dd1461031e57600080fd5b806301ffc9a71461020957806306fdde031461023e578063081812fc14610260578063095ea7b314610298575b600080fd5b34801561021557600080fd5b50610229610224366004612a1e565b610683565b60405190151581526020015b60405180910390f35b34801561024a57600080fd5b506102536106d5565b6040516102359190612a8b565b34801561026c57600080fd5b5061028061027b366004612a9e565b610767565b6040516001600160a01b039091168152602001610235565b3480156102a457600080fd5b506102b86102b3366004612ace565b61078e565b005b3480156102c657600080fd5b506009545b604051908152602001610235565b3480156102e557600080fd5b506102296102f4366004612a9e565b60009081526010602052604090205460ff1690565b34801561031557600080fd5b506102cb6108a8565b34801561032a57600080fd5b506102b8610339366004612af8565b6108c7565b34801561034a57600080fd5b506102cb6108f8565b34801561035f57600080fd5b506102b861036e366004612a9e565b610903565b34801561037f57600080fd5b506102b861038e366004612af8565b6109a3565b34801561039f57600080fd5b507f00000000000000000000000000000000000000000000000000000000000004576102cb565b3480156103d257600080fd5b506102296103e1366004612a9e565b6000908152600260205260409020546001600160a01b0316151590565b34801561040a57600080fd5b506102cb610419366004612a9e565b6109be565b34801561042a57600080fd5b506102b8610439366004612a9e565b610bae565b34801561044a57600080fd5b50610280610459366004612a9e565b610c18565b34801561046a57600080fd5b50600a546102cb565b34801561047f57600080fd5b506102cb61048e366004612b34565b610c78565b34801561049f57600080fd5b506102b8610cfe565b3480156104b457600080fd5b506007546001600160a01b0316610280565b3480156104d257600080fd5b506102cb6104e1366004612a9e565b6000908152600f602052604090205490565b3480156104ff57600080fd5b50610253610d12565b34801561051457600080fd5b506102b8610523366004612b34565b610d21565b34801561053457600080fd5b506102cb610d4b565b34801561054957600080fd5b50600d546001600160a01b0316610280565b34801561056757600080fd5b506102b8610576366004612bdb565b610e39565b6102b8610589366004612ace565b610e51565b34801561059a57600080fd5b506102b86105a9366004612c24565b6111ec565b3480156105ba57600080fd5b506102b86105c9366004612c60565b6111f7565b3480156105da57600080fd5b506102536105e9366004612a9e565b61122f565b3480156105fa57600080fd5b50610229610609366004612cdc565b611325565b34801561061a57600080fd5b506102b8610629366004612b34565b611353565b34801561063a57600080fd5b50600b546102cb565b34801561064f57600080fd5b506102b861065e366004612af8565b6108ed565b34801561066f57600080fd5b506102b861067e366004612ace565b6113c9565b60006001600160e01b031982166380ac58cd60e01b14806106b457506001600160e01b03198216635b5e139f60e01b145b806106cf57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600080546106e490612d0f565b80601f016020809104026020016040519081016040528092919081815260200182805461071090612d0f565b801561075d5780601f106107325761010080835404028352916020019161075d565b820191906000526020600020905b81548152906001019060200180831161074057829003601f168201915b5050505050905090565b600061077282611508565b506000908152600460205260409020546001600160a01b031690565b600061079982610c18565b9050806001600160a01b0316836001600160a01b03160361080b5760405162461bcd60e51b815260206004820152602160248201527f4552433732313a20617070726f76616c20746f2063757272656e74206f776e656044820152603960f91b60648201526084015b60405180910390fd5b336001600160a01b038216148061082757506108278133611325565b6108995760405162461bcd60e51b815260206004820152603d60248201527f4552433732313a20617070726f76652063616c6c6572206973206e6f7420746f60448201527f6b656e206f776e6572206f7220617070726f76656420666f7220616c6c0000006064820152608401610802565b6108a38383611567565b505050565b60006108b561dead610c78565b600b546108c29190612d5f565b905090565b6108d133826115d5565b6108ed5760405162461bcd60e51b815260040161080290612d72565b6108a3838383611634565b60006108c230610c78565b61090b611798565b6040518181527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a1600c546000828152600f60205260409020541115610969576000818152600f6020526040902054600c555b610972816117f1565b600b805490600061098283612dbf565b90915550506000818152600f60205260408120556109a06001600855565b50565b6108a3838383604051806020016040528060008152506111f7565b60006008821115610a0b5760405162461bcd60e51b815260206004820152601760248201527613585e1a5b5d5b480e081391951cc81c195c881b5a5b9d604a1b6044820152606401610802565b6001821015610a555760405162461bcd60e51b8152602060048201526016602482015275135a5b9a5b5d5b480c48139195081c195c881b5a5b9d60521b6044820152606401610802565b6000610a616011611886565b600a5490915060009081906001811115610a8e57600a546000908152600f60205260409020549250610a94565b60095492505b8315610aa057600c5492505b600954831015610ab057600c5492505b60005b86811015610ba357610ac482612dd6565b9150670de23a223f999400670de82ca4016b40006818650127cc3dc800006000670de0b6b3a7640000610b0c81610afb8982612def565b610b059190612d5f565b8590611890565b610b169190612d5f565b90508181670de0b6b3a7640000610b37610b30838b612def565b8890611890565b610b419190612d5f565b610b4b9190612def565b610b559190612e06565b610b5f9089612e28565b97508815610b8057610b7260018a612d5f565b50610b7e600187612d5f565b505b610b8a8888612e28565b9650505050508080610b9b90612dd6565b915050610ab3565b509095945050505050565b600d546001600160a01b03163314610bfd5760405162461bcd60e51b815260206004820152601260248201527110d85b1b195c881b9bdd08184815985d5b1d60721b6044820152606401610802565b6000908152601060205260409020805460ff19166001179055565b6000818152600260205260408120546001600160a01b0316806106cf5760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610802565b60006001600160a01b038216610ce25760405162461bcd60e51b815260206004820152602960248201527f4552433732313a2061646472657373207a65726f206973206e6f7420612076616044820152683634b21037bbb732b960b91b6064820152608401610802565b506001600160a01b031660009081526003602052604090205490565b610d066118d9565b610d106000611933565b565b6060600180546106e490612d0f565b610d296118d9565b600d80546001600160a01b0319166001600160a01b0392909216919091179055565b600080600a54600003610d615750600954610d75565b50600a546000908152600f60205260409020545b6000610d816011611886565b5050600954811015610d925750600c545b600a5480610d9f81612dd6565b9150670de23a223f9994009050670de82ca4016b40006818650127cc3dc800006000670de0b6b3a7640000610dd881610afb8882612def565b610de29190612d5f565b905060008282670de0b6b3a7640000610e05610dfe838b612def565b8990611890565b610e0f9190612d5f565b610e199190612def565b610e239190612e06565b610e2d9088612e28565b98975050505050505050565b610e416118d9565b600e610e4d8282612e89565b5050565b610e59611798565b7f0000000000000000000000000000000000000000000000000000000000000457610e846011611886565b82600a54610e929190612e28565b610e9c9190612d5f565b1115610ef85760405162461bcd60e51b815260206004820152602560248201527f546865726520617265206e6f20746f6b656e73206c65667420746f206265206d6044820152641a5b9d195960da1b6064820152608401610802565b6008811115610f435760405162461bcd60e51b815260206004820152601760248201527613585e1a5b5d5b480e081391951cc81c195c881b5a5b9d604a1b6044820152606401610802565b60008111610f935760405162461bcd60e51b815260206004820152601860248201527f4d696e696e696d756d2031204e465420706572206d696e7400000000000000006044820152606401610802565b6000610f9e826109be565b905034811115610fe15760405162461bcd60e51b815260206004820152600e60248201526d09cdee840cadcdeeaced040cae8d60931b6044820152606401610802565b60005b82811015611105576000610ff86011611886565b1115611088576000611021600161100f6011611886565b6110199190612d5f565b601190611985565b905061102e303383611634565b611039601182611991565b506040518181527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a1600b805490600061107d83612dd6565b9190505550506110f3565b6000611092610d4b565b600a805491925060006110a483612dd6565b9091555050600a546000818152600f60205260408120839055600b8054916110cb83612dd6565b91905055506110da868261199d565b600d546110f0906001600160a01b03168261078e565b50505b806110fd81612dd6565b915050610fe4565b50600d546040516000916001600160a01b03169034908381818185875af1925050503d8060008114611153576040519150601f19603f3d011682016040523d82523d6000602084013e611158565b606091505b50509050806111a95760405162461bcd60e51b815260206004820152601760248201527f5478206661696c6564206279207661756c742063616c6c0000000000000000006044820152606401610802565b604051348152839033907fee6c19dda6d0905f248e9d0333edd087f5c5d40b005fa077e46390c19228107d9060200160405180910390a35050610e4d6001600855565b610e4d3383836119b7565b61120133836115d5565b61121d5760405162461bcd60e51b815260040161080290612d72565b61122984848484611a85565b50505050565b6000818152600260205260409020546060906001600160a01b0316158061126e57506000828152600260205260409020546001600160a01b031661dead145b1561129b57600e6040516020016112859190612fbc565b6040516020818303038152906040529050919050565b600082815260026020526040902054306001600160a01b03909116036112cd57600e6040516020016112859190612ff5565b60008281526010602052604090205460ff16151560010361130457600e6112f383611ab8565b604051602001611285929190613030565b600e61130f83611ab8565b60405160200161128592919061308a565b919050565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b61135b6118d9565b6001600160a01b0381166113c05760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610802565b6109a081611933565b600d546001600160a01b031633146114185760405162461bcd60e51b815260206004820152601260248201527110d85b1b195c881b9bdd08184815985d5b1d60721b6044820152606401610802565b61142181611508565b61142a81610c18565b6001600160a01b0316826001600160a01b03161461147a5760405162461bcd60e51b815260206004820152600d60248201526c2737ba1027232a1037bbb732b960991b6044820152606401610802565b611485601182611b4b565b50611491823083611634565b600c546000828152600f602052604090205411156114bc576000818152600f6020526040902054600c555b600b80549060006114cc83612dbf565b90915550506040518181527ff8e1a15aba9398e019f0b49df1a4fde98ee17ae345cb5f6b5e2c27f5033e8ce79060200160405180910390a15050565b6000818152600260205260409020546001600160a01b03166109a05760405162461bcd60e51b8152602060048201526018602482015277115490cdcc8c4e881a5b9d985b1a59081d1bdad95b88125160421b6044820152606401610802565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061159c82610c18565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000806115e183610c18565b9050806001600160a01b0316846001600160a01b0316148061160857506116088185611325565b8061162c5750836001600160a01b031661162184610767565b6001600160a01b0316145b949350505050565b826001600160a01b031661164782610c18565b6001600160a01b03161461166d5760405162461bcd60e51b8152600401610802906130df565b6001600160a01b0382166116cf5760405162461bcd60e51b8152602060048201526024808201527f4552433732313a207472616e7366657220746f20746865207a65726f206164646044820152637265737360e01b6064820152608401610802565b826001600160a01b03166116e282610c18565b6001600160a01b0316146117085760405162461bcd60e51b8152600401610802906130df565b600081815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0387811680865260038552838620805460001901905590871680865283862080546001019055868652600290945282852080549092168417909155905184937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91a4505050565b6002600854036117ea5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610802565b6002600855565b60006117fc82610c18565b905061180782610c18565b600083815260046020908152604080832080546001600160a01b03199081169091556001600160a01b0385168085526003845282852080546000190190558785526002909352818420805490911690555192935084927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908390a45050565b60006106cf825490565b6000826000036118b85781156118a75760006118b1565b670de0b6b3a76400005b90506106cf565b6118d26118cd6118c785611b57565b84611c0d565b611c19565b9392505050565b6007546001600160a01b03163314610d105760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610802565b600780546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b60006118d28383611c5f565b60006118d28383611c89565b610e4d828260405180602001604052806000815250611d7c565b816001600160a01b0316836001600160a01b031603611a185760405162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c6572000000000000006044820152606401610802565b6001600160a01b03838116600081815260056020908152604080832094871680845294825291829020805460ff191686151590811790915591519182527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a3505050565b611a90848484611634565b611a9c84848484611daf565b6112295760405162461bcd60e51b815260040161080290613124565b60606000611ac583611eb0565b600101905060008167ffffffffffffffff811115611ae557611ae5612b4f565b6040519080825280601f01601f191660200182016040528015611b0f576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a8504945084611b1957509392505050565b60006118d28383611f88565b6000670de0b6b3a7640000821015611b8557604051633621413760e21b815260048101839052602401610802565b6000611b9a670de0b6b3a76400008404611fd7565b670de0b6b3a764000081029250905082811c670de0b6b3a763ffff198101611bc3575050919050565b6706f05b59d3b200005b8015611c0557670de0b6b3a7640000828002049150671bc16d674ec800008210611bfd579283019260019190911c905b60011c611bcd565b505050919050565b60006118d283836120bb565b6000680a688906bd8b0000008210611c4757604051634a4f26f160e01b815260048101839052602401610802565b670de0b6b3a7640000604083901b046118d281612181565b6000826000018281548110611c7657611c76613176565b9060005260206000200154905092915050565b60008181526001830160205260408120548015611d72576000611cad600183612d5f565b8554909150600090611cc190600190612d5f565b9050818114611d26576000866000018281548110611ce157611ce1613176565b9060005260206000200154905080876000018481548110611d0457611d04613176565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080611d3757611d3761318c565b6001900381819060005260206000200160009055905585600101600086815260200190815260200160002060009055600193505050506106cf565b60009150506106cf565b611d86838361287d565b611d936000848484611daf565b6108a35760405162461bcd60e51b815260040161080290613124565b60006001600160a01b0384163b15611ea557604051630a85bd0160e11b81526001600160a01b0385169063150b7a0290611df39033908990889088906004016131a2565b6020604051808303816000875af1925050508015611e2e575060408051601f3d908101601f19168201909252611e2b918101906131df565b60015b611e8b573d808015611e5c576040519150601f19603f3d011682016040523d82523d6000602084013e611e61565b606091505b508051600003611e835760405162461bcd60e51b815260040161080290613124565b805181602001fd5b6001600160e01b031916630a85bd0160e11b14905061162c565b506001949350505050565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b8310611eef5772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef81000000008310611f1b576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc100008310611f3957662386f26fc10000830492506010015b6305f5e1008310611f51576305f5e100830492506008015b6127108310611f6557612710830492506004015b60648310611f77576064830492506002015b600a83106106cf5760010192915050565b6000818152600183016020526040812054611fcf575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556106cf565b5060006106cf565b6000600160801b8210611ff757608091821c91611ff49082612e28565b90505b68010000000000000000821061201a57604091821c916120179082612e28565b90505b640100000000821061203957602091821c916120369082612e28565b90505b62010000821061205657601091821c916120539082612e28565b90505b610100821061207257600891821c9161206f9082612e28565b90505b6010821061208d57600491821c9161208a9082612e28565b90505b600482106120a857600291821c916120a59082612e28565b90505b60028210611320576106cf600182612e28565b60008080600019848609848602925082811083820303915050670de0b6b3a764000081106120ff5760405163698d9a0160e11b815260048101829052602401610802565b600080670de0b6b3a764000086880991506706f05b59d3b1ffff821190508260000361213d5780670de0b6b3a76400008504019450505050506106cf565b620400008285030493909111909103600160ee1b02919091177faccb18165bd6fe31ae1cf318dc5b51eee0e1ba569b88cd74c1773b91fac106690201905092915050565b600160bf1b6780000000000000008216156121a55768016a09e667f3bcc9090260401c5b6740000000000000008216156121c4576801306fe0a31b7152df0260401c5b6720000000000000008216156121e3576801172b83c7d517adce0260401c5b6710000000000000008216156122025768010b5586cf9890f62a0260401c5b670800000000000000821615612221576801059b0d31585743ae0260401c5b67040000000000000082161561224057680102c9a3e778060ee70260401c5b67020000000000000082161561225f5768010163da9fb33356d80260401c5b67010000000000000082161561227e57680100b1afa5abcbed610260401c5b668000000000000082161561229c5768010058c86da1c09ea20260401c5b66400000000000008216156122ba576801002c605e2e8cec500260401c5b66200000000000008216156122d857680100162f3904051fa10260401c5b66100000000000008216156122f6576801000b175effdc76ba0260401c5b660800000000000082161561231457680100058ba01fb9f96d0260401c5b66040000000000008216156123325768010002c5cc37da94920260401c5b6602000000000000821615612350576801000162e525ee05470260401c5b660100000000000082161561236e5768010000b17255775c040260401c5b6580000000000082161561238b576801000058b91b5bc9ae0260401c5b654000000000008216156123a857680100002c5c89d5ec6d0260401c5b652000000000008216156123c55768010000162e43f4f8310260401c5b651000000000008216156123e257680100000b1721bcfc9a0260401c5b650800000000008216156123ff5768010000058b90cf1e6e0260401c5b6504000000000082161561241c576801000002c5c863b73f0260401c5b6502000000000082161561243957680100000162e430e5a20260401c5b65010000000000821615612456576801000000b1721835510260401c5b64800000000082161561247257680100000058b90c0b490260401c5b64400000000082161561248e5768010000002c5c8601cc0260401c5b6420000000008216156124aa576801000000162e42fff00260401c5b6410000000008216156124c65768010000000b17217fbb0260401c5b6408000000008216156124e2576801000000058b90bfce0260401c5b6404000000008216156124fe57680100000002c5c85fe30260401c5b64020000000082161561251a5768010000000162e42ff10260401c5b64010000000082161561253657680100000000b17217f80260401c5b63800000008216156125515768010000000058b90bfc0260401c5b634000000082161561256c576801000000002c5c85fe0260401c5b632000000082161561258757680100000000162e42ff0260401c5b63100000008216156125a2576801000000000b17217f0260401c5b63080000008216156125bd57680100000000058b90c00260401c5b63040000008216156125d85768010000000002c5c8600260401c5b63020000008216156125f3576801000000000162e4300260401c5b630100000082161561260e5768010000000000b172180260401c5b62800000821615612628576801000000000058b90c0260401c5b6240000082161561264257680100000000002c5c860260401c5b6220000082161561265c5768010000000000162e430260401c5b6210000082161561267657680100000000000b17210260401c5b620800008216156126905768010000000000058b910260401c5b620400008216156126aa576801000000000002c5c80260401c5b620200008216156126c457680100000000000162e40260401c5b620100008216156126de576801000000000000b1720260401c5b6180008216156126f757680100000000000058b90260401c5b6140008216156127105768010000000000002c5d0260401c5b612000821615612729576801000000000000162e0260401c5b6110008216156127425768010000000000000b170260401c5b61080082161561275b576801000000000000058c0260401c5b61040082161561277457680100000000000002c60260401c5b61020082161561278d57680100000000000001630260401c5b6101008216156127a657680100000000000000b10260401c5b60808216156127be57680100000000000000590260401c5b60408216156127d6576801000000000000002c0260401c5b60208216156127ee57680100000000000000160260401c5b6010821615612806576801000000000000000b0260401c5b600882161561281e57680100000000000000060260401c5b600482161561283657680100000000000000030260401c5b600282161561284e57680100000000000000010260401c5b600182161561286657680100000000000000010260401c5b670de0b6b3a76400000260409190911c60bf031c90565b6001600160a01b0382166128d35760405162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f20616464726573736044820152606401610802565b6000818152600260205260409020546001600160a01b0316156129385760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610802565b6000818152600260205260409020546001600160a01b03161561299d5760405162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e746564000000006044820152606401610802565b6001600160a01b038216600081815260036020908152604080832080546001019055848352600290915280822080546001600160a01b0319168417905551839291907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b6001600160e01b0319811681146109a057600080fd5b600060208284031215612a3057600080fd5b81356118d281612a08565b60005b83811015612a56578181015183820152602001612a3e565b50506000910152565b60008151808452612a77816020860160208601612a3b565b601f01601f19169290920160200192915050565b6020815260006118d26020830184612a5f565b600060208284031215612ab057600080fd5b5035919050565b80356001600160a01b038116811461132057600080fd5b60008060408385031215612ae157600080fd5b612aea83612ab7565b946020939093013593505050565b600080600060608486031215612b0d57600080fd5b612b1684612ab7565b9250612b2460208501612ab7565b9150604084013590509250925092565b600060208284031215612b4657600080fd5b6118d282612ab7565b634e487b7160e01b600052604160045260246000fd5b600067ffffffffffffffff80841115612b8057612b80612b4f565b604051601f8501601f19908116603f01168101908282118183101715612ba857612ba8612b4f565b81604052809350858152868686011115612bc157600080fd5b858560208301376000602087830101525050509392505050565b600060208284031215612bed57600080fd5b813567ffffffffffffffff811115612c0457600080fd5b8201601f81018413612c1557600080fd5b61162c84823560208401612b65565b60008060408385031215612c3757600080fd5b612c4083612ab7565b915060208301358015158114612c5557600080fd5b809150509250929050565b60008060008060808587031215612c7657600080fd5b612c7f85612ab7565b9350612c8d60208601612ab7565b925060408501359150606085013567ffffffffffffffff811115612cb057600080fd5b8501601f81018713612cc157600080fd5b612cd087823560208401612b65565b91505092959194509250565b60008060408385031215612cef57600080fd5b612cf883612ab7565b9150612d0660208401612ab7565b90509250929050565b600181811c90821680612d2357607f821691505b602082108103612d4357634e487b7160e01b600052602260045260246000fd5b50919050565b634e487b7160e01b600052601160045260246000fd5b818103818111156106cf576106cf612d49565b6020808252602d908201527f4552433732313a2063616c6c6572206973206e6f7420746f6b656e206f776e6560408201526c1c881bdc88185c1c1c9bdd9959609a1b606082015260800190565b600081612dce57612dce612d49565b506000190190565b600060018201612de857612de8612d49565b5060010190565b80820281158282048414176106cf576106cf612d49565b600082612e2357634e487b7160e01b600052601260045260246000fd5b500490565b808201808211156106cf576106cf612d49565b601f8211156108a357600081815260208120601f850160051c81016020861015612e625750805b601f850160051c820191505b81811015612e8157828155600101612e6e565b505050505050565b815167ffffffffffffffff811115612ea357612ea3612b4f565b612eb781612eb18454612d0f565b84612e3b565b602080601f831160018114612eec5760008415612ed45750858301515b600019600386901b1c1916600185901b178555612e81565b600085815260208120601f198616915b82811015612f1b57888601518255948401946001909101908401612efc565b5085821015612f395787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60008154612f5681612d0f565b60018281168015612f6e5760018114612f8357612fb2565b60ff1984168752821515830287019450612fb2565b8560005260208060002060005b85811015612fa95781548a820152908401908201612f90565b50505082870194505b5050505092915050565b6768747470733a2f2f60c01b81526000612fd96008830184612f49565b6b17b13ab93732b2173539b7b760a11b8152600c019392505050565b6768747470733a2f2f60c01b815260006130126008830184612f49565b6d17b932ba3ab93732b2173539b7b760911b8152600e019392505050565b6768747470733a2f2f60c01b8152600061304d6008830185612f49565b652f6c6173742f60d01b8152835161306c816006840160208801612a3b565b64173539b7b760d91b60069290910191820152600b01949350505050565b6768747470733a2f2f60c01b815260006130a76008830185612f49565b602f60f81b815283516130c1816001840160208801612a3b565b64173539b7b760d91b60019290910191820152600601949350505050565b60208082526025908201527f4552433732313a207472616e736665722066726f6d20696e636f72726563742060408201526437bbb732b960d91b606082015260800190565b60208082526032908201527f4552433732313a207472616e7366657220746f206e6f6e20455243373231526560408201527131b2b4bb32b91034b6b83632b6b2b73a32b960711b606082015260800190565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052603160045260246000fd5b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906131d590830184612a5f565b9695505050505050565b6000602082840312156131f157600080fd5b81516118d281612a0856fea2646970667358221220245f00bbfdf6a55246ce13b0266c37852c6595e758cab6bbf60b76e1921122fb64736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000457000000000000000000000000000000000000000000000000001c6bf52634000000000000000000000000000054178d0b564881cd0cf4dee4bccf528207b2b30d00000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000017537472616e6765204c6f6f6b696e6720537069646572730000000000000000000000000000000000000000000000000000000000000000000000000000000003534c530000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _maxSupply (uint256): 1111
Arg [1] : _MinMintFee (uint256): 8000000000000000
Arg [2] : _vaultContract (address): 0x54178d0b564881cd0Cf4DeE4BCCF528207B2b30d
Arg [3] : _name (string): Strange Looking Spiders
Arg [4] : _symbol (string): SLS
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000457
Arg [1] : 000000000000000000000000000000000000000000000000001c6bf526340000
Arg [2] : 00000000000000000000000054178d0b564881cd0cf4dee4bccf528207b2b30d
Arg [3] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000017
Arg [6] : 537472616e6765204c6f6f6b696e672053706964657273000000000000000000
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000003
Arg [8] : 534c530000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.