ETH Price: $1,978.62 (-4.65%)

Contract

0x0772F5054C2061383690b81f46bB1F2FeEFB4fE9
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Public Buy151020352022-07-08 12:56:561337 days ago1657285016IN
0x0772F505...FeEFB4fE9
0 ETH0.01237614160.58531211
Presale Buy150996292022-07-08 3:52:051337 days ago1657252325IN
0x0772F505...FeEFB4fE9
0 ETH0.0007145720.62076586
Public Buy150882792022-07-06 10:06:171339 days ago1657101977IN
0x0772F505...FeEFB4fE9
0 ETH0.0128213166.36131469
Public Buy150882792022-07-06 10:06:171339 days ago1657101977IN
0x0772F505...FeEFB4fE9
0 ETH0.01260107163.50374683
Public Buy150882782022-07-06 10:06:021339 days ago1657101962IN
0x0772F505...FeEFB4fE9
0 ETH0.01264225164.03817697
Public Buy150882782022-07-06 10:06:021339 days ago1657101962IN
0x0772F505...FeEFB4fE9
0 ETH0.00957866124.28692111
Public Buy150882782022-07-06 10:06:021339 days ago1657101962IN
0x0772F505...FeEFB4fE9
0 ETH0.01174537152.40081251
Public Buy150882782022-07-06 10:06:021339 days ago1657101962IN
0x0772F505...FeEFB4fE9
0 ETH0.01129887146.60729213
Public Buy150833892022-07-05 15:40:511340 days ago1657035651IN
0x0772F505...FeEFB4fE9
0 ETH0.00834214108.2425961
Public Buy150693742022-07-03 11:42:371342 days ago1656848557IN
0x0772F505...FeEFB4fE9
0 ETH0.00456578108.2425961
Public Buy150559492022-07-01 10:00:311344 days ago1656669631IN
0x0772F505...FeEFB4fE9
0 ETH0.00870395206.34776255
Public Buy150511322022-06-30 15:42:331345 days ago1656603753IN
0x0772F505...FeEFB4fE9
0 ETH0.0036102946.84491341
Public Buy150511302022-06-30 15:41:551345 days ago1656603715IN
0x0772F505...FeEFB4fE9
0 ETH0.0031983541.4998997
Public Buy150511262022-06-30 15:41:031345 days ago1656603663IN
0x0772F505...FeEFB4fE9
0 ETH0.0036052546.77955077
Public Buy150510222022-06-30 15:16:461345 days ago1656602206IN
0x0772F505...FeEFB4fE9
0 ETH0.02203697285.93821033
Presale Buy150485302022-06-30 4:16:341345 days ago1656562594IN
0x0772F505...FeEFB4fE9
0 ETH0.0007626322
Presale Buy150478162022-06-30 0:57:171345 days ago1656550637IN
0x0772F505...FeEFB4fE9
0 ETH0.0008538524.28959265
Presale Buy150475292022-06-29 23:37:501346 days ago1656545870IN
0x0772F505...FeEFB4fE9
0 ETH0.00086224.87523165
Presale Buy150475292022-06-29 23:37:501346 days ago1656545870IN
0x0772F505...FeEFB4fE9
0 ETH0.0008750324.87523165
Presale Buy150475292022-06-29 23:37:501346 days ago1656545870IN
0x0772F505...FeEFB4fE9
0 ETH0.0008747324.87523165
Presale Buy150475292022-06-29 23:37:501346 days ago1656545870IN
0x0772F505...FeEFB4fE9
0 ETH0.00086224.87523165
Presale Buy150475292022-06-29 23:37:501346 days ago1656545870IN
0x0772F505...FeEFB4fE9
0 ETH0.0009320426.89640824
Presale Buy150475292022-06-29 23:37:501346 days ago1656545870IN
0x0772F505...FeEFB4fE9
0 ETH0.0009320426.89640824
Public Buy150473902022-06-29 23:04:521346 days ago1656543892IN
0x0772F505...FeEFB4fE9
0 ETH0.0034826645.18891476
Public Buy150473682022-06-29 22:59:161346 days ago1656543556IN
0x0772F505...FeEFB4fE9
0 ETH0.0021579328
View all transactions

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ChefSaleManager

Compiler Version
v0.8.10+commit.fc410830

Optimization Enabled:
No with 200 runs

Other Settings:
default evmVersion, MIT license
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import '@openzeppelin/contracts/access/Ownable.sol';
import '../ChefAvatar.sol';

/// @title Tickets that exchange to a Chef. Sold during the Big Town Chef sale.
/// @author Valerio Leo @valeriohq

contract ChefSaleManager is Ownable {
	uint256 public presalePrice;
	uint256 public publicFixedPrice;
	ChefAvatar public chefAvatar;
	address public treasury;
	uint256 public presaleStart = block.timestamp + 180 days; // default to half a year from now
	uint256 public presaleLength = 1 days; // default to 1 day after presaleStart
	uint256 public publicStart = block.timestamp + 180 days; // default to half a year from now
	uint256 public publicSaleMaxPurchaseQuantity = 3;
	bytes32 public merkleRoot;

	event MerkleRootChanged(bytes32 newMerkleRoot);
	event TreasuryChanged(address newTreasury);
	event PricesChanged(uint256 newPresalePrice, uint256 newPublicFixedPrice);
	event PresaleConfigChanged(uint256 newPresaleStart, uint256 newPresaleLength);
	event PublicSaleConfigChanged(uint256 newPublicStart);
	event PublicSaleMaxPurchaseQuantityChanged(uint256 newPublicSaleMaxPurchaseQuantity);
	event PublicSalePricingModelChanged(PublicSalePricingModel newPublicSalePricingModel);
	event DutchAuctionConfigurationChanged(
		uint256 newDutchStartPrice,
		uint256 newDutchEndPrice,
		uint256 newDutchPriceStepDrecrease,
		uint256 newDutchStartTime,
		uint256 newDutchStep
	);


	struct DutchAuction {
		uint256 dutchStartPrice;
		uint256 dutchEndPrice;
		uint256 dutchPriceStepDrecrease;
		uint256 dutchStartTime;
		uint256 dutchStep;
	}

	DutchAuction public dutchAuction;

	mapping(address => uint256) public publicSalePurchasesPerAddress;
	mapping(address => uint) public presaleChefs;

	enum SalePhases{
		NO_SALE,
		PRESALE,
		PUBLIC_SALE
	}

	enum PublicSalePricingModel{
		FIXED_PRICE,
		DUTCH_AUCTION
	}

	PublicSalePricingModel public publicSalePricingModel;

	constructor(
		uint256 _presalePrice,
		uint256 _publicPrice,
		ChefAvatar _chefAvatar,
		address _treasury
	) {
		presalePrice = _presalePrice;
		publicFixedPrice = _publicPrice;
		chefAvatar = _chefAvatar;
		treasury = _treasury;
	}

	/// @notice It changes the merkleRoot variable.
	/// @dev Only callable by owner.
	/// @param _merkleRoot: the new merkle root
	function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner {
		merkleRoot = _merkleRoot;

		emit MerkleRootChanged(_merkleRoot);
	}

	/// @notice It changes the treasury treasury that receives the payments.
	/// @dev Only callable by owner.
	/// @param _treasury: the new treasury address
	function setTreasury(address _treasury) external onlyOwner {
		treasury = _treasury;

		emit TreasuryChanged(_treasury);
	}

	/// @notice It updates the presale and public sale prices.
	/// @dev Only callable by owner.
	/// @param _presalePrice: the new presale price
	/// @param _publicPrice: the new public sale price
	function setPrices(uint256 _presalePrice, uint256 _publicPrice) external onlyOwner {
		presalePrice = _presalePrice;
		publicFixedPrice = _publicPrice;

		emit PricesChanged(_presalePrice, _publicPrice);
	}

	/// @notice It updates the start time and length of the presale
	/// @dev Only callable by owner.
	/// @param _presaleStart: the new presale start timestamp
	/// @param _presaleLength: the new presale length in seconds
	function setPresaleConfig(uint256 _presaleStart, uint256 _presaleLength) external onlyOwner {
		presaleStart = _presaleStart;
		presaleLength = _presaleLength;

		emit PresaleConfigChanged(_presaleStart, _presaleLength);
	}

	/// @notice It updates the start time of the public sale
	/// @dev Only callable by owner.
	/// @param _publicStart: the new public sale start timestamp
	function setPublicConfig(uint256 _publicStart) external onlyOwner {
		publicStart = _publicStart;

		emit PublicSaleConfigChanged(_publicStart);
	}
	
	/// @notice It updates the max purchase quantity of the public sale
	/// @dev Only callable by owner.
	/// @param newAmount: the new max amount users can mint during public sale
	function setPublicSaleMaxPurchaseQuantity(uint256 newAmount) external onlyOwner {
		publicSaleMaxPurchaseQuantity = newAmount;

		emit PublicSaleMaxPurchaseQuantityChanged(newAmount);
	}

	/// @notice It updates the pricing model of the public sale.
	/// @dev Only callable by owner. Parameter can be one of 0 or 1. 0 for fixed price, 1 for dutch auction.
	/// @param pricingModel: the new pricing model of the public sale
	function setPublicSalePricingModel(PublicSalePricingModel pricingModel) external onlyOwner {
		publicSalePricingModel = pricingModel;

		emit PublicSalePricingModelChanged(pricingModel);
	}

	/// @notice It updates the dutch auction settings.
	/// @dev Only callable by owner.
	/// @param _dutchStartPrice: the new start price
	/// @param _dutchEndPrice: the new end price
	/// @param _dutchPriceStepDrecrease: the new price decrease step
	/// @param _dutchStartTime: the new start timestamp in seconds
	/// @param _dutchStep: the new step in seconds for the price decrease
	function configureDutch(
		uint256 _dutchStartPrice,
		uint256 _dutchEndPrice,
		uint256 _dutchPriceStepDrecrease,
		uint256 _dutchStartTime,
		uint256 _dutchStep
	) external onlyOwner {
		require(_dutchStartPrice > _dutchEndPrice, "ChefSaleManager: dutchStartPrice must be greater than dutchEndPrice");
		require(_dutchPriceStepDrecrease > 0, "ChefSaleManager: dutchPriceStepDrecrease must be greater than 0");
		require(_dutchStartTime >= block.timestamp, "ChefSaleManager: dutchStartTime must be greater than or equal to block.timestamp");
		require(_dutchStep > 0, "ChefSaleManager: dutchStep must be greater than 0");
		require(_dutchStartTime > _dutchStep, "ChefSaleManager: dutchStartTime must be greater than dutchStep");

		dutchAuction.dutchStartPrice = _dutchStartPrice;
		dutchAuction.dutchEndPrice = _dutchEndPrice;
		dutchAuction.dutchPriceStepDrecrease = _dutchPriceStepDrecrease;
		dutchAuction.dutchStartTime = _dutchStartTime;
		dutchAuction.dutchStep = _dutchStep;

		emit DutchAuctionConfigurationChanged(
			_dutchStartPrice,
			_dutchEndPrice,
			_dutchPriceStepDrecrease,
			_dutchStartTime,
			_dutchStep
		);
	}

	function _getDutchAuctionPrice() internal view returns (uint256) {
		uint256 elapsed = block.timestamp - dutchAuction.dutchStartTime;
		uint256 stepsElapsed = elapsed / dutchAuction.dutchStep;
		uint256 priceDecrease = stepsElapsed * dutchAuction.dutchPriceStepDrecrease;

		if(priceDecrease > dutchAuction.dutchStartPrice) {
			return dutchAuction.dutchEndPrice;
		}

		uint256 currPrice = dutchAuction.dutchStartPrice - priceDecrease;

		return currPrice >= dutchAuction.dutchEndPrice ? currPrice : dutchAuction.dutchEndPrice;
	}

	/// @notice It returns the current price per-nft taking into account the currect sale phase and pricing model
	function getCurrentPrice() public view returns (uint256) {
		SalePhases phase = getSalePhase();

		if(phase == SalePhases.PRESALE) {
			return presalePrice;
		}
		if(phase == SalePhases.PUBLIC_SALE && publicSalePricingModel == PublicSalePricingModel.DUTCH_AUCTION) {
			return _getDutchAuctionPrice();
		}

		if(phase == SalePhases.PUBLIC_SALE && publicSalePricingModel == PublicSalePricingModel.FIXED_PRICE) {
			return publicFixedPrice;
		}

		require(false, "Invalid phase"); // stop execution if reach here
	}

	function _transferFunds(uint256 totalCost) private {
		require(msg.value == totalCost, "wrong amount");
		(bool success, ) = payable(treasury).call{value: totalCost}("");
		require(success, "transfer failed");
	}

	function admitPresaleUser(uint256 quantity, uint256 maxQuantity, bytes32[] calldata proofs) internal returns (bool) {
		bool isProofValid = MerkleProof.verify(
			proofs,
			merkleRoot,
			keccak256(
				abi.encodePacked(
					keccak256(abi.encodePacked(msg.sender, maxQuantity))
				)
			)
		);

		presaleChefs[msg.sender] += quantity;

		return presaleChefs[msg.sender] <= maxQuantity && isProofValid;
	}
	
	function admitPublicUser(uint256 quantity) internal returns (bool) {
		publicSalePurchasesPerAddress[msg.sender] += quantity;

		return publicSalePurchasesPerAddress[msg.sender] <= publicSaleMaxPurchaseQuantity;
	}

	/// @notice It returns the current sale phase
	function getSalePhase() view public returns (SalePhases) {
		if (block.timestamp < presaleStart) {
			return SalePhases.NO_SALE;
		}
		if (block.timestamp < presaleStart + presaleLength) {
			return SalePhases.PRESALE;
		}

		if(block.timestamp >= publicStart) {
			return SalePhases.PUBLIC_SALE;
		}

		return SalePhases.NO_SALE;
	}

	/// @notice It will purchase the given amount of tokens for the user during the presale phase
	/// @dev Only callable by during the presale phase. The correct amount of ETH should be sent based on the current price or the call will revert`
	/// @param quantity: the amount of tokens to purchase
	/// @param maxQuantity: the maximum amount of tokens this user can purchase during presale
	/// @param proofs: the merkle proofs for the current user
	function presaleBuy(uint256 quantity, uint256 maxQuantity, bytes32[] calldata proofs) external payable {
		SalePhases salePhase = getSalePhase();
		require(salePhase == SalePhases.PRESALE, "presale not active");

		uint256 totalCost = getCurrentPrice() * quantity;
		require(msg.value == totalCost, "Wrong amount sent");
		
		bool admitUser = admitPresaleUser(quantity, maxQuantity, proofs);

		require(admitUser, "User not admitted");

		_transferFunds(totalCost);
		chefAvatar.mint(quantity, msg.sender);
	}

	/// @notice It will purchase the given amount of tokens for the user during the public sale phase
	/// @dev Only callable by during the public sale phase. The correct amount of ETH should be sent based on the current price or the call will revert
	/// @param quantity: the amount of tokens to purchase
	function publicBuy(uint256 quantity) external payable {
		SalePhases salePhase = getSalePhase();
		require(salePhase == SalePhases.PUBLIC_SALE, "public sale not active");

		uint256 totalCost = getCurrentPrice() * quantity;
		require(msg.value == totalCost, "Wrong amount sent");
		
		bool admitUser = admitPublicUser(quantity);
		require(admitUser, "User not admitted");

		_transferFunds(totalCost);
		chefAvatar.mint(quantity, msg.sender);
	}
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)

pragma solidity ^0.8.0;

import "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * By default, the owner account will be the one that deploys the contract. This
 * can later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the deployer as the initial owner.
     */
    constructor() {
        _transferOwnership(_msgSender());
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        require(owner() == _msgSender(), "Ownable: caller is not the owner");
        _;
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions anymore. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby removing any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        require(newOwner != address(0), "Ownable: new owner is the zero address");
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.0;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @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);

    /**
     * @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);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.0;

import "../IERC20.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));
        }
    }

    /**
     * @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 v4.4.1 (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`, checking first that contract recipients
     * are aware of the ERC721 protocol to prevent tokens from being forever locked.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Transfers `tokenId` token from `from` to `to`.
     *
     * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(
        address from,
        address to,
        uint256 tokenId
    ) external;

    /**
     * @dev Gives permission to `to` to transfer `tokenId` token to another account.
     * The approval is cleared when the token is transferred.
     *
     * Only a single account can be approved at a time, so approving the zero address clears previous approvals.
     *
     * Requirements:
     *
     * - The caller must own the token or be an approved operator.
     * - `tokenId` must exist.
     *
     * Emits an {Approval} event.
     */
    function approve(address to, uint256 tokenId) external;

    /**
     * @dev Returns the account approved for `tokenId` token.
     *
     * Requirements:
     *
     * - `tokenId` must exist.
     */
    function getApproved(uint256 tokenId) external view returns (address operator);

    /**
     * @dev Approve or remove `operator` as an operator for the caller.
     * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
     *
     * Requirements:
     *
     * - The `operator` cannot be the caller.
     *
     * Emits an {ApprovalForAll} event.
     */
    function setApprovalForAll(address operator, bool _approved) external;

    /**
     * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
     *
     * See {setApprovalForAll}
     */
    function isApprovedForAll(address owner, address operator) external view returns (bool);

    /**
     * @dev Safely transfers `tokenId` token from `from` to `to`.
     *
     * Requirements:
     *
     * - `from` cannot be the zero address.
     * - `to` cannot be the zero address.
     * - `tokenId` token must exist and be owned by `from`.
     * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
     * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
     *
     * Emits a {Transfer} event.
     */
    function safeTransferFrom(
        address from,
        address to,
        uint256 tokenId,
        bytes calldata data
    ) external;
}

File 6 of 20 : IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (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 `IERC721.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.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.5.0) (utils/Address.sol)

pragma solidity ^0.8.1;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev Returns true if `account` is a contract.
     *
     * [IMPORTANT]
     * ====
     * It is unsafe to assume that an address for which this function returns
     * false is an externally-owned account (EOA) and not a contract.
     *
     * Among others, `isContract` will return false for the following
     * types of addresses:
     *
     *  - an externally-owned account
     *  - a contract in construction
     *  - an address where a contract will be created
     *  - an address where a contract lived, but was destroyed
     * ====
     *
     * [IMPORTANT]
     * ====
     * You shouldn't rely on `isContract` to protect against flash loan attacks!
     *
     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
     * constructor.
     * ====
     */
    function isContract(address account) internal view returns (bool) {
        // This method relies on extcodesize/address.code.length, which returns 0
        // for contracts in construction, since the code is only stored at the end
        // of the constructor execution.

        return account.code.length > 0;
    }

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        require(address(this).balance >= amount, "Address: insufficient balance");

        (bool success, ) = recipient.call{value: amount}("");
        require(success, "Address: unable to send value, recipient may have reverted");
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason, it is bubbled up by this
     * function (like regular Solidity function calls).
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     *
     * _Available since v3.1._
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCall(target, data, "Address: low-level call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
     * `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value
    ) internal returns (bytes memory) {
        return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
    }

    /**
     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
     * with `errorMessage` as a fallback revert reason when `target` reverts.
     *
     * _Available since v3.1._
     */
    function functionCallWithValue(
        address target,
        bytes memory data,
        uint256 value,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(address(this).balance >= value, "Address: insufficient balance for call");
        require(isContract(target), "Address: call to non-contract");

        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        return functionStaticCall(target, data, "Address: low-level static call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a static call.
     *
     * _Available since v3.3._
     */
    function functionStaticCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal view returns (bytes memory) {
        require(isContract(target), "Address: static call to non-contract");

        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionDelegateCall(target, data, "Address: low-level delegate call failed");
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
     * but performing a delegate call.
     *
     * _Available since v3.4._
     */
    function functionDelegateCall(
        address target,
        bytes memory data,
        string memory errorMessage
    ) internal returns (bytes memory) {
        require(isContract(target), "Address: delegate call to non-contract");

        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResult(success, returndata, errorMessage);
    }

    /**
     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
     * revert reason using the provided one.
     *
     * _Available since v4.3._
     */
    function verifyCallResult(
        bool success,
        bytes memory returndata,
        string memory errorMessage
    ) internal pure returns (bytes memory) {
        if (success) {
            return returndata;
        } else {
            // Look for revert reason and bubble it up if present
            if (returndata.length > 0) {
                // The easiest way to bubble the revert reason is using memory via assembly

                assembly {
                    let returndata_size := mload(returndata)
                    revert(add(32, returndata), returndata_size)
                }
            } else {
                revert(errorMessage);
            }
        }
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)

pragma solidity ^0.8.0;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)

pragma solidity ^0.8.0;

/**
 * @dev String operations.
 */
library Strings {
    bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";

    /**
     * @dev Converts a `uint256` to its ASCII `string` decimal representation.
     */
    function toString(uint256 value) internal pure returns (string memory) {
        // Inspired by OraclizeAPI's implementation - MIT licence
        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol

        if (value == 0) {
            return "0";
        }
        uint256 temp = value;
        uint256 digits;
        while (temp != 0) {
            digits++;
            temp /= 10;
        }
        bytes memory buffer = new bytes(digits);
        while (value != 0) {
            digits -= 1;
            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
            value /= 10;
        }
        return string(buffer);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
     */
    function toHexString(uint256 value) internal pure returns (string memory) {
        if (value == 0) {
            return "0x00";
        }
        uint256 temp = value;
        uint256 length = 0;
        while (temp != 0) {
            length++;
            temp >>= 8;
        }
        return toHexString(value, length);
    }

    /**
     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
     */
    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
        bytes memory buffer = new bytes(2 * length + 2);
        buffer[0] = "0";
        buffer[1] = "x";
        for (uint256 i = 2 * length + 1; i > 1; --i) {
            buffer[i] = _HEX_SYMBOLS[value & 0xf];
            value >>= 4;
        }
        require(value == 0, "Strings: hex length insufficient");
        return string(buffer);
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/MerkleProof.sol)

pragma solidity ^0.8.0;

/**
 * @dev These functions deal with verification of Merkle Trees proofs.
 *
 * The proofs can be generated using the JavaScript library
 * https://github.com/miguelmota/merkletreejs[merkletreejs].
 * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled.
 *
 * See `test/utils/cryptography/MerkleProof.test.js` for some examples.
 */
library MerkleProof {
    /**
     * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree
     * defined by `root`. For this, a `proof` must be provided, containing
     * sibling hashes on the branch from the leaf to the root of the tree. Each
     * pair of leaves and each pair of pre-images are assumed to be sorted.
     */
    function verify(
        bytes32[] memory proof,
        bytes32 root,
        bytes32 leaf
    ) internal pure returns (bool) {
        return processProof(proof, leaf) == root;
    }

    /**
     * @dev Returns the rebuilt hash obtained by traversing a Merklee tree up
     * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt
     * hash matches the root of the tree. When processing the proof, the pairs
     * of leafs & pre-images are assumed to be sorted.
     *
     * _Available since v4.4._
     */
    function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) {
        bytes32 computedHash = leaf;
        for (uint256 i = 0; i < proof.length; i++) {
            bytes32 proofElement = proof[i];
            if (computedHash <= proofElement) {
                // Hash(current computed hash + current element of the proof)
                computedHash = _efficientHash(computedHash, proofElement);
            } else {
                // Hash(current element of the proof + current computed hash)
                computedHash = _efficientHash(proofElement, computedHash);
            }
        }
        return computedHash;
    }

    function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) {
        assembly {
            mstore(0x00, a)
            mstore(0x20, b)
            value := keccak256(0x00, 0x40)
        }
    }
}

// SPDX-License-Identifier: 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

pragma solidity ^0.8.4;

import "@openzeppelin/contracts/access/Ownable.sol";
import "erc721a/contracts/ERC721A.sol";
import './Sale/ChefSaleManager.sol';
import './Sale/ChefRevealProvider.sol';

contract ChefAvatar is ERC721A, Ownable {
    using Strings for uint256;

    event RevealProviderChanged(address newRevealProvider);
    event SaleManagerChanged(address newSaleManager);
    
    ChefRevealProvider public chefRevealProvider;
    ChefSaleManager public saleManager;

    uint256 public immutable maxSupply;
    string private _baseTokenURI;
    uint256 public revealOffset; // It will be used to shuffle IPFS files as (revealOffset + tokenId) % maxSupply

    constructor(
        uint256 _reserved,
        uint256 _maxSupply,
        address treasury,
        string memory name,
		string memory symbol,
        string memory baseTokenURI
    )
        ERC721A(name, symbol)
    {
        require(_reserved <= _maxSupply, "ChefAvatar: reserved must be less than or equal to maxSupply");

        maxSupply = _maxSupply;
        _baseTokenURI = baseTokenURI;

        if(_reserved > 0) { //not all projects have reserved tokens
            _mint(treasury, _reserved);
        }
    }

    function setChefRevealProvider(address _chefRevealProvider) external onlyOwner {
        chefRevealProvider = ChefRevealProvider(_chefRevealProvider);

        emit RevealProviderChanged(_chefRevealProvider);
    }
    
    function setChefSaleManager(address _chefSaleManager) external onlyOwner {
        saleManager = ChefSaleManager(_chefSaleManager);

        emit SaleManagerChanged(_chefSaleManager);
    }

    function _baseURI() internal view virtual override returns (string memory) {
        return _baseTokenURI;
    }

    function setBaseTokenURI(string calldata newTokenURI) onlyOwner public {
        _baseTokenURI = newTokenURI;
    }

    function exists(uint256 tokenId) external view returns (bool) {
        return _exists(tokenId);
    }

    function tokenURI(uint256 tokenId) public view override returns (string memory) {
        require(_exists(tokenId), "nonexistent token");

        uint256 offsetId = revealOffset == 0
            ? maxSupply // tokenId will always be less than maxSupply
            : tokenId;

        return string(abi.encodePacked(_baseTokenURI, offsetId.toString()));
    }

    function _mint(address to, uint256 quantity) private {
        require(totalSupply() + quantity <= maxSupply, "max supply reached");
        ERC721A._mint(to, quantity, '', true);
    }

    function mint(uint256 quantity, address to) public {
        require(msg.sender == address(saleManager), "only saleManager can mint");

        _mint(to, quantity);
    }


    /// @notice Request randomness from a user-provided seed
    /// @dev Only callable by the Owner.
    /// @param userProvidedSeed: extra entrpy for the VRF
    function callReveal(uint256 userProvidedSeed) external onlyOwner {
        require(revealOffset == 0, "Reveal already called");

        chefRevealProvider.getRandomNumber(userProvidedSeed);
    }
    
    function reveal(uint256 randomness) external {
        require(msg.sender == address(chefRevealProvider), "Only the Chef Reveal Provider can reveal");
        require(revealOffset == 0, "Reveal already called");

        revealOffset = randomness;
    }
}

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;

import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "../../Chainlink/VRFConsumerBase.sol";
import "../ChefAvatar.sol";

/// @title A title that should describe the contract/interface
/// https://docs.chain.link/docs/vrf-contracts/
/// You can get the keyhash and vrfCoordinator from here https://docs.chain.link/docs/vrf-contracts/
contract ChefRevealProvider is VRFConsumerBase, Ownable {
  using SafeERC20 for IERC20;

  uint256 public fee;
  uint256 public randomNumber;
  bytes32 public immutable keyHash;
  bytes32 public requestId;

  event FeeChanged(uint256 newFee);

  ChefAvatar public immutable chefAvatar;

  /// @dev Ctor
  /// @param VRFCoordinator: address of the VRF coordinator
  /// @param LINKToken: address of the LINK token
  constructor(
    address VRFCoordinator,
    address LINKToken,
    bytes32 _keyHash,
    uint256 _fee,
    ChefAvatar _chefAvatar
  )
    VRFConsumerBase(
			VRFCoordinator, // VRF Coordinator
			LINKToken  // LINK Token
		)
  {
    keyHash = _keyHash;
    fee = _fee;
    chefAvatar = _chefAvatar;
  }

  /// @notice Change the fee
  /// @param _fee: new fee (in LINK)
  function setFee(uint256 _fee) external onlyOwner {
    fee = _fee;

    emit FeeChanged(_fee);
  }

  /// @notice It allows the admin to withdraw tokens sent to the contract
  /// @dev Only callable by owner.
  /// @param token: the address of the token to withdraw
  /// @param amount: the number of token amount to withdraw
  function withdrawTokens(address token, uint256 amount) external onlyOwner {
    IERC20(token).safeTransfer(_msgSender(), amount);
  }

  /// @notice Request randomness from a user-provided seed
  /// @dev Only callable by RevealConsumer.
  /// @param userProvidedSeed: extra entrpy for the VRF
  function getRandomNumber(uint256 userProvidedSeed) external {
    require(msg.sender == address(chefAvatar), "only ChefAvatar");
    require(LINK.balanceOf(address(this)) >= fee, "insufficient LINK tokens");
    require(requestId == bytes32(0), "request already made");

    requestId = requestRandomness(keyHash, fee, userProvidedSeed);
  }

  /// @notice Callback function used by ChainLink's VRF Coordinator
  function fulfillRandomness(bytes32 incomingRequestId, uint256 randomness) internal override {
    require(incomingRequestId == requestId, "Wrong requestId");

    chefAvatar.reveal(randomness);
  }
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

import "./interfaces/ILinkToken.sol";

import "./VRFRequestIDBase.sol";

/** ****************************************************************************
 * @notice Interface for contracts using VRF randomness
 * *****************************************************************************
 * @dev PURPOSE
 *
 * @dev Reggie the Random Oracle (not his real job) wants to provide randomness
 * @dev to Vera the verifier in such a way that Vera can be sure he's not
 * @dev making his output up to suit himself. Reggie provides Vera a public key
 * @dev to which he knows the secret key. Each time Vera provides a seed to
 * @dev Reggie, he gives back a value which is computed completely
 * @dev deterministically from the seed and the secret key.
 *
 * @dev Reggie provides a proof by which Vera can verify that the output was
 * @dev correctly computed once Reggie tells it to her, but without that proof,
 * @dev the output is indistinguishable to her from a uniform random sample
 * @dev from the output space.
 *
 * @dev The purpose of this contract is to make it easy for unrelated contracts
 * @dev to talk to Vera the verifier about the work Reggie is doing, to provide
 * @dev simple access to a verifiable source of randomness.
 * *****************************************************************************
 * @dev USAGE
 *
 * @dev Calling contracts must inherit from VRFConsumerBase, and can
 * @dev initialize VRFConsumerBase's attributes in their constructor as
 * @dev shown:
 *
 * @dev   contract VRFConsumer {
 * @dev     constuctor(<other arguments>, address _vrfCoordinator, address _link)
 * @dev       VRFConsumerBase(_vrfCoordinator, _link) public {
 * @dev         <initialization with other arguments goes here>
 * @dev       }
 * @dev   }
 *
 * @dev The oracle will have given you an ID for the VRF keypair they have
 * @dev committed to (let's call it keyHash), and have told you the minimum LINK
 * @dev price for VRF service. Make sure your contract has sufficient LINK, and
 * @dev call requestRandomness(keyHash, fee, seed), where seed is the input you
 * @dev want to generate randomness from.
 *
 * @dev Once the VRFCoordinator has received and validated the oracle's response
 * @dev to your request, it will call your contract's fulfillRandomness method.
 *
 * @dev The randomness argument to fulfillRandomness is the actual random value
 * @dev generated from your seed.
 *
 * @dev The requestId argument is generated from the keyHash and the seed by
 * @dev makeRequestId(keyHash, seed). If your contract could have concurrent
 * @dev requests open, you can use the requestId to track which seed is
 * @dev associated with which randomness. See VRFRequestIDBase.sol for more
 * @dev details. (See "SECURITY CONSIDERATIONS" for principles to keep in mind,
 * @dev if your contract could have multiple requests in flight simultaneously.)
 *
 * @dev Colliding `requestId`s are cryptographically impossible as long as seeds
 * @dev differ. (Which is critical to making unpredictable randomness! See the
 * @dev next section.)
 *
 * *****************************************************************************
 * @dev SECURITY CONSIDERATIONS
 *
 * @dev A method with the ability to call your fulfillRandomness method directly
 * @dev could spoof a VRF response with any random value, so it's critical that
 * @dev it cannot be directly called by anything other than this base contract
 * @dev (specifically, by the VRFConsumerBase.rawFulfillRandomness method).
 *
 * @dev For your users to trust that your contract's random behavior is free
 * @dev from malicious interference, it's best if you can write it so that all
 * @dev behaviors implied by a VRF response are executed *during* your
 * @dev fulfillRandomness method. If your contract must store the response (or
 * @dev anything derived from it) and use it later, you must ensure that any
 * @dev user-significant behavior which depends on that stored value cannot be
 * @dev manipulated by a subsequent VRF request.
 *
 * @dev Similarly, both miners and the VRF oracle itself have some influence
 * @dev over the order in which VRF responses appear on the blockchain, so if
 * @dev your contract could have multiple VRF requests in flight simultaneously,
 * @dev you must ensure that the order in which the VRF responses arrive cannot
 * @dev be used to manipulate your contract's user-significant behavior.
 *
 * @dev Since the ultimate input to the VRF is mixed with the block hash of the
 * @dev block in which the request is made, user-provided seeds have no impact
 * @dev on its economic security properties. They are only included for API
 * @dev compatability with previous versions of this contract.
 *
 * @dev Since the block hash of the block which contains the requestRandomness
 * @dev call is mixed into the input to the VRF *last*, a sufficiently powerful
 * @dev miner could, in principle, fork the blockchain to evict the block
 * @dev containing the request, forcing the request to be included in a
 * @dev different block with a different hash, and therefore a different input
 * @dev to the VRF. However, such an attack would incur a substantial economic
 * @dev cost. This cost scales with the number of blocks the VRF oracle waits
 * @dev until it calls responds to a request.
 */
abstract contract VRFConsumerBase is VRFRequestIDBase {

	event RandomnessRequested(bytes32 requestId);

	/**
	 * @notice fulfillRandomness handles the VRF response. Your contract must
	 * @notice implement it. See "SECURITY CONSIDERATIONS" above for important
	 * @notice principles to keep in mind when implementing your fulfillRandomness
	 * @notice method.
	 *
	 * @dev VRFConsumerBase expects its subcontracts to have a method with this
	 * @dev signature, and will call it once it has verified the proof
	 * @dev associated with the randomness. (It is triggered via a call to
	 * @dev rawFulfillRandomness, below.)
	 *
	 * @param requestId The Id initially returned by requestRandomness
	 * @param randomness the VRF output
	 */
	function fulfillRandomness(bytes32 requestId, uint256 randomness)
		internal virtual;

	/**
	 * @notice requestRandomness initiates a request for VRF output given _seed
	 *
	 * @dev The fulfillRandomness method receives the output, once it's provided
	 * @dev by the Oracle, and verified by the vrfCoordinator.
	 *
	 * @dev The _keyHash must already be registered with the VRFCoordinator, and
	 * @dev the _fee must exceed the fee specified during registration of the
	 * @dev _keyHash.
	 *
	 * @dev The _seed parameter is vestigial, and is kept only for API
	 * @dev compatibility with older versions. It can't *hurt* to mix in some of
	 * @dev your own randomness, here, but it's not necessary because the VRF
	 * @dev oracle will mix the hash of the block containing your request into the
	 * @dev VRF seed it ultimately uses.
	 *
	 * @param _keyHash ID of public key against which randomness is generated
	 * @param _fee The amount of LINK to send with the request
	 * @param _seed seed mixed into the input of the VRF.
	 *
	 * @return requestId unique ID for this request
	 *
	 * @dev The returned requestId can be used to distinguish responses to
	 * @dev concurrent requests. It is passed as the first argument to
	 * @dev fulfillRandomness.
	 */
	function requestRandomness(bytes32 _keyHash, uint256 _fee, uint256 _seed)
		internal returns (bytes32 requestId)
	{
		LINK.transferAndCall(vrfCoordinator, _fee, abi.encode(_keyHash, _seed));
		// This is the seed passed to VRFCoordinator. The oracle will mix this with
		// the hash of the block containing this request to obtain the seed/input
		// which is finally passed to the VRF cryptographic machinery.
		uint256 vRFSeed  = makeVRFInputSeed(_keyHash, _seed, address(this), nonces[_keyHash]);
		// nonces[_keyHash] must stay in sync with
		// VRFCoordinator.nonces[_keyHash][this], which was incremented by the above
		// successful LINK.transferAndCall (in VRFCoordinator.randomnessRequest).
		// This provides protection against the user repeating their input seed,
		// which would result in a predictable/duplicate output, if multiple such
		// requests appeared in the same block.
		nonces[_keyHash] = nonces[_keyHash] + 1;
		bytes32 requestId = makeRequestId(_keyHash, vRFSeed);

		emit RandomnessRequested(requestId);

		return requestId;
	}

	ILinkToken immutable internal LINK;
	address immutable private vrfCoordinator;

	// Nonces for each VRF key from which randomness has been requested.
	//
	// Must stay in sync with VRFCoordinator[_keyHash][this]
	mapping(bytes32 /* keyHash */ => uint256 /* nonce */) private nonces;

	/**
	 * @param _vrfCoordinator address of VRFCoordinator contract
	 * @param _link address of LINK token contract
	 *
	 * @dev https://docs.chain.link/docs/link-token-contracts
	 */
	constructor(address _vrfCoordinator, address _link) {
		vrfCoordinator = _vrfCoordinator;
		LINK = ILinkToken(_link);
	}

	// rawFulfillRandomness is called by VRFCoordinator when it receives a valid VRF
	// proof. rawFulfillRandomness then calls fulfillRandomness, after validating
	// the origin of the call
	function rawFulfillRandomness(bytes32 requestId, uint256 randomness) external {
		require(msg.sender == vrfCoordinator, "Only VRFCoordinator can fulfill");
		fulfillRandomness(requestId, randomness);
	}
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

contract VRFRequestIDBase {

	/**
	 * @notice returns the seed which is actually input to the VRF coordinator
	 *
	 * @dev To prevent repetition of VRF output due to repetition of the
	 * @dev user-supplied seed, that seed is combined in a hash with the
	 * @dev user-specific nonce, and the address of the consuming contract. The
	 * @dev risk of repetition is mostly mitigated by inclusion of a blockhash in
	 * @dev the final seed, but the nonce does protect against repetition in
	 * @dev requests which are included in a single block.
	 *
	 * @param _userSeed VRF seed input provided by user
	 * @param _requester Address of the requesting contract
	 * @param _nonce User-specific nonce at the time of the request
	 */
	function makeVRFInputSeed(bytes32 _keyHash, uint256 _userSeed,
		address _requester, uint256 _nonce)
		internal pure returns (uint256)
	{
		return  uint256(keccak256(abi.encode(_keyHash, _userSeed, _requester, _nonce)));
	}

	/**
	 * @notice Returns the id for this request
	 * @param _keyHash The serviceAgreement ID to be used for this request
	 * @param _vRFInputSeed The seed to be passed directly to the VRF
	 * @return The id for this request
	 *
	 * @dev Note that _vRFInputSeed is not the seed passed by the consuming
	 * @dev contract, but the one generated by makeVRFInputSeed
	 */
	function makeRequestId(
		bytes32 _keyHash, uint256 _vRFInputSeed) internal pure returns (bytes32) {
		return keccak256(abi.encodePacked(_keyHash, _vRFInputSeed));
	}
}

// SPDX-License-Identifier: MIT
pragma solidity 0.8.10;

interface ILinkToken {
	function allowance(address owner, address spender) external view returns (uint256 remaining);
	function approve(address spender, uint256 value) external returns (bool success);
	function balanceOf(address owner) external view returns (uint256 balance);
	function decimals() external view returns (uint8 decimalPlaces);
	function decreaseApproval(address spender, uint256 addedValue) external returns (bool success);
	function increaseApproval(address spender, uint256 subtractedValue) external;
	function name() external view returns (string memory tokenName);
	function symbol() external view returns (string memory tokenSymbol);
	function totalSupply() external view returns (uint256 totalTokensIssued);
	function transfer(address to, uint256 value) external returns (bool success);
	function transferAndCall(address to, uint256 value, bytes memory data) external returns (bool success);
	function transferFrom(address from, address to, uint256 value) external returns (bool success);
}

// 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 AuxQueryForZeroAddress();
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 extension. Built to optimize for lower gas during batch mints.
 *
 * Assumes serials are sequentially minted starting at _startTokenId() (defaults to 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**256 - 1 (max value of uint256).
 */
contract ERC721A is Context, ERC165, IERC721, IERC721Metadata {
    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;
        // For miscellaneous variable(s) pertaining to the address
        // (e.g. number of whitelist mint slots used).
        // If there are multiple variables, please pack them into a uint64.
        uint64 aux;
    }

    // The tokenId of the next token to be minted.
    uint256 internal _currentIndex;

    // The number of tokens burned.
    uint256 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_;
        _currentIndex = _startTokenId();
    }

    /**
     * To change the starting tokenId, please override this function.
     */
    function _startTokenId() internal view virtual returns (uint256) {
        return 0;
    }

    /**
     * @dev See {IERC721Enumerable-totalSupply}.
     * @dev Burned tokens are calculated here, use _totalMinted() if you want to count just minted tokens.
     */
    function totalSupply() public view returns (uint256) {
        // Counter underflow is impossible as _burnCounter cannot be incremented
        // more than _currentIndex - _startTokenId() times
        unchecked {
            return _currentIndex - _burnCounter - _startTokenId();
        }
    }

    /**
     * Returns the total amount of tokens minted in the contract.
     */
    function _totalMinted() internal view returns (uint256) {
        // Counter underflow is impossible as _currentIndex does not decrement,
        // and it is initialized to _startTokenId()
        unchecked {
            return _currentIndex - _startTokenId();
        }
    }

    /**
     * @dev See {IERC165-supportsInterface}.
     */
    function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
        return
            interfaceId == type(IERC721).interfaceId ||
            interfaceId == type(IERC721Metadata).interfaceId ||
            super.supportsInterface(interfaceId);
    }

    /**
     * @dev See {IERC721-balanceOf}.
     */
    function balanceOf(address owner) public view override returns (uint256) {
        if (owner == address(0)) revert BalanceQueryForZeroAddress();
        return uint256(_addressData[owner].balance);
    }

    /**
     * Returns the number of tokens minted by `owner`.
     */
    function _numberMinted(address owner) internal view returns (uint256) {
        if (owner == address(0)) revert MintedQueryForZeroAddress();
        return uint256(_addressData[owner].numberMinted);
    }

    /**
     * Returns the number of tokens burned by or on behalf of `owner`.
     */
    function _numberBurned(address owner) internal view returns (uint256) {
        if (owner == address(0)) revert BurnedQueryForZeroAddress();
        return uint256(_addressData[owner].numberBurned);
    }

    /**
     * Returns the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
     */
    function _getAux(address owner) internal view returns (uint64) {
        if (owner == address(0)) revert AuxQueryForZeroAddress();
        return _addressData[owner].aux;
    }

    /**
     * Sets the auxillary data for `owner`. (e.g. number of whitelist mint slots used).
     * If there are multiple variables, please pack them into a uint64.
     */
    function _setAux(address owner, uint64 aux) internal {
        if (owner == address(0)) revert AuxQueryForZeroAddress();
        _addressData[owner].aux = aux;
    }

    /**
     * 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 (_startTokenId() <= curr && 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 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 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 (to.isContract() && !_checkContractOnERC721Received(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 _startTokenId() <= tokenId && 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 > 1.8e19 (2**64) - 1
        // updatedIndex overflows if _currentIndex + quantity > 1.2e77 (2**256) - 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;
            uint256 end = updatedIndex + quantity;

            if (safe && to.isContract()) {
                do {
                    emit Transfer(address(0), to, updatedIndex);
                    if (!_checkContractOnERC721Received(address(0), to, updatedIndex++, _data)) {
                        revert TransferToNonERC721ReceiverImplementer();
                    }
                } while (updatedIndex != end);
                // Reentrancy protection
                if (_currentIndex != startTokenId) revert();
            } else {
                do {
                    emit Transfer(address(0), to, updatedIndex++);
                } while (updatedIndex != end);
            }
            _currentIndex = 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**256.
        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**256.
        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 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 _checkContractOnERC721Received(
        address from,
        address to,
        uint256 tokenId,
        bytes memory _data
    ) private returns (bool) {
        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))
                }
            }
        }
    }

    /**
     * @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 {}
}

Settings
{
  "evmVersion": "london",
  "libraries": {},
  "metadata": {
    "bytecodeHash": "ipfs",
    "useLiteralContent": true
  },
  "optimizer": {
    "enabled": false,
    "runs": 200
  },
  "remappings": [],
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  }
}

Contract Security Audit

Contract ABI

API
[{"inputs":[{"internalType":"uint256","name":"_presalePrice","type":"uint256"},{"internalType":"uint256","name":"_publicPrice","type":"uint256"},{"internalType":"contract ChefAvatar","name":"_chefAvatar","type":"address"},{"internalType":"address","name":"_treasury","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newDutchStartPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDutchEndPrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDutchPriceStepDrecrease","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDutchStartTime","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newDutchStep","type":"uint256"}],"name":"DutchAuctionConfigurationChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"newMerkleRoot","type":"bytes32"}],"name":"MerkleRootChanged","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":"uint256","name":"newPresaleStart","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPresaleLength","type":"uint256"}],"name":"PresaleConfigChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPresalePrice","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"newPublicFixedPrice","type":"uint256"}],"name":"PricesChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPublicStart","type":"uint256"}],"name":"PublicSaleConfigChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newPublicSaleMaxPurchaseQuantity","type":"uint256"}],"name":"PublicSaleMaxPurchaseQuantityChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum ChefSaleManager.PublicSalePricingModel","name":"newPublicSalePricingModel","type":"uint8"}],"name":"PublicSalePricingModelChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newTreasury","type":"address"}],"name":"TreasuryChanged","type":"event"},{"inputs":[],"name":"chefAvatar","outputs":[{"internalType":"contract ChefAvatar","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_dutchStartPrice","type":"uint256"},{"internalType":"uint256","name":"_dutchEndPrice","type":"uint256"},{"internalType":"uint256","name":"_dutchPriceStepDrecrease","type":"uint256"},{"internalType":"uint256","name":"_dutchStartTime","type":"uint256"},{"internalType":"uint256","name":"_dutchStep","type":"uint256"}],"name":"configureDutch","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"dutchAuction","outputs":[{"internalType":"uint256","name":"dutchStartPrice","type":"uint256"},{"internalType":"uint256","name":"dutchEndPrice","type":"uint256"},{"internalType":"uint256","name":"dutchPriceStepDrecrease","type":"uint256"},{"internalType":"uint256","name":"dutchStartTime","type":"uint256"},{"internalType":"uint256","name":"dutchStep","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrentPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getSalePhase","outputs":[{"internalType":"enum ChefSaleManager.SalePhases","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"uint256","name":"maxQuantity","type":"uint256"},{"internalType":"bytes32[]","name":"proofs","type":"bytes32[]"}],"name":"presaleBuy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"presaleChefs","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleLength","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presalePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"presaleStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"quantity","type":"uint256"}],"name":"publicBuy","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"publicFixedPrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSaleMaxPurchaseQuantity","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicSalePricingModel","outputs":[{"internalType":"enum ChefSaleManager.PublicSalePricingModel","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"publicSalePurchasesPerAddress","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicStart","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_presaleStart","type":"uint256"},{"internalType":"uint256","name":"_presaleLength","type":"uint256"}],"name":"setPresaleConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_presalePrice","type":"uint256"},{"internalType":"uint256","name":"_publicPrice","type":"uint256"}],"name":"setPrices","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_publicStart","type":"uint256"}],"name":"setPublicConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"newAmount","type":"uint256"}],"name":"setPublicSaleMaxPurchaseQuantity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"enum ChefSaleManager.PublicSalePricingModel","name":"pricingModel","type":"uint8"}],"name":"setPublicSalePricingModel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}]

608060405262ed4e00426200001591906200022a565b6005556201518060065562ed4e00426200003091906200022a565b60075560036008553480156200004557600080fd5b5060405162002f1b38038062002f1b83398181016040528101906200006b919062000367565b6200008b6200007f6200012560201b60201c565b6200012d60201b60201c565b836001819055508260028190555081600360006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050505050620003d9565b600033905090565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b6000819050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60006200023782620001f1565b91506200024483620001f1565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff038211156200027c576200027b620001fb565b5b828201905092915050565b600080fd5b6200029781620001f1565b8114620002a357600080fd5b50565b600081519050620002b7816200028c565b92915050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000620002ea82620002bd565b9050919050565b6000620002fe82620002dd565b9050919050565b6200031081620002f1565b81146200031c57600080fd5b50565b600081519050620003308162000305565b92915050565b6200034181620002dd565b81146200034d57600080fd5b50565b600081519050620003618162000336565b92915050565b6000806000806080858703121562000384576200038362000287565b5b60006200039487828801620002a6565b9450506020620003a787828801620002a6565b9350506040620003ba878288016200031f565b9250506060620003cd8782880162000350565b91505092959194509250565b612b3280620003e96000396000f3fe6080604052600436106101b65760003560e01c80638c0dc498116100ec578063c0188b6b1161008a578063eb91d37e11610064578063eb91d37e146105ab578063efca6e9e146105d6578063f0f4426014610601578063f2fde38b1461062a576101b6565b8063c0188b6b14610539578063c09416bb14610555578063de8801e514610580576101b6565b806398c0ba80116100c657806398c0ba801461048b5780639da0d7d4146104b6578063a419f3f3146104e5578063a5f4c6ff1461050e576101b6565b80638c0dc4981461040e5780638da5cb5b14610437578063979db8a914610462576101b6565b806358aaf18c11610159578063715018a611610133578063715018a61461036657806373c4d81e1461037d5780637632b21e146103ba5780637cb64759146103e5576101b6565b806358aaf18c146102e25780635ff9df6e146102fe57806361d027b31461033b576101b6565b80632eb4a7ab116101955780632eb4a7ab146102385780634ade034b146102635780634d1c86461461028e5780634e3befd3146102b7576101b6565b80620e7fa8146101bb57806305fefda7146101e65780631cae01931461020f575b600080fd5b3480156101c757600080fd5b506101d0610653565b6040516101dd9190611b17565b60405180910390f35b3480156101f257600080fd5b5061020d60048036038101906102089190611b68565b610659565b005b34801561021b57600080fd5b5061023660048036038101906102319190611ba8565b610720565b005b34801561024457600080fd5b5061024d6107dd565b60405161025a9190611bee565b60405180910390f35b34801561026f57600080fd5b506102786107e3565b6040516102859190611b17565b60405180910390f35b34801561029a57600080fd5b506102b560048036038101906102b09190611c2e565b6107e9565b005b3480156102c357600080fd5b506102cc6108c9565b6040516102d99190611cd2565b60405180910390f35b6102fc60048036038101906102f79190611d52565b610918565b005b34801561030a57600080fd5b5061032560048036038101906103209190611e24565b610ad5565b6040516103329190611b17565b60405180910390f35b34801561034757600080fd5b50610350610aed565b60405161035d9190611e60565b60405180910390f35b34801561037257600080fd5b5061037b610b13565b005b34801561038957600080fd5b506103a4600480360381019061039f9190611e24565b610b9b565b6040516103b19190611b17565b60405180910390f35b3480156103c657600080fd5b506103cf610bb3565b6040516103dc9190611b17565b60405180910390f35b3480156103f157600080fd5b5061040c60048036038101906104079190611ea7565b610bb9565b005b34801561041a57600080fd5b5061043560048036038101906104309190611b68565b610c76565b005b34801561044357600080fd5b5061044c610d3d565b6040516104599190611e60565b60405180910390f35b34801561046e57600080fd5b5061048960048036038101906104849190611ba8565b610d66565b005b34801561049757600080fd5b506104a0610e23565b6040516104ad9190611f33565b60405180910390f35b3480156104c257600080fd5b506104cb610e49565b6040516104dc959493929190611f4e565b60405180910390f35b3480156104f157600080fd5b5061050c60048036038101906105079190611fa1565b610e6d565b005b34801561051a57600080fd5b506105236110ae565b6040516105309190611b17565b60405180910390f35b610553600480360381019061054e9190611ba8565b6110b4565b005b34801561056157600080fd5b5061056a61126a565b6040516105779190611b17565b60405180910390f35b34801561058c57600080fd5b50610595611270565b6040516105a29190611b17565b60405180910390f35b3480156105b757600080fd5b506105c0611276565b6040516105cd9190611b17565b60405180910390f35b3480156105e257600080fd5b506105eb6113f1565b6040516105f89190612064565b60405180910390f35b34801561060d57600080fd5b5061062860048036038101906106239190611e24565b611404565b005b34801561063657600080fd5b50610651600480360381019061064c9190611e24565b6114fb565b005b60015481565b6106616115f3565b73ffffffffffffffffffffffffffffffffffffffff1661067f610d3d565b73ffffffffffffffffffffffffffffffffffffffff16146106d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cc906120dc565b60405180910390fd5b81600181905550806002819055507f80aade646210706e24b438e253bdb9596f344bc718597854cba4a597f4db8f9382826040516107149291906120fc565b60405180910390a15050565b6107286115f3565b73ffffffffffffffffffffffffffffffffffffffff16610746610d3d565b73ffffffffffffffffffffffffffffffffffffffff161461079c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610793906120dc565b60405180910390fd5b806008819055507fca8113490c92374f7a5c275d8a7de468a1af463070800f68487a1356567c2f67816040516107d29190611b17565b60405180910390a150565b60095481565b60085481565b6107f16115f3565b73ffffffffffffffffffffffffffffffffffffffff1661080f610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085c906120dc565b60405180910390fd5b80601160006101000a81548160ff0219169083600181111561088a57610889611c5b565b5b02179055507fb406fd672faba51005db81dd9a9d9503d0ba75cac8593b7e1482205095a83057816040516108be9190612064565b60405180910390a150565b60006005544210156108de5760009050610915565b6006546005546108ee9190612154565b4210156108fe5760019050610915565b60075442106109105760029050610915565b600090505b90565b60006109226108c9565b90506001600281111561093857610937611c5b565b5b81600281111561094b5761094a611c5b565b5b1461098b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610982906121f6565b60405180910390fd5b600085610996611276565b6109a09190612216565b90508034146109e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109db906122bc565b60405180910390fd5b60006109f2878787876115fb565b905080610a34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2b90612328565b60405180910390fd5b610a3d82611749565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166394bf804d88336040518363ffffffff1660e01b8152600401610a9a929190612348565b600060405180830381600087803b158015610ab457600080fd5b505af1158015610ac8573d6000803e3d6000fd5b5050505050505050505050565b60106020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b1b6115f3565b73ffffffffffffffffffffffffffffffffffffffff16610b39610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b86906120dc565b60405180910390fd5b610b99600061185d565b565b600f6020528060005260406000206000915090505481565b60025481565b610bc16115f3565b73ffffffffffffffffffffffffffffffffffffffff16610bdf610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610c35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2c906120dc565b60405180910390fd5b806009819055507f1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c81604051610c6b9190611bee565b60405180910390a150565b610c7e6115f3565b73ffffffffffffffffffffffffffffffffffffffff16610c9c610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610cf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce9906120dc565b60405180910390fd5b81600581905550806006819055507f5ec762be0cf8b29424e084eea17d9648e3470a9457704680545b1e97959f42a98282604051610d319291906120fc565b60405180910390a15050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610d6e6115f3565b73ffffffffffffffffffffffffffffffffffffffff16610d8c610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd9906120dc565b60405180910390fd5b806007819055507fa3bbb2b8b982a90f75d465769316f8ad3c13c0fdb5307ab43071c7787907809c81604051610e189190611b17565b60405180910390a150565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a8060000154908060010154908060020154908060030154908060040154905085565b610e756115f3565b73ffffffffffffffffffffffffffffffffffffffff16610e93610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610ee9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee0906120dc565b60405180910390fd5b838511610f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2290612409565b60405180910390fd5b60008311610f6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f659061249b565b60405180910390fd5b42821015610fb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa890612553565b60405180910390fd5b60008111610ff4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610feb906125e5565b60405180910390fd5b808211611036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102d90612677565b60405180910390fd5b84600a6000018190555083600a6001018190555082600a6002018190555081600a6003018190555080600a600401819055507fdb4c922535fa7d05beb33ae92ab821510d407b85be2345c891a8557a4f3ef8a1858585858560405161109f959493929190611f4e565b60405180910390a15050505050565b60075481565b60006110be6108c9565b90506002808111156110d3576110d2611c5b565b5b8160028111156110e6576110e5611c5b565b5b14611126576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111d906126e3565b60405180910390fd5b600082611131611276565b61113b9190612216565b905080341461117f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611176906122bc565b60405180910390fd5b600061118a84611921565b9050806111cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c390612328565b60405180910390fd5b6111d582611749565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166394bf804d85336040518363ffffffff1660e01b8152600401611232929190612348565b600060405180830381600087803b15801561124c57600080fd5b505af1158015611260573d6000803e3d6000fd5b5050505050505050565b60065481565b60055481565b6000806112816108c9565b90506001600281111561129757611296611c5b565b5b8160028111156112aa576112a9611c5b565b5b14156112bb576001549150506113ee565b6002808111156112ce576112cd611c5b565b5b8160028111156112e1576112e0611c5b565b5b14801561132057506001808111156112fc576112fb611c5b565b5b601160009054906101000a900460ff16600181111561131e5761131d611c5b565b5b145b156113355761132d6119c5565b9150506113ee565b60028081111561134857611347611c5b565b5b81600281111561135b5761135a611c5b565b5b14801561139b57506000600181111561137757611376611c5b565b5b601160009054906101000a900460ff16600181111561139957611398611c5b565b5b145b156113ab576002549150506113ee565b60006113ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e39061274f565b60405180910390fd5b505b90565b601160009054906101000a900460ff1681565b61140c6115f3565b73ffffffffffffffffffffffffffffffffffffffff1661142a610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614611480576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611477906120dc565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fc714d22a2f08b695f81e7c707058db484aa5b4d6b4c9fd64beb10fe85832f608816040516114f09190611e60565b60405180910390a150565b6115036115f3565b73ffffffffffffffffffffffffffffffffffffffff16611521610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614611577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156e906120dc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115de906127e1565b60405180910390fd5b6115f08161185d565b50565b600033905090565b60008061169a848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050600954338860405160200161165992919061286a565b6040516020818303038152906040528051906020012060405160200161167f91906128b7565b60405160208183030381529060405280519060200120611a5b565b905085601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116eb9190612154565b9250508190555084601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115801561173e5750805b915050949350505050565b80341461178b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117829061291e565b60405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16826040516117d39061296f565b60006040518083038185875af1925050503d8060008114611810576040519150601f19603f3d011682016040523d82523d6000602084013e611815565b606091505b5050905080611859576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611850906129d0565b60405180910390fd5b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546119729190612154565b92505081905550600854600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411159050919050565b600080600a60030154426119d991906129f0565b90506000600a60040154826119ee9190612a53565b90506000600a6002015482611a039190612216565b9050600a60000154811115611a2257600a600101549350505050611a58565b600081600a60000154611a3591906129f0565b9050600a60010154811015611a4f57600a60010154611a51565b805b9450505050505b90565b600082611a688584611a72565b1490509392505050565b60008082905060005b8451811015611adc576000858281518110611a9957611a98612a84565b5b60200260200101519050808311611abb57611ab48382611ae7565b9250611ac8565b611ac58184611ae7565b92505b508080611ad490612ab3565b915050611a7b565b508091505092915050565b600082600052816020526040600020905092915050565b6000819050919050565b611b1181611afe565b82525050565b6000602082019050611b2c6000830184611b08565b92915050565b600080fd5b600080fd5b611b4581611afe565b8114611b5057600080fd5b50565b600081359050611b6281611b3c565b92915050565b60008060408385031215611b7f57611b7e611b32565b5b6000611b8d85828601611b53565b9250506020611b9e85828601611b53565b9150509250929050565b600060208284031215611bbe57611bbd611b32565b5b6000611bcc84828501611b53565b91505092915050565b6000819050919050565b611be881611bd5565b82525050565b6000602082019050611c036000830184611bdf565b92915050565b60028110611c1657600080fd5b50565b600081359050611c2881611c09565b92915050565b600060208284031215611c4457611c43611b32565b5b6000611c5284828501611c19565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110611c9b57611c9a611c5b565b5b50565b6000819050611cac82611c8a565b919050565b6000611cbc82611c9e565b9050919050565b611ccc81611cb1565b82525050565b6000602082019050611ce76000830184611cc3565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112611d1257611d11611ced565b5b8235905067ffffffffffffffff811115611d2f57611d2e611cf2565b5b602083019150836020820283011115611d4b57611d4a611cf7565b5b9250929050565b60008060008060608587031215611d6c57611d6b611b32565b5b6000611d7a87828801611b53565b9450506020611d8b87828801611b53565b935050604085013567ffffffffffffffff811115611dac57611dab611b37565b5b611db887828801611cfc565b925092505092959194509250565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611df182611dc6565b9050919050565b611e0181611de6565b8114611e0c57600080fd5b50565b600081359050611e1e81611df8565b92915050565b600060208284031215611e3a57611e39611b32565b5b6000611e4884828501611e0f565b91505092915050565b611e5a81611de6565b82525050565b6000602082019050611e756000830184611e51565b92915050565b611e8481611bd5565b8114611e8f57600080fd5b50565b600081359050611ea181611e7b565b92915050565b600060208284031215611ebd57611ebc611b32565b5b6000611ecb84828501611e92565b91505092915050565b6000819050919050565b6000611ef9611ef4611eef84611dc6565b611ed4565b611dc6565b9050919050565b6000611f0b82611ede565b9050919050565b6000611f1d82611f00565b9050919050565b611f2d81611f12565b82525050565b6000602082019050611f486000830184611f24565b92915050565b600060a082019050611f636000830188611b08565b611f706020830187611b08565b611f7d6040830186611b08565b611f8a6060830185611b08565b611f976080830184611b08565b9695505050505050565b600080600080600060a08688031215611fbd57611fbc611b32565b5b6000611fcb88828901611b53565b9550506020611fdc88828901611b53565b9450506040611fed88828901611b53565b9350506060611ffe88828901611b53565b925050608061200f88828901611b53565b9150509295509295909350565b6002811061202d5761202c611c5b565b5b50565b600081905061203e8261201c565b919050565b600061204e82612030565b9050919050565b61205e81612043565b82525050565b60006020820190506120796000830184612055565b92915050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120c660208361207f565b91506120d182612090565b602082019050919050565b600060208201905081810360008301526120f5816120b9565b9050919050565b60006040820190506121116000830185611b08565b61211e6020830184611b08565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061215f82611afe565b915061216a83611afe565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561219f5761219e612125565b5b828201905092915050565b7f70726573616c65206e6f74206163746976650000000000000000000000000000600082015250565b60006121e060128361207f565b91506121eb826121aa565b602082019050919050565b6000602082019050818103600083015261220f816121d3565b9050919050565b600061222182611afe565b915061222c83611afe565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561226557612264612125565b5b828202905092915050565b7f57726f6e6720616d6f756e742073656e74000000000000000000000000000000600082015250565b60006122a660118361207f565b91506122b182612270565b602082019050919050565b600060208201905081810360008301526122d581612299565b9050919050565b7f55736572206e6f742061646d6974746564000000000000000000000000000000600082015250565b600061231260118361207f565b915061231d826122dc565b602082019050919050565b6000602082019050818103600083015261234181612305565b9050919050565b600060408201905061235d6000830185611b08565b61236a6020830184611e51565b9392505050565b7f4368656653616c654d616e616765723a2064757463685374617274507269636560008201527f206d7573742062652067726561746572207468616e206475746368456e64507260208201527f6963650000000000000000000000000000000000000000000000000000000000604082015250565b60006123f360438361207f565b91506123fe82612371565b606082019050919050565b60006020820190508181036000830152612422816123e6565b9050919050565b7f4368656653616c654d616e616765723a2064757463685072696365537465704460008201527f7265637265617365206d7573742062652067726561746572207468616e203000602082015250565b6000612485603f8361207f565b915061249082612429565b604082019050919050565b600060208201905081810360008301526124b481612478565b9050919050565b7f4368656653616c654d616e616765723a206475746368537461727454696d652060008201527f6d7573742062652067726561746572207468616e206f7220657175616c20746f60208201527f20626c6f636b2e74696d657374616d7000000000000000000000000000000000604082015250565b600061253d60508361207f565b9150612548826124bb565b606082019050919050565b6000602082019050818103600083015261256c81612530565b9050919050565b7f4368656653616c654d616e616765723a20647574636853746570206d7573742060008201527f62652067726561746572207468616e2030000000000000000000000000000000602082015250565b60006125cf60318361207f565b91506125da82612573565b604082019050919050565b600060208201905081810360008301526125fe816125c2565b9050919050565b7f4368656653616c654d616e616765723a206475746368537461727454696d652060008201527f6d7573742062652067726561746572207468616e206475746368537465700000602082015250565b6000612661603e8361207f565b915061266c82612605565b604082019050919050565b6000602082019050818103600083015261269081612654565b9050919050565b7f7075626c69632073616c65206e6f742061637469766500000000000000000000600082015250565b60006126cd60168361207f565b91506126d882612697565b602082019050919050565b600060208201905081810360008301526126fc816126c0565b9050919050565b7f496e76616c696420706861736500000000000000000000000000000000000000600082015250565b6000612739600d8361207f565b915061274482612703565b602082019050919050565b600060208201905081810360008301526127688161272c565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006127cb60268361207f565b91506127d68261276f565b604082019050919050565b600060208201905081810360008301526127fa816127be565b9050919050565b60008160601b9050919050565b600061281982612801565b9050919050565b600061282b8261280e565b9050919050565b61284361283e82611de6565b612820565b82525050565b6000819050919050565b61286461285f82611afe565b612849565b82525050565b60006128768285612832565b6014820191506128868284612853565b6020820191508190509392505050565b6000819050919050565b6128b16128ac82611bd5565b612896565b82525050565b60006128c382846128a0565b60208201915081905092915050565b7f77726f6e6720616d6f756e740000000000000000000000000000000000000000600082015250565b6000612908600c8361207f565b9150612913826128d2565b602082019050919050565b60006020820190508181036000830152612937816128fb565b9050919050565b600081905092915050565b50565b600061295960008361293e565b915061296482612949565b600082019050919050565b600061297a8261294c565b9150819050919050565b7f7472616e73666572206661696c65640000000000000000000000000000000000600082015250565b60006129ba600f8361207f565b91506129c582612984565b602082019050919050565b600060208201905081810360008301526129e9816129ad565b9050919050565b60006129fb82611afe565b9150612a0683611afe565b925082821015612a1957612a18612125565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612a5e82611afe565b9150612a6983611afe565b925082612a7957612a78612a24565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612abe82611afe565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612af157612af0612125565b5b60018201905091905056fea2646970667358221220e537b50e983ca41c46cb6ed6a3e5cb2af9d47afbf16b811c109daa74e20b85ce64736f6c634300080a003300000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000152cc0b640fa85fecff43d2a417fa9b369661b97000000000000000000000000ddaff95c5bad81dfd176d57a0df6a2ac7594193b

Deployed Bytecode

0x6080604052600436106101b65760003560e01c80638c0dc498116100ec578063c0188b6b1161008a578063eb91d37e11610064578063eb91d37e146105ab578063efca6e9e146105d6578063f0f4426014610601578063f2fde38b1461062a576101b6565b8063c0188b6b14610539578063c09416bb14610555578063de8801e514610580576101b6565b806398c0ba80116100c657806398c0ba801461048b5780639da0d7d4146104b6578063a419f3f3146104e5578063a5f4c6ff1461050e576101b6565b80638c0dc4981461040e5780638da5cb5b14610437578063979db8a914610462576101b6565b806358aaf18c11610159578063715018a611610133578063715018a61461036657806373c4d81e1461037d5780637632b21e146103ba5780637cb64759146103e5576101b6565b806358aaf18c146102e25780635ff9df6e146102fe57806361d027b31461033b576101b6565b80632eb4a7ab116101955780632eb4a7ab146102385780634ade034b146102635780634d1c86461461028e5780634e3befd3146102b7576101b6565b80620e7fa8146101bb57806305fefda7146101e65780631cae01931461020f575b600080fd5b3480156101c757600080fd5b506101d0610653565b6040516101dd9190611b17565b60405180910390f35b3480156101f257600080fd5b5061020d60048036038101906102089190611b68565b610659565b005b34801561021b57600080fd5b5061023660048036038101906102319190611ba8565b610720565b005b34801561024457600080fd5b5061024d6107dd565b60405161025a9190611bee565b60405180910390f35b34801561026f57600080fd5b506102786107e3565b6040516102859190611b17565b60405180910390f35b34801561029a57600080fd5b506102b560048036038101906102b09190611c2e565b6107e9565b005b3480156102c357600080fd5b506102cc6108c9565b6040516102d99190611cd2565b60405180910390f35b6102fc60048036038101906102f79190611d52565b610918565b005b34801561030a57600080fd5b5061032560048036038101906103209190611e24565b610ad5565b6040516103329190611b17565b60405180910390f35b34801561034757600080fd5b50610350610aed565b60405161035d9190611e60565b60405180910390f35b34801561037257600080fd5b5061037b610b13565b005b34801561038957600080fd5b506103a4600480360381019061039f9190611e24565b610b9b565b6040516103b19190611b17565b60405180910390f35b3480156103c657600080fd5b506103cf610bb3565b6040516103dc9190611b17565b60405180910390f35b3480156103f157600080fd5b5061040c60048036038101906104079190611ea7565b610bb9565b005b34801561041a57600080fd5b5061043560048036038101906104309190611b68565b610c76565b005b34801561044357600080fd5b5061044c610d3d565b6040516104599190611e60565b60405180910390f35b34801561046e57600080fd5b5061048960048036038101906104849190611ba8565b610d66565b005b34801561049757600080fd5b506104a0610e23565b6040516104ad9190611f33565b60405180910390f35b3480156104c257600080fd5b506104cb610e49565b6040516104dc959493929190611f4e565b60405180910390f35b3480156104f157600080fd5b5061050c60048036038101906105079190611fa1565b610e6d565b005b34801561051a57600080fd5b506105236110ae565b6040516105309190611b17565b60405180910390f35b610553600480360381019061054e9190611ba8565b6110b4565b005b34801561056157600080fd5b5061056a61126a565b6040516105779190611b17565b60405180910390f35b34801561058c57600080fd5b50610595611270565b6040516105a29190611b17565b60405180910390f35b3480156105b757600080fd5b506105c0611276565b6040516105cd9190611b17565b60405180910390f35b3480156105e257600080fd5b506105eb6113f1565b6040516105f89190612064565b60405180910390f35b34801561060d57600080fd5b5061062860048036038101906106239190611e24565b611404565b005b34801561063657600080fd5b50610651600480360381019061064c9190611e24565b6114fb565b005b60015481565b6106616115f3565b73ffffffffffffffffffffffffffffffffffffffff1661067f610d3d565b73ffffffffffffffffffffffffffffffffffffffff16146106d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016106cc906120dc565b60405180910390fd5b81600181905550806002819055507f80aade646210706e24b438e253bdb9596f344bc718597854cba4a597f4db8f9382826040516107149291906120fc565b60405180910390a15050565b6107286115f3565b73ffffffffffffffffffffffffffffffffffffffff16610746610d3d565b73ffffffffffffffffffffffffffffffffffffffff161461079c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610793906120dc565b60405180910390fd5b806008819055507fca8113490c92374f7a5c275d8a7de468a1af463070800f68487a1356567c2f67816040516107d29190611b17565b60405180910390a150565b60095481565b60085481565b6107f16115f3565b73ffffffffffffffffffffffffffffffffffffffff1661080f610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610865576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161085c906120dc565b60405180910390fd5b80601160006101000a81548160ff0219169083600181111561088a57610889611c5b565b5b02179055507fb406fd672faba51005db81dd9a9d9503d0ba75cac8593b7e1482205095a83057816040516108be9190612064565b60405180910390a150565b60006005544210156108de5760009050610915565b6006546005546108ee9190612154565b4210156108fe5760019050610915565b60075442106109105760029050610915565b600090505b90565b60006109226108c9565b90506001600281111561093857610937611c5b565b5b81600281111561094b5761094a611c5b565b5b1461098b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610982906121f6565b60405180910390fd5b600085610996611276565b6109a09190612216565b90508034146109e4576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109db906122bc565b60405180910390fd5b60006109f2878787876115fb565b905080610a34576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a2b90612328565b60405180910390fd5b610a3d82611749565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166394bf804d88336040518363ffffffff1660e01b8152600401610a9a929190612348565b600060405180830381600087803b158015610ab457600080fd5b505af1158015610ac8573d6000803e3d6000fd5b5050505050505050505050565b60106020528060005260406000206000915090505481565b600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b610b1b6115f3565b73ffffffffffffffffffffffffffffffffffffffff16610b39610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b86906120dc565b60405180910390fd5b610b99600061185d565b565b600f6020528060005260406000206000915090505481565b60025481565b610bc16115f3565b73ffffffffffffffffffffffffffffffffffffffff16610bdf610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610c35576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610c2c906120dc565b60405180910390fd5b806009819055507f1b930366dfeaa7eb3b325021e4ae81e36527063452ee55b86c95f85b36f4c31c81604051610c6b9190611bee565b60405180910390a150565b610c7e6115f3565b73ffffffffffffffffffffffffffffffffffffffff16610c9c610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610cf2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ce9906120dc565b60405180910390fd5b81600581905550806006819055507f5ec762be0cf8b29424e084eea17d9648e3470a9457704680545b1e97959f42a98282604051610d319291906120fc565b60405180910390a15050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b610d6e6115f3565b73ffffffffffffffffffffffffffffffffffffffff16610d8c610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610de2576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610dd9906120dc565b60405180910390fd5b806007819055507fa3bbb2b8b982a90f75d465769316f8ad3c13c0fdb5307ab43071c7787907809c81604051610e189190611b17565b60405180910390a150565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600a8060000154908060010154908060020154908060030154908060040154905085565b610e756115f3565b73ffffffffffffffffffffffffffffffffffffffff16610e93610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614610ee9576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610ee0906120dc565b60405180910390fd5b838511610f2b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f2290612409565b60405180910390fd5b60008311610f6e576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610f659061249b565b60405180910390fd5b42821015610fb1576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610fa890612553565b60405180910390fd5b60008111610ff4576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610feb906125e5565b60405180910390fd5b808211611036576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161102d90612677565b60405180910390fd5b84600a6000018190555083600a6001018190555082600a6002018190555081600a6003018190555080600a600401819055507fdb4c922535fa7d05beb33ae92ab821510d407b85be2345c891a8557a4f3ef8a1858585858560405161109f959493929190611f4e565b60405180910390a15050505050565b60075481565b60006110be6108c9565b90506002808111156110d3576110d2611c5b565b5b8160028111156110e6576110e5611c5b565b5b14611126576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161111d906126e3565b60405180910390fd5b600082611131611276565b61113b9190612216565b905080341461117f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611176906122bc565b60405180910390fd5b600061118a84611921565b9050806111cc576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016111c390612328565b60405180910390fd5b6111d582611749565b600360009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166394bf804d85336040518363ffffffff1660e01b8152600401611232929190612348565b600060405180830381600087803b15801561124c57600080fd5b505af1158015611260573d6000803e3d6000fd5b5050505050505050565b60065481565b60055481565b6000806112816108c9565b90506001600281111561129757611296611c5b565b5b8160028111156112aa576112a9611c5b565b5b14156112bb576001549150506113ee565b6002808111156112ce576112cd611c5b565b5b8160028111156112e1576112e0611c5b565b5b14801561132057506001808111156112fc576112fb611c5b565b5b601160009054906101000a900460ff16600181111561131e5761131d611c5b565b5b145b156113355761132d6119c5565b9150506113ee565b60028081111561134857611347611c5b565b5b81600281111561135b5761135a611c5b565b5b14801561139b57506000600181111561137757611376611c5b565b5b601160009054906101000a900460ff16600181111561139957611398611c5b565b5b145b156113ab576002549150506113ee565b60006113ec576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016113e39061274f565b60405180910390fd5b505b90565b601160009054906101000a900460ff1681565b61140c6115f3565b73ffffffffffffffffffffffffffffffffffffffff1661142a610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614611480576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611477906120dc565b60405180910390fd5b80600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055507fc714d22a2f08b695f81e7c707058db484aa5b4d6b4c9fd64beb10fe85832f608816040516114f09190611e60565b60405180910390a150565b6115036115f3565b73ffffffffffffffffffffffffffffffffffffffff16611521610d3d565b73ffffffffffffffffffffffffffffffffffffffff1614611577576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161156e906120dc565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614156115e7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016115de906127e1565b60405180910390fd5b6115f08161185d565b50565b600033905090565b60008061169a848480806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050600954338860405160200161165992919061286a565b6040516020818303038152906040528051906020012060405160200161167f91906128b7565b60405160208183030381529060405280519060200120611a5b565b905085601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546116eb9190612154565b9250508190555084601060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541115801561173e5750805b915050949350505050565b80341461178b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016117829061291e565b60405180910390fd5b6000600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16826040516117d39061296f565b60006040518083038185875af1925050503d8060008114611810576040519150601f19603f3d011682016040523d82523d6000602084013e611815565b606091505b5050905080611859576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401611850906129d0565b60405180910390fd5b5050565b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff169050816000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e060405160405180910390a35050565b600081600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008282546119729190612154565b92505081905550600854600f60003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205411159050919050565b600080600a60030154426119d991906129f0565b90506000600a60040154826119ee9190612a53565b90506000600a6002015482611a039190612216565b9050600a60000154811115611a2257600a600101549350505050611a58565b600081600a60000154611a3591906129f0565b9050600a60010154811015611a4f57600a60010154611a51565b805b9450505050505b90565b600082611a688584611a72565b1490509392505050565b60008082905060005b8451811015611adc576000858281518110611a9957611a98612a84565b5b60200260200101519050808311611abb57611ab48382611ae7565b9250611ac8565b611ac58184611ae7565b92505b508080611ad490612ab3565b915050611a7b565b508091505092915050565b600082600052816020526040600020905092915050565b6000819050919050565b611b1181611afe565b82525050565b6000602082019050611b2c6000830184611b08565b92915050565b600080fd5b600080fd5b611b4581611afe565b8114611b5057600080fd5b50565b600081359050611b6281611b3c565b92915050565b60008060408385031215611b7f57611b7e611b32565b5b6000611b8d85828601611b53565b9250506020611b9e85828601611b53565b9150509250929050565b600060208284031215611bbe57611bbd611b32565b5b6000611bcc84828501611b53565b91505092915050565b6000819050919050565b611be881611bd5565b82525050565b6000602082019050611c036000830184611bdf565b92915050565b60028110611c1657600080fd5b50565b600081359050611c2881611c09565b92915050565b600060208284031215611c4457611c43611b32565b5b6000611c5284828501611c19565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60038110611c9b57611c9a611c5b565b5b50565b6000819050611cac82611c8a565b919050565b6000611cbc82611c9e565b9050919050565b611ccc81611cb1565b82525050565b6000602082019050611ce76000830184611cc3565b92915050565b600080fd5b600080fd5b600080fd5b60008083601f840112611d1257611d11611ced565b5b8235905067ffffffffffffffff811115611d2f57611d2e611cf2565b5b602083019150836020820283011115611d4b57611d4a611cf7565b5b9250929050565b60008060008060608587031215611d6c57611d6b611b32565b5b6000611d7a87828801611b53565b9450506020611d8b87828801611b53565b935050604085013567ffffffffffffffff811115611dac57611dab611b37565b5b611db887828801611cfc565b925092505092959194509250565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000611df182611dc6565b9050919050565b611e0181611de6565b8114611e0c57600080fd5b50565b600081359050611e1e81611df8565b92915050565b600060208284031215611e3a57611e39611b32565b5b6000611e4884828501611e0f565b91505092915050565b611e5a81611de6565b82525050565b6000602082019050611e756000830184611e51565b92915050565b611e8481611bd5565b8114611e8f57600080fd5b50565b600081359050611ea181611e7b565b92915050565b600060208284031215611ebd57611ebc611b32565b5b6000611ecb84828501611e92565b91505092915050565b6000819050919050565b6000611ef9611ef4611eef84611dc6565b611ed4565b611dc6565b9050919050565b6000611f0b82611ede565b9050919050565b6000611f1d82611f00565b9050919050565b611f2d81611f12565b82525050565b6000602082019050611f486000830184611f24565b92915050565b600060a082019050611f636000830188611b08565b611f706020830187611b08565b611f7d6040830186611b08565b611f8a6060830185611b08565b611f976080830184611b08565b9695505050505050565b600080600080600060a08688031215611fbd57611fbc611b32565b5b6000611fcb88828901611b53565b9550506020611fdc88828901611b53565b9450506040611fed88828901611b53565b9350506060611ffe88828901611b53565b925050608061200f88828901611b53565b9150509295509295909350565b6002811061202d5761202c611c5b565b5b50565b600081905061203e8261201c565b919050565b600061204e82612030565b9050919050565b61205e81612043565b82525050565b60006020820190506120796000830184612055565b92915050565b600082825260208201905092915050565b7f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572600082015250565b60006120c660208361207f565b91506120d182612090565b602082019050919050565b600060208201905081810360008301526120f5816120b9565b9050919050565b60006040820190506121116000830185611b08565b61211e6020830184611b08565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600061215f82611afe565b915061216a83611afe565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0382111561219f5761219e612125565b5b828201905092915050565b7f70726573616c65206e6f74206163746976650000000000000000000000000000600082015250565b60006121e060128361207f565b91506121eb826121aa565b602082019050919050565b6000602082019050818103600083015261220f816121d3565b9050919050565b600061222182611afe565b915061222c83611afe565b9250817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff048311821515161561226557612264612125565b5b828202905092915050565b7f57726f6e6720616d6f756e742073656e74000000000000000000000000000000600082015250565b60006122a660118361207f565b91506122b182612270565b602082019050919050565b600060208201905081810360008301526122d581612299565b9050919050565b7f55736572206e6f742061646d6974746564000000000000000000000000000000600082015250565b600061231260118361207f565b915061231d826122dc565b602082019050919050565b6000602082019050818103600083015261234181612305565b9050919050565b600060408201905061235d6000830185611b08565b61236a6020830184611e51565b9392505050565b7f4368656653616c654d616e616765723a2064757463685374617274507269636560008201527f206d7573742062652067726561746572207468616e206475746368456e64507260208201527f6963650000000000000000000000000000000000000000000000000000000000604082015250565b60006123f360438361207f565b91506123fe82612371565b606082019050919050565b60006020820190508181036000830152612422816123e6565b9050919050565b7f4368656653616c654d616e616765723a2064757463685072696365537465704460008201527f7265637265617365206d7573742062652067726561746572207468616e203000602082015250565b6000612485603f8361207f565b915061249082612429565b604082019050919050565b600060208201905081810360008301526124b481612478565b9050919050565b7f4368656653616c654d616e616765723a206475746368537461727454696d652060008201527f6d7573742062652067726561746572207468616e206f7220657175616c20746f60208201527f20626c6f636b2e74696d657374616d7000000000000000000000000000000000604082015250565b600061253d60508361207f565b9150612548826124bb565b606082019050919050565b6000602082019050818103600083015261256c81612530565b9050919050565b7f4368656653616c654d616e616765723a20647574636853746570206d7573742060008201527f62652067726561746572207468616e2030000000000000000000000000000000602082015250565b60006125cf60318361207f565b91506125da82612573565b604082019050919050565b600060208201905081810360008301526125fe816125c2565b9050919050565b7f4368656653616c654d616e616765723a206475746368537461727454696d652060008201527f6d7573742062652067726561746572207468616e206475746368537465700000602082015250565b6000612661603e8361207f565b915061266c82612605565b604082019050919050565b6000602082019050818103600083015261269081612654565b9050919050565b7f7075626c69632073616c65206e6f742061637469766500000000000000000000600082015250565b60006126cd60168361207f565b91506126d882612697565b602082019050919050565b600060208201905081810360008301526126fc816126c0565b9050919050565b7f496e76616c696420706861736500000000000000000000000000000000000000600082015250565b6000612739600d8361207f565b915061274482612703565b602082019050919050565b600060208201905081810360008301526127688161272c565b9050919050565b7f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160008201527f6464726573730000000000000000000000000000000000000000000000000000602082015250565b60006127cb60268361207f565b91506127d68261276f565b604082019050919050565b600060208201905081810360008301526127fa816127be565b9050919050565b60008160601b9050919050565b600061281982612801565b9050919050565b600061282b8261280e565b9050919050565b61284361283e82611de6565b612820565b82525050565b6000819050919050565b61286461285f82611afe565b612849565b82525050565b60006128768285612832565b6014820191506128868284612853565b6020820191508190509392505050565b6000819050919050565b6128b16128ac82611bd5565b612896565b82525050565b60006128c382846128a0565b60208201915081905092915050565b7f77726f6e6720616d6f756e740000000000000000000000000000000000000000600082015250565b6000612908600c8361207f565b9150612913826128d2565b602082019050919050565b60006020820190508181036000830152612937816128fb565b9050919050565b600081905092915050565b50565b600061295960008361293e565b915061296482612949565b600082019050919050565b600061297a8261294c565b9150819050919050565b7f7472616e73666572206661696c65640000000000000000000000000000000000600082015250565b60006129ba600f8361207f565b91506129c582612984565b602082019050919050565b600060208201905081810360008301526129e9816129ad565b9050919050565b60006129fb82611afe565b9150612a0683611afe565b925082821015612a1957612a18612125565b5b828203905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b6000612a5e82611afe565b9150612a6983611afe565b925082612a7957612a78612a24565b5b828204905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b6000612abe82611afe565b91507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff821415612af157612af0612125565b5b60018201905091905056fea2646970667358221220e537b50e983ca41c46cb6ed6a3e5cb2af9d47afbf16b811c109daa74e20b85ce64736f6c634300080a0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000152cc0b640fa85fecff43d2a417fa9b369661b97000000000000000000000000ddaff95c5bad81dfd176d57a0df6a2ac7594193b

-----Decoded View---------------
Arg [0] : _presalePrice (uint256): 0
Arg [1] : _publicPrice (uint256): 0
Arg [2] : _chefAvatar (address): 0x152Cc0B640FA85fECFf43d2a417fA9B369661B97
Arg [3] : _treasury (address): 0xddaff95C5BAD81dFd176D57A0dF6A2AC7594193B

-----Encoded View---------------
4 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 000000000000000000000000152cc0b640fa85fecff43d2a417fa9b369661b97
Arg [3] : 000000000000000000000000ddaff95c5bad81dfd176d57a0df6a2ac7594193b


Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.