Overview
TokenID
1651
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 Name:
RFOXNFTWhitelist
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)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "./lib/RFOXNFTPresale.sol"; import "./structs/ParamStructs.sol"; contract RFOXNFTWhitelist is RFOXNFTPresale { /** * @dev Initialization of the RFOX NFT with presale / whitelist mechanism. * Can only be called by the factory. * * Features: * Public sale. * Presale / whitelisted address. * No Bot Prevention. * * @param params Struct for whitelist parameters. */ function initialize(ParamStructs.WhitelistParams calldata params) external { require(msg.sender == address(factory), "Forbidden"); require( params.publicSaleStartTime >= params.saleStartTime, "Invalid public sale time" ); publicSaleStartTime = params.publicSaleStartTime; isWhitelistActivated = true; maxMintedPresalePerAddress = params.maxMintedPresalePerAddress; TOKEN_PRICE_PRESALE = params.pricePresale; initializeBase( params.name, params.symbol, params.baseURI, params.saleToken, params.price, params.maxNft, params.maxTokensPerTransaction, params.saleStartTime, params.saleEndTime, params.owner ); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which allows children to implement an emergency stop * mechanism that can be triggered by an authorized account. * * This module is used through inheritance. It will make available the * modifiers `whenNotPaused` and `whenPaused`, which can be applied to * the functions of your contract. Note that they will not be pausable by * simply including this module, only once the modifiers are put in place. */ abstract contract Pausable is Context { /** * @dev Emitted when the pause is triggered by `account`. */ event Paused(address account); /** * @dev Emitted when the pause is lifted by `account`. */ event Unpaused(address account); bool private _paused; /** * @dev Initializes the contract in unpaused state. */ constructor() { _paused = false; } /** * @dev Modifier to make a function callable only when the contract is not paused. * * Requirements: * * - The contract must not be paused. */ modifier whenNotPaused() { _requireNotPaused(); _; } /** * @dev Modifier to make a function callable only when the contract is paused. * * Requirements: * * - The contract must be paused. */ modifier whenPaused() { _requirePaused(); _; } /** * @dev Returns true if the contract is paused, and false otherwise. */ function paused() public view virtual returns (bool) { return _paused; } /** * @dev Throws if the contract is paused. */ function _requireNotPaused() internal view virtual { require(!paused(), "Pausable: paused"); } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { require(paused(), "Pausable: not paused"); } /** * @dev Triggers stopped state. * * Requirements: * * - The contract must not be paused. */ function _pause() internal virtual whenNotPaused { _paused = true; emit Paused(_msgSender()); } /** * @dev Returns to normal state. * * Requirements: * * - The contract must be paused. */ function _unpause() internal virtual whenPaused { _paused = false; emit Unpaused(_msgSender()); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/draft-IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20 token, address from, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove( IERC20 token, address spender, uint256 value ) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom( address from, address to, uint256 tokenId, bytes calldata data ) external; /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol) pragma solidity ^0.8.0; /** * @title ERC721 token receiver interface * @dev Interface for any contract that wants to support safeTransfers * from ERC721 asset contracts. */ interface IERC721Receiver { /** * @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom} * by `operator` from `from`, this function is called. * * It must return its Solidity selector to confirm the token transfer. * If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted. * * The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`. */ function onERC721Received( address operator, address from, uint256 tokenId, bytes calldata data ) external returns (bytes4); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (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); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all merkle trees admit multiproofs. See {processMultiProof} for details. * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol) pragma solidity ^0.8.0; import "./IERC165.sol"; /** * @dev Implementation of the {IERC165} interface. * * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check * for the additional interface id that will be supported. For example: * * ```solidity * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { * return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId); * } * ``` * * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation. */ abstract contract ERC165 is IERC165 { /** * @dev See {IERC165-supportsInterface}. */ function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) { return interfaceId == type(IERC165).interfaceId; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv( uint256 x, uint256 y, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv( uint256 x, uint256 y, uint256 denominator, Rounding rounding ) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10**64) { value /= 10**64; result += 64; } if (value >= 10**32) { value /= 10**32; result += 32; } if (value >= 10**16) { value /= 10**16; result += 16; } if (value >= 10**8) { value /= 10**8; result += 8; } if (value >= 10**4) { value /= 10**4; result += 4; } if (value >= 10**2) { value /= 10**2; result += 2; } if (value >= 10**1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10**result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result * 8) < value ? 1 : 0); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.8.0) (utils/Strings.sol) pragma solidity ^0.8.0; import "./math/Math.sol"; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/security/Pausable.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "erc721a/contracts/ERC721A.sol"; import "operator-filter-registry/src/DefaultOperatorFilterer.sol"; import "../../../interfaces/IRFOXFactory.sol"; /** * @dev Base Contract of RFOX NFT, which extend ERC721A * @dev All function stated here will become the global function which can be used by any version of RFOX NFT */ contract BaseRFOXNFT is ERC721A, Pausable, Ownable, DefaultOperatorFilterer { using SafeMath for uint256; using SafeERC20 for IERC20; // Override token name string private _name; // Override token symbol string private _symbol; // Override the base token URI string private _baseURIPrefix; // How many NFTs can buy per transaction uint256 public maxTokensPerTransaction; // NFTs Price uint256 public TOKEN_PRICE; // Max total supply of NFTs uint256 public MAX_NFT; // NFTs sale's currency IERC20 public saleToken; // NFT Factory IRFOXFactory public factory; // NFTs can not min exceed MAX_NFT // Timestamp of selling started for whitelisted addresses uint256 public saleStartTime; // Timestamp of selling ended for both public & whitelisted addresses uint256 public saleEndTime; event UpdateTokenPrice( address indexed sender, uint256 oldTokenPrice, uint256 newTokenPrice ); event UpdateURI(address indexed sender, string oldURI, string newURI); event Withdraw( address indexed sender, address saleToken, uint256 totalWithdrawn ); event MaxTokensPerTransaction( address indexed sender, uint256 oldValue, uint256 newValue ); /** * @dev Check if the caller is an EOA, will revert if called by contract. */ modifier callerIsUser() { require(tx.origin == msg.sender, "Caller must be EOA"); _; } /** * @dev Check if the total mint target will exceed the total suply of NFT. * * @param totalMintTarget total token that will be minted. */ modifier tokenInSupply(uint256 totalMintTarget) { require(totalSupply().add(totalMintTarget) <= MAX_NFT, "Exceeded Max NFTs" ); _; } /** * @dev Check if total mint NFT exceed the limit or not. * * @param tokensNumber total token that will be minted. */ modifier maxPurchasePerTx(uint256 tokensNumber) { require( tokensNumber <= maxTokensPerTransaction, "Max purchase per one transaction exceeded" ); _; } /** * @dev Check if the public sale is opened or not. * This modifier will can be overwritten. * In this case, it's overwritten in the presale contract, * since the starting time between public & presale is different. */ modifier authorizePublicSale() virtual { require( block.timestamp >= saleStartTime, "Sale has not been started" ); _; } constructor() ERC721A("", "") { factory = IRFOXFactory(msg.sender); } /** * @dev Initialize function to setup initial value of several settings. * * @param name_ NFT Name. * @param symbol_ NFT Symbol. * @param baseURI_ NFT Base URI. * @param token Token address for the payment, Zero address will be considered as the native token (ETH, BNB, MATIC, etc). * @param price Price per token for the payment. * @param maxNft Max total supply of the NFT * @param maxTokensPerTransaction_ Max total token per purchased. * @param saleStartTime_ In the standard sale, this is the starting time of public sale. In the whitelist / presale, this is the starting time of the private sale. * @param saleEndTime_ The end time of the sale (public and presale). Can be 0 if we don't want to have expiration time. * @param ownership The owner of the NFT. */ function initializeBase( string memory name_, string memory symbol_, string memory baseURI_, IERC20 token, uint256 price, uint256 maxNft, uint256 maxTokensPerTransaction_, /// Max NFT per transaction uint256 saleStartTime_, uint256 saleEndTime_, address ownership ) internal { require(saleStartTime_ > 0, "Invalid start time"); require(maxTokensPerTransaction_ > 0, "Max tokens per tx cannot be 0"); _name = name_; _symbol = symbol_; _baseURIPrefix = baseURI_; saleToken = token; TOKEN_PRICE = price; MAX_NFT = maxNft; maxTokensPerTransaction = maxTokensPerTransaction_; saleStartTime = saleStartTime_; saleEndTime = saleEndTime_; transferOwnership(ownership); } /** * @dev Getter for the NFT name. * * @return NFT name. */ function name() public view override returns (string memory) { return _name; } /** * @dev Getter for the NFT symbol. * * @return NFT symbol */ function symbol() public view override returns (string memory) { return _symbol; } /** * @dev Only owner can migrate base URI * * @param newBaseURIPrefix string prefix of start URI */ function setBaseURI(string memory newBaseURIPrefix) external onlyOwner { string memory _oldUri = _baseURIPrefix; _baseURIPrefix = newBaseURIPrefix; emit UpdateURI(msg.sender, _oldUri, _baseURIPrefix); } function _baseURI() internal view override returns (string memory) { return _baseURIPrefix; } /** * @dev Getter for the base URI. * * @return Base URI of the NFT. */ function baseURI() external view returns (string memory) { return _baseURI(); } /** * @dev Update the value for max purchased token per tx. * * @param newMaxTokensPerTransaction new max token per purchased. */ function setMaxTokensPerTransaction(uint256 newMaxTokensPerTransaction) external onlyOwner { require(newMaxTokensPerTransaction > 0, "INVALID_ZERO_VALUE"); uint256 _oldMaxTokensPerTransaction = maxTokensPerTransaction; maxTokensPerTransaction = newMaxTokensPerTransaction; emit MaxTokensPerTransaction( msg.sender, _oldMaxTokensPerTransaction, maxTokensPerTransaction ); } /** * @dev Owner can safe mint to address. * Limited to only 1 token per minting. * * @param to Receiver address. */ /// @param to Address of receiver function safeMint(address to) external onlyOwner tokenInSupply(1) { _safeMint(to, 1); } /** * @dev Owner can pause the contract in emergency */ function pause() external onlyOwner { _pause(); } /** * @dev Owner can unpause the contract in emergency */ function unpause() external onlyOwner { _unpause(); } /** * @dev getter for the spesific token's URI -- ID of NFTs. * * @param tokenId NFT ID. * * @return Return the token URL link. */ function tokenURI(uint256 tokenId) public view override(ERC721A) returns (string memory) { return super.tokenURI(tokenId); } /** * @dev Owner withdraw revenue from Sales */ function withdraw() external onlyOwner { uint256 balance; if (address(saleToken) == address(0)) { balance = address(this).balance; (bool succeed,) = msg.sender.call{value: balance}( "" ); require(succeed, "Failed to withdraw Ether"); } else { balance = saleToken.balanceOf(address(this)); saleToken.safeTransfer(msg.sender, balance); } emit Withdraw(msg.sender, address(saleToken), balance); } /** * @dev The base function for purchasing. * Check if the token still in supply. * Check the end of sale time. * * @notice Every contract that implement this function responsible to check the starting sale time * and any other conditional check. * * @param tokensNumber total purchased token. */ function _buyNFTs(uint256 tokensNumber) internal tokenInSupply(tokensNumber) { if (saleEndTime > 0) require(block.timestamp <= saleEndTime, "Sale has been finished"); if (address(saleToken) == address(0)) { require( msg.value == TOKEN_PRICE.mul(tokensNumber), "Invalid eth for purchasing" ); } else { require(msg.value == 0, "ETH_NOT_ALLOWED"); saleToken.safeTransferFrom( msg.sender, address(this), TOKEN_PRICE.mul(tokensNumber) ); } _safeMint(msg.sender, tokensNumber); } /** * @dev Update the token price. * * @param newTokenPrice The new token price. */ function setTokenPrice(uint256 newTokenPrice) external onlyOwner { uint256 oldTokenPrice = TOKEN_PRICE; TOKEN_PRICE = newTokenPrice; emit UpdateTokenPrice(msg.sender, oldTokenPrice, TOKEN_PRICE); } function setApprovalForAll(address operator, bool approved) public override onlyAllowedOperatorApproval(operator) { super.setApprovalForAll(operator, approved); } function approve(address operator, uint256 tokenId) public override onlyAllowedOperatorApproval(operator) { super.approve(operator, tokenId); } function transferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) { super.transferFrom(from, to, tokenId); } function safeTransferFrom(address from, address to, uint256 tokenId) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId); } function safeTransferFrom(address from, address to, uint256 tokenId, bytes memory data) public override onlyAllowedOperator(from) { super.safeTransferFrom(from, to, tokenId, data); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/utils/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "./BaseRFOXNFT.sol"; /** * @dev The extension of the BaseRFOX standard. * This is the base contract for the presale / whitelist mechanism. */ contract BaseRFOXNFTPresale is BaseRFOXNFT { using SafeMath for uint256; using SafeERC20 for IERC20; // How many NFTs can be minted per address during presale uint256 public maxMintedPresalePerAddress; // Timestamp of selling started for public uint256 public publicSaleStartTime; // Price for presale minting uint256 public TOKEN_PRICE_PRESALE; // Flag for total NFT minted during presale mapping(address => uint256) totalPresaleMintedPerAddress; // Merkle root for whitelist proof bytes32 public merkleRoot; // The flag for whitelist activation bool public isWhitelistActivated; event MaxMintedPresalePerAddress(address indexed sender, uint256 oldMaxMintedPresalePerAddress, uint256 newMaxMintedPresalePerAddress); event ActivateWhitelist(address indexed sender); event DeactivateWhitelist(address indexed sender); event UpdateMerkleRoot( address indexed sender, bytes32 oldMerkleRoot, bytes32 newMerkleRoot ); event UpdateTokenPricePresale( address indexed sender, uint256 oldTokenPrice, uint256 newTokenPrice ); /** * @dev Check if the whitelist feature is activated. */ modifier whenWhitelistActivated() { require(isWhitelistActivated, "Whitelist is not active"); _; } /** * @dev Check if the whitelist feature is disabled. */ modifier whenWhitelistDeactivated() { require(!isWhitelistActivated, "Whitelist is active"); _; } /** * @dev The rules are: * 1. If whitelist activated: - Only whitelisted address can mint the NFT after the saleEndTime (presale start time). * 2. If whitelist is not activated: - If users is not whitelisted & whitelisted, they can only mint after the publicSaleStartTime and before the saleEndTime. * * @param proof Array of the merkle tree proof, to check if the sender is whitelisted or not. */ modifier authorizePresale(bytes32[] calldata proof) { if (isWhitelistActivated) { require( (checkWhitelisted(msg.sender, proof) && block.timestamp >= saleStartTime), "Unauthorized to join the presale" ); } else { require( block.timestamp >= publicSaleStartTime, "Sale has not been started" ); } _; } /** * @notice Base function to process the presale transaction submitted by the whitelisted address. * Each whitelisted address has quota to mint for the presale. * There is limit amount of token that can be minted during the presale. * * @param tokensNumber How many NFTs for buying this round */ /// @param tokensNumber How many NFTs for buying this round function _buyNFTsPresale(uint256 tokensNumber) internal tokenInSupply(tokensNumber) { require(totalPresaleMintedPerAddress[msg.sender].add(tokensNumber) <= maxMintedPresalePerAddress, "Exceed the limit"); totalPresaleMintedPerAddress[msg.sender] = totalPresaleMintedPerAddress[msg.sender].add(tokensNumber); if (saleEndTime > 0) require(block.timestamp <= saleEndTime, "Sale has been finished"); if (address(saleToken) == address(0)) { require( msg.value == TOKEN_PRICE_PRESALE.mul(tokensNumber), "Invalid eth for purchasing" ); } else { require(msg.value == 0, "ETH_NOT_ALLOWED"); saleToken.safeTransferFrom( msg.sender, address(this), TOKEN_PRICE_PRESALE.mul(tokensNumber) ); } _safeMint(msg.sender, tokensNumber); } /** * @dev setting whitelist purposes * * @param _maxMintedPresalePerAddress how many token can be minted per address during the presale */ function updateMaxMintedPresalePerAddress(uint256 _maxMintedPresalePerAddress) external onlyOwner { require(_maxMintedPresalePerAddress <= MAX_NFT, "Invalid max mint per address"); uint256 oldMaxMintedPresalePerAddress = maxMintedPresalePerAddress; maxMintedPresalePerAddress = _maxMintedPresalePerAddress; emit MaxMintedPresalePerAddress(msg.sender, oldMaxMintedPresalePerAddress, maxMintedPresalePerAddress); } /** * @dev Activate whitelist feature */ function activateWhitelist() external onlyOwner whenWhitelistDeactivated { isWhitelistActivated = true; emit ActivateWhitelist(msg.sender); } /** * @dev Deactivate whitelist feature */ function deactivateWhitelist() external onlyOwner whenWhitelistActivated { isWhitelistActivated = false; emit DeactivateWhitelist(msg.sender); } /** * @dev Update the merkle root for the whitelist tree. * If the whitelist changed, then need to update the hash root. * * @param _merkleRoot new hash of the root. */ function updateMerkleRoot(bytes32 _merkleRoot) external onlyOwner { bytes32 oldMerkleRoot = merkleRoot; merkleRoot = _merkleRoot; emit UpdateMerkleRoot(msg.sender, oldMerkleRoot, merkleRoot); } /** * @dev Getter for the hash of the address. * * @param account The address to be checked. * * @return The hash of the address */ function _leaf(address account) internal pure returns (bytes32) { return keccak256(abi.encodePacked(account)); } /** * @dev Check if the particular address is whitelisted or not. * * @param account The address to be checked. * @param proof The bytes32 array from the offchain whitelist address. * * @return true / false. */ function checkWhitelisted(address account, bytes32[] memory proof) public view returns (bool) { bytes32 leaf = _leaf(account); return MerkleProof.verify(proof, merkleRoot, leaf); } /** * @dev Update the token price. * * @param newTokenPricePresale The new token price during presale. */ function setTokenPricePresale(uint256 newTokenPricePresale) external onlyOwner { uint256 oldTokenPricePresale = TOKEN_PRICE_PRESALE; TOKEN_PRICE_PRESALE = newTokenPricePresale; emit UpdateTokenPricePresale(msg.sender, oldTokenPricePresale, TOKEN_PRICE_PRESALE); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import "./RFOXNFTSale.sol"; import "./base/BaseRFOXNFTPresale.sol"; contract RFOXNFTPresale is RFOXNFTSale, BaseRFOXNFTPresale { /** * @dev Overwrite the authorizePublicSale modifier from the base RFOX NFT contract. * In the standard sale contract, the saleStartTime is the starting time of the public sale. * In the presale contract, the saleStartTime will be considered as the starting time of the presale. * and the publicSaleStartTime will be the starting time of the public sale. */ modifier authorizePublicSale() override { require( block.timestamp >= publicSaleStartTime, "Sale has not been started" ); _; } /** * @dev Each whitelisted address has quota to mint for the presale. * There is limit amount of token that can be minted during the presale. * * @param tokensNumber How many NFTs for buying this round * @param proof The bytes32 array from the offchain whitelist address. */ function buyNFTsPresale(uint256 tokensNumber, bytes32[] calldata proof) external payable whenNotPaused callerIsUser authorizePresale(proof) { _buyNFTsPresale(tokensNumber); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "./base/BaseRFOXNFT.sol"; contract RFOXNFTSale is BaseRFOXNFT { /** * @dev Public sale. * * @param tokensNumber How many NFTs for buying this round */ function buyNFTsPublic(uint256 tokensNumber) public payable whenNotPaused callerIsUser maxPurchasePerTx(tokensNumber) authorizePublicSale { _buyNFTs(tokensNumber); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; library ParamStructs { /** * @dev Parameters for Standard Feature. * * @param name NFT name. * @param symbol NFT symbol. * @param baseURI NFT base uri. * @param saleToken Purchase medium. Zero address will be considered as native token. * @param price Price per token. * @param maxNft Max total supply of NFT. * @param maxTokensPerTransaction Max NFT per transaction. * @param saleStartTime Starting time of the presale (whitelisted address). * @param saleEndTime End time of the public sale. * @param ownership The owner of the token. */ struct StandardParams { string name; string symbol; string baseURI; IERC20 saleToken; uint256 price; uint256 maxNft; uint256 maxTokensPerTransaction; uint256 saleStartTime; uint256 saleEndTime; address owner; } /** * @dev Parameters for Whitelist / Presale Feature. * * @param name NFT name. * @param symbol NFT symbol. * @param baseURI NFT base uri. * @param saleToken Purchase medium. Zero address will be considered as native token. * @param price Price per token. * @param maxNft Max total supply of NFT. * @param maxTokensPerTransaction Max NFT per transaction. * @param saleStartTime Starting time of the presale (whitelisted address). * @param saleEndTime End time of the public sale. * @param publicSaleStartTime Starting time of the public sale * @param maxMintedPresalePerAddress Maximum mint per whitelisted address during presale. * @param pricePresale Price for minting during presale. * @param ownership The owner of the token. */ struct WhitelistParams { string name; string symbol; string baseURI; IERC20 saleToken; uint256 price; uint256 maxNft; uint256 maxTokensPerTransaction; uint256 saleStartTime; uint256 saleEndTime; uint256 publicSaleStartTime; uint256 maxMintedPresalePerAddress; uint256 pricePresale; address owner; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IRFOXFactory { function createNFT() external returns (address pair); }
// SPDX-License-Identifier: MIT // Creator: Chiru Labs pragma solidity ^0.8.4; import '@openzeppelin/contracts/token/ERC721/IERC721.sol'; import '@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol'; import '@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol'; import '@openzeppelin/contracts/utils/Address.sol'; import '@openzeppelin/contracts/utils/Context.sol'; import '@openzeppelin/contracts/utils/Strings.sol'; import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; error ApprovalCallerNotOwnerNorApproved(); error ApprovalQueryForNonexistentToken(); error ApproveToCaller(); error ApprovalToCurrentOwner(); error BalanceQueryForZeroAddress(); error MintedQueryForZeroAddress(); error BurnedQueryForZeroAddress(); error MintToZeroAddress(); error MintZeroQuantity(); error OwnerIndexOutOfBounds(); error OwnerQueryForNonexistentToken(); error TokenIndexOutOfBounds(); error TransferCallerNotOwnerNorApproved(); error TransferFromIncorrectOwner(); error TransferToNonERC721ReceiverImplementer(); error TransferToZeroAddress(); error URIQueryForNonexistentToken(); /** * @dev Implementation of https://eips.ethereum.org/EIPS/eip-721[ERC721] Non-Fungible Token Standard, including * the Metadata and Enumerable extension. Built to optimize for lower gas during batch mints. * * Assumes serials are sequentially minted starting at 0 (e.g. 0, 1, 2, 3..). * * Assumes that an owner cannot have more than 2**64 - 1 (max value of uint64) of supply. * * Assumes that the maximum token id cannot exceed 2**128 - 1 (max value of uint128). */ contract ERC721A is Context, ERC165, IERC721, IERC721Metadata, IERC721Enumerable { using Address for address; using Strings for uint256; // Compiler will pack this into a single 256bit word. struct TokenOwnership { // The address of the owner. address addr; // Keeps track of the start time of ownership with minimal overhead for tokenomics. uint64 startTimestamp; // Whether the token has been burned. bool burned; } // Compiler will pack this into a single 256bit word. struct AddressData { // Realistically, 2**64-1 is more than enough. uint64 balance; // Keeps track of mint count with minimal overhead for tokenomics. uint64 numberMinted; // Keeps track of burn count with minimal overhead for tokenomics. uint64 numberBurned; } // Compiler will pack the following // _currentIndex and _burnCounter into a single 256bit word. // The tokenId of the next token to be minted. uint128 internal _currentIndex; // The number of tokens burned. uint128 internal _burnCounter; // Token name string private _name; // Token symbol string private _symbol; // Mapping from token ID to ownership details // An empty struct value does not necessarily mean the token is unowned. See ownershipOf implementation for details. mapping(uint256 => TokenOwnership) internal _ownerships; // Mapping owner address to address data mapping(address => AddressData) private _addressData; // 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; constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev See {IERC721Enumerable-totalSupply}. */ function totalSupply() public view override returns (uint256) { // Counter underflow is impossible as _burnCounter cannot be incremented // more than _currentIndex times unchecked { return _currentIndex - _burnCounter; } } /** * @dev See {IERC721Enumerable-tokenByIndex}. * This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. */ function tokenByIndex(uint256 index) public view override returns (uint256) { uint256 numMintedSoFar = _currentIndex; uint256 tokenIdsIdx; // Counter overflow is impossible as the loop breaks when // uint256 i is equal to another uint256 numMintedSoFar. unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (!ownership.burned) { if (tokenIdsIdx == index) { return i; } tokenIdsIdx++; } } } revert TokenIndexOutOfBounds(); } /** * @dev See {IERC721Enumerable-tokenOfOwnerByIndex}. * This read function is O(totalSupply). If calling from a separate contract, be sure to test gas first. * It may also degrade with extremely large collection sizes (e.g >> 10000), test for your use case. */ function tokenOfOwnerByIndex(address owner, uint256 index) public view override returns (uint256) { if (index >= balanceOf(owner)) revert OwnerIndexOutOfBounds(); uint256 numMintedSoFar = _currentIndex; uint256 tokenIdsIdx; address currOwnershipAddr; // Counter overflow is impossible as the loop breaks when // uint256 i is equal to another uint256 numMintedSoFar. unchecked { for (uint256 i; i < numMintedSoFar; i++) { TokenOwnership memory ownership = _ownerships[i]; if (ownership.burned) { continue; } if (ownership.addr != address(0)) { currOwnershipAddr = ownership.addr; } if (currOwnershipAddr == owner) { if (tokenIdsIdx == index) { return i; } tokenIdsIdx++; } } } // Execution should never reach this point. revert(); } /** * @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 || interfaceId == type(IERC721Enumerable).interfaceId || super.supportsInterface(interfaceId); } /** * @dev See {IERC721-balanceOf}. */ function balanceOf(address owner) public view override returns (uint256) { if (owner == address(0)) revert BalanceQueryForZeroAddress(); return uint256(_addressData[owner].balance); } function _numberMinted(address owner) internal view returns (uint256) { if (owner == address(0)) revert MintedQueryForZeroAddress(); return uint256(_addressData[owner].numberMinted); } function _numberBurned(address owner) internal view returns (uint256) { if (owner == address(0)) revert BurnedQueryForZeroAddress(); return uint256(_addressData[owner].numberBurned); } /** * Gas spent here starts off proportional to the maximum mint batch size. * It gradually moves to O(1) as tokens get transferred around in the collection over time. */ function ownershipOf(uint256 tokenId) internal view returns (TokenOwnership memory) { uint256 curr = tokenId; unchecked { if (curr < _currentIndex) { TokenOwnership memory ownership = _ownerships[curr]; if (!ownership.burned) { if (ownership.addr != address(0)) { return ownership; } // Invariant: // There will always be an ownership that has an address and is not burned // before an ownership that does not have an address and is not burned. // Hence, curr will not underflow. while (true) { curr--; ownership = _ownerships[curr]; if (ownership.addr != address(0)) { return ownership; } } } } } revert OwnerQueryForNonexistentToken(); } /** * @dev See {IERC721-ownerOf}. */ function ownerOf(uint256 tokenId) public view override returns (address) { return ownershipOf(tokenId).addr; } /** * @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) { if (!_exists(tokenId)) revert URIQueryForNonexistentToken(); string memory baseURI = _baseURI(); return bytes(baseURI).length != 0 ? string(abi.encodePacked(baseURI, tokenId.toString())) : ''; } /** * @dev Base URI for computing {tokenURI}. If set, the resulting URI for each * token will be the concatenation of the `baseURI` and the `tokenId`. Empty * by default, can be overriden in child contracts. */ function _baseURI() internal view virtual returns (string memory) { return ''; } /** * @dev See {IERC721-approve}. */ function approve(address to, uint256 tokenId) public virtual override { address owner = ERC721A.ownerOf(tokenId); if (to == owner) revert ApprovalToCurrentOwner(); if (_msgSender() != owner && !isApprovedForAll(owner, _msgSender())) { revert ApprovalCallerNotOwnerNorApproved(); } _approve(to, tokenId, owner); } /** * @dev See {IERC721-getApproved}. */ function getApproved(uint256 tokenId) public view override returns (address) { if (!_exists(tokenId)) revert ApprovalQueryForNonexistentToken(); return _tokenApprovals[tokenId]; } /** * @dev See {IERC721-setApprovalForAll}. */ function setApprovalForAll(address operator, bool approved) public virtual override { if (operator == _msgSender()) revert ApproveToCaller(); _operatorApprovals[_msgSender()][operator] = approved; emit ApprovalForAll(_msgSender(), operator, approved); } /** * @dev See {IERC721-isApprovedForAll}. */ function isApprovedForAll(address owner, address operator) public view virtual override returns (bool) { return _operatorApprovals[owner][operator]; } /** * @dev See {IERC721-transferFrom}. */ function transferFrom( address from, address to, uint256 tokenId ) public virtual override { _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 { _transfer(from, to, tokenId); if (!_checkOnERC721Received(from, to, tokenId, _data)) { revert TransferToNonERC721ReceiverImplementer(); } } /** * @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`), */ function _exists(uint256 tokenId) internal view returns (bool) { return tokenId < _currentIndex && !_ownerships[tokenId].burned; } function _safeMint(address to, uint256 quantity) internal { _safeMint(to, quantity, ''); } /** * @dev Safely mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called for each safe transfer. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _safeMint( address to, uint256 quantity, bytes memory _data ) internal { _mint(to, quantity, _data, true); } /** * @dev Mints `quantity` tokens and transfers them to `to`. * * Requirements: * * - `to` cannot be the zero address. * - `quantity` must be greater than 0. * * Emits a {Transfer} event. */ function _mint( address to, uint256 quantity, bytes memory _data, bool safe ) internal { uint256 startTokenId = _currentIndex; if (to == address(0)) revert MintToZeroAddress(); if (quantity == 0) revert MintZeroQuantity(); _beforeTokenTransfers(address(0), to, startTokenId, quantity); // Overflows are incredibly unrealistic. // balance or numberMinted overflow if current value of either + quantity > 3.4e38 (2**128) - 1 // updatedIndex overflows if _currentIndex + quantity > 3.4e38 (2**128) - 1 unchecked { _addressData[to].balance += uint64(quantity); _addressData[to].numberMinted += uint64(quantity); _ownerships[startTokenId].addr = to; _ownerships[startTokenId].startTimestamp = uint64(block.timestamp); uint256 updatedIndex = startTokenId; for (uint256 i; i < quantity; i++) { emit Transfer(address(0), to, updatedIndex); if (safe && !_checkOnERC721Received(address(0), to, updatedIndex, _data)) { revert TransferToNonERC721ReceiverImplementer(); } updatedIndex++; } _currentIndex = uint128(updatedIndex); } _afterTokenTransfers(address(0), to, startTokenId, quantity); } /** * @dev Transfers `tokenId` from `from` to `to`. * * 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 ) private { TokenOwnership memory prevOwnership = ownershipOf(tokenId); bool isApprovedOrOwner = (_msgSender() == prevOwnership.addr || isApprovedForAll(prevOwnership.addr, _msgSender()) || getApproved(tokenId) == _msgSender()); if (!isApprovedOrOwner) revert TransferCallerNotOwnerNorApproved(); if (prevOwnership.addr != from) revert TransferFromIncorrectOwner(); if (to == address(0)) revert TransferToZeroAddress(); _beforeTokenTransfers(from, to, tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**128. unchecked { _addressData[from].balance -= 1; _addressData[to].balance += 1; _ownerships[tokenId].addr = to; _ownerships[tokenId].startTimestamp = uint64(block.timestamp); // If the ownership slot of tokenId+1 is not explicitly set, that means the transfer initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId < _currentIndex) { _ownerships[nextTokenId].addr = prevOwnership.addr; _ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(from, to, tokenId); _afterTokenTransfers(from, to, tokenId, 1); } /** * @dev Destroys `tokenId`. * The approval is cleared when the token is burned. * * Requirements: * * - `tokenId` must exist. * * Emits a {Transfer} event. */ function _burn(uint256 tokenId) internal virtual { TokenOwnership memory prevOwnership = ownershipOf(tokenId); _beforeTokenTransfers(prevOwnership.addr, address(0), tokenId, 1); // Clear approvals from the previous owner _approve(address(0), tokenId, prevOwnership.addr); // Underflow of the sender's balance is impossible because we check for // ownership above and the recipient's balance can't realistically overflow. // Counter overflow is incredibly unrealistic as tokenId would have to be 2**128. unchecked { _addressData[prevOwnership.addr].balance -= 1; _addressData[prevOwnership.addr].numberBurned += 1; // Keep track of who burned the token, and the timestamp of burning. _ownerships[tokenId].addr = prevOwnership.addr; _ownerships[tokenId].startTimestamp = uint64(block.timestamp); _ownerships[tokenId].burned = true; // If the ownership slot of tokenId+1 is not explicitly set, that means the burn initiator owns it. // Set the slot of tokenId+1 explicitly in storage to maintain correctness for ownerOf(tokenId+1) calls. uint256 nextTokenId = tokenId + 1; if (_ownerships[nextTokenId].addr == address(0)) { // This will suffice for checking _exists(nextTokenId), // as a burned slot cannot contain the zero address. if (nextTokenId < _currentIndex) { _ownerships[nextTokenId].addr = prevOwnership.addr; _ownerships[nextTokenId].startTimestamp = prevOwnership.startTimestamp; } } } emit Transfer(prevOwnership.addr, address(0), tokenId); _afterTokenTransfers(prevOwnership.addr, address(0), tokenId, 1); // Overflow not possible, as _burnCounter cannot be exceed _currentIndex times. unchecked { _burnCounter++; } } /** * @dev Approve `to` to operate on `tokenId` * * Emits a {Approval} event. */ function _approve( address to, uint256 tokenId, address owner ) private { _tokenApprovals[tokenId] = to; emit Approval(owner, to, tokenId); } /** * @dev Internal function to invoke {IERC721Receiver-onERC721Received} on a target address. * The call is not executed if the target address is not a contract. * * @param from address representing the previous owner of the given token ID * @param to target address that will receive the tokens * @param tokenId uint256 ID of the token to be transferred * @param _data bytes optional data to send along with the call * @return bool whether the call correctly returned the expected magic value */ function _checkOnERC721Received( address from, address to, uint256 tokenId, bytes memory _data ) private returns (bool) { if (to.isContract()) { try IERC721Receiver(to).onERC721Received(_msgSender(), from, tokenId, _data) returns (bytes4 retval) { return retval == IERC721Receiver(to).onERC721Received.selector; } catch (bytes memory reason) { if (reason.length == 0) { revert TransferToNonERC721ReceiverImplementer(); } else { assembly { revert(add(32, reason), mload(reason)) } } } } else { return true; } } /** * @dev Hook that is called before a set of serially-ordered token ids are about to be transferred. This includes minting. * And also called before burning one token. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` will be * transferred to `to`. * - When `from` is zero, `tokenId` will be minted for `to`. * - When `to` is zero, `tokenId` will be burned by `from`. * - `from` and `to` are never both zero. */ function _beforeTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} /** * @dev Hook that is called after a set of serially-ordered token ids have been transferred. This includes * minting. * And also called after one token has been burned. * * startTokenId - the first token id to be transferred * quantity - the amount to be transferred * * Calling conditions: * * - When `from` and `to` are both non-zero, `from`'s `tokenId` has been * transferred to `to`. * - When `from` is zero, `tokenId` has been minted for `to`. * - When `to` is zero, `tokenId` has been burned by `from`. * - `from` and `to` are never both zero. */ function _afterTokenTransfers( address from, address to, uint256 startTokenId, uint256 quantity ) internal virtual {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {OperatorFilterer} from "./OperatorFilterer.sol"; import {CANONICAL_CORI_SUBSCRIPTION} from "./lib/Constants.sol"; /** * @title DefaultOperatorFilterer * @notice Inherits from OperatorFilterer and automatically subscribes to the default OpenSea subscription. * @dev Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract DefaultOperatorFilterer is OperatorFilterer { /// @dev The constructor that is called when the contract is being deployed. constructor() OperatorFilterer(CANONICAL_CORI_SUBSCRIPTION, true) {} }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; interface IOperatorFilterRegistry { /** * @notice Returns true if operator is not filtered for a given token, either by address or codeHash. Also returns * true if supplied registrant address is not registered. */ function isOperatorAllowed(address registrant, address operator) external view returns (bool); /** * @notice Registers an address with the registry. May be called by address itself or by EIP-173 owner. */ function register(address registrant) external; /** * @notice Registers an address with the registry and "subscribes" to another address's filtered operators and codeHashes. */ function registerAndSubscribe(address registrant, address subscription) external; /** * @notice Registers an address with the registry and copies the filtered operators and codeHashes from another * address without subscribing. */ function registerAndCopyEntries(address registrant, address registrantToCopy) external; /** * @notice Unregisters an address with the registry and removes its subscription. May be called by address itself or by EIP-173 owner. * Note that this does not remove any filtered addresses or codeHashes. * Also note that any subscriptions to this registrant will still be active and follow the existing filtered addresses and codehashes. */ function unregister(address addr) external; /** * @notice Update an operator address for a registered address - when filtered is true, the operator is filtered. */ function updateOperator(address registrant, address operator, bool filtered) external; /** * @notice Update multiple operators for a registered address - when filtered is true, the operators will be filtered. Reverts on duplicates. */ function updateOperators(address registrant, address[] calldata operators, bool filtered) external; /** * @notice Update a codeHash for a registered address - when filtered is true, the codeHash is filtered. */ function updateCodeHash(address registrant, bytes32 codehash, bool filtered) external; /** * @notice Update multiple codeHashes for a registered address - when filtered is true, the codeHashes will be filtered. Reverts on duplicates. */ function updateCodeHashes(address registrant, bytes32[] calldata codeHashes, bool filtered) external; /** * @notice Subscribe an address to another registrant's filtered operators and codeHashes. Will remove previous * subscription if present. * Note that accounts with subscriptions may go on to subscribe to other accounts - in this case, * subscriptions will not be forwarded. Instead the former subscription's existing entries will still be * used. */ function subscribe(address registrant, address registrantToSubscribe) external; /** * @notice Unsubscribe an address from its current subscribed registrant, and optionally copy its filtered operators and codeHashes. */ function unsubscribe(address registrant, bool copyExistingEntries) external; /** * @notice Get the subscription address of a given registrant, if any. */ function subscriptionOf(address addr) external returns (address registrant); /** * @notice Get the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscribers(address registrant) external returns (address[] memory); /** * @notice Get the subscriber at a given index in the set of addresses subscribed to a given registrant. * Note that order is not guaranteed as updates are made. */ function subscriberAt(address registrant, uint256 index) external returns (address); /** * @notice Copy filtered operators and codeHashes from a different registrantToCopy to addr. */ function copyEntriesOf(address registrant, address registrantToCopy) external; /** * @notice Returns true if operator is filtered by a given address or its subscription. */ function isOperatorFiltered(address registrant, address operator) external returns (bool); /** * @notice Returns true if the hash of an address's code is filtered by a given address or its subscription. */ function isCodeHashOfFiltered(address registrant, address operatorWithCode) external returns (bool); /** * @notice Returns true if a codeHash is filtered by a given address or its subscription. */ function isCodeHashFiltered(address registrant, bytes32 codeHash) external returns (bool); /** * @notice Returns a list of filtered operators for a given address or its subscription. */ function filteredOperators(address addr) external returns (address[] memory); /** * @notice Returns the set of filtered codeHashes for a given address or its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashes(address addr) external returns (bytes32[] memory); /** * @notice Returns the filtered operator at the given index of the set of filtered operators for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredOperatorAt(address registrant, uint256 index) external returns (address); /** * @notice Returns the filtered codeHash at the given index of the list of filtered codeHashes for a given address or * its subscription. * Note that order is not guaranteed as updates are made. */ function filteredCodeHashAt(address registrant, uint256 index) external returns (bytes32); /** * @notice Returns true if an address has registered */ function isRegistered(address addr) external returns (bool); /** * @dev Convenience method to compute the code hash of an arbitrary contract */ function codeHashOf(address addr) external returns (bytes32); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.17; address constant CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS = 0x000000000000AAeB6D7670E522A718067333cd4E; address constant CANONICAL_CORI_SUBSCRIPTION = 0x3cc6CddA760b79bAfa08dF41ECFA224f810dCeB6;
// SPDX-License-Identifier: MIT pragma solidity ^0.8.13; import {IOperatorFilterRegistry} from "./IOperatorFilterRegistry.sol"; import {CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS} from "./lib/Constants.sol"; /** * @title OperatorFilterer * @notice Abstract contract whose constructor automatically registers and optionally subscribes to or copies another * registrant's entries in the OperatorFilterRegistry. * @dev This smart contract is meant to be inherited by token contracts so they can use the following: * - `onlyAllowedOperator` modifier for `transferFrom` and `safeTransferFrom` methods. * - `onlyAllowedOperatorApproval` modifier for `approve` and `setApprovalForAll` methods. * Please note that if your token contract does not provide an owner with EIP-173, it must provide * administration methods on the contract itself to interact with the registry otherwise the subscription * will be locked to the options set during construction. */ abstract contract OperatorFilterer { /// @dev Emitted when an operator is not allowed. error OperatorNotAllowed(address operator); IOperatorFilterRegistry public constant OPERATOR_FILTER_REGISTRY = IOperatorFilterRegistry(CANONICAL_OPERATOR_FILTER_REGISTRY_ADDRESS); /// @dev The constructor that is called when the contract is being deployed. constructor(address subscriptionOrRegistrantToCopy, bool subscribe) { // If an inheriting token contract is deployed to a network without the registry deployed, the modifier // will not revert, but the contract will need to be registered with the registry once it is deployed in // order for the modifier to filter addresses. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { if (subscribe) { OPERATOR_FILTER_REGISTRY.registerAndSubscribe(address(this), subscriptionOrRegistrantToCopy); } else { if (subscriptionOrRegistrantToCopy != address(0)) { OPERATOR_FILTER_REGISTRY.registerAndCopyEntries(address(this), subscriptionOrRegistrantToCopy); } else { OPERATOR_FILTER_REGISTRY.register(address(this)); } } } } /** * @dev A helper function to check if an operator is allowed. */ modifier onlyAllowedOperator(address from) virtual { // Allow spending tokens from addresses with balance // Note that this still allows listings and marketplaces with escrow to transfer tokens if transferred // from an EOA. if (from != msg.sender) { _checkFilterOperator(msg.sender); } _; } /** * @dev A helper function to check if an operator approval is allowed. */ modifier onlyAllowedOperatorApproval(address operator) virtual { _checkFilterOperator(operator); _; } /** * @dev A helper function to check if an operator is allowed. */ function _checkFilterOperator(address operator) internal view virtual { // Check registry code length to facilitate testing in environments without a deployed registry. if (address(OPERATOR_FILTER_REGISTRY).code.length > 0) { // under normal circumstances, this function will revert rather than return false, but inheriting contracts // may specify their own OperatorFilterRegistry implementations, which may behave differently if (!OPERATOR_FILTER_REGISTRY.isOperatorAllowed(address(this), operator)) { revert OperatorNotAllowed(operator); } } } }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"name":"ApprovalCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"ApprovalQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"ApprovalToCurrentOwner","type":"error"},{"inputs":[],"name":"ApproveToCaller","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"MintToZeroAddress","type":"error"},{"inputs":[],"name":"MintZeroQuantity","type":"error"},{"inputs":[{"internalType":"address","name":"operator","type":"address"}],"name":"OperatorNotAllowed","type":"error"},{"inputs":[],"name":"OwnerIndexOutOfBounds","type":"error"},{"inputs":[],"name":"OwnerQueryForNonexistentToken","type":"error"},{"inputs":[],"name":"TokenIndexOutOfBounds","type":"error"},{"inputs":[],"name":"TransferCallerNotOwnerNorApproved","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"inputs":[],"name":"URIQueryForNonexistentToken","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"ActivateWhitelist","type":"event"},{"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":true,"internalType":"address","name":"sender","type":"address"}],"name":"DeactivateWhitelist","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldMaxMintedPresalePerAddress","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newMaxMintedPresalePerAddress","type":"uint256"}],"name":"MaxMintedPresalePerAddress","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newValue","type":"uint256"}],"name":"MaxTokensPerTransaction","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":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","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"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"bytes32","name":"oldMerkleRoot","type":"bytes32"},{"indexed":false,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"UpdateMerkleRoot","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldTokenPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTokenPrice","type":"uint256"}],"name":"UpdateTokenPrice","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"oldTokenPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newTokenPrice","type":"uint256"}],"name":"UpdateTokenPricePresale","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"string","name":"oldURI","type":"string"},{"indexed":false,"internalType":"string","name":"newURI","type":"string"}],"name":"UpdateURI","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"saleToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"totalWithdrawn","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"MAX_NFT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"OPERATOR_FILTER_REGISTRY","outputs":[{"internalType":"contract IOperatorFilterRegistry","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_PRICE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN_PRICE_PRESALE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"activateWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokensNumber","type":"uint256"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"buyNFTsPresale","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokensNumber","type":"uint256"}],"name":"buyNFTsPublic","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"checkWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deactivateWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"factory","outputs":[{"internalType":"contract IRFOXFactory","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"string","name":"name","type":"string"},{"internalType":"string","name":"symbol","type":"string"},{"internalType":"string","name":"baseURI","type":"string"},{"internalType":"contract IERC20","name":"saleToken","type":"address"},{"internalType":"uint256","name":"price","type":"uint256"},{"internalType":"uint256","name":"maxNft","type":"uint256"},{"internalType":"uint256","name":"maxTokensPerTransaction","type":"uint256"},{"internalType":"uint256","name":"saleStartTime","type":"uint256"},{"internalType":"uint256","name":"saleEndTime","type":"uint256"},{"internalType":"uint256","name":"publicSaleStartTime","type":"uint256"},{"internalType":"uint256","name":"maxMintedPresalePerAddress","type":"uint256"},{"internalType":"uint256","name":"pricePresale","type":"uint256"},{"internalType":"address","name":"owner","type":"address"}],"internalType":"struct ParamStructs.WhitelistParams","name":"params","type":"tuple"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","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":"isWhitelistActivated","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxMintedPresalePerAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxTokensPerTransaction","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"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":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"safeMint","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":"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":[],"name":"saleEndTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"saleStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"saleToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","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":"newBaseURIPrefix","type":"string"}],"name":"setBaseURI","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newMaxTokensPerTransaction","type":"uint256"}],"name":"setMaxTokensPerTransaction","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newTokenPrice","type":"uint256"}],"name":"setTokenPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newTokenPricePresale","type":"uint256"}],"name":"setTokenPricePresale","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":"index","type":"uint256"}],"name":"tokenByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"uint256","name":"index","type":"uint256"}],"name":"tokenOfOwnerByIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"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":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_maxMintedPresalePerAddress","type":"uint256"}],"name":"updateMaxMintedPresalePerAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"updateMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50733cc6cdda760b79bafa08df41ecfa224f810dceb66001604051806020016040528060008152506040518060200160405280600081525081600190816200005a9190620002df565b506002620000698282620002df565b50506007805460ff19169055506200008133620001e0565b6daaeb6d7670e522a718067333cd4e3b15620001c65780156200011457604051633e9f1edf60e11b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e90637d3e3dbe906044015b600060405180830381600087803b158015620000f557600080fd5b505af11580156200010a573d6000803e3d6000fd5b50505050620001c6565b6001600160a01b03821615620001655760405163a0af290360e01b81523060048201526001600160a01b03831660248201526daaeb6d7670e522a718067333cd4e9063a0af290390604401620000da565b604051632210724360e11b81523060048201526daaeb6d7670e522a718067333cd4e90634420e48690602401600060405180830381600087803b158015620001ac57600080fd5b505af1158015620001c1573d6000803e3d6000fd5b505050505b5050600f80546001600160a01b03191633179055620003ab565b600780546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200026557607f821691505b6020821081036200028657634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002da57600081815260208120601f850160051c81016020861015620002b55750805b601f850160051c820191505b81811015620002d657828155600101620002c1565b5050505b505050565b81516001600160401b03811115620002fb57620002fb6200023a565b62000313816200030c845462000250565b846200028c565b602080601f8311600181146200034b5760008415620003325750858301515b600019600386901b1c1916600185901b178555620002d6565b600085815260208120601f198616915b828110156200037c578886015182559484019460019091019084016200035b565b50858210156200039b5787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61346680620003bb6000396000f3fe6080604052600436106102c95760003560e01c80636352211e116101755780639a70f6f2116100dc578063d2d8cb6711610095578063ed338ff11161006f578063ed338ff11461082a578063f2fde38b14610840578063f85aff9414610860578063f8e6b54d1461087657600080fd5b8063d2d8cb67146107ab578063e985e367146107c1578063e985e9c5146107e157600080fd5b80639a70f6f2146106ff578063a22cb46514610715578063a69890f014610735578063b88d4fde1461074b578063c45a01551461076b578063c87b56dd1461078b57600080fd5b8063715018a61161012e578063715018a614610675578063845067861461068a5780638456cb591461069d57806389e877a3146106b25780638da5cb5b146106c757806395d89b41146106ea57600080fd5b80636352211e146105d45780636a61e5fc146105f45780636bb7b1d9146106145780636c0360eb1461062a5780636fdaddf11461063f57806370a082311461065557600080fd5b80632f745c591161023457806341f43434116101ed5780634f6ccce7116101c75780634f6ccce71461056257806355f804b31461058257806355fcd367146105a25780635c975abb146105bc57600080fd5b806341f434341461050057806342842e0e146105225780634783f0ef1461054257600080fd5b80632f745c5914610461578063311df29a146104815780633597d7f3146104a15780633ccfd60b146104b65780633f4ba83a146104cb57806340d097c3146104e057600080fd5b80631471c8cb116102865780631471c8cb146103b257806318160ddd146103d25780631cbaee2d146103f557806321c3cdd31461040b57806323b872dd1461042b5780632eb4a7ab1461044b57600080fd5b806301ffc9a7146102ce57806306fdde0314610303578063081812fc14610325578063095ea7b31461035d5780630ed013fb1461037f5780631449d3e614610392575b600080fd5b3480156102da57600080fd5b506102ee6102e9366004612c08565b610896565b60405190151581526020015b60405180910390f35b34801561030f57600080fd5b50610318610903565b6040516102fa9190612c75565b34801561033157600080fd5b50610345610340366004612c88565b610995565b6040516001600160a01b0390911681526020016102fa565b34801561036957600080fd5b5061037d610378366004612cb6565b6109d9565b005b61037d61038d366004612ce2565b6109f2565b34801561039e57600080fd5b5061037d6103ad366004612c88565b610b4c565b3480156103be57600080fd5b5061037d6103cd366004612c88565b610be1565b3480156103de57600080fd5b506103e7610c7b565b6040519081526020016102fa565b34801561040157600080fd5b506103e760105481565b34801561041757600080fd5b5061037d610426366004612d60565b610c9a565b34801561043757600080fd5b5061037d610446366004612d9b565b610e6b565b34801561045757600080fd5b506103e760165481565b34801561046d57600080fd5b506103e761047c366004612cb6565b610e96565b34801561048d57600080fd5b5061037d61049c366004612c88565b610f8a565b3480156104ad57600080fd5b5061037d610fd2565b3480156104c257600080fd5b5061037d611063565b3480156104d757600080fd5b5061037d6111f0565b3480156104ec57600080fd5b5061037d6104fb366004612ddc565b611202565b34801561050c57600080fd5b506103456daaeb6d7670e522a718067333cd4e81565b34801561052e57600080fd5b5061037d61053d366004612d9b565b61124e565b34801561054e57600080fd5b5061037d61055d366004612c88565b611273565b34801561056e57600080fd5b506103e761057d366004612c88565b6112bb565b34801561058e57600080fd5b5061037d61059d366004612e96565b611364565b3480156105ae57600080fd5b506017546102ee9060ff1681565b3480156105c857600080fd5b5060075460ff166102ee565b3480156105e057600080fd5b506103456105ef366004612c88565b611447565b34801561060057600080fd5b5061037d61060f366004612c88565b611459565b34801561062057600080fd5b506103e760135481565b34801561063657600080fd5b506103186114a1565b34801561064b57600080fd5b506103e7600d5481565b34801561066157600080fd5b506103e7610670366004612ddc565b6114b0565b34801561068157600080fd5b5061037d6114fe565b61037d610698366004612c88565b611510565b3480156106a957600080fd5b5061037d611618565b3480156106be57600080fd5b5061037d611628565b3480156106d357600080fd5b5060075461010090046001600160a01b0316610345565b3480156106f657600080fd5b506103186116b3565b34801561070b57600080fd5b506103e760145481565b34801561072157600080fd5b5061037d610730366004612eec565b6116c2565b34801561074157600080fd5b506103e760125481565b34801561075757600080fd5b5061037d610766366004612f25565b6116d6565b34801561077757600080fd5b50600f54610345906001600160a01b031681565b34801561079757600080fd5b506103186107a6366004612c88565b6116fc565b3480156107b757600080fd5b506103e7600c5481565b3480156107cd57600080fd5b50600e54610345906001600160a01b031681565b3480156107ed57600080fd5b506102ee6107fc366004612fa4565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561083657600080fd5b506103e760115481565b34801561084c57600080fd5b5061037d61085b366004612ddc565b611707565b34801561086c57600080fd5b506103e7600b5481565b34801561088257600080fd5b506102ee610891366004612fd2565b61177d565b60006001600160e01b031982166380ac58cd60e01b14806108c757506001600160e01b03198216635b5e139f60e01b145b806108e257506001600160e01b0319821663780e9d6360e01b145b806108fd57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600880546109129061308c565b80601f016020809104026020016040519081016040528092919081815260200182805461093e9061308c565b801561098b5780601f106109605761010080835404028352916020019161098b565b820191906000526020600020905b81548152906001019060200180831161096e57829003601f168201915b5050505050905090565b60006109a0826117da565b6109bd576040516333d1c03960e21b815260040160405180910390fd5b506000908152600560205260409020546001600160a01b031690565b816109e38161180e565b6109ed83836118c7565b505050565b6109fa61194f565b323314610a435760405162461bcd60e51b815260206004820152601260248201527143616c6c6572206d75737420626520454f4160701b60448201526064015b60405180910390fd5b6017548290829060ff1615610aee57610a8f3383838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061177d92505050565b8015610a9d57506010544210155b610ae95760405162461bcd60e51b815260206004820181905260248201527f556e617574686f72697a656420746f206a6f696e207468652070726573616c656044820152606401610a3a565b610b3c565b601354421015610b3c5760405162461bcd60e51b815260206004820152601960248201527814d85b19481a185cc81b9bdd081899595b881cdd185c9d1959603a1b6044820152606401610a3a565b610b4585611995565b5050505050565b610b54611b86565b60008111610b995760405162461bcd60e51b8152602060048201526012602482015271494e56414c49445f5a45524f5f56414c554560701b6044820152606401610a3a565b600b805490829055604080518281526020810184905233917fb39bf8311c05c3cf0e747394ce1a50d0a55862cd7f3b087bf2c3bcb7f7fec46191015b60405180910390a25050565b610be9611b86565b600d54811115610c3b5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206d6178206d696e74207065722061646472657373000000006044820152606401610a3a565b6012805490829055604080518281526020810184905233917f6624911a35f6ecff7839762364df0b18738cf8d54e6e5401e8a8057dca9a877f9101610bd5565b6000546001600160801b03600160801b82048116918116919091031690565b600f546001600160a01b03163314610ce05760405162461bcd60e51b81526020600482015260096024820152682337b93134b23232b760b91b6044820152606401610a3a565b8060e001358161012001351015610d395760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207075626c69632073616c652074696d6500000000000000006044820152606401610a3a565b6101208101356013556017805460ff19166001179055610140810135601255610160810135601455610e68610d6e82806130c6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610db09250505060208401846130c6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610df29250505060408501856130c6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e37925050506080860160608701612ddc565b608086013560a087013560c088013560e08901356101008a0135610e636101a08c016101808d01612ddc565b611be6565b50565b826001600160a01b0381163314610e8557610e853361180e565b610e90848484611ceb565b50505050565b6000610ea1836114b0565b8210610ec0576040516306ed618760e11b815260040160405180910390fd5b600080546001600160801b03169080805b838110156102c957600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161580159282019290925290610f385750610f82565b80516001600160a01b031615610f4d57805192505b876001600160a01b0316836001600160a01b031603610f8057868403610f79575093506108fd92505050565b6001909301925b505b600101610ed1565b610f92611b86565b6014805490829055604080518281526020810184905233917fa9e0d811fda9bb12a8a33a230a373534ad7176732c43020ff83c3b8425ba9e859101610bd5565b610fda611b86565b60175460ff1661102c5760405162461bcd60e51b815260206004820152601760248201527f57686974656c697374206973206e6f74206163746976650000000000000000006044820152606401610a3a565b6017805460ff1916905560405133907f66c181ea7309d1a2533ad3614dab6d488bde2babb04711eeda39ed70b6e4d8ff90600090a2565b61106b611b86565b600e546000906001600160a01b031661111f57506040514790600090339083908381818185875af1925050503d80600081146110c3576040519150601f19603f3d011682016040523d82523d6000602084013e6110c8565b606091505b50509050806111195760405162461bcd60e51b815260206004820152601860248201527f4661696c656420746f20776974686472617720457468657200000000000000006044820152606401610a3a565b506111a5565b600e546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118b9190613113565b600e549091506111a5906001600160a01b03163383611cf6565b600e54604080516001600160a01b0390921682526020820183905233917f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb910160405180910390a250565b6111f8611b86565b611200611d59565b565b61120a611b86565b6001600d546112218261121b610c7b565b90611dab565b111561123f5760405162461bcd60e51b8152600401610a3a9061312c565b61124a826001611dbe565b5050565b826001600160a01b0381163314611268576112683361180e565b610e90848484611dd8565b61127b611b86565b6016805490829055604080518281526020810184905233917f8b67e84be49a1952e3818ead1025bf3a2299ec901780204d0dec64678b2352879101610bd5565b600080546001600160801b031681805b8281101561134a57600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161515918101829052906113415785830361133a5750949350505050565b6001909201915b506001016112cb565b506040516329c8c00760e21b815260040160405180910390fd5b61136c611b86565b6000600a805461137b9061308c565b80601f01602080910402602001604051908101604052809291908181526020018280546113a79061308c565b80156113f45780601f106113c9576101008083540402835291602001916113f4565b820191906000526020600020905b8154815290600101906020018083116113d757829003601f168201915b5050505050905081600a908161140a91906131a5565b50336001600160a01b03167f1583e02b0b2a79149e9152563c00c240bf33e5291f9c5337a03c013d74e177dd82600a604051610bd5929190613264565b600061145282611df3565b5192915050565b611461611b86565b600c805490829055604080518281526020810184905233917f6ef4f75898b1bc6ecd3c31efb5dd41fa825f83ee3ca1161450111af12115f7cc9101610bd5565b60606114ab611f15565b905090565b60006001600160a01b0382166114d9576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600460205260409020546001600160401b031690565b611506611b86565b6112006000611f24565b61151861194f565b32331461155c5760405162461bcd60e51b815260206004820152601260248201527143616c6c6572206d75737420626520454f4160701b6044820152606401610a3a565b80600b548111156115c15760405162461bcd60e51b815260206004820152602960248201527f4d617820707572636861736520706572206f6e65207472616e73616374696f6e60448201526808195e18d95959195960ba1b6064820152608401610a3a565b60135442101561160f5760405162461bcd60e51b815260206004820152601960248201527814d85b19481a185cc81b9bdd081899595b881cdd185c9d1959603a1b6044820152606401610a3a565b61124a82611f7e565b611620611b86565b611200612076565b611630611b86565b60175460ff16156116795760405162461bcd60e51b815260206004820152601360248201527257686974656c6973742069732061637469766560681b6044820152606401610a3a565b6017805460ff1916600117905560405133907f8756637acb74261437cc71a59a5be5b0deabb5eba0dd08280d1a7d5325caff2b90600090a2565b6060600980546109129061308c565b816116cc8161180e565b6109ed83836120b3565b836001600160a01b03811633146116f0576116f03361180e565b610b4585858585612148565b60606108fd8261217c565b61170f611b86565b6001600160a01b0381166117745760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a3a565b610e6881611f24565b6000806117c3846040516bffffffffffffffffffffffff19606083901b166020820152600090603401604051602081830303815290604052805190602001209050919050565b90506117d283601654836121ff565b949350505050565b600080546001600160801b0316821080156108fd575050600090815260036020526040902054600160e01b900460ff161590565b6daaeb6d7670e522a718067333cd4e3b15610e6857604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa15801561187b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189f91906132ff565b610e6857604051633b79c77360e21b81526001600160a01b0382166004820152602401610a3a565b60006118d282611447565b9050806001600160a01b0316836001600160a01b0316036119065760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590611926575061192481336107fc565b155b15611944576040516367d9dca160e11b815260040160405180910390fd5b6109ed838383612215565b60075460ff16156112005760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610a3a565b80600d546119a58261121b610c7b565b11156119c35760405162461bcd60e51b8152600401610a3a9061312c565b601254336000908152601560205260409020546119e09084611dab565b1115611a215760405162461bcd60e51b815260206004820152601060248201526f115e18d95959081d1a19481b1a5b5a5d60821b6044820152606401610a3a565b33600090815260156020526040902054611a3b9083611dab565b3360009081526015602052604090205560115415611a9e57601154421115611a9e5760405162461bcd60e51b815260206004820152601660248201527514d85b19481a185cc81899595b88199a5b9a5cda195960521b6044820152606401610a3a565b600e546001600160a01b0316611b0e57601454611abb9083612271565b3414611b095760405162461bcd60e51b815260206004820152601a60248201527f496e76616c69642065746820666f722070757263686173696e670000000000006044820152606401610a3a565b611b7c565b3415611b4e5760405162461bcd60e51b815260206004820152600f60248201526e11551217d393d517d0531313d5d151608a1b6044820152606401610a3a565b611b7c3330611b688560145461227190919063ffffffff16565b600e546001600160a01b031692919061227d565b61124a3383611dbe565b6007546001600160a01b036101009091041633146112005760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a3a565b60008311611c2b5760405162461bcd60e51b8152602060048201526012602482015271496e76616c69642073746172742074696d6560701b6044820152606401610a3a565b60008411611c7b5760405162461bcd60e51b815260206004820152601d60248201527f4d617820746f6b656e73207065722074782063616e6e6f7420626520300000006044820152606401610a3a565b6008611c878b826131a5565b506009611c948a826131a5565b50600a611ca189826131a5565b50600e80546001600160a01b0319166001600160a01b038916179055600c869055600d859055600b84905560108390556011829055611cdf81611707565b50505050505050505050565b6109ed8383836122b5565b6040516001600160a01b0383166024820152604481018290526109ed90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526124cf565b611d616125a1565b6007805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000611db78284613332565b9392505050565b61124a8282604051806020016040528060008152506125ea565b6109ed838383604051806020016040528060008152506116d6565b60408051606081018252600080825260208201819052918101829052905482906001600160801b0316811015611efc57600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290611efa5780516001600160a01b031615611e91579392505050565b5060001901600081815260036020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215611ef5579392505050565b611e91565b505b604051636f96cda160e11b815260040160405180910390fd5b6060600a80546109129061308c565b600780546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80600d54611f8e8261121b610c7b565b1115611fac5760405162461bcd60e51b8152600401610a3a9061312c565b60115415611fff57601154421115611fff5760405162461bcd60e51b815260206004820152601660248201527514d85b19481a185cc81899595b88199a5b9a5cda195960521b6044820152606401610a3a565b600e546001600160a01b031661201c57600c54611abb9083612271565b341561205c5760405162461bcd60e51b815260206004820152600f60248201526e11551217d393d517d0531313d5d151608a1b6044820152606401610a3a565b611b7c3330611b6885600c5461227190919063ffffffff16565b61207e61194f565b6007805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611d8e3390565b336001600160a01b038316036120dc5760405163b06307db60e01b815260040160405180910390fd5b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6121538484846122b5565b61215f848484846125f7565b610e90576040516368d2bf6b60e11b815260040160405180910390fd5b6060612187826117da565b6121a457604051630a14c4b560e41b815260040160405180910390fd5b60006121ae611f15565b905080516000036121ce5760405180602001604052806000815250611db7565b806121d8846126f9565b6040516020016121e9929190613345565b6040516020818303038152906040529392505050565b60008261220c858461278b565b14949350505050565b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000611db78284613374565b6040516001600160a01b0380851660248301528316604482015260648101829052610e909085906323b872dd60e01b90608401611d22565b60006122c082611df3565b80519091506000906001600160a01b0316336001600160a01b031614806122ee575081516122ee90336107fc565b806123095750336122fe84610995565b6001600160a01b0316145b90508061232957604051632ce44b5f60e11b815260040160405180910390fd5b846001600160a01b031682600001516001600160a01b03161461235e5760405162a1148160e81b815260040160405180910390fd5b6001600160a01b03841661238557604051633a954ecd60e21b815260040160405180910390fd5b6123956000848460000151612215565b6001600160a01b038581166000908152600460209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600390945282852080546001600160e01b031916909417600160a01b429092169190910217909255908601808352912054909116612488576000546001600160801b031681101561248857825160008281526003602090815260409091208054918601516001600160401b0316600160a01b026001600160e01b03199092166001600160a01b03909316929092171790555b5082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4610b45565b6000612524826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127d89092919063ffffffff16565b8051909150156109ed578080602001905181019061254291906132ff565b6109ed5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a3a565b60075460ff166112005760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a3a565b6109ed83838360016127e7565b60006001600160a01b0384163b156126ee57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061263b90339089908890889060040161338b565b6020604051808303816000875af1925050508015612676575060408051601f3d908101601f19168201909252612673918101906133c8565b60015b6126d4573d8080156126a4576040519150601f19603f3d011682016040523d82523d6000602084013e6126a9565b606091505b5080516000036126cc576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506117d2565b506001949350505050565b6060600061270683612972565b60010190506000816001600160401b0381111561272557612725612df9565b6040519080825280601f01601f19166020018201604052801561274f576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461275957509392505050565b600081815b84518110156127d0576127bc828683815181106127af576127af6133e5565b6020026020010151612a4a565b9150806127c8816133fb565b915050612790565b509392505050565b60606117d28484600085612a79565b6000546001600160801b03166001600160a01b03851661281957604051622e076360e81b815260040160405180910390fd5b8360000361283a5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038516600081815260046020908152604080832080546001600160801b031981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c018116909202179091558584526003909252822080546001600160e01b031916909317600160a01b42909216919091021790915581905b8581101561294c5760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4838015612922575061292060008884886125f7565b155b15612940576040516368d2bf6b60e11b815260040160405180910390fd5b600191820191016128cb565b50600080546001600160801b0319166001600160801b0392909216919091179055610b45565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106129b15772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106129dd576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106129fb57662386f26fc10000830492506010015b6305f5e1008310612a13576305f5e100830492506008015b6127108310612a2757612710830492506004015b60648310612a39576064830492506002015b600a83106108fd5760010192915050565b6000818310612a66576000828152602084905260409020611db7565b6000838152602083905260409020611db7565b606082471015612ada5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a3a565b600080866001600160a01b03168587604051612af69190613414565b60006040518083038185875af1925050503d8060008114612b33576040519150601f19603f3d011682016040523d82523d6000602084013e612b38565b606091505b5091509150612b4987838387612b54565b979650505050505050565b60608315612bc3578251600003612bbc576001600160a01b0385163b612bbc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a3a565b50816117d2565b6117d28383815115612bd85781518083602001fd5b8060405162461bcd60e51b8152600401610a3a9190612c75565b6001600160e01b031981168114610e6857600080fd5b600060208284031215612c1a57600080fd5b8135611db781612bf2565b60005b83811015612c40578181015183820152602001612c28565b50506000910152565b60008151808452612c61816020860160208601612c25565b601f01601f19169290920160200192915050565b602081526000611db76020830184612c49565b600060208284031215612c9a57600080fd5b5035919050565b6001600160a01b0381168114610e6857600080fd5b60008060408385031215612cc957600080fd5b8235612cd481612ca1565b946020939093013593505050565b600080600060408486031215612cf757600080fd5b8335925060208401356001600160401b0380821115612d1557600080fd5b818601915086601f830112612d2957600080fd5b813581811115612d3857600080fd5b8760208260051b8501011115612d4d57600080fd5b6020830194508093505050509250925092565b600060208284031215612d7257600080fd5b81356001600160401b03811115612d8857600080fd5b82016101a08185031215611db757600080fd5b600080600060608486031215612db057600080fd5b8335612dbb81612ca1565b92506020840135612dcb81612ca1565b929592945050506040919091013590565b600060208284031215612dee57600080fd5b8135611db781612ca1565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612e3757612e37612df9565b604052919050565b60006001600160401b03831115612e5857612e58612df9565b612e6b601f8401601f1916602001612e0f565b9050828152838383011115612e7f57600080fd5b828260208301376000602084830101529392505050565b600060208284031215612ea857600080fd5b81356001600160401b03811115612ebe57600080fd5b8201601f81018413612ecf57600080fd5b6117d284823560208401612e3f565b8015158114610e6857600080fd5b60008060408385031215612eff57600080fd5b8235612f0a81612ca1565b91506020830135612f1a81612ede565b809150509250929050565b60008060008060808587031215612f3b57600080fd5b8435612f4681612ca1565b93506020850135612f5681612ca1565b92506040850135915060608501356001600160401b03811115612f7857600080fd5b8501601f81018713612f8957600080fd5b612f9887823560208401612e3f565b91505092959194509250565b60008060408385031215612fb757600080fd5b8235612fc281612ca1565b91506020830135612f1a81612ca1565b60008060408385031215612fe557600080fd5b8235612ff081612ca1565b91506020838101356001600160401b038082111561300d57600080fd5b818601915086601f83011261302157600080fd5b81358181111561303357613033612df9565b8060051b9150613044848301612e0f565b818152918301840191848101908984111561305e57600080fd5b938501935b8385101561307c57843582529385019390850190613063565b8096505050505050509250929050565b600181811c908216806130a057607f821691505b6020821081036130c057634e487b7160e01b600052602260045260246000fd5b50919050565b6000808335601e198436030181126130dd57600080fd5b8301803591506001600160401b038211156130f757600080fd5b60200191503681900382131561310c57600080fd5b9250929050565b60006020828403121561312557600080fd5b5051919050565b6020808252601190820152704578636565646564204d6178204e46547360781b604082015260600190565b601f8211156109ed57600081815260208120601f850160051c8101602086101561317e5750805b601f850160051c820191505b8181101561319d5782815560010161318a565b505050505050565b81516001600160401b038111156131be576131be612df9565b6131d2816131cc845461308c565b84613157565b602080601f83116001811461320757600084156131ef5750858301515b600019600386901b1c1916600185901b17855561319d565b600085815260208120601f198616915b8281101561323657888601518255948401946001909101908401613217565b50858210156132545787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006132776040830185612c49565b6020838203818501526000855461328d8161308c565b808552600182811680156132a857600181146132c2576132f0565b60ff1984168787015282151560051b8701860194506132f0565b896000528560002060005b848110156132e85781548982018901529083019087016132cd565b880187019550505b50929998505050505050505050565b60006020828403121561331157600080fd5b8151611db781612ede565b634e487b7160e01b600052601160045260246000fd5b808201808211156108fd576108fd61331c565b60008351613357818460208801612c25565b83519083019061336b818360208801612c25565b01949350505050565b80820281158282048414176108fd576108fd61331c565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906133be90830184612c49565b9695505050505050565b6000602082840312156133da57600080fd5b8151611db781612bf2565b634e487b7160e01b600052603260045260246000fd5b60006001820161340d5761340d61331c565b5060010190565b60008251613426818460208701612c25565b919091019291505056fea264697066735822122041ff6a47fa69c31c8c9f12db47149e09a6ee9e56a231fff4ec7dd23cf8558e7764736f6c63430008110033
Deployed Bytecode
0x6080604052600436106102c95760003560e01c80636352211e116101755780639a70f6f2116100dc578063d2d8cb6711610095578063ed338ff11161006f578063ed338ff11461082a578063f2fde38b14610840578063f85aff9414610860578063f8e6b54d1461087657600080fd5b8063d2d8cb67146107ab578063e985e367146107c1578063e985e9c5146107e157600080fd5b80639a70f6f2146106ff578063a22cb46514610715578063a69890f014610735578063b88d4fde1461074b578063c45a01551461076b578063c87b56dd1461078b57600080fd5b8063715018a61161012e578063715018a614610675578063845067861461068a5780638456cb591461069d57806389e877a3146106b25780638da5cb5b146106c757806395d89b41146106ea57600080fd5b80636352211e146105d45780636a61e5fc146105f45780636bb7b1d9146106145780636c0360eb1461062a5780636fdaddf11461063f57806370a082311461065557600080fd5b80632f745c591161023457806341f43434116101ed5780634f6ccce7116101c75780634f6ccce71461056257806355f804b31461058257806355fcd367146105a25780635c975abb146105bc57600080fd5b806341f434341461050057806342842e0e146105225780634783f0ef1461054257600080fd5b80632f745c5914610461578063311df29a146104815780633597d7f3146104a15780633ccfd60b146104b65780633f4ba83a146104cb57806340d097c3146104e057600080fd5b80631471c8cb116102865780631471c8cb146103b257806318160ddd146103d25780631cbaee2d146103f557806321c3cdd31461040b57806323b872dd1461042b5780632eb4a7ab1461044b57600080fd5b806301ffc9a7146102ce57806306fdde0314610303578063081812fc14610325578063095ea7b31461035d5780630ed013fb1461037f5780631449d3e614610392575b600080fd5b3480156102da57600080fd5b506102ee6102e9366004612c08565b610896565b60405190151581526020015b60405180910390f35b34801561030f57600080fd5b50610318610903565b6040516102fa9190612c75565b34801561033157600080fd5b50610345610340366004612c88565b610995565b6040516001600160a01b0390911681526020016102fa565b34801561036957600080fd5b5061037d610378366004612cb6565b6109d9565b005b61037d61038d366004612ce2565b6109f2565b34801561039e57600080fd5b5061037d6103ad366004612c88565b610b4c565b3480156103be57600080fd5b5061037d6103cd366004612c88565b610be1565b3480156103de57600080fd5b506103e7610c7b565b6040519081526020016102fa565b34801561040157600080fd5b506103e760105481565b34801561041757600080fd5b5061037d610426366004612d60565b610c9a565b34801561043757600080fd5b5061037d610446366004612d9b565b610e6b565b34801561045757600080fd5b506103e760165481565b34801561046d57600080fd5b506103e761047c366004612cb6565b610e96565b34801561048d57600080fd5b5061037d61049c366004612c88565b610f8a565b3480156104ad57600080fd5b5061037d610fd2565b3480156104c257600080fd5b5061037d611063565b3480156104d757600080fd5b5061037d6111f0565b3480156104ec57600080fd5b5061037d6104fb366004612ddc565b611202565b34801561050c57600080fd5b506103456daaeb6d7670e522a718067333cd4e81565b34801561052e57600080fd5b5061037d61053d366004612d9b565b61124e565b34801561054e57600080fd5b5061037d61055d366004612c88565b611273565b34801561056e57600080fd5b506103e761057d366004612c88565b6112bb565b34801561058e57600080fd5b5061037d61059d366004612e96565b611364565b3480156105ae57600080fd5b506017546102ee9060ff1681565b3480156105c857600080fd5b5060075460ff166102ee565b3480156105e057600080fd5b506103456105ef366004612c88565b611447565b34801561060057600080fd5b5061037d61060f366004612c88565b611459565b34801561062057600080fd5b506103e760135481565b34801561063657600080fd5b506103186114a1565b34801561064b57600080fd5b506103e7600d5481565b34801561066157600080fd5b506103e7610670366004612ddc565b6114b0565b34801561068157600080fd5b5061037d6114fe565b61037d610698366004612c88565b611510565b3480156106a957600080fd5b5061037d611618565b3480156106be57600080fd5b5061037d611628565b3480156106d357600080fd5b5060075461010090046001600160a01b0316610345565b3480156106f657600080fd5b506103186116b3565b34801561070b57600080fd5b506103e760145481565b34801561072157600080fd5b5061037d610730366004612eec565b6116c2565b34801561074157600080fd5b506103e760125481565b34801561075757600080fd5b5061037d610766366004612f25565b6116d6565b34801561077757600080fd5b50600f54610345906001600160a01b031681565b34801561079757600080fd5b506103186107a6366004612c88565b6116fc565b3480156107b757600080fd5b506103e7600c5481565b3480156107cd57600080fd5b50600e54610345906001600160a01b031681565b3480156107ed57600080fd5b506102ee6107fc366004612fa4565b6001600160a01b03918216600090815260066020908152604080832093909416825291909152205460ff1690565b34801561083657600080fd5b506103e760115481565b34801561084c57600080fd5b5061037d61085b366004612ddc565b611707565b34801561086c57600080fd5b506103e7600b5481565b34801561088257600080fd5b506102ee610891366004612fd2565b61177d565b60006001600160e01b031982166380ac58cd60e01b14806108c757506001600160e01b03198216635b5e139f60e01b145b806108e257506001600160e01b0319821663780e9d6360e01b145b806108fd57506301ffc9a760e01b6001600160e01b03198316145b92915050565b6060600880546109129061308c565b80601f016020809104026020016040519081016040528092919081815260200182805461093e9061308c565b801561098b5780601f106109605761010080835404028352916020019161098b565b820191906000526020600020905b81548152906001019060200180831161096e57829003601f168201915b5050505050905090565b60006109a0826117da565b6109bd576040516333d1c03960e21b815260040160405180910390fd5b506000908152600560205260409020546001600160a01b031690565b816109e38161180e565b6109ed83836118c7565b505050565b6109fa61194f565b323314610a435760405162461bcd60e51b815260206004820152601260248201527143616c6c6572206d75737420626520454f4160701b60448201526064015b60405180910390fd5b6017548290829060ff1615610aee57610a8f3383838080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525061177d92505050565b8015610a9d57506010544210155b610ae95760405162461bcd60e51b815260206004820181905260248201527f556e617574686f72697a656420746f206a6f696e207468652070726573616c656044820152606401610a3a565b610b3c565b601354421015610b3c5760405162461bcd60e51b815260206004820152601960248201527814d85b19481a185cc81b9bdd081899595b881cdd185c9d1959603a1b6044820152606401610a3a565b610b4585611995565b5050505050565b610b54611b86565b60008111610b995760405162461bcd60e51b8152602060048201526012602482015271494e56414c49445f5a45524f5f56414c554560701b6044820152606401610a3a565b600b805490829055604080518281526020810184905233917fb39bf8311c05c3cf0e747394ce1a50d0a55862cd7f3b087bf2c3bcb7f7fec46191015b60405180910390a25050565b610be9611b86565b600d54811115610c3b5760405162461bcd60e51b815260206004820152601c60248201527f496e76616c6964206d6178206d696e74207065722061646472657373000000006044820152606401610a3a565b6012805490829055604080518281526020810184905233917f6624911a35f6ecff7839762364df0b18738cf8d54e6e5401e8a8057dca9a877f9101610bd5565b6000546001600160801b03600160801b82048116918116919091031690565b600f546001600160a01b03163314610ce05760405162461bcd60e51b81526020600482015260096024820152682337b93134b23232b760b91b6044820152606401610a3a565b8060e001358161012001351015610d395760405162461bcd60e51b815260206004820152601860248201527f496e76616c6964207075626c69632073616c652074696d6500000000000000006044820152606401610a3a565b6101208101356013556017805460ff19166001179055610140810135601255610160810135601455610e68610d6e82806130c6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610db09250505060208401846130c6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610df29250505060408501856130c6565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250610e37925050506080860160608701612ddc565b608086013560a087013560c088013560e08901356101008a0135610e636101a08c016101808d01612ddc565b611be6565b50565b826001600160a01b0381163314610e8557610e853361180e565b610e90848484611ceb565b50505050565b6000610ea1836114b0565b8210610ec0576040516306ed618760e11b815260040160405180910390fd5b600080546001600160801b03169080805b838110156102c957600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161580159282019290925290610f385750610f82565b80516001600160a01b031615610f4d57805192505b876001600160a01b0316836001600160a01b031603610f8057868403610f79575093506108fd92505050565b6001909301925b505b600101610ed1565b610f92611b86565b6014805490829055604080518281526020810184905233917fa9e0d811fda9bb12a8a33a230a373534ad7176732c43020ff83c3b8425ba9e859101610bd5565b610fda611b86565b60175460ff1661102c5760405162461bcd60e51b815260206004820152601760248201527f57686974656c697374206973206e6f74206163746976650000000000000000006044820152606401610a3a565b6017805460ff1916905560405133907f66c181ea7309d1a2533ad3614dab6d488bde2babb04711eeda39ed70b6e4d8ff90600090a2565b61106b611b86565b600e546000906001600160a01b031661111f57506040514790600090339083908381818185875af1925050503d80600081146110c3576040519150601f19603f3d011682016040523d82523d6000602084013e6110c8565b606091505b50509050806111195760405162461bcd60e51b815260206004820152601860248201527f4661696c656420746f20776974686472617720457468657200000000000000006044820152606401610a3a565b506111a5565b600e546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611167573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061118b9190613113565b600e549091506111a5906001600160a01b03163383611cf6565b600e54604080516001600160a01b0390921682526020820183905233917f9b1bfa7fa9ee420a16e124f794c35ac9f90472acc99140eb2f6447c714cad8eb910160405180910390a250565b6111f8611b86565b611200611d59565b565b61120a611b86565b6001600d546112218261121b610c7b565b90611dab565b111561123f5760405162461bcd60e51b8152600401610a3a9061312c565b61124a826001611dbe565b5050565b826001600160a01b0381163314611268576112683361180e565b610e90848484611dd8565b61127b611b86565b6016805490829055604080518281526020810184905233917f8b67e84be49a1952e3818ead1025bf3a2299ec901780204d0dec64678b2352879101610bd5565b600080546001600160801b031681805b8281101561134a57600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff161515918101829052906113415785830361133a5750949350505050565b6001909201915b506001016112cb565b506040516329c8c00760e21b815260040160405180910390fd5b61136c611b86565b6000600a805461137b9061308c565b80601f01602080910402602001604051908101604052809291908181526020018280546113a79061308c565b80156113f45780601f106113c9576101008083540402835291602001916113f4565b820191906000526020600020905b8154815290600101906020018083116113d757829003601f168201915b5050505050905081600a908161140a91906131a5565b50336001600160a01b03167f1583e02b0b2a79149e9152563c00c240bf33e5291f9c5337a03c013d74e177dd82600a604051610bd5929190613264565b600061145282611df3565b5192915050565b611461611b86565b600c805490829055604080518281526020810184905233917f6ef4f75898b1bc6ecd3c31efb5dd41fa825f83ee3ca1161450111af12115f7cc9101610bd5565b60606114ab611f15565b905090565b60006001600160a01b0382166114d9576040516323d3ad8160e21b815260040160405180910390fd5b506001600160a01b03166000908152600460205260409020546001600160401b031690565b611506611b86565b6112006000611f24565b61151861194f565b32331461155c5760405162461bcd60e51b815260206004820152601260248201527143616c6c6572206d75737420626520454f4160701b6044820152606401610a3a565b80600b548111156115c15760405162461bcd60e51b815260206004820152602960248201527f4d617820707572636861736520706572206f6e65207472616e73616374696f6e60448201526808195e18d95959195960ba1b6064820152608401610a3a565b60135442101561160f5760405162461bcd60e51b815260206004820152601960248201527814d85b19481a185cc81b9bdd081899595b881cdd185c9d1959603a1b6044820152606401610a3a565b61124a82611f7e565b611620611b86565b611200612076565b611630611b86565b60175460ff16156116795760405162461bcd60e51b815260206004820152601360248201527257686974656c6973742069732061637469766560681b6044820152606401610a3a565b6017805460ff1916600117905560405133907f8756637acb74261437cc71a59a5be5b0deabb5eba0dd08280d1a7d5325caff2b90600090a2565b6060600980546109129061308c565b816116cc8161180e565b6109ed83836120b3565b836001600160a01b03811633146116f0576116f03361180e565b610b4585858585612148565b60606108fd8261217c565b61170f611b86565b6001600160a01b0381166117745760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610a3a565b610e6881611f24565b6000806117c3846040516bffffffffffffffffffffffff19606083901b166020820152600090603401604051602081830303815290604052805190602001209050919050565b90506117d283601654836121ff565b949350505050565b600080546001600160801b0316821080156108fd575050600090815260036020526040902054600160e01b900460ff161590565b6daaeb6d7670e522a718067333cd4e3b15610e6857604051633185c44d60e21b81523060048201526001600160a01b03821660248201526daaeb6d7670e522a718067333cd4e9063c617113490604401602060405180830381865afa15801561187b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061189f91906132ff565b610e6857604051633b79c77360e21b81526001600160a01b0382166004820152602401610a3a565b60006118d282611447565b9050806001600160a01b0316836001600160a01b0316036119065760405163250fdee360e21b815260040160405180910390fd5b336001600160a01b03821614801590611926575061192481336107fc565b155b15611944576040516367d9dca160e11b815260040160405180910390fd5b6109ed838383612215565b60075460ff16156112005760405162461bcd60e51b815260206004820152601060248201526f14185d5cd8589b194e881c185d5cd95960821b6044820152606401610a3a565b80600d546119a58261121b610c7b565b11156119c35760405162461bcd60e51b8152600401610a3a9061312c565b601254336000908152601560205260409020546119e09084611dab565b1115611a215760405162461bcd60e51b815260206004820152601060248201526f115e18d95959081d1a19481b1a5b5a5d60821b6044820152606401610a3a565b33600090815260156020526040902054611a3b9083611dab565b3360009081526015602052604090205560115415611a9e57601154421115611a9e5760405162461bcd60e51b815260206004820152601660248201527514d85b19481a185cc81899595b88199a5b9a5cda195960521b6044820152606401610a3a565b600e546001600160a01b0316611b0e57601454611abb9083612271565b3414611b095760405162461bcd60e51b815260206004820152601a60248201527f496e76616c69642065746820666f722070757263686173696e670000000000006044820152606401610a3a565b611b7c565b3415611b4e5760405162461bcd60e51b815260206004820152600f60248201526e11551217d393d517d0531313d5d151608a1b6044820152606401610a3a565b611b7c3330611b688560145461227190919063ffffffff16565b600e546001600160a01b031692919061227d565b61124a3383611dbe565b6007546001600160a01b036101009091041633146112005760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610a3a565b60008311611c2b5760405162461bcd60e51b8152602060048201526012602482015271496e76616c69642073746172742074696d6560701b6044820152606401610a3a565b60008411611c7b5760405162461bcd60e51b815260206004820152601d60248201527f4d617820746f6b656e73207065722074782063616e6e6f7420626520300000006044820152606401610a3a565b6008611c878b826131a5565b506009611c948a826131a5565b50600a611ca189826131a5565b50600e80546001600160a01b0319166001600160a01b038916179055600c869055600d859055600b84905560108390556011829055611cdf81611707565b50505050505050505050565b6109ed8383836122b5565b6040516001600160a01b0383166024820152604481018290526109ed90849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526124cf565b611d616125a1565b6007805460ff191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b03909116815260200160405180910390a1565b6000611db78284613332565b9392505050565b61124a8282604051806020016040528060008152506125ea565b6109ed838383604051806020016040528060008152506116d6565b60408051606081018252600080825260208201819052918101829052905482906001600160801b0316811015611efc57600081815260036020908152604091829020825160608101845290546001600160a01b0381168252600160a01b81046001600160401b031692820192909252600160e01b90910460ff16151591810182905290611efa5780516001600160a01b031615611e91579392505050565b5060001901600081815260036020908152604091829020825160608101845290546001600160a01b038116808352600160a01b82046001600160401b031693830193909352600160e01b900460ff1615159281019290925215611ef5579392505050565b611e91565b505b604051636f96cda160e11b815260040160405180910390fd5b6060600a80546109129061308c565b600780546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80600d54611f8e8261121b610c7b565b1115611fac5760405162461bcd60e51b8152600401610a3a9061312c565b60115415611fff57601154421115611fff5760405162461bcd60e51b815260206004820152601660248201527514d85b19481a185cc81899595b88199a5b9a5cda195960521b6044820152606401610a3a565b600e546001600160a01b031661201c57600c54611abb9083612271565b341561205c5760405162461bcd60e51b815260206004820152600f60248201526e11551217d393d517d0531313d5d151608a1b6044820152606401610a3a565b611b7c3330611b6885600c5461227190919063ffffffff16565b61207e61194f565b6007805460ff191660011790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258611d8e3390565b336001600160a01b038316036120dc5760405163b06307db60e01b815260040160405180910390fd5b3360008181526006602090815260408083206001600160a01b03871680855290835292819020805460ff191686151590811790915590519081529192917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31910160405180910390a35050565b6121538484846122b5565b61215f848484846125f7565b610e90576040516368d2bf6b60e11b815260040160405180910390fd5b6060612187826117da565b6121a457604051630a14c4b560e41b815260040160405180910390fd5b60006121ae611f15565b905080516000036121ce5760405180602001604052806000815250611db7565b806121d8846126f9565b6040516020016121e9929190613345565b6040516020818303038152906040529392505050565b60008261220c858461278b565b14949350505050565b60008281526005602052604080822080546001600160a01b0319166001600160a01b0387811691821790925591518593918516917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591a4505050565b6000611db78284613374565b6040516001600160a01b0380851660248301528316604482015260648101829052610e909085906323b872dd60e01b90608401611d22565b60006122c082611df3565b80519091506000906001600160a01b0316336001600160a01b031614806122ee575081516122ee90336107fc565b806123095750336122fe84610995565b6001600160a01b0316145b90508061232957604051632ce44b5f60e11b815260040160405180910390fd5b846001600160a01b031682600001516001600160a01b03161461235e5760405162a1148160e81b815260040160405180910390fd5b6001600160a01b03841661238557604051633a954ecd60e21b815260040160405180910390fd5b6123956000848460000151612215565b6001600160a01b038581166000908152600460209081526040808320805467ffffffffffffffff198082166001600160401b0392831660001901831617909255898616808652838620805493841693831660019081018416949094179055898652600390945282852080546001600160e01b031916909417600160a01b429092169190910217909255908601808352912054909116612488576000546001600160801b031681101561248857825160008281526003602090815260409091208054918601516001600160401b0316600160a01b026001600160e01b03199092166001600160a01b03909316929092171790555b5082846001600160a01b0316866001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4610b45565b6000612524826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166127d89092919063ffffffff16565b8051909150156109ed578080602001905181019061254291906132ff565b6109ed5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610a3a565b60075460ff166112005760405162461bcd60e51b815260206004820152601460248201527314185d5cd8589b194e881b9bdd081c185d5cd95960621b6044820152606401610a3a565b6109ed83838360016127e7565b60006001600160a01b0384163b156126ee57604051630a85bd0160e11b81526001600160a01b0385169063150b7a029061263b90339089908890889060040161338b565b6020604051808303816000875af1925050508015612676575060408051601f3d908101601f19168201909252612673918101906133c8565b60015b6126d4573d8080156126a4576040519150601f19603f3d011682016040523d82523d6000602084013e6126a9565b606091505b5080516000036126cc576040516368d2bf6b60e11b815260040160405180910390fd5b805181602001fd5b6001600160e01b031916630a85bd0160e11b1490506117d2565b506001949350505050565b6060600061270683612972565b60010190506000816001600160401b0381111561272557612725612df9565b6040519080825280601f01601f19166020018201604052801561274f576020820181803683370190505b5090508181016020015b600019016f181899199a1a9b1b9c1cb0b131b232b360811b600a86061a8153600a850494508461275957509392505050565b600081815b84518110156127d0576127bc828683815181106127af576127af6133e5565b6020026020010151612a4a565b9150806127c8816133fb565b915050612790565b509392505050565b60606117d28484600085612a79565b6000546001600160801b03166001600160a01b03851661281957604051622e076360e81b815260040160405180910390fd5b8360000361283a5760405163b562e8dd60e01b815260040160405180910390fd5b6001600160a01b038516600081815260046020908152604080832080546001600160801b031981166001600160401b038083168c0181169182176801000000000000000067ffffffffffffffff1990941690921783900481168c018116909202179091558584526003909252822080546001600160e01b031916909317600160a01b42909216919091021790915581905b8581101561294c5760405182906001600160a01b038916906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a4838015612922575061292060008884886125f7565b155b15612940576040516368d2bf6b60e11b815260040160405180910390fd5b600191820191016128cb565b50600080546001600160801b0319166001600160801b0392909216919091179055610b45565b60008072184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b83106129b15772184f03e93ff9f4daa797ed6e38ed64bf6a1f0160401b830492506040015b6d04ee2d6d415b85acef810000000083106129dd576d04ee2d6d415b85acef8100000000830492506020015b662386f26fc1000083106129fb57662386f26fc10000830492506010015b6305f5e1008310612a13576305f5e100830492506008015b6127108310612a2757612710830492506004015b60648310612a39576064830492506002015b600a83106108fd5760010192915050565b6000818310612a66576000828152602084905260409020611db7565b6000838152602083905260409020611db7565b606082471015612ada5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610a3a565b600080866001600160a01b03168587604051612af69190613414565b60006040518083038185875af1925050503d8060008114612b33576040519150601f19603f3d011682016040523d82523d6000602084013e612b38565b606091505b5091509150612b4987838387612b54565b979650505050505050565b60608315612bc3578251600003612bbc576001600160a01b0385163b612bbc5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610a3a565b50816117d2565b6117d28383815115612bd85781518083602001fd5b8060405162461bcd60e51b8152600401610a3a9190612c75565b6001600160e01b031981168114610e6857600080fd5b600060208284031215612c1a57600080fd5b8135611db781612bf2565b60005b83811015612c40578181015183820152602001612c28565b50506000910152565b60008151808452612c61816020860160208601612c25565b601f01601f19169290920160200192915050565b602081526000611db76020830184612c49565b600060208284031215612c9a57600080fd5b5035919050565b6001600160a01b0381168114610e6857600080fd5b60008060408385031215612cc957600080fd5b8235612cd481612ca1565b946020939093013593505050565b600080600060408486031215612cf757600080fd5b8335925060208401356001600160401b0380821115612d1557600080fd5b818601915086601f830112612d2957600080fd5b813581811115612d3857600080fd5b8760208260051b8501011115612d4d57600080fd5b6020830194508093505050509250925092565b600060208284031215612d7257600080fd5b81356001600160401b03811115612d8857600080fd5b82016101a08185031215611db757600080fd5b600080600060608486031215612db057600080fd5b8335612dbb81612ca1565b92506020840135612dcb81612ca1565b929592945050506040919091013590565b600060208284031215612dee57600080fd5b8135611db781612ca1565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715612e3757612e37612df9565b604052919050565b60006001600160401b03831115612e5857612e58612df9565b612e6b601f8401601f1916602001612e0f565b9050828152838383011115612e7f57600080fd5b828260208301376000602084830101529392505050565b600060208284031215612ea857600080fd5b81356001600160401b03811115612ebe57600080fd5b8201601f81018413612ecf57600080fd5b6117d284823560208401612e3f565b8015158114610e6857600080fd5b60008060408385031215612eff57600080fd5b8235612f0a81612ca1565b91506020830135612f1a81612ede565b809150509250929050565b60008060008060808587031215612f3b57600080fd5b8435612f4681612ca1565b93506020850135612f5681612ca1565b92506040850135915060608501356001600160401b03811115612f7857600080fd5b8501601f81018713612f8957600080fd5b612f9887823560208401612e3f565b91505092959194509250565b60008060408385031215612fb757600080fd5b8235612fc281612ca1565b91506020830135612f1a81612ca1565b60008060408385031215612fe557600080fd5b8235612ff081612ca1565b91506020838101356001600160401b038082111561300d57600080fd5b818601915086601f83011261302157600080fd5b81358181111561303357613033612df9565b8060051b9150613044848301612e0f565b818152918301840191848101908984111561305e57600080fd5b938501935b8385101561307c57843582529385019390850190613063565b8096505050505050509250929050565b600181811c908216806130a057607f821691505b6020821081036130c057634e487b7160e01b600052602260045260246000fd5b50919050565b6000808335601e198436030181126130dd57600080fd5b8301803591506001600160401b038211156130f757600080fd5b60200191503681900382131561310c57600080fd5b9250929050565b60006020828403121561312557600080fd5b5051919050565b6020808252601190820152704578636565646564204d6178204e46547360781b604082015260600190565b601f8211156109ed57600081815260208120601f850160051c8101602086101561317e5750805b601f850160051c820191505b8181101561319d5782815560010161318a565b505050505050565b81516001600160401b038111156131be576131be612df9565b6131d2816131cc845461308c565b84613157565b602080601f83116001811461320757600084156131ef5750858301515b600019600386901b1c1916600185901b17855561319d565b600085815260208120601f198616915b8281101561323657888601518255948401946001909101908401613217565b50858210156132545787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6040815260006132776040830185612c49565b6020838203818501526000855461328d8161308c565b808552600182811680156132a857600181146132c2576132f0565b60ff1984168787015282151560051b8701860194506132f0565b896000528560002060005b848110156132e85781548982018901529083019087016132cd565b880187019550505b50929998505050505050505050565b60006020828403121561331157600080fd5b8151611db781612ede565b634e487b7160e01b600052601160045260246000fd5b808201808211156108fd576108fd61331c565b60008351613357818460208801612c25565b83519083019061336b818360208801612c25565b01949350505050565b80820281158282048414176108fd576108fd61331c565b6001600160a01b03858116825284166020820152604081018390526080606082018190526000906133be90830184612c49565b9695505050505050565b6000602082840312156133da57600080fd5b8151611db781612bf2565b634e487b7160e01b600052603260045260246000fd5b60006001820161340d5761340d61331c565b5060010190565b60008251613426818460208701612c25565b919091019291505056fea264697066735822122041ff6a47fa69c31c8c9f12db47149e09a6ee9e56a231fff4ec7dd23cf8558e7764736f6c63430008110033
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.