Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- HexToysLootBoxFactory
- Optimization enabled
- true
- Compiler version
- v0.8.17+commit.8df45f5f
- Optimization runs
- 200
- EVM Version
- default
- Verified at
- 2023-06-28T15:50:02.225265Z
contracts/lootbox/HexToysLootBoxFactory.sol
// Multiple PixelPimp HexToysLootBox Factory contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "./HexToysLootBox.sol";
contract HexToysLootBoxFactory is OwnableUpgradeable {
using SafeMath for uint256;
/** Create HexToysLootBox fee (PLS) */
uint256 public creatingFee;
uint256 public serviceFee;
address[] public boxes;
// collection address => creator address
mapping(address => address) public boxCreators;
/** Events */
event HexToysMysteryBoxCreated(address box_address, address owner, string name, string uri, address paymentToken, uint256 price);
event FeeUpdated(uint256 old_fee, uint256 new_fee);
function initialize() public initializer {
__Ownable_init();
creatingFee = 100000 ether;
serviceFee = 21; // 21 for 2.1%
}
function createHexToysMysteryBox(string memory _name,
string memory _uri,
address _tokenAddress,
uint256 _price) external payable {
require(msg.value >= creatingFee, "insufficient fee");
bytes memory bytecode = type(HexToysLootBox).creationCode;
bytes32 salt = keccak256(abi.encodePacked(_name, _tokenAddress, block.timestamp));
address payable mysterybox;
assembly {
mysterybox := create2(0, add(bytecode, 32), mload(bytecode), salt)
}
HexToysLootBox(mysterybox).initialize(_name, _uri, _tokenAddress, _price, msg.sender);
boxes.push(mysterybox);
boxCreators[mysterybox] = msg.sender;
emit HexToysMysteryBoxCreated(mysterybox, msg.sender, _name, _uri, _tokenAddress, _price);
}
function updateCreatingFee(uint256 _fee) public onlyOwner {
uint256 oldFee = creatingFee;
creatingFee = _fee;
emit FeeUpdated(oldFee, _fee);
}
function updateServiceFee(uint256 _serviceFee) public onlyOwner {
serviceFee = _serviceFee;
}
function withdrawCoin() public onlyOwner {
uint balance = address(this).balance;
require(balance > 0, "insufficient balance");
(bool result, ) = payable(msg.sender).call{value: balance}("");
require(result, "Failed to Withdraw");
}
function withdrawToken(address tokenAddress) external onlyOwner {
IERC20 token = IERC20(tokenAddress);
uint balance = token.balanceOf(address(this));
require(balance > 0, "insufficient balance");
require(token.transfer(msg.sender, balance));
}
receive() external payable {}
}
@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import "../proxy/utils/Initializable.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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling 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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library AddressUpgradeable {
/**
* @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
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [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://consensys.net/diligence/blog/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.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
import "../proxy/utils/Initializable.sol";
/**
* @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 ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
@openzeppelin/contracts/token/ERC1155/IERC1155.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC1155/IERC1155.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC1155 compliant contract, as defined in the
* https://eips.ethereum.org/EIPS/eip-1155[EIP].
*
* _Available since v3.1._
*/
interface IERC1155 is IERC165 {
/**
* @dev Emitted when `value` tokens of token type `id` are transferred from `from` to `to` by `operator`.
*/
event TransferSingle(address indexed operator, address indexed from, address indexed to, uint256 id, uint256 value);
/**
* @dev Equivalent to multiple {TransferSingle} events, where `operator`, `from` and `to` are the same for all
* transfers.
*/
event TransferBatch(
address indexed operator,
address indexed from,
address indexed to,
uint256[] ids,
uint256[] values
);
/**
* @dev Emitted when `account` grants or revokes permission to `operator` to transfer their tokens, according to
* `approved`.
*/
event ApprovalForAll(address indexed account, address indexed operator, bool approved);
/**
* @dev Emitted when the URI for token type `id` changes to `value`, if it is a non-programmatic URI.
*
* If an {URI} event was emitted for `id`, the standard
* https://eips.ethereum.org/EIPS/eip-1155#metadata-extensions[guarantees] that `value` will equal the value
* returned by {IERC1155MetadataURI-uri}.
*/
event URI(string value, uint256 indexed id);
/**
* @dev Returns the amount of tokens of token type `id` owned by `account`.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function balanceOf(address account, uint256 id) external view returns (uint256);
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {balanceOf}.
*
* Requirements:
*
* - `accounts` and `ids` must have the same length.
*/
function balanceOfBatch(
address[] calldata accounts,
uint256[] calldata ids
) external view returns (uint256[] memory);
/**
* @dev Grants or revokes permission to `operator` to transfer the caller's tokens, according to `approved`,
*
* Emits an {ApprovalForAll} event.
*
* Requirements:
*
* - `operator` cannot be the caller.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns true if `operator` is approved to transfer ``account``'s tokens.
*
* See {setApprovalForAll}.
*/
function isApprovedForAll(address account, address operator) external view returns (bool);
/**
* @dev Transfers `amount` tokens of token type `id` from `from` to `to`.
*
* Emits a {TransferSingle} event.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - If the caller is not `from`, it must have been approved to spend ``from``'s tokens via {setApprovalForAll}.
* - `from` must have a balance of tokens of type `id` of at least `amount`.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155Received} and return the
* acceptance magic value.
*/
function safeTransferFrom(address from, address to, uint256 id, uint256 amount, bytes calldata data) external;
/**
* @dev xref:ROOT:erc1155.adoc#batch-operations[Batched] version of {safeTransferFrom}.
*
* Emits a {TransferBatch} event.
*
* Requirements:
*
* - `ids` and `amounts` must have the same length.
* - If `to` refers to a smart contract, it must implement {IERC1155Receiver-onERC1155BatchReceived} and return the
* acceptance magic value.
*/
function safeBatchTransferFrom(
address from,
address to,
uint256[] calldata ids,
uint256[] calldata amounts,
bytes calldata data
) external;
}
@openzeppelin/contracts/token/ERC1155/IERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/IERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev _Available since v3.1._
*/
interface IERC1155Receiver is IERC165 {
/**
* @dev Handles the receipt of a single ERC1155 token type. This function is
* called at the end of a `safeTransferFrom` after the balance has been updated.
*
* NOTE: To accept the transfer, this must return
* `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))`
* (i.e. 0xf23a6e61, or its own function selector).
*
* @param operator The address which initiated the transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param id The ID of the token being transferred
* @param value The amount of tokens being transferred
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` if transfer is allowed
*/
function onERC1155Received(
address operator,
address from,
uint256 id,
uint256 value,
bytes calldata data
) external returns (bytes4);
/**
* @dev Handles the receipt of a multiple ERC1155 token types. This function
* is called at the end of a `safeBatchTransferFrom` after the balances have
* been updated.
*
* NOTE: To accept the transfer(s), this must return
* `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))`
* (i.e. 0xbc197c81, or its own function selector).
*
* @param operator The address which initiated the batch transfer (i.e. msg.sender)
* @param from The address which previously owned the token
* @param ids An array containing ids of each token being transferred (order and length must match values array)
* @param values An array containing amounts of each token being transferred (order and length must match ids array)
* @param data Additional data with no specified format
* @return `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` if transfer is allowed
*/
function onERC1155BatchReceived(
address operator,
address from,
uint256[] calldata ids,
uint256[] calldata values,
bytes calldata data
) external returns (bytes4);
}
@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC1155/utils/ERC1155Holder.sol)
pragma solidity ^0.8.0;
import "./ERC1155Receiver.sol";
/**
* Simple implementation of `ERC1155Receiver` that will allow a contract to hold ERC1155 tokens.
*
* IMPORTANT: When inheriting this contract, you must include a way to use the received tokens, otherwise they will be
* stuck.
*
* @dev _Available since v3.1._
*/
contract ERC1155Holder is ERC1155Receiver {
function onERC1155Received(
address,
address,
uint256,
uint256,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155Received.selector;
}
function onERC1155BatchReceived(
address,
address,
uint256[] memory,
uint256[] memory,
bytes memory
) public virtual override returns (bytes4) {
return this.onERC1155BatchReceived.selector;
}
}
@openzeppelin/contracts/token/ERC1155/utils/ERC1155Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC1155/utils/ERC1155Receiver.sol)
pragma solidity ^0.8.0;
import "../IERC1155Receiver.sol";
import "../../../utils/introspection/ERC165.sol";
/**
* @dev _Available since v3.1._
*/
abstract contract ERC1155Receiver is ERC165, IERC1155Receiver {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override(ERC165, IERC165) returns (bool) {
return interfaceId == type(IERC1155Receiver).interfaceId || super.supportsInterface(interfaceId);
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
@openzeppelin/contracts/token/ERC721/IERC721.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol)
pragma solidity ^0.8.0;
import "../../utils/introspection/IERC165.sol";
/**
* @dev Required interface of an ERC721 compliant contract.
*/
interface IERC721 is IERC165 {
/**
* @dev Emitted when `tokenId` token is transferred from `from` to `to`.
*/
event Transfer(address indexed from, address indexed to, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables `approved` to manage the `tokenId` token.
*/
event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId);
/**
* @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets.
*/
event ApprovalForAll(address indexed owner, address indexed operator, bool approved);
/**
* @dev Returns the number of tokens in ``owner``'s account.
*/
function balanceOf(address owner) external view returns (uint256 balance);
/**
* @dev Returns the owner of the `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function ownerOf(uint256 tokenId) external view returns (address owner);
/**
* @dev Safely transfers `tokenId` token from `from` to `to`.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external;
/**
* @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients
* are aware of the ERC721 protocol to prevent tokens from being forever locked.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must exist and be owned by `from`.
* - If the caller is not `from`, it must have been allowed to move this token by either {approve} or {setApprovalForAll}.
* - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer.
*
* Emits a {Transfer} event.
*/
function safeTransferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Transfers `tokenId` token from `from` to `to`.
*
* WARNING: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721
* or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must
* understand this adds an external call which potentially creates a reentrancy vulnerability.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `tokenId` token must be owned by `from`.
* - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 tokenId) external;
/**
* @dev Gives permission to `to` to transfer `tokenId` token to another account.
* The approval is cleared when the token is transferred.
*
* Only a single account can be approved at a time, so approving the zero address clears previous approvals.
*
* Requirements:
*
* - The caller must own the token or be an approved operator.
* - `tokenId` must exist.
*
* Emits an {Approval} event.
*/
function approve(address to, uint256 tokenId) external;
/**
* @dev Approve or remove `operator` as an operator for the caller.
* Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller.
*
* Requirements:
*
* - The `operator` cannot be the caller.
*
* Emits an {ApprovalForAll} event.
*/
function setApprovalForAll(address operator, bool approved) external;
/**
* @dev Returns the account approved for `tokenId` token.
*
* Requirements:
*
* - `tokenId` must exist.
*/
function getApproved(uint256 tokenId) external view returns (address operator);
/**
* @dev Returns if the `operator` is allowed to manage all of the assets of `owner`.
*
* See {setApprovalForAll}
*/
function isApprovedForAll(address owner, address operator) external view returns (bool);
}
@openzeppelin/contracts/token/ERC721/IERC721Receiver.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC721/IERC721Receiver.sol)
pragma solidity ^0.8.0;
/**
* @title ERC721 token receiver interface
* @dev Interface for any contract that wants to support safeTransfers
* from ERC721 asset contracts.
*/
interface IERC721Receiver {
/**
* @dev Whenever an {IERC721} `tokenId` token is transferred to this contract via {IERC721-safeTransferFrom}
* by `operator` from `from`, this function is called.
*
* It must return its Solidity selector to confirm the token transfer.
* If any other value is returned or the interface is not implemented by the recipient, the transfer will be reverted.
*
* The selector can be obtained in Solidity with `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(
address operator,
address from,
uint256 tokenId,
bytes calldata data
) external returns (bytes4);
}
@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/utils/ERC721Holder.sol)
pragma solidity ^0.8.0;
import "../IERC721Receiver.sol";
/**
* @dev Implementation of the {IERC721Receiver} interface.
*
* Accepts all token transfers.
* Make sure the contract is able to use its token with {IERC721-safeTransferFrom}, {IERC721-approve} or {IERC721-setApprovalForAll}.
*/
contract ERC721Holder is IERC721Receiver {
/**
* @dev See {IERC721Receiver-onERC721Received}.
*
* Always returns `IERC721Receiver.onERC721Received.selector`.
*/
function onERC721Received(address, address, uint256, bytes memory) public virtual override returns (bytes4) {
return this.onERC721Received.selector;
}
}
@openzeppelin/contracts/utils/introspection/ERC165.sol
// 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;
}
}
@openzeppelin/contracts/utils/introspection/IERC165.sol
// 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);
}
@openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
@openzeppelin/contracts/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}
contracts/lootbox/HexToysLootBox.sol
// Multiple Fixed HexToysLootBox contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/token/ERC721/IERC721.sol";
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/token/ERC721/utils/ERC721Holder.sol";
import "@openzeppelin/contracts/token/ERC1155/utils/ERC1155Holder.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
interface IHexToysMysteryBoxFactory {
function serviceFee() external view returns (uint256);
}
contract HexToysLootBox is ERC1155Holder, ERC721Holder {
using SafeMath for uint256;
using EnumerableSet for EnumerableSet.AddressSet;
using EnumerableSet for EnumerableSet.Bytes32Set;
/**
Card Struct
*/
struct Card {
uint256 cardType; // 0: ERC721, 1: ERC1155
bytes32 key; // card key which was generated with collection and tokenId
address collectionId; // collection address
uint256 tokenId; // token id of collection
uint256 amount; // added nft token balances
}
address public factory;
address public owner;
address public tokenAddress;
uint256 public price;
uint256 public constant PERCENTS_DIVIDER = 1000;
string public boxName;
string public boxUri;
bool public status = true;
// This is a set which contains cardKey
mapping(bytes32 => Card) public _cards;
EnumerableSet.Bytes32Set private _cardIndices;
// The amount of cards in this mysterybox.
uint256 public cardAmount;
event AddToken(
uint256 cardType,
bytes32 key,
address collectionId,
uint256 tokenId,
uint256 amount,
uint256 _cardAmount
);
event SpinResult(address player, bytes32 key, uint256 _cardAmount);
event RemoveCard(bytes32 key, uint256 removeAmount, uint256 _cardAmount);
event EmergencyWithdrawAllCards(bytes32[] keys, uint256 _cardAmount);
event PriceChanged(uint256 newPrice);
event PaymentTokenChanged(address newTokenAddress);
event HexToysMysteryBoxStatus(bool boxStatus);
event OwnerShipChanged(address newAccount);
event HexToysMysteryBoxNameChanged(string newName);
event HexToysMysteryBoxUriChanged(string newUri);
constructor() {
factory = msg.sender;
}
function initialize(
string memory _name,
string memory _uri,
address _tokenAddress,
uint256 _price,
address _owner
) public onlyFactory {
boxName = _name;
boxUri = _uri;
tokenAddress = _tokenAddress;
price = _price;
owner = _owner;
}
// ***************************
// For Change Parameters ***********
// ***************************
function changePrice(uint256 newPrice) public onlyOwner {
price = newPrice;
emit PriceChanged(newPrice);
}
function changePaymentToken(address _newTokenAddress) external onlyOwner {
tokenAddress = _newTokenAddress;
emit PaymentTokenChanged(_newTokenAddress);
}
function enableThisHexToysMysteryBox() public onlyOwner {
status = true;
emit HexToysMysteryBoxStatus(status);
}
function disableThisHexToysMysteryBox() public onlyOwner {
status = false;
emit HexToysMysteryBoxStatus(status);
}
function transferOwner(address account) public onlyOwner {
require(account != address(0), "Ownable: new owner is zero address");
owner = account;
emit OwnerShipChanged(account);
}
function removeOwnership() public onlyOwner {
owner = address(0x0);
emit OwnerShipChanged(owner);
}
function changeHexToysMysteryBoxName(string memory name) public onlyOwner {
boxName = name;
emit HexToysMysteryBoxNameChanged(name);
}
function changeHexToysMysteryBoxUri(string memory _uri) public onlyOwner {
boxUri = _uri;
emit HexToysMysteryBoxUriChanged(_uri);
}
// ***************************
// For Main function ***********
// ***************************
function addToken(
uint256 cardType,
address collection,
uint256 tokenId,
uint256 amount
) public onlyOwner {
require((cardType == 0 || cardType == 1), "Invalid card type");
if (cardType == 0) {
require(
IERC721(collection).ownerOf(tokenId) == msg.sender,
"You are not token owner"
);
IERC721(collection).safeTransferFrom(
msg.sender,
address(this),
tokenId
);
} else if (cardType == 1) {
require(
IERC1155(collection).balanceOf(msg.sender, tokenId) >= amount,
"You don't have enough Tokens"
);
IERC1155(collection).safeTransferFrom(
msg.sender,
address(this),
tokenId,
amount,
"Add Card"
);
}
bytes32 key = itemKeyFromId(collection, tokenId);
if (_cards[key].amount == 0) {
_cardIndices.add(key);
}
_cards[key].cardType = cardType;
_cards[key].key = key;
_cards[key].collectionId = collection;
_cards[key].tokenId = tokenId;
_cards[key].amount = _cards[key].amount.add(amount);
cardAmount = cardAmount.add(amount);
emit AddToken(cardType, key, collection, tokenId, amount, cardAmount);
}
function addTokenBatch(
uint256[] memory cardTypes,
address[] memory collections,
uint256[] memory tokenIds,
uint256[] memory amounts
) public onlyOwner {
uint256 countToAdd = tokenIds.length;
for (uint256 i = 0; i < countToAdd; i++) {
if (cardTypes[i] == 0) {
IERC721(collections[i]).safeTransferFrom(
msg.sender,
address(this),
tokenIds[i]
);
} else if (cardTypes[i] == 1) {
IERC1155(collections[i]).safeTransferFrom(
msg.sender,
address(this),
tokenIds[i],
amounts[i],
"Add Card"
);
}
bytes32 key = itemKeyFromId(collections[i], tokenIds[i]);
if (_cards[key].amount == 0) {
_cardIndices.add(key);
}
_cards[key].cardType = cardTypes[i];
_cards[key].key = key;
_cards[key].collectionId = collections[i];
_cards[key].tokenId = tokenIds[i];
_cards[key].amount = _cards[key].amount.add(amounts[i]);
cardAmount = cardAmount.add(amounts[i]);
emit AddToken(
cardTypes[i],
key,
collections[i],
tokenIds[i],
amounts[i],
cardAmount
);
}
}
function spin() external payable {
require(status, "This mysterybox is disabled.");
require(cardAmount > 0, "There is no card in this mysterybox anymore.");
uint256 fee = IHexToysMysteryBoxFactory(factory).serviceFee();
uint256 feeAmount = price.mul(fee).div(PERCENTS_DIVIDER);
uint256 ownerAmount = price.sub(feeAmount);
if (tokenAddress == address(0x0)) {
require(msg.value >= price, "too small amount");
if (feeAmount > 0) {
(bool result, ) = payable(factory).call{value: feeAmount}("");
require(
result,
"Failed to send service fee to factory address"
);
}
(bool result1, ) = payable(owner).call{value: ownerAmount}("");
require(result1, "Failed to send coin to mysterybox owner");
} else {
IERC20 governanceToken = IERC20(tokenAddress);
require(
governanceToken.transferFrom(msg.sender, address(this), price),
"insufficient token balance"
);
// transfer governance token to factory
if (feeAmount > 0) {
require(governanceToken.transfer(factory, feeAmount));
}
// transfer governance token to owner
require(governanceToken.transfer(owner, ownerAmount));
}
bytes32 cardKey = getCardKeyRandmly();
cardAmount = cardAmount.sub(1);
require(
_cards[cardKey].amount > 0,
"No enough cards of this kind in the mysterybox."
);
if (_cards[cardKey].cardType == 0) {
// ERC721
IERC721(_cards[cardKey].collectionId).safeTransferFrom(
address(this),
msg.sender,
_cards[cardKey].tokenId
);
} else if (_cards[cardKey].cardType == 1) {
// ERC1155
IERC1155(_cards[cardKey].collectionId).safeTransferFrom(
address(this),
msg.sender,
_cards[cardKey].tokenId,
1,
"Your prize from Pixelpimp HexToysLootBox"
);
}
_cards[cardKey].amount = _cards[cardKey].amount.sub(1);
if (_cards[cardKey].amount == 0) {
_cardIndices.remove(cardKey);
}
emit SpinResult(msg.sender, cardKey, cardAmount);
}
// ***************************
// view card information ***********
// ***************************
function cardKeyCount() public view returns (uint256) {
return _cardIndices.length();
}
function cardKeyWithIndex(uint256 index) public view returns (bytes32) {
return _cardIndices.at(index);
}
// ***************************
// emergency call information ***********
// ***************************
function emergencyWithdrawCard(
address collectionId,
uint256 tokenId,
uint256 amount
) public onlyOwner {
bytes32 cardKey = itemKeyFromId(collectionId, tokenId);
Card memory card = _cards[cardKey];
require(
card.tokenId != 0 && card.collectionId != address(0x0),
"Invalid Collection id and token id"
);
require(card.amount >= amount, "Insufficient balance");
require(amount > 0, "Insufficient amount");
if (card.cardType == 0) {
// withdraw single card
IERC721(card.collectionId).safeTransferFrom(
address(this),
msg.sender,
card.tokenId
);
} else if (card.cardType == 1) {
// withdraw multiple card
IERC1155(card.collectionId).safeTransferFrom(
address(this),
msg.sender,
card.tokenId,
amount,
"Reset HexToysLootBox"
);
}
cardAmount = cardAmount.sub(amount);
_cards[cardKey].amount = _cards[cardKey].amount.sub(amount);
if (_cards[cardKey].amount == 0) {
_cardIndices.remove(cardKey);
}
emit RemoveCard(cardKey, amount, cardAmount);
}
function emergencyWithdrawAllCards() public onlyOwner {
bytes32[] memory keys = new bytes32[](cardKeyCount());
for (uint256 i = 0; i < cardKeyCount(); i++) {
bytes32 key = cardKeyWithIndex(i);
keys[i] = key;
if (_cards[key].amount > 0) {
Card memory card = _cards[key];
if (card.cardType == 0) {
// withdraw single card
IERC721(card.collectionId).safeTransferFrom(
address(this),
msg.sender,
card.tokenId
);
} else if (card.cardType == 1) {
// withdraw multiple card
IERC1155(card.collectionId).safeTransferFrom(
address(this),
msg.sender,
card.tokenId,
card.amount,
"Reset HexToysLootBox"
);
}
cardAmount = cardAmount.sub(_cards[key].amount);
_cards[key].amount = 0;
_cardIndices.remove(key);
}
}
emit EmergencyWithdrawAllCards(keys, cardAmount);
}
// ***************************
// general function ***********
// ***************************
function getCardKeyRandmly() private view returns (bytes32) {
uint256 randomNumber = uint256(
keccak256(
abi.encode(block.timestamp, block.difficulty, block.number)
)
).mod(cardAmount);
uint256 amountSum = 0;
bytes32 resultKey = cardKeyWithIndex(0);
for (uint i = 0; i < cardKeyCount(); i++) {
amountSum = amountSum.add(_cards[cardKeyWithIndex(i)].amount);
if (amountSum > randomNumber) {
resultKey = cardKeyWithIndex(i);
break;
}
}
return resultKey;
}
function itemKeyFromId(
address _collection,
uint256 _token_id
) public pure returns (bytes32) {
return keccak256(abi.encode(_collection, _token_id));
}
modifier onlyFactory() {
require(address(msg.sender) == factory, "Only for factory.");
_;
}
modifier onlyOwner() {
require(address(msg.sender) == owner, "Only for owner.");
_;
}
function withdrawCoin() public onlyOwner {
uint balance = address(this).balance;
require(balance > 0, "insufficient balance");
(bool result, ) = payable(msg.sender).call{value: balance}("");
require(result, "Failed to withdraw");
}
/**
* @dev To receive ETH
*/
receive() external payable {}
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":200,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"boxCreators","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"boxes","inputs":[{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"createHexToysMysteryBox","inputs":[{"type":"string","name":"_name","internalType":"string"},{"type":"string","name":"_uri","internalType":"string"},{"type":"address","name":"_tokenAddress","internalType":"address"},{"type":"uint256","name":"_price","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"creatingFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"serviceFee","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateCreatingFee","inputs":[{"type":"uint256","name":"_fee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateServiceFee","inputs":[{"type":"uint256","name":"_serviceFee","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawCoin","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawToken","inputs":[{"type":"address","name":"tokenAddress","internalType":"address"}]},{"type":"event","name":"FeeUpdated","inputs":[{"type":"uint256","name":"old_fee","indexed":false},{"type":"uint256","name":"new_fee","indexed":false}],"anonymous":false},{"type":"event","name":"HexToysMysteryBoxCreated","inputs":[{"type":"address","name":"box_address","indexed":false},{"type":"address","name":"owner","indexed":false},{"type":"string","name":"name","indexed":false},{"type":"string","name":"uri","indexed":false},{"type":"address","name":"paymentToken","indexed":false},{"type":"uint256","name":"price","indexed":false}],"anonymous":false},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","indexed":true},{"type":"address","name":"newOwner","indexed":true}],"anonymous":false},{"type":"receive"}]
Contract Creation Code
0x608060405234801561001057600080fd5b50613c28806100206000396000f3fe6080604052600436106100c65760003560e01c80638abdf5aa1161007f578063ac144f3211610059578063ac144f32146101e8578063ae4b7c26146101fb578063f2fde38b1461021b578063f7b059721461023b57600080fd5b80638abdf5aa146101905780638da5cb5b146101b45780639080895f146101d257600080fd5b80633dc8fd9e146100d25780634ed3faf2146100f45780636220aea814610131578063715018a6146101465780638129fc1c1461015b578063894760691461017057600080fd5b366100cd57005b600080fd5b3480156100de57600080fd5b506100f26100ed366004610994565b610271565b005b34801561010057600080fd5b5061011461010f366004610994565b6102be565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561013d57600080fd5b506100f26102e8565b34801561015257600080fd5b506100f26103cb565b34801561016757600080fd5b506100f26103df565b34801561017c57600080fd5b506100f261018b3660046109c9565b610503565b34801561019c57600080fd5b506101a660665481565b604051908152602001610128565b3480156101c057600080fd5b506033546001600160a01b0316610114565b3480156101de57600080fd5b506101a660655481565b6100f26101f6366004610a8e565b610640565b34801561020757600080fd5b506100f2610216366004610994565b6107fe565b34801561022757600080fd5b506100f26102363660046109c9565b61080b565b34801561024757600080fd5b506101146102563660046109c9565b6068602052600090815260409020546001600160a01b031681565b610279610881565b606580549082905560408051828152602081018490527f528d9479e9f9889a87a3c30c7f7ba537e5e59c4c85a37733b16e57c62df61302910160405180910390a15050565b606781815481106102ce57600080fd5b6000918252602090912001546001600160a01b0316905081565b6102f0610881565b478061033a5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064015b60405180910390fd5b604051600090339083908381818185875af1925050503d806000811461037c576040519150601f19603f3d011682016040523d82523d6000602084013e610381565b606091505b50509050806103c75760405162461bcd60e51b81526020600482015260126024820152714661696c656420746f20576974686472617760701b6044820152606401610331565b5050565b6103d3610881565b6103dd60006108db565b565b600054610100900460ff16158080156103ff5750600054600160ff909116105b806104195750303b158015610419575060005460ff166001145b61047c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610331565b6000805460ff19166001179055801561049f576000805461ff0019166101001790555b6104a761092d565b69152d02c7e14af680000060655560156066558015610500576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b61050b610881565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610554573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105789190610b0a565b9050600081116105c15760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401610331565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303816000875af115801561060e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190610b23565b61063b57600080fd5b505050565b6065543410156106855760405162461bcd60e51b815260206004820152601060248201526f696e73756666696369656e742066656560801b6044820152606401610331565b60006040518060200161069790610987565b6020820181038252601f19601f82011660405250905060008584426040516020016106c493929190610b69565b6040516020818303038152906040528051906020012090506000818351602085016000f56040516350eeb51760e11b81529091506001600160a01b0382169063a1dd6a2e9061071f908a908a908a908a903390600401610bd4565b600060405180830381600087803b15801561073957600080fd5b505af115801561074d573d6000803e3d6000fd5b505060678054600181019091557f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6ae0180546001600160a01b03199081166001600160a01b0386169081179092556000918252606860205260409182902080543392168217905590517fa66e47eb41749cc0c3628e99f14a5a05c535d605f7a028120e7214927c40340993506107ed92508491908b908b908b908b90610c24565b60405180910390a150505050505050565b610806610881565b606655565b610813610881565b6001600160a01b0381166108785760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610331565b610500816108db565b6033546001600160a01b031633146103dd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610331565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166109545760405162461bcd60e51b815260040161033190610c77565b6103dd600054610100900460ff1661097e5760405162461bcd60e51b815260040161033190610c77565b6103dd336108db565b612f3080610cc383390190565b6000602082840312156109a657600080fd5b5035919050565b80356001600160a01b03811681146109c457600080fd5b919050565b6000602082840312156109db57600080fd5b6109e4826109ad565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610a1257600080fd5b813567ffffffffffffffff80821115610a2d57610a2d6109eb565b604051601f8301601f19908116603f01168101908282118183101715610a5557610a556109eb565b81604052838152866020858801011115610a6e57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610aa457600080fd5b843567ffffffffffffffff80821115610abc57600080fd5b610ac888838901610a01565b95506020870135915080821115610ade57600080fd5b50610aeb87828801610a01565b935050610afa604086016109ad565b9396929550929360600135925050565b600060208284031215610b1c57600080fd5b5051919050565b600060208284031215610b3557600080fd5b815180151581146109e457600080fd5b60005b83811015610b60578181015183820152602001610b48565b50506000910152565b60008451610b7b818460208901610b45565b60609490941b6bffffffffffffffffffffffff191691909301908152601481019190915260340192915050565b60008151808452610bc0816020860160208601610b45565b601f01601f19169290920160200192915050565b60a081526000610be760a0830188610ba8565b8281036020840152610bf98188610ba8565b6001600160a01b03968716604085015260608401959095525050921660809092019190915292915050565b600060018060a01b038089168352808816602084015260c06040840152610c4e60c0840188610ba8565b8381036060850152610c608188610ba8565b959091166080840152505060a00152949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fe60806040526006805460ff1916600117905534801561001d57600080fd5b50600080546001600160a01b03191633179055612ef18061003f6000396000f3fe6080604052600436106101e75760003560e01c80639a2d450511610102578063bc197c8111610095578063cb937adc11610064578063cb937adc146105f1578063d99bb9f714610606578063f0acd7d51461061b578063f23a6e611461062357600080fd5b8063bc197c811461057a578063c1223827146105a6578063c45a0155146105bc578063c4c9ca06146105dc57600080fd5b8063a035b1fe116100d1578063a035b1fe14610504578063a1dd6a2e1461051a578063a2b40d191461053a578063ba1508511461055a57600080fd5b80639a2d4505146104255780639a530419146104455780639d76ea581461045a578063a000e0841461047a57600080fd5b806349b5ace91161017a5780636337e5d4116101495780636337e5d4146103965780638da5cb5b146103ab5780638db8fd29146103e35780638e953a631461040357600080fd5b806349b5ace91461032c5780634fb2e45d146103415780635dd3ffd0146103615780636220aea81461038157600080fd5b8063150b7a02116101b6578063150b7a021461028e578063200d2ed2146102d257806320bf74f4146102ec5780634558d7171461030c57600080fd5b806301c234a8146101f357806301ffc9a71461021c5780630717cf521461024c5780630da0dbff1461026e57600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b506102096103e881565b6040519081526020015b60405180910390f35b34801561022857600080fd5b5061023c610237366004612518565b61064f565b6040519015158152602001610213565b34801561025857600080fd5b5061026c610267366004612630565b610686565b005b34801561027a57600080fd5b5061020961028936600461273a565b610ae4565b34801561029a57600080fd5b506102b96102a93660046127c3565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610213565b3480156102de57600080fd5b5060065461023c9060ff1681565b3480156102f857600080fd5b5061026c610307366004612823565b610af1565b34801561031857600080fd5b5061026c610327366004612860565b610ecd565b34801561033857600080fd5b5061026c610f4c565b34801561034d57600080fd5b5061026c61035c366004612860565b6111e5565b34801561036d57600080fd5b5061026c61037c36600461287d565b6112be565b34801561038d57600080fd5b5061026c611324565b3480156103a257600080fd5b5061026c611424565b3480156103b757600080fd5b506001546103cb906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156103ef57600080fd5b506102096103fe3660046128ba565b61148f565b34801561040f57600080fd5b506104186114cc565b60405161021391906128e6565b34801561043157600080fd5b5061026c61044036600461287d565b61155a565b34801561045157600080fd5b506104186115c0565b34801561046657600080fd5b506002546103cb906001600160a01b031681565b34801561048657600080fd5b506104ce61049536600461273a565b60076020526000908152604090208054600182015460028301546003840154600490940154929391926001600160a01b03909116919085565b6040805195865260208601949094526001600160a01b03909216928401929092526060830191909152608082015260a001610213565b34801561051057600080fd5b5061020960035481565b34801561052657600080fd5b5061026c610535366004612934565b6115cd565b34801561054657600080fd5b5061026c61055536600461273a565b61166b565b34801561056657600080fd5b5061026c6105753660046129c9565b6116ca565b34801561058657600080fd5b506102b96105953660046129fe565b63bc197c8160e01b95945050505050565b3480156105b257600080fd5b50610209600a5481565b3480156105c857600080fd5b506000546103cb906001600160a01b031681565b3480156105e857600080fd5b5061026c6119dd565b3480156105fd57600080fd5b50610209611a47565b34801561061257600080fd5b5061026c611a58565b61026c611ac3565b34801561062f57600080fd5b506102b961063e366004612aac565b63f23a6e6160e01b95945050505050565b60006001600160e01b03198216630271189760e51b148061068057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6001546001600160a01b031633146106b95760405162461bcd60e51b81526004016106b090612b15565b60405180910390fd5b815160005b81811015610adc578581815181106106d8576106d8612b3e565b6020026020010151600003610780578481815181106106f9576106f9612b3e565b60200260200101516001600160a01b03166342842e0e333087858151811061072357610723612b3e565b60200260200101516040518463ffffffff1660e01b815260040161074993929190612b54565b600060405180830381600087803b15801561076357600080fd5b505af1158015610777573d6000803e3d6000fd5b50505050610851565b85818151811061079257610792612b3e565b6020026020010151600103610851578481815181106107b3576107b3612b3e565b60200260200101516001600160a01b031663f242432a33308785815181106107dd576107dd612b3e565b60200260200101518786815181106107f7576107f7612b3e565b60200260200101516040518563ffffffff1660e01b815260040161081e9493929190612b78565b600060405180830381600087803b15801561083857600080fd5b505af115801561084c573d6000803e3d6000fd5b505050505b600061088f86838151811061086857610868612b3e565b602002602001015186848151811061088257610882612b3e565b602002602001015161148f565b600081815260076020526040812060040154919250036108b6576108b460088261226d565b505b8682815181106108c8576108c8612b3e565b602090810291909101810151600083815260079092526040909120908155600101819055855186908390811061090057610900612b3e565b60200260200101516007600083815260200190815260200160002060020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555084828151811061095457610954612b3e565b602002602001015160076000838152602001908152602001600020600301819055506109b884838151811061098b5761098b612b3e565b6020026020010151600760008481526020019081526020016000206004015461228090919063ffffffff16565b60008281526007602052604090206004015583516109fb908590849081106109e2576109e2612b3e565b6020026020010151600a5461228090919063ffffffff16565b600a819055507f9125b5c4a8d148552b55dd5af43ea17980b656542dbb9169d1da89a228e7028f878381518110610a3457610a34612b3e565b602002602001015182888581518110610a4f57610a4f612b3e565b6020026020010151888681518110610a6957610a69612b3e565b6020026020010151888781518110610a8357610a83612b3e565b602090810291909101810151600a5460408051978852928701959095526001600160a01b03909316908501526060840152608083015260a082015260c00160405180910390a15080610ad481612bd7565b9150506106be565b505050505050565b600061068060088361228c565b6001546001600160a01b03163314610b1b5760405162461bcd60e51b81526004016106b090612b15565b831580610b285750836001145b610b685760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642063617264207479706560781b60448201526064016106b0565b83600003610c98576040516331a9108f60e11b81526004810183905233906001600160a01b03851690636352211e90602401602060405180830381865afa158015610bb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdb9190612bf0565b6001600160a01b031614610c315760405162461bcd60e51b815260206004820152601760248201527f596f7520617265206e6f7420746f6b656e206f776e657200000000000000000060448201526064016106b0565b604051632142170760e11b81526001600160a01b038416906342842e0e90610c6190339030908790600401612b54565b600060405180830381600087803b158015610c7b57600080fd5b505af1158015610c8f573d6000803e3d6000fd5b50505050610dc2565b83600103610dc257604051627eeac760e11b81523360048201526024810183905281906001600160a01b0385169062fdd58e90604401602060405180830381865afa158015610ceb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0f9190612c0d565b1015610d5d5760405162461bcd60e51b815260206004820152601c60248201527f596f7520646f6e2774206861766520656e6f75676820546f6b656e730000000060448201526064016106b0565b604051637921219560e11b81526001600160a01b0384169063f242432a90610d8f903390309087908790600401612b78565b600060405180830381600087803b158015610da957600080fd5b505af1158015610dbd573d6000803e3d6000fd5b505050505b6000610dce848461148f565b60008181526007602052604081206004015491925003610df557610df360088261226d565b505b6000818152600760205260409020858155600181018290556002810180546001600160a01b0319166001600160a01b0387161790556003810184905560040154610e3f9083612280565b600082815260076020526040902060040155600a54610e5e9083612280565b600a81905560408051878152602081018490526001600160a01b03871691810191909152606081018590526080810184905260a08101919091527f9125b5c4a8d148552b55dd5af43ea17980b656542dbb9169d1da89a228e7028f9060c0015b60405180910390a15050505050565b6001546001600160a01b03163314610ef75760405162461bcd60e51b81526004016106b090612b15565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fcf0c407085ca3ba312474d8448768345a1f695deaa14fcbd6d3bfee5f1ebce86906020015b60405180910390a150565b6001546001600160a01b03163314610f765760405162461bcd60e51b81526004016106b090612b15565b6000610f80611a47565b67ffffffffffffffff811115610f9857610f98612542565b604051908082528060200260200182016040528015610fc1578160200160208202803683370190505b50905060005b610fcf611a47565b8110156111b1576000610fe182610ae4565b905080838381518110610ff657610ff6612b3e565b6020908102919091018101919091526000828152600790915260409020600401541561119e576000818152600760209081526040808320815160a081018352815480825260018301549482019490945260028201546001600160a01b0316928101929092526003810154606083015260040154608082015291036110e35780604001516001600160a01b03166342842e0e303384606001516040518463ffffffff1660e01b81526004016110ac93929190612b54565b600060405180830381600087803b1580156110c657600080fd5b505af11580156110da573d6000803e3d6000fd5b5050505061115d565b805160010361115d57604080820151606083015160808401519251637921219560e11b81526001600160a01b039092169263f242432a9261112a9230923392600401612c26565b600060405180830381600087803b15801561114457600080fd5b505af1158015611158573d6000803e3d6000fd5b505050505b600082815260076020526040902060040154600a5461117b91612298565b600a5560008281526007602052604081206004015561119b6008836122a4565b50505b50806111a981612bd7565b915050610fc7565b507f196988fd7b6f23d05ca56ef39a4e36e8038146a591a64652399dbae0da27fe3281600a54604051610f41929190612c7b565b6001546001600160a01b0316331461120f5760405162461bcd60e51b81526004016106b090612b15565b6001600160a01b0381166112705760405162461bcd60e51b815260206004820152602260248201527f4f776e61626c653a206e6577206f776e6572206973207a65726f206164647265604482015261737360f01b60648201526084016106b0565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527fef2d6bcc8588d18f6a6c9e90d664073f2e04265248f5e3814b7b0b46b9e9080d90602001610f41565b6001546001600160a01b031633146112e85760405162461bcd60e51b81526004016106b090612b15565b60056112f48282612d48565b507f11e08370b4f68b25bd73ed77315f1bcab3f7568fe889f16a5a9122edf5ff738f81604051610f4191906128e6565b6001546001600160a01b0316331461134e5760405162461bcd60e51b81526004016106b090612b15565b47806113935760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064016106b0565b604051600090339083908381818185875af1925050503d80600081146113d5576040519150601f19603f3d011682016040523d82523d6000602084013e6113da565b606091505b50509050806114205760405162461bcd60e51b81526020600482015260126024820152714661696c656420746f20776974686472617760701b60448201526064016106b0565b5050565b6001546001600160a01b0316331461144e5760405162461bcd60e51b81526004016106b090612b15565b6006805460ff19169055604051600081527fa57693c28d08df0c902ce29d389e3f049d05cd83aa70c2a048bdf544b6044d54906020015b60405180910390a1565b604080516001600160a01b038416602082015290810182905260009060600160405160208183030381529060405280519060200120905092915050565b600580546114d990612cc3565b80601f016020809104026020016040519081016040528092919081815260200182805461150590612cc3565b80156115525780601f1061152757610100808354040283529160200191611552565b820191906000526020600020905b81548152906001019060200180831161153557829003601f168201915b505050505081565b6001546001600160a01b031633146115845760405162461bcd60e51b81526004016106b090612b15565b60046115908282612d48565b507f1f684be123de4215cef66caae7c9d41d91b1d1979fee7c4f4cfdf4ebc61c020e81604051610f4191906128e6565b600480546114d990612cc3565b6000546001600160a01b0316331461161b5760405162461bcd60e51b815260206004820152601160248201527027b7363c903337b9103330b1ba37b93c9760791b60448201526064016106b0565b60046116278682612d48565b5060056116348582612d48565b50600280546001600160a01b039485166001600160a01b031991821617909155600392909255600180549190931691161790555050565b6001546001600160a01b031633146116955760405162461bcd60e51b81526004016106b090612b15565b60038190556040518181527fa6dc15bdb68da224c66db4b3838d9a2b205138e8cff6774e57d0af91e196d62290602001610f41565b6001546001600160a01b031633146116f45760405162461bcd60e51b81526004016106b090612b15565b6000611700848461148f565b600081815260076020908152604091829020825160a0810184528154815260018201549281019290925260028101546001600160a01b031692820192909252600382015460608201819052600490920154608082015291925015801590611773575060408101516001600160a01b031615155b6117ca5760405162461bcd60e51b815260206004820152602260248201527f496e76616c696420436f6c6c656374696f6e20696420616e6420746f6b656e206044820152611a5960f21b60648201526084016106b0565b82816080015110156118155760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b60448201526064016106b0565b6000831161185b5760405162461bcd60e51b8152602060048201526013602482015272125b9cdd59999a58da595b9d08185b5bdd5b9d606a1b60448201526064016106b0565b80516000036118d35780604001516001600160a01b03166342842e0e303384606001516040518463ffffffff1660e01b815260040161189c93929190612b54565b600060405180830381600087803b1580156118b657600080fd5b505af11580156118ca573d6000803e3d6000fd5b50505050611949565b80516001036119495780604001516001600160a01b031663f242432a30338460600151876040518563ffffffff1660e01b81526004016119169493929190612c26565b600060405180830381600087803b15801561193057600080fd5b505af1158015611944573d6000803e3d6000fd5b505050505b600a546119569084612298565b600a556000828152600760205260409020600401546119759084612298565b60008381526007602052604081206004018290550361199b576119996008836122a4565b505b600a546040805184815260208101869052908101919091527ff5c4b73c03f3d5d113b8e786c98cfa95dbf31dbb37b29c9864661845325e166490606001610ebe565b6001546001600160a01b03163314611a075760405162461bcd60e51b81526004016106b090612b15565b6006805460ff191660019081179091556040519081527fa57693c28d08df0c902ce29d389e3f049d05cd83aa70c2a048bdf544b6044d5490602001611485565b6000611a5360086122b0565b905090565b6001546001600160a01b03163314611a825760405162461bcd60e51b81526004016106b090612b15565b600180546001600160a01b0319169055604051600081527fef2d6bcc8588d18f6a6c9e90d664073f2e04265248f5e3814b7b0b46b9e9080d90602001611485565b60065460ff16611b155760405162461bcd60e51b815260206004820152601c60248201527f54686973206d797374657279626f782069732064697361626c65642e0000000060448201526064016106b0565b6000600a5411611b7c5760405162461bcd60e51b815260206004820152602c60248201527f5468657265206973206e6f206361726420696e2074686973206d79737465727960448201526b3137bc1030b73cb6b7b9329760a11b60648201526084016106b0565b60008060009054906101000a90046001600160a01b03166001600160a01b0316638abdf5aa6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf49190612c0d565b90506000611c196103e8611c13846003546122ba90919063ffffffff16565b906122c6565b90506000611c328260035461229890919063ffffffff16565b6002549091506001600160a01b0316611e0457600354341015611c8a5760405162461bcd60e51b815260206004820152601060248201526f1d1bdbc81cdb585b1b08185b5bdd5b9d60821b60448201526064016106b0565b8115611d4b57600080546040516001600160a01b039091169084908381818185875af1925050503d8060008114611cdd576040519150601f19603f3d011682016040523d82523d6000602084013e611ce2565b606091505b5050905080611d495760405162461bcd60e51b815260206004820152602d60248201527f4661696c656420746f2073656e6420736572766963652066656520746f20666160448201526c63746f7279206164647265737360981b60648201526084016106b0565b505b6001546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611d98576040519150601f19603f3d011682016040523d82523d6000602084013e611d9d565b606091505b5050905080611dfe5760405162461bcd60e51b815260206004820152602760248201527f4661696c656420746f2073656e6420636f696e20746f206d797374657279626f6044820152663c1037bbb732b960c91b60648201526084016106b0565b50611fd3565b6002546003546040516323b872dd60e01b81526001600160a01b039092169182916323b872dd91611e3c913391309190600401612b54565b6020604051808303816000875af1158015611e5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7f9190612e08565b611ecb5760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420746f6b656e2062616c616e636500000000000060448201526064016106b0565b8215611f515760005460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018590529082169063a9059cbb906044016020604051808303816000875af1158015611f24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f489190612e08565b611f5157600080fd5b60015460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529082169063a9059cbb906044016020604051808303816000875af1158015611fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc89190612e08565b611fd157600080fd5b505b6000611fdd6122d2565b600a54909150611fee906001612298565b600a556000818152600760205260409020600401546120675760405162461bcd60e51b815260206004820152602f60248201527f4e6f20656e6f756768206361726473206f662074686973206b696e6420696e2060448201526e3a34329036bcb9ba32b93cb137bc1760891b60648201526084016106b0565b60008181526007602052604081205490036120fd576000818152600760205260409081902060028101546003909101549151632142170760e11b81526001600160a01b03909116916342842e0e916120c6913091339190600401612b54565b600060405180830381600087803b1580156120e057600080fd5b505af11580156120f4573d6000803e3d6000fd5b505050506121e1565b6000818152600760205260409020546001036121e1576000818152600760205260409081902060028101546003909101549151637921219560e11b815230600482015233602482015260448101929092526001606483015260a06084830152602860a48301527f596f7572207072697a652066726f6d20506978656c70696d7020486578546f7960c4830152670e698dedee884def60c31b60e48301526001600160a01b03169063f242432a9061010401600060405180830381600087803b1580156121c857600080fd5b505af11580156121dc573d6000803e3d6000fd5b505050505b6000818152600760205260409020600401546121fe906001612298565b600082815260076020526040812060040182905503612224576122226008826122a4565b505b600a54604080513381526020810184905280820192909252517fbf0e5397fea21fa0112849e656cea9b74500509d4403f1700b59e9fdd60afe129181900360600190a150505050565b600061227983836123a0565b9392505050565b60006122798284612e2a565b600061227983836123ef565b60006122798284612e3d565b60006122798383612419565b6000610680825490565b60006122798284612e50565b60006122798284612e7d565b600a546040805142602082015244918101919091524360608201526000918291612318919060800160408051601f1981840301815291905280516020909101209061250c565b90506000806123276000610ae4565b905060005b612334611a47565b8110156123985761236c6007600061234b84610ae4565b8152602001908152602001600020600401548461228090919063ffffffff16565b9250838311156123865761237f81610ae4565b9150612398565b8061239081612bd7565b91505061232c565b509392505050565b60008181526001830160205260408120546123e757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610680565b506000610680565b600082600001828154811061240657612406612b3e565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561250257600061243d600183612e3d565b855490915060009061245190600190612e3d565b90508181146124b657600086600001828154811061247157612471612b3e565b906000526020600020015490508087600001848154811061249457612494612b3e565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806124c7576124c7612e91565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610680565b6000915050610680565b60006122798284612ea7565b60006020828403121561252a57600080fd5b81356001600160e01b03198116811461227957600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561258157612581612542565b604052919050565b600067ffffffffffffffff8211156125a3576125a3612542565b5060051b60200190565b600082601f8301126125be57600080fd5b813560206125d36125ce83612589565b612558565b82815260059290921b840181019181810190868411156125f257600080fd5b8286015b8481101561260d57803583529183019183016125f6565b509695505050505050565b6001600160a01b038116811461262d57600080fd5b50565b6000806000806080858703121561264657600080fd5b843567ffffffffffffffff8082111561265e57600080fd5b61266a888389016125ad565b955060209150818701358181111561268157600080fd5b8701601f8101891361269257600080fd5b80356126a06125ce82612589565b81815260059190911b8201840190848101908b8311156126bf57600080fd5b928501925b828410156126e65783356126d781612618565b825292850192908501906126c4565b975050505060408701359150808211156126ff57600080fd5b61270b888389016125ad565b9350606087013591508082111561272157600080fd5b5061272e878288016125ad565b91505092959194509250565b60006020828403121561274c57600080fd5b5035919050565b600082601f83011261276457600080fd5b813567ffffffffffffffff81111561277e5761277e612542565b612791601f8201601f1916602001612558565b8181528460208386010111156127a657600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156127d957600080fd5b84356127e481612618565b935060208501356127f481612618565b925060408501359150606085013567ffffffffffffffff81111561281757600080fd5b61272e87828801612753565b6000806000806080858703121561283957600080fd5b84359350602085013561284b81612618565b93969395505050506040820135916060013590565b60006020828403121561287257600080fd5b813561227981612618565b60006020828403121561288f57600080fd5b813567ffffffffffffffff8111156128a657600080fd5b6128b284828501612753565b949350505050565b600080604083850312156128cd57600080fd5b82356128d881612618565b946020939093013593505050565b600060208083528351808285015260005b81811015612913578581018301518582016040015282016128f7565b506000604082860101526040601f19601f8301168501019250505092915050565b600080600080600060a0868803121561294c57600080fd5b853567ffffffffffffffff8082111561296457600080fd5b61297089838a01612753565b9650602088013591508082111561298657600080fd5b5061299388828901612753565b94505060408601356129a481612618565b92506060860135915060808601356129bb81612618565b809150509295509295909350565b6000806000606084860312156129de57600080fd5b83356129e981612618565b95602085013595506040909401359392505050565b600080600080600060a08688031215612a1657600080fd5b8535612a2181612618565b94506020860135612a3181612618565b9350604086013567ffffffffffffffff80821115612a4e57600080fd5b612a5a89838a016125ad565b94506060880135915080821115612a7057600080fd5b612a7c89838a016125ad565b93506080880135915080821115612a9257600080fd5b50612a9f88828901612753565b9150509295509295909350565b600080600080600060a08688031215612ac457600080fd5b8535612acf81612618565b94506020860135612adf81612618565b93506040860135925060608601359150608086013567ffffffffffffffff811115612b0957600080fd5b612a9f88828901612753565b6020808252600f908201526e27b7363c903337b91037bbb732b91760891b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a060808201819052600890820152671059190810d85c9960c21b60c082015260e00190565b634e487b7160e01b600052601160045260246000fd5b600060018201612be957612be9612bc1565b5060010190565b600060208284031215612c0257600080fd5b815161227981612618565b600060208284031215612c1f57600080fd5b5051919050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a060808201819052601490820152730a4cae6cae84090caf0a8def2e698dedee884def60631b60c082015260e00190565b604080825283519082018190526000906020906060840190828701845b82811015612cb457815184529284019290840190600101612c98565b50505092019290925292915050565b600181811c90821680612cd757607f821691505b602082108103612cf757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612d4357600081815260208120601f850160051c81016020861015612d245750805b601f850160051c820191505b81811015610adc57828155600101612d30565b505050565b815167ffffffffffffffff811115612d6257612d62612542565b612d7681612d708454612cc3565b84612cfd565b602080601f831160018114612dab5760008415612d935750858301515b600019600386901b1c1916600185901b178555610adc565b600085815260208120601f198616915b82811015612dda57888601518255948401946001909101908401612dbb565b5085821015612df85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215612e1a57600080fd5b8151801515811461227957600080fd5b8082018082111561068057610680612bc1565b8181038181111561068057610680612bc1565b808202811582820484141761068057610680612bc1565b634e487b7160e01b600052601260045260246000fd5b600082612e8c57612e8c612e67565b500490565b634e487b7160e01b600052603160045260246000fd5b600082612eb657612eb6612e67565b50069056fea264697066735822122010f81b4fbb0c0180f2d4185deedbed66051246081d85e6b3f62ab3a28e5a3f7264736f6c63430008110033a2646970667358221220ad00e399670e0ebc1996bb72d947d527cc56e6cd7a8dbbc2b8723db97e637c4864736f6c63430008110033
Deployed ByteCode
0x6080604052600436106100c65760003560e01c80638abdf5aa1161007f578063ac144f3211610059578063ac144f32146101e8578063ae4b7c26146101fb578063f2fde38b1461021b578063f7b059721461023b57600080fd5b80638abdf5aa146101905780638da5cb5b146101b45780639080895f146101d257600080fd5b80633dc8fd9e146100d25780634ed3faf2146100f45780636220aea814610131578063715018a6146101465780638129fc1c1461015b578063894760691461017057600080fd5b366100cd57005b600080fd5b3480156100de57600080fd5b506100f26100ed366004610994565b610271565b005b34801561010057600080fd5b5061011461010f366004610994565b6102be565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561013d57600080fd5b506100f26102e8565b34801561015257600080fd5b506100f26103cb565b34801561016757600080fd5b506100f26103df565b34801561017c57600080fd5b506100f261018b3660046109c9565b610503565b34801561019c57600080fd5b506101a660665481565b604051908152602001610128565b3480156101c057600080fd5b506033546001600160a01b0316610114565b3480156101de57600080fd5b506101a660655481565b6100f26101f6366004610a8e565b610640565b34801561020757600080fd5b506100f2610216366004610994565b6107fe565b34801561022757600080fd5b506100f26102363660046109c9565b61080b565b34801561024757600080fd5b506101146102563660046109c9565b6068602052600090815260409020546001600160a01b031681565b610279610881565b606580549082905560408051828152602081018490527f528d9479e9f9889a87a3c30c7f7ba537e5e59c4c85a37733b16e57c62df61302910160405180910390a15050565b606781815481106102ce57600080fd5b6000918252602090912001546001600160a01b0316905081565b6102f0610881565b478061033a5760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064015b60405180910390fd5b604051600090339083908381818185875af1925050503d806000811461037c576040519150601f19603f3d011682016040523d82523d6000602084013e610381565b606091505b50509050806103c75760405162461bcd60e51b81526020600482015260126024820152714661696c656420746f20576974686472617760701b6044820152606401610331565b5050565b6103d3610881565b6103dd60006108db565b565b600054610100900460ff16158080156103ff5750600054600160ff909116105b806104195750303b158015610419575060005460ff166001145b61047c5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610331565b6000805460ff19166001179055801561049f576000805461ff0019166101001790555b6104a761092d565b69152d02c7e14af680000060655560156066558015610500576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b61050b610881565b6040516370a0823160e01b815230600482015281906000906001600160a01b038316906370a0823190602401602060405180830381865afa158015610554573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105789190610b0a565b9050600081116105c15760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b6044820152606401610331565b60405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0383169063a9059cbb906044016020604051808303816000875af115801561060e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106329190610b23565b61063b57600080fd5b505050565b6065543410156106855760405162461bcd60e51b815260206004820152601060248201526f696e73756666696369656e742066656560801b6044820152606401610331565b60006040518060200161069790610987565b6020820181038252601f19601f82011660405250905060008584426040516020016106c493929190610b69565b6040516020818303038152906040528051906020012090506000818351602085016000f56040516350eeb51760e11b81529091506001600160a01b0382169063a1dd6a2e9061071f908a908a908a908a903390600401610bd4565b600060405180830381600087803b15801561073957600080fd5b505af115801561074d573d6000803e3d6000fd5b505060678054600181019091557f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6ae0180546001600160a01b03199081166001600160a01b0386169081179092556000918252606860205260409182902080543392168217905590517fa66e47eb41749cc0c3628e99f14a5a05c535d605f7a028120e7214927c40340993506107ed92508491908b908b908b908b90610c24565b60405180910390a150505050505050565b610806610881565b606655565b610813610881565b6001600160a01b0381166108785760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610331565b610500816108db565b6033546001600160a01b031633146103dd5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610331565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166109545760405162461bcd60e51b815260040161033190610c77565b6103dd600054610100900460ff1661097e5760405162461bcd60e51b815260040161033190610c77565b6103dd336108db565b612f3080610cc383390190565b6000602082840312156109a657600080fd5b5035919050565b80356001600160a01b03811681146109c457600080fd5b919050565b6000602082840312156109db57600080fd5b6109e4826109ad565b9392505050565b634e487b7160e01b600052604160045260246000fd5b600082601f830112610a1257600080fd5b813567ffffffffffffffff80821115610a2d57610a2d6109eb565b604051601f8301601f19908116603f01168101908282118183101715610a5557610a556109eb565b81604052838152866020858801011115610a6e57600080fd5b836020870160208301376000602085830101528094505050505092915050565b60008060008060808587031215610aa457600080fd5b843567ffffffffffffffff80821115610abc57600080fd5b610ac888838901610a01565b95506020870135915080821115610ade57600080fd5b50610aeb87828801610a01565b935050610afa604086016109ad565b9396929550929360600135925050565b600060208284031215610b1c57600080fd5b5051919050565b600060208284031215610b3557600080fd5b815180151581146109e457600080fd5b60005b83811015610b60578181015183820152602001610b48565b50506000910152565b60008451610b7b818460208901610b45565b60609490941b6bffffffffffffffffffffffff191691909301908152601481019190915260340192915050565b60008151808452610bc0816020860160208601610b45565b601f01601f19169290920160200192915050565b60a081526000610be760a0830188610ba8565b8281036020840152610bf98188610ba8565b6001600160a01b03968716604085015260608401959095525050921660809092019190915292915050565b600060018060a01b038089168352808816602084015260c06040840152610c4e60c0840188610ba8565b8381036060850152610c608188610ba8565b959091166080840152505060a00152949350505050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fe60806040526006805460ff1916600117905534801561001d57600080fd5b50600080546001600160a01b03191633179055612ef18061003f6000396000f3fe6080604052600436106101e75760003560e01c80639a2d450511610102578063bc197c8111610095578063cb937adc11610064578063cb937adc146105f1578063d99bb9f714610606578063f0acd7d51461061b578063f23a6e611461062357600080fd5b8063bc197c811461057a578063c1223827146105a6578063c45a0155146105bc578063c4c9ca06146105dc57600080fd5b8063a035b1fe116100d1578063a035b1fe14610504578063a1dd6a2e1461051a578063a2b40d191461053a578063ba1508511461055a57600080fd5b80639a2d4505146104255780639a530419146104455780639d76ea581461045a578063a000e0841461047a57600080fd5b806349b5ace91161017a5780636337e5d4116101495780636337e5d4146103965780638da5cb5b146103ab5780638db8fd29146103e35780638e953a631461040357600080fd5b806349b5ace91461032c5780634fb2e45d146103415780635dd3ffd0146103615780636220aea81461038157600080fd5b8063150b7a02116101b6578063150b7a021461028e578063200d2ed2146102d257806320bf74f4146102ec5780634558d7171461030c57600080fd5b806301c234a8146101f357806301ffc9a71461021c5780630717cf521461024c5780630da0dbff1461026e57600080fd5b366101ee57005b600080fd5b3480156101ff57600080fd5b506102096103e881565b6040519081526020015b60405180910390f35b34801561022857600080fd5b5061023c610237366004612518565b61064f565b6040519015158152602001610213565b34801561025857600080fd5b5061026c610267366004612630565b610686565b005b34801561027a57600080fd5b5061020961028936600461273a565b610ae4565b34801561029a57600080fd5b506102b96102a93660046127c3565b630a85bd0160e11b949350505050565b6040516001600160e01b03199091168152602001610213565b3480156102de57600080fd5b5060065461023c9060ff1681565b3480156102f857600080fd5b5061026c610307366004612823565b610af1565b34801561031857600080fd5b5061026c610327366004612860565b610ecd565b34801561033857600080fd5b5061026c610f4c565b34801561034d57600080fd5b5061026c61035c366004612860565b6111e5565b34801561036d57600080fd5b5061026c61037c36600461287d565b6112be565b34801561038d57600080fd5b5061026c611324565b3480156103a257600080fd5b5061026c611424565b3480156103b757600080fd5b506001546103cb906001600160a01b031681565b6040516001600160a01b039091168152602001610213565b3480156103ef57600080fd5b506102096103fe3660046128ba565b61148f565b34801561040f57600080fd5b506104186114cc565b60405161021391906128e6565b34801561043157600080fd5b5061026c61044036600461287d565b61155a565b34801561045157600080fd5b506104186115c0565b34801561046657600080fd5b506002546103cb906001600160a01b031681565b34801561048657600080fd5b506104ce61049536600461273a565b60076020526000908152604090208054600182015460028301546003840154600490940154929391926001600160a01b03909116919085565b6040805195865260208601949094526001600160a01b03909216928401929092526060830191909152608082015260a001610213565b34801561051057600080fd5b5061020960035481565b34801561052657600080fd5b5061026c610535366004612934565b6115cd565b34801561054657600080fd5b5061026c61055536600461273a565b61166b565b34801561056657600080fd5b5061026c6105753660046129c9565b6116ca565b34801561058657600080fd5b506102b96105953660046129fe565b63bc197c8160e01b95945050505050565b3480156105b257600080fd5b50610209600a5481565b3480156105c857600080fd5b506000546103cb906001600160a01b031681565b3480156105e857600080fd5b5061026c6119dd565b3480156105fd57600080fd5b50610209611a47565b34801561061257600080fd5b5061026c611a58565b61026c611ac3565b34801561062f57600080fd5b506102b961063e366004612aac565b63f23a6e6160e01b95945050505050565b60006001600160e01b03198216630271189760e51b148061068057506301ffc9a760e01b6001600160e01b03198316145b92915050565b6001546001600160a01b031633146106b95760405162461bcd60e51b81526004016106b090612b15565b60405180910390fd5b815160005b81811015610adc578581815181106106d8576106d8612b3e565b6020026020010151600003610780578481815181106106f9576106f9612b3e565b60200260200101516001600160a01b03166342842e0e333087858151811061072357610723612b3e565b60200260200101516040518463ffffffff1660e01b815260040161074993929190612b54565b600060405180830381600087803b15801561076357600080fd5b505af1158015610777573d6000803e3d6000fd5b50505050610851565b85818151811061079257610792612b3e565b6020026020010151600103610851578481815181106107b3576107b3612b3e565b60200260200101516001600160a01b031663f242432a33308785815181106107dd576107dd612b3e565b60200260200101518786815181106107f7576107f7612b3e565b60200260200101516040518563ffffffff1660e01b815260040161081e9493929190612b78565b600060405180830381600087803b15801561083857600080fd5b505af115801561084c573d6000803e3d6000fd5b505050505b600061088f86838151811061086857610868612b3e565b602002602001015186848151811061088257610882612b3e565b602002602001015161148f565b600081815260076020526040812060040154919250036108b6576108b460088261226d565b505b8682815181106108c8576108c8612b3e565b602090810291909101810151600083815260079092526040909120908155600101819055855186908390811061090057610900612b3e565b60200260200101516007600083815260200190815260200160002060020160006101000a8154816001600160a01b0302191690836001600160a01b0316021790555084828151811061095457610954612b3e565b602002602001015160076000838152602001908152602001600020600301819055506109b884838151811061098b5761098b612b3e565b6020026020010151600760008481526020019081526020016000206004015461228090919063ffffffff16565b60008281526007602052604090206004015583516109fb908590849081106109e2576109e2612b3e565b6020026020010151600a5461228090919063ffffffff16565b600a819055507f9125b5c4a8d148552b55dd5af43ea17980b656542dbb9169d1da89a228e7028f878381518110610a3457610a34612b3e565b602002602001015182888581518110610a4f57610a4f612b3e565b6020026020010151888681518110610a6957610a69612b3e565b6020026020010151888781518110610a8357610a83612b3e565b602090810291909101810151600a5460408051978852928701959095526001600160a01b03909316908501526060840152608083015260a082015260c00160405180910390a15080610ad481612bd7565b9150506106be565b505050505050565b600061068060088361228c565b6001546001600160a01b03163314610b1b5760405162461bcd60e51b81526004016106b090612b15565b831580610b285750836001145b610b685760405162461bcd60e51b8152602060048201526011602482015270496e76616c69642063617264207479706560781b60448201526064016106b0565b83600003610c98576040516331a9108f60e11b81526004810183905233906001600160a01b03851690636352211e90602401602060405180830381865afa158015610bb7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdb9190612bf0565b6001600160a01b031614610c315760405162461bcd60e51b815260206004820152601760248201527f596f7520617265206e6f7420746f6b656e206f776e657200000000000000000060448201526064016106b0565b604051632142170760e11b81526001600160a01b038416906342842e0e90610c6190339030908790600401612b54565b600060405180830381600087803b158015610c7b57600080fd5b505af1158015610c8f573d6000803e3d6000fd5b50505050610dc2565b83600103610dc257604051627eeac760e11b81523360048201526024810183905281906001600160a01b0385169062fdd58e90604401602060405180830381865afa158015610ceb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d0f9190612c0d565b1015610d5d5760405162461bcd60e51b815260206004820152601c60248201527f596f7520646f6e2774206861766520656e6f75676820546f6b656e730000000060448201526064016106b0565b604051637921219560e11b81526001600160a01b0384169063f242432a90610d8f903390309087908790600401612b78565b600060405180830381600087803b158015610da957600080fd5b505af1158015610dbd573d6000803e3d6000fd5b505050505b6000610dce848461148f565b60008181526007602052604081206004015491925003610df557610df360088261226d565b505b6000818152600760205260409020858155600181018290556002810180546001600160a01b0319166001600160a01b0387161790556003810184905560040154610e3f9083612280565b600082815260076020526040902060040155600a54610e5e9083612280565b600a81905560408051878152602081018490526001600160a01b03871691810191909152606081018590526080810184905260a08101919091527f9125b5c4a8d148552b55dd5af43ea17980b656542dbb9169d1da89a228e7028f9060c0015b60405180910390a15050505050565b6001546001600160a01b03163314610ef75760405162461bcd60e51b81526004016106b090612b15565b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527fcf0c407085ca3ba312474d8448768345a1f695deaa14fcbd6d3bfee5f1ebce86906020015b60405180910390a150565b6001546001600160a01b03163314610f765760405162461bcd60e51b81526004016106b090612b15565b6000610f80611a47565b67ffffffffffffffff811115610f9857610f98612542565b604051908082528060200260200182016040528015610fc1578160200160208202803683370190505b50905060005b610fcf611a47565b8110156111b1576000610fe182610ae4565b905080838381518110610ff657610ff6612b3e565b6020908102919091018101919091526000828152600790915260409020600401541561119e576000818152600760209081526040808320815160a081018352815480825260018301549482019490945260028201546001600160a01b0316928101929092526003810154606083015260040154608082015291036110e35780604001516001600160a01b03166342842e0e303384606001516040518463ffffffff1660e01b81526004016110ac93929190612b54565b600060405180830381600087803b1580156110c657600080fd5b505af11580156110da573d6000803e3d6000fd5b5050505061115d565b805160010361115d57604080820151606083015160808401519251637921219560e11b81526001600160a01b039092169263f242432a9261112a9230923392600401612c26565b600060405180830381600087803b15801561114457600080fd5b505af1158015611158573d6000803e3d6000fd5b505050505b600082815260076020526040902060040154600a5461117b91612298565b600a5560008281526007602052604081206004015561119b6008836122a4565b50505b50806111a981612bd7565b915050610fc7565b507f196988fd7b6f23d05ca56ef39a4e36e8038146a591a64652399dbae0da27fe3281600a54604051610f41929190612c7b565b6001546001600160a01b0316331461120f5760405162461bcd60e51b81526004016106b090612b15565b6001600160a01b0381166112705760405162461bcd60e51b815260206004820152602260248201527f4f776e61626c653a206e6577206f776e6572206973207a65726f206164647265604482015261737360f01b60648201526084016106b0565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527fef2d6bcc8588d18f6a6c9e90d664073f2e04265248f5e3814b7b0b46b9e9080d90602001610f41565b6001546001600160a01b031633146112e85760405162461bcd60e51b81526004016106b090612b15565b60056112f48282612d48565b507f11e08370b4f68b25bd73ed77315f1bcab3f7568fe889f16a5a9122edf5ff738f81604051610f4191906128e6565b6001546001600160a01b0316331461134e5760405162461bcd60e51b81526004016106b090612b15565b47806113935760405162461bcd60e51b8152602060048201526014602482015273696e73756666696369656e742062616c616e636560601b60448201526064016106b0565b604051600090339083908381818185875af1925050503d80600081146113d5576040519150601f19603f3d011682016040523d82523d6000602084013e6113da565b606091505b50509050806114205760405162461bcd60e51b81526020600482015260126024820152714661696c656420746f20776974686472617760701b60448201526064016106b0565b5050565b6001546001600160a01b0316331461144e5760405162461bcd60e51b81526004016106b090612b15565b6006805460ff19169055604051600081527fa57693c28d08df0c902ce29d389e3f049d05cd83aa70c2a048bdf544b6044d54906020015b60405180910390a1565b604080516001600160a01b038416602082015290810182905260009060600160405160208183030381529060405280519060200120905092915050565b600580546114d990612cc3565b80601f016020809104026020016040519081016040528092919081815260200182805461150590612cc3565b80156115525780601f1061152757610100808354040283529160200191611552565b820191906000526020600020905b81548152906001019060200180831161153557829003601f168201915b505050505081565b6001546001600160a01b031633146115845760405162461bcd60e51b81526004016106b090612b15565b60046115908282612d48565b507f1f684be123de4215cef66caae7c9d41d91b1d1979fee7c4f4cfdf4ebc61c020e81604051610f4191906128e6565b600480546114d990612cc3565b6000546001600160a01b0316331461161b5760405162461bcd60e51b815260206004820152601160248201527027b7363c903337b9103330b1ba37b93c9760791b60448201526064016106b0565b60046116278682612d48565b5060056116348582612d48565b50600280546001600160a01b039485166001600160a01b031991821617909155600392909255600180549190931691161790555050565b6001546001600160a01b031633146116955760405162461bcd60e51b81526004016106b090612b15565b60038190556040518181527fa6dc15bdb68da224c66db4b3838d9a2b205138e8cff6774e57d0af91e196d62290602001610f41565b6001546001600160a01b031633146116f45760405162461bcd60e51b81526004016106b090612b15565b6000611700848461148f565b600081815260076020908152604091829020825160a0810184528154815260018201549281019290925260028101546001600160a01b031692820192909252600382015460608201819052600490920154608082015291925015801590611773575060408101516001600160a01b031615155b6117ca5760405162461bcd60e51b815260206004820152602260248201527f496e76616c696420436f6c6c656374696f6e20696420616e6420746f6b656e206044820152611a5960f21b60648201526084016106b0565b82816080015110156118155760405162461bcd60e51b8152602060048201526014602482015273496e73756666696369656e742062616c616e636560601b60448201526064016106b0565b6000831161185b5760405162461bcd60e51b8152602060048201526013602482015272125b9cdd59999a58da595b9d08185b5bdd5b9d606a1b60448201526064016106b0565b80516000036118d35780604001516001600160a01b03166342842e0e303384606001516040518463ffffffff1660e01b815260040161189c93929190612b54565b600060405180830381600087803b1580156118b657600080fd5b505af11580156118ca573d6000803e3d6000fd5b50505050611949565b80516001036119495780604001516001600160a01b031663f242432a30338460600151876040518563ffffffff1660e01b81526004016119169493929190612c26565b600060405180830381600087803b15801561193057600080fd5b505af1158015611944573d6000803e3d6000fd5b505050505b600a546119569084612298565b600a556000828152600760205260409020600401546119759084612298565b60008381526007602052604081206004018290550361199b576119996008836122a4565b505b600a546040805184815260208101869052908101919091527ff5c4b73c03f3d5d113b8e786c98cfa95dbf31dbb37b29c9864661845325e166490606001610ebe565b6001546001600160a01b03163314611a075760405162461bcd60e51b81526004016106b090612b15565b6006805460ff191660019081179091556040519081527fa57693c28d08df0c902ce29d389e3f049d05cd83aa70c2a048bdf544b6044d5490602001611485565b6000611a5360086122b0565b905090565b6001546001600160a01b03163314611a825760405162461bcd60e51b81526004016106b090612b15565b600180546001600160a01b0319169055604051600081527fef2d6bcc8588d18f6a6c9e90d664073f2e04265248f5e3814b7b0b46b9e9080d90602001611485565b60065460ff16611b155760405162461bcd60e51b815260206004820152601c60248201527f54686973206d797374657279626f782069732064697361626c65642e0000000060448201526064016106b0565b6000600a5411611b7c5760405162461bcd60e51b815260206004820152602c60248201527f5468657265206973206e6f206361726420696e2074686973206d79737465727960448201526b3137bc1030b73cb6b7b9329760a11b60648201526084016106b0565b60008060009054906101000a90046001600160a01b03166001600160a01b0316638abdf5aa6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611bd0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bf49190612c0d565b90506000611c196103e8611c13846003546122ba90919063ffffffff16565b906122c6565b90506000611c328260035461229890919063ffffffff16565b6002549091506001600160a01b0316611e0457600354341015611c8a5760405162461bcd60e51b815260206004820152601060248201526f1d1bdbc81cdb585b1b08185b5bdd5b9d60821b60448201526064016106b0565b8115611d4b57600080546040516001600160a01b039091169084908381818185875af1925050503d8060008114611cdd576040519150601f19603f3d011682016040523d82523d6000602084013e611ce2565b606091505b5050905080611d495760405162461bcd60e51b815260206004820152602d60248201527f4661696c656420746f2073656e6420736572766963652066656520746f20666160448201526c63746f7279206164647265737360981b60648201526084016106b0565b505b6001546040516000916001600160a01b03169083908381818185875af1925050503d8060008114611d98576040519150601f19603f3d011682016040523d82523d6000602084013e611d9d565b606091505b5050905080611dfe5760405162461bcd60e51b815260206004820152602760248201527f4661696c656420746f2073656e6420636f696e20746f206d797374657279626f6044820152663c1037bbb732b960c91b60648201526084016106b0565b50611fd3565b6002546003546040516323b872dd60e01b81526001600160a01b039092169182916323b872dd91611e3c913391309190600401612b54565b6020604051808303816000875af1158015611e5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e7f9190612e08565b611ecb5760405162461bcd60e51b815260206004820152601a60248201527f696e73756666696369656e7420746f6b656e2062616c616e636500000000000060448201526064016106b0565b8215611f515760005460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018590529082169063a9059cbb906044016020604051808303816000875af1158015611f24573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f489190612e08565b611f5157600080fd5b60015460405163a9059cbb60e01b81526001600160a01b039182166004820152602481018490529082169063a9059cbb906044016020604051808303816000875af1158015611fa4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611fc89190612e08565b611fd157600080fd5b505b6000611fdd6122d2565b600a54909150611fee906001612298565b600a556000818152600760205260409020600401546120675760405162461bcd60e51b815260206004820152602f60248201527f4e6f20656e6f756768206361726473206f662074686973206b696e6420696e2060448201526e3a34329036bcb9ba32b93cb137bc1760891b60648201526084016106b0565b60008181526007602052604081205490036120fd576000818152600760205260409081902060028101546003909101549151632142170760e11b81526001600160a01b03909116916342842e0e916120c6913091339190600401612b54565b600060405180830381600087803b1580156120e057600080fd5b505af11580156120f4573d6000803e3d6000fd5b505050506121e1565b6000818152600760205260409020546001036121e1576000818152600760205260409081902060028101546003909101549151637921219560e11b815230600482015233602482015260448101929092526001606483015260a06084830152602860a48301527f596f7572207072697a652066726f6d20506978656c70696d7020486578546f7960c4830152670e698dedee884def60c31b60e48301526001600160a01b03169063f242432a9061010401600060405180830381600087803b1580156121c857600080fd5b505af11580156121dc573d6000803e3d6000fd5b505050505b6000818152600760205260409020600401546121fe906001612298565b600082815260076020526040812060040182905503612224576122226008826122a4565b505b600a54604080513381526020810184905280820192909252517fbf0e5397fea21fa0112849e656cea9b74500509d4403f1700b59e9fdd60afe129181900360600190a150505050565b600061227983836123a0565b9392505050565b60006122798284612e2a565b600061227983836123ef565b60006122798284612e3d565b60006122798383612419565b6000610680825490565b60006122798284612e50565b60006122798284612e7d565b600a546040805142602082015244918101919091524360608201526000918291612318919060800160408051601f1981840301815291905280516020909101209061250c565b90506000806123276000610ae4565b905060005b612334611a47565b8110156123985761236c6007600061234b84610ae4565b8152602001908152602001600020600401548461228090919063ffffffff16565b9250838311156123865761237f81610ae4565b9150612398565b8061239081612bd7565b91505061232c565b509392505050565b60008181526001830160205260408120546123e757508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610680565b506000610680565b600082600001828154811061240657612406612b3e565b9060005260206000200154905092915050565b6000818152600183016020526040812054801561250257600061243d600183612e3d565b855490915060009061245190600190612e3d565b90508181146124b657600086600001828154811061247157612471612b3e565b906000526020600020015490508087600001848154811061249457612494612b3e565b6000918252602080832090910192909255918252600188019052604090208390555b85548690806124c7576124c7612e91565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610680565b6000915050610680565b60006122798284612ea7565b60006020828403121561252a57600080fd5b81356001600160e01b03198116811461227957600080fd5b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561258157612581612542565b604052919050565b600067ffffffffffffffff8211156125a3576125a3612542565b5060051b60200190565b600082601f8301126125be57600080fd5b813560206125d36125ce83612589565b612558565b82815260059290921b840181019181810190868411156125f257600080fd5b8286015b8481101561260d57803583529183019183016125f6565b509695505050505050565b6001600160a01b038116811461262d57600080fd5b50565b6000806000806080858703121561264657600080fd5b843567ffffffffffffffff8082111561265e57600080fd5b61266a888389016125ad565b955060209150818701358181111561268157600080fd5b8701601f8101891361269257600080fd5b80356126a06125ce82612589565b81815260059190911b8201840190848101908b8311156126bf57600080fd5b928501925b828410156126e65783356126d781612618565b825292850192908501906126c4565b975050505060408701359150808211156126ff57600080fd5b61270b888389016125ad565b9350606087013591508082111561272157600080fd5b5061272e878288016125ad565b91505092959194509250565b60006020828403121561274c57600080fd5b5035919050565b600082601f83011261276457600080fd5b813567ffffffffffffffff81111561277e5761277e612542565b612791601f8201601f1916602001612558565b8181528460208386010111156127a657600080fd5b816020850160208301376000918101602001919091529392505050565b600080600080608085870312156127d957600080fd5b84356127e481612618565b935060208501356127f481612618565b925060408501359150606085013567ffffffffffffffff81111561281757600080fd5b61272e87828801612753565b6000806000806080858703121561283957600080fd5b84359350602085013561284b81612618565b93969395505050506040820135916060013590565b60006020828403121561287257600080fd5b813561227981612618565b60006020828403121561288f57600080fd5b813567ffffffffffffffff8111156128a657600080fd5b6128b284828501612753565b949350505050565b600080604083850312156128cd57600080fd5b82356128d881612618565b946020939093013593505050565b600060208083528351808285015260005b81811015612913578581018301518582016040015282016128f7565b506000604082860101526040601f19601f8301168501019250505092915050565b600080600080600060a0868803121561294c57600080fd5b853567ffffffffffffffff8082111561296457600080fd5b61297089838a01612753565b9650602088013591508082111561298657600080fd5b5061299388828901612753565b94505060408601356129a481612618565b92506060860135915060808601356129bb81612618565b809150509295509295909350565b6000806000606084860312156129de57600080fd5b83356129e981612618565b95602085013595506040909401359392505050565b600080600080600060a08688031215612a1657600080fd5b8535612a2181612618565b94506020860135612a3181612618565b9350604086013567ffffffffffffffff80821115612a4e57600080fd5b612a5a89838a016125ad565b94506060880135915080821115612a7057600080fd5b612a7c89838a016125ad565b93506080880135915080821115612a9257600080fd5b50612a9f88828901612753565b9150509295509295909350565b600080600080600060a08688031215612ac457600080fd5b8535612acf81612618565b94506020860135612adf81612618565b93506040860135925060608601359150608086013567ffffffffffffffff811115612b0957600080fd5b612a9f88828901612753565b6020808252600f908201526e27b7363c903337b91037bbb732b91760891b604082015260600190565b634e487b7160e01b600052603260045260246000fd5b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a060808201819052600890820152671059190810d85c9960c21b60c082015260e00190565b634e487b7160e01b600052601160045260246000fd5b600060018201612be957612be9612bc1565b5060010190565b600060208284031215612c0257600080fd5b815161227981612618565b600060208284031215612c1f57600080fd5b5051919050565b6001600160a01b0394851681529290931660208301526040820152606081019190915260a060808201819052601490820152730a4cae6cae84090caf0a8def2e698dedee884def60631b60c082015260e00190565b604080825283519082018190526000906020906060840190828701845b82811015612cb457815184529284019290840190600101612c98565b50505092019290925292915050565b600181811c90821680612cd757607f821691505b602082108103612cf757634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115612d4357600081815260208120601f850160051c81016020861015612d245750805b601f850160051c820191505b81811015610adc57828155600101612d30565b505050565b815167ffffffffffffffff811115612d6257612d62612542565b612d7681612d708454612cc3565b84612cfd565b602080601f831160018114612dab5760008415612d935750858301515b600019600386901b1c1916600185901b178555610adc565b600085815260208120601f198616915b82811015612dda57888601518255948401946001909101908401612dbb565b5085821015612df85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208284031215612e1a57600080fd5b8151801515811461227957600080fd5b8082018082111561068057610680612bc1565b8181038181111561068057610680612bc1565b808202811582820484141761068057610680612bc1565b634e487b7160e01b600052601260045260246000fd5b600082612e8c57612e8c612e67565b500490565b634e487b7160e01b600052603160045260246000fd5b600082612eb657612eb6612e67565b50069056fea264697066735822122010f81b4fbb0c0180f2d4185deedbed66051246081d85e6b3f62ab3a28e5a3f7264736f6c63430008110033a2646970667358221220ad00e399670e0ebc1996bb72d947d527cc56e6cd7a8dbbc2b8723db97e637c4864736f6c63430008110033