Contract Address Details

0x72cc6E4DE47f673062c41C67505188144a0a3D84

Factory Last Balance Update: Block #17927853
Created by 0x5befa2–df5471 at 0xac9f7d–137867

Balance

0 Fuse

Fetching tokens...

Contract name:
Factory




Optimization enabled
true
Compiler version
v0.8.6+commit.11564f7e




Optimization runs
200
EVM Version
default




Verified at
2022-04-12 02:35:46.049718Z

Constructor Arguments

000000000000000000000000ca49ecf7e7bb9bbc9d1d295384663f6ba5c0e36600000000000000000000000071eeba415a523f5c952cc2f06361d5443545ad28

Arg [0] (address) : 0xca49ecf7e7bb9bbc9d1d295384663f6ba5c0e366
Arg [1] (address) : 0x71eeba415a523f5c952cc2f06361d5443545ad28

              

Contract source code

// File @openzeppelin/contracts/utils/structs/EnumerableSet.sol@v4.5.0
// OpenZeppelin Contracts v4.4.1 (utils/structs/EnumerableSet.sol)
// SPDX-License-Identifier: GPL-2.0-or-later
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastvalue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastvalue;
// Update the index for the moved value
set._indexes[lastvalue] = valueIndex; // Replace lastvalue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
return _values(set._inner);
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
assembly {
result := store
}
return result;
}
}
// File @openzeppelin/contracts/utils/Context.sol@v4.5.0
// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
}
// File @openzeppelin/contracts/access/Ownable.sol@v4.5.0
// OpenZeppelin Contracts v4.4.1 (access/Ownable.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
_;
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions anymore. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby removing any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
// File @openzeppelin/contracts/token/ERC20/IERC20.sol@v4.5.0
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(
address from,
address to,
uint256 amount
) external returns (bool);
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
}
// File @openzeppelin/contracts/utils/Address.sol@v4.5.0
// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCall(target, data, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value
) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
require(isContract(target), "Address: call to non-contract");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
require(isContract(target), "Address: static call to non-contract");
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
require(isContract(target), "Address: delegate call to non-contract");
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResult(success, returndata, errorMessage);
}
/**
* @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
}
// File @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol@v4.5.0
// OpenZeppelin Contracts v4.4.1 (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
function safeTransfer(
IERC20 token,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
function safeTransferFrom(
IERC20 token,
address from,
address to,
uint256 value
) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(
IERC20 token,
address spender,
uint256 value
) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
function safeIncreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
uint256 newAllowance = token.allowance(address(this), spender) + value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
function safeDecreaseAllowance(
IERC20 token,
address spender,
uint256 value
) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
uint256 newAllowance = oldAllowance - value;
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));
}
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
if (returndata.length > 0) {
// Return data is optional
require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
}
}
// File @openzeppelin/contracts/security/ReentrancyGuard.sol@v4.5.0
// OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
// On the first call to nonReentrant, _notEntered will be true
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
_;
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
}
// File @openzeppelin/contracts/utils/Strings.sol@v4.5.0
// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _HEX_SYMBOLS = "0123456789abcdef";
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
// Inspired by OraclizeAPI's implementation - MIT licence
// https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol
if (value == 0) {
return "0";
}
uint256 temp = value;
uint256 digits;
while (temp != 0) {
digits++;
temp /= 10;
}
bytes memory buffer = new bytes(digits);
while (value != 0) {
digits -= 1;
buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));
value /= 10;
}
return string(buffer);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
if (value == 0) {
return "0x00";
}
uint256 temp = value;
uint256 length = 0;
while (temp != 0) {
length++;
temp >>= 8;
}
return toHexString(value, length);
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _HEX_SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
}
// File @openzeppelin/contracts/utils/cryptography/ECDSA.sol@v4.5.0
// OpenZeppelin Contracts (last updated v4.5.0) (utils/cryptography/ECDSA.sol)
pragma solidity ^0.8.0;
/**
* @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.
*
* These functions can be used to verify that a message was signed by the holder
* of the private keys of a given address.
*/
library ECDSA {
enum RecoverError {
NoError,
InvalidSignature,
InvalidSignatureLength,
InvalidSignatureS,
InvalidSignatureV
}
function _throwError(RecoverError error) private pure {
if (error == RecoverError.NoError) {
return; // no error: do nothing
} else if (error == RecoverError.InvalidSignature) {
revert("ECDSA: invalid signature");
} else if (error == RecoverError.InvalidSignatureLength) {
revert("ECDSA: invalid signature length");
} else if (error == RecoverError.InvalidSignatureS) {
revert("ECDSA: invalid signature 's' value");
} else if (error == RecoverError.InvalidSignatureV) {
revert("ECDSA: invalid signature 'v' value");
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature` or error string. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*
* Documentation for signature generation:
* - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]
* - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]
*
* _Available since v4.3._
*/
function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {
// Check the signature length
// - case 65: r,s,v signature (standard)
// - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._
if (signature.length == 65) {
bytes32 r;
bytes32 s;
uint8 v;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
s := mload(add(signature, 0x40))
v := byte(0, mload(add(signature, 0x60)))
}
return tryRecover(hash, v, r, s);
} else if (signature.length == 64) {
bytes32 r;
bytes32 vs;
// ecrecover takes the signature parameters, and the only way to get them
// currently is to use assembly.
assembly {
r := mload(add(signature, 0x20))
vs := mload(add(signature, 0x40))
}
return tryRecover(hash, r, vs);
} else {
return (address(0), RecoverError.InvalidSignatureLength);
}
}
/**
* @dev Returns the address that signed a hashed message (`hash`) with
* `signature`. This address can then be used for verification purposes.
*
* The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:
* this function rejects them by requiring the `s` value to be in the lower
* half order, and the `v` value to be either 27 or 28.
*
* IMPORTANT: `hash` _must_ be the result of a hash operation for the
* verification to be secure: it is possible to craft signatures that
* recover to arbitrary addresses for non-hashed data. A safe way to ensure
* this is by receiving a hash of the original message (which may otherwise
* be too long), and then calling {toEthSignedMessageHash} on it.
*/
function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, signature);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.
*
* See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address, RecoverError) {
bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);
uint8 v = uint8((uint256(vs) >> 255) + 27);
return tryRecover(hash, v, r, s);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.
*
* _Available since v4.2._
*/
function recover(
bytes32 hash,
bytes32 r,
bytes32 vs
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, r, vs);
_throwError(error);
return recovered;
}
/**
* @dev Overload of {ECDSA-tryRecover} that receives the `v`,
* `r` and `s` signature fields separately.
*
* _Available since v4.3._
*/
function tryRecover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address, RecoverError) {
// EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature
// unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines
// the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most
// signatures from current libraries generate a unique signature with an s-value in the lower half order.
//
// If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value
// with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or
// vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept
// these malleable signatures as well.
if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {
return (address(0), RecoverError.InvalidSignatureS);
}
if (v != 27 && v != 28) {
return (address(0), RecoverError.InvalidSignatureV);
}
// If the signature is valid (and not malleable), return the signer address
address signer = ecrecover(hash, v, r, s);
if (signer == address(0)) {
return (address(0), RecoverError.InvalidSignature);
}
return (signer, RecoverError.NoError);
}
/**
* @dev Overload of {ECDSA-recover} that receives the `v`,
* `r` and `s` signature fields separately.
*/
function recover(
bytes32 hash,
uint8 v,
bytes32 r,
bytes32 s
) internal pure returns (address) {
(address recovered, RecoverError error) = tryRecover(hash, v, r, s);
_throwError(error);
return recovered;
}
/**
* @dev Returns an Ethereum Signed Message, created from a `hash`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {
// 32 is the length in bytes of hash,
// enforced by the type signature above
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", hash));
}
/**
* @dev Returns an Ethereum Signed Message, created from `s`. This
* produces hash corresponding to the one signed with the
* https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]
* JSON-RPC method as part of EIP-191.
*
* See {recover}.
*/
function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s));
}
/**
* @dev Returns an Ethereum Signed Typed Data, created from a
* `domainSeparator` and a `structHash`. This produces hash corresponding
* to the one signed with the
* https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]
* JSON-RPC method as part of EIP-712.
*
* See {recover}.
*/
function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {
return keccak256(abi.encodePacked("\x19\x01", domainSeparator, structHash));
}
}
// File @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol@v4.5.0
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface for the optional metadata functions from the ERC20 standard.
*
* _Available since v4.1._
*/
interface IERC20Metadata is IERC20 {
/**
* @dev Returns the name of the token.
*/
function name() external view returns (string memory);
/**
* @dev Returns the symbol of the token.
*/
function symbol() external view returns (string memory);
/**
* @dev Returns the decimals places of the token.
*/
function decimals() external view returns (uint8);
}
// File @openzeppelin/contracts/token/ERC20/ERC20.sol@v4.5.0
// OpenZeppelin Contracts (last updated v4.5.0) (token/ERC20/ERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC20} interface.
*
* This implementation is agnostic to the way tokens are created. This means
* that a supply mechanism has to be added in a derived contract using {_mint}.
* For a generic mechanism see {ERC20PresetMinterPauser}.
*
* TIP: For a detailed writeup see our guide
* https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* We have followed general OpenZeppelin Contracts guidelines: functions revert
* instead returning `false` on failure. This behavior is nonetheless
* conventional and does not conflict with the expectations of ERC20
* applications.
*
* Additionally, an {Approval} event is emitted on calls to {transferFrom}.
* This allows applications to reconstruct the allowance for all accounts just
* by listening to said events. Other implementations of the EIP may not emit
* these events, as it isn't required by the specification.
*
* Finally, the non-standard {decreaseAllowance} and {increaseAllowance}
* functions have been added to mitigate the well-known issues around setting
* allowances. See {IERC20-approve}.
*/
contract ERC20 is Context, IERC20, IERC20Metadata {
mapping(address => uint256) private _balances;
mapping(address => mapping(address => uint256)) private _allowances;
uint256 private _totalSupply;
string private _name;
string private _symbol;
/**
* @dev Sets the values for {name} and {symbol}.
*
* The default value of {decimals} is 18. To select a different value for
* {decimals} you should overload it.
*
* All two of these values are immutable: they can only be set once during
* construction.
*/
constructor(string memory name_, string memory symbol_) {
_name = name_;
_symbol = symbol_;
}
/**
* @dev Returns the name of the token.
*/
function name() public view virtual override returns (string memory) {
return _name;
}
/**
* @dev Returns the symbol of the token, usually a shorter version of the
* name.
*/
function symbol() public view virtual override returns (string memory) {
return _symbol;
}
/**
* @dev Returns the number of decimals used to get its user representation.
* For example, if `decimals` equals `2`, a balance of `505` tokens should
* be displayed to a user as `5.05` (`505 / 10 ** 2`).
*
* Tokens usually opt for a value of 18, imitating the relationship between
* Ether and Wei. This is the value {ERC20} uses, unless this function is
* overridden;
*
* NOTE: This information is only used for _display_ purposes: it in
* no way affects any of the arithmetic of the contract, including
* {IERC20-balanceOf} and {IERC20-transfer}.
*/
function decimals() public view virtual override returns (uint8) {
return 18;
}
/**
* @dev See {IERC20-totalSupply}.
*/
function totalSupply() public view virtual override returns (uint256) {
return _totalSupply;
}
/**
* @dev See {IERC20-balanceOf}.
*/
function balanceOf(address account) public view virtual override returns (uint256) {
return _balances[account];
}
/**
* @dev See {IERC20-transfer}.
*
* Requirements:
*
* - `to` cannot be the zero address.
* - the caller must have a balance of at least `amount`.
*/
function transfer(address to, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_transfer(owner, to, amount);
return true;
}
/**
* @dev See {IERC20-allowance}.
*/
function allowance(address owner, address spender) public view virtual override returns (uint256) {
return _allowances[owner][spender];
}
/**
* @dev See {IERC20-approve}.
*
* NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on
* `transferFrom`. This is semantically equivalent to an infinite approval.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function approve(address spender, uint256 amount) public virtual override returns (bool) {
address owner = _msgSender();
_approve(owner, spender, amount);
return true;
}
/**
* @dev See {IERC20-transferFrom}.
*
* Emits an {Approval} event indicating the updated allowance. This is not
* required by the EIP. See the note at the beginning of {ERC20}.
*
* NOTE: Does not update the allowance if the current allowance
* is the maximum `uint256`.
*
* Requirements:
*
* - `from` and `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
* - the caller must have allowance for ``from``'s tokens of at least
* `amount`.
*/
function transferFrom(
address from,
address to,
uint256 amount
) public virtual override returns (bool) {
address spender = _msgSender();
_spendAllowance(from, spender, amount);
_transfer(from, to, amount);
return true;
}
/**
* @dev Atomically increases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
*/
function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {
address owner = _msgSender();
_approve(owner, spender, _allowances[owner][spender] + addedValue);
return true;
}
/**
* @dev Atomically decreases the allowance granted to `spender` by the caller.
*
* This is an alternative to {approve} that can be used as a mitigation for
* problems described in {IERC20-approve}.
*
* Emits an {Approval} event indicating the updated allowance.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `spender` must have allowance for the caller of at least
* `subtractedValue`.
*/
function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {
address owner = _msgSender();
uint256 currentAllowance = _allowances[owner][spender];
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `sender` to `recipient`.
*
* This internal function is equivalent to {transfer}, and can be used to
* e.g. implement automatic token fees, slashing mechanisms, etc.
*
* Emits a {Transfer} event.
*
* Requirements:
*
* - `from` cannot be the zero address.
* - `to` cannot be the zero address.
* - `from` must have a balance of at least `amount`.
*/
function _transfer(
address from,
address to,
uint256 amount
) internal virtual {
require(from != address(0), "ERC20: transfer from the zero address");
require(to != address(0), "ERC20: transfer to the zero address");
_beforeTokenTransfer(from, to, amount);
uint256 fromBalance = _balances[from];
require(fromBalance >= amount, "ERC20: transfer amount exceeds balance");
unchecked {
_balances[from] = fromBalance - amount;
}
_balances[to] += amount;
emit Transfer(from, to, amount);
_afterTokenTransfer(from, to, amount);
}
/** @dev Creates `amount` tokens and assigns them to `account`, increasing
* the total supply.
*
* Emits a {Transfer} event with `from` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
*/
function _mint(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: mint to the zero address");
_beforeTokenTransfer(address(0), account, amount);
_totalSupply += amount;
_balances[account] += amount;
emit Transfer(address(0), account, amount);
_afterTokenTransfer(address(0), account, amount);
}
/**
* @dev Destroys `amount` tokens from `account`, reducing the
* total supply.
*
* Emits a {Transfer} event with `to` set to the zero address.
*
* Requirements:
*
* - `account` cannot be the zero address.
* - `account` must have at least `amount` tokens.
*/
function _burn(address account, uint256 amount) internal virtual {
require(account != address(0), "ERC20: burn from the zero address");
_beforeTokenTransfer(account, address(0), amount);
uint256 accountBalance = _balances[account];
require(accountBalance >= amount, "ERC20: burn amount exceeds balance");
unchecked {
_balances[account] = accountBalance - amount;
}
_totalSupply -= amount;
emit Transfer(account, address(0), amount);
_afterTokenTransfer(account, address(0), amount);
}
/**
* @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.
*
* This internal function is equivalent to `approve`, and can be used to
* e.g. set automatic allowances for certain subsystems, etc.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `owner` cannot be the zero address.
* - `spender` cannot be the zero address.
*/
function _approve(
address owner,
address spender,
uint256 amount
) internal virtual {
require(owner != address(0), "ERC20: approve from the zero address");
require(spender != address(0), "ERC20: approve to the zero address");
_allowances[owner][spender] = amount;
emit Approval(owner, spender, amount);
}
/**
* @dev Spend `amount` form the allowance of `owner` toward `spender`.
*
* Does not update the allowance amount in case of infinite allowance.
* Revert if not enough allowance is available.
*
* Might emit an {Approval} event.
*/
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual {
uint256 currentAllowance = allowance(owner, spender);
if (currentAllowance != type(uint256).max) {
require(currentAllowance >= amount, "ERC20: insufficient allowance");
unchecked {
_approve(owner, spender, currentAllowance - amount);
}
}
}
/**
* @dev Hook that is called before any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* will be transferred to `to`.
* - when `from` is zero, `amount` tokens will be minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens will be burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _beforeTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
/**
* @dev Hook that is called after any transfer of tokens. This includes
* minting and burning.
*
* Calling conditions:
*
* - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens
* has been transferred to `to`.
* - when `from` is zero, `amount` tokens have been minted for `to`.
* - when `to` is zero, `amount` of ``from``'s tokens have been burned.
* - `from` and `to` are never both zero.
*
* To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].
*/
function _afterTokenTransfer(
address from,
address to,
uint256 amount
) internal virtual {}
}
// File contracts/interfaces/ILP.sol
pragma solidity ^0.8.6;
interface ILP {
function name() external view returns (string memory);
function symbol() external view returns (string memory);
function mint(address _to, uint256 _amount) external returns (bool);
function mintable() external view returns (bool);
function burnable() external view returns (bool);
function mintableStatusFrozen() external view returns (bool);
function burnableStatusFrozen() external view returns (bool);
function burn(
uint256 _amount,
address[] memory _tokens,
address[] memory _adapters,
address[] memory _pools
) external returns (bool);
}
// File contracts/interfaces/IAdapter.sol
pragma solidity ^0.8.6;
interface IAdapter {
function withdraw(
address _recipient,
address _pool,
uint256 _share // multiplied by 1e18, for example 20% = 2e17
) external returns (bool);
}
// File contracts/interfaces/IFactory.sol
pragma solidity ^0.8.6;
interface IFactory {
function getDaos() external view returns (address[] memory);
function shop() external view returns (address);
function monthlyCost() external view returns (uint256);
function subscriptions(address _dao) external view returns (uint256);
function containsDao(address _dao) external view returns (bool);
}
// File contracts/core/Dao.sol
/*
██ ██ ██████ █████ ██████ ██████ █████ ██████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███ ██ ██ ███████ ██ ██ ██ ██ ███████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██████ ██ ██ ██████ ██████ ██ ██ ██████
*/
pragma solidity ^0.8.6;
contract Dao is ReentrancyGuard, ERC20 {
using EnumerableSet for EnumerableSet.AddressSet;
using SafeERC20 for IERC20;
using Address for address;
using Address for address payable;
using ECDSA for bytes32;
uint32 public constant VOTING_DURATION = 3 days;
/*----STATE------------------------------------------*/
// These addresses can rule without voting
EnumerableSet.AddressSet private permitted;
// These contracts help burn LP's
EnumerableSet.AddressSet private adapters;
// Factory Address
address public immutable factory;
// Shop Address
address public immutable shop;
// LP Token Address
address public lp = address(0);
// Quorum >=1 <=100
uint8 public quorum;
// Executed Voting
struct ExecutedVoting {
address target;
bytes data;
uint256 value;
uint256 nonce;
uint256 timestamp;
uint256 executionTimestamp;
bytes32 txHash;
bytes[] sigs;
}
ExecutedVoting[] internal executedVoting;
mapping(bytes32 => bool) public executedTx;
struct ExecutedPermitted {
address target;
bytes data;
uint256 value;
uint256 executionTimestamp;
address executor;
}
ExecutedPermitted[] public executedPermitted;
// GT
bool public mintable = true;
bool public burnable = true;
/*----EVENTS-----------------------------------------*/
event Executed(
address indexed target,
bytes data,
uint256 value,
uint256 indexed nonce,
uint256 timestamp,
uint256 executionTimestamp,
bytes32 txHash,
bytes[] sigs
);
event ExecutedP(
address indexed target,
bytes data,
uint256 value,
address indexed executor
);
/*----MODIFIERS--------------------------------------*/
modifier onlyDao() {
require(
msg.sender == address(this),
"DAO: this function is only for DAO"
);
_;
}
/*----CONSTRUCTOR------------------------------------*/
constructor(
string memory _name,
string memory _symbol,
uint8 _quorum,
address[] memory _partners,
uint256[] memory _shares
) ERC20(_name, _symbol) {
factory = msg.sender;
shop = IFactory(msg.sender).shop();
require(
_quorum >= 1 && _quorum <= 100,
"DAO: quorum should be 1 <= q <= 100"
);
quorum = _quorum;
require(
_partners.length > 0 && _partners.length == _shares.length,
"DAO: shares distribution is invalid"
);
for (uint256 i = 0; i < _partners.length; i++) {
_mint(_partners[i], _shares[i]);
}
}
/*----MAIN FUNCTIONS TO RULE--------------------------*/
function executePermitted(
address _target,
bytes calldata _data,
uint256 _value
) external nonReentrant returns (bool) {
require(checkSubscription(), "DAO: subscription not paid");
require(permitted.contains(msg.sender), "DAO: only for permitted");
executedPermitted.push(
ExecutedPermitted({
target: _target,
data: _data,
value: _value,
executionTimestamp: block.timestamp,
executor: msg.sender
})
);
emit ExecutedP(_target, _data, _value, msg.sender);
if (_data.length == 0) {
payable(_target).sendValue(_value);
} else {
if (_value == 0) {
_target.functionCall(_data);
} else {
_target.functionCallWithValue(_data, _value);
}
}
return true;
}
function execute(
address _target,
bytes calldata _data,
uint256 _value,
uint256 _nonce,
uint256 _timestamp,
bytes[] memory _sigs
) external nonReentrant returns (bool) {
require(checkSubscription(), "DAO: subscription not paid");
require(balanceOf(msg.sender) > 0, "DAO: only for members");
require(
_timestamp + VOTING_DURATION >= block.timestamp,
"DAO: voting is over"
);
bytes32 txHash = getTxHash(_target, _data, _value, _nonce, _timestamp);
require(!executedTx[txHash], "DAO: voting already executed");
require(_checkSigs(_sigs, txHash), "DAO: quorum is not reached");
executedTx[txHash] = true;
executedVoting.push(
ExecutedVoting({
target: _target,
data: _data,
value: _value,
nonce: _nonce,
timestamp: _timestamp,
executionTimestamp: block.timestamp,
txHash: txHash,
sigs: _sigs
})
);
emit Executed(
_target,
_data,
_value,
_nonce,
_timestamp,
block.timestamp,
txHash,
_sigs
);
if (_data.length == 0) {
payable(_target).sendValue(_value);
} else {
if (_value == 0) {
_target.functionCall(_data);
} else {
_target.functionCallWithValue(_data, _value);
}
}
return true;
}
function getTxHash(
address _target,
bytes calldata _data,
uint256 _value,
uint256 _nonce,
uint256 _timestamp
) public view returns (bytes32) {
return
keccak256(
abi.encode(
address(this),
_target,
_data,
_value,
_nonce,
_timestamp,
block.chainid
)
);
}
function _checkSigs(bytes[] memory _sigs, bytes32 _txHash)
internal
view
returns (bool)
{
bytes32 ethSignedHash = _txHash.toEthSignedMessageHash();
uint256 share = 0;
address[] memory signers = new address[](_sigs.length);
for (uint256 i = 0; i < _sigs.length; i++) {
address signer = ethSignedHash.recover(_sigs[i]);
signers[i] = signer;
}
require(!_hasDuplicate(signers), "DAO: signatures are not unique");
for (uint256 i = 0; i < signers.length; i++) {
share += balanceOf(signers[i]);
}
if (share * 100 < totalSupply() * quorum) {
return false;
}
return true;
}
function checkSubscription() public view returns (bool) {
if (
IFactory(factory).monthlyCost() > 0 &&
IFactory(factory).subscriptions(address(this)) < block.timestamp
) {
return false;
}
return true;
}
/*----BURN LP TOKENS---------------------------------*/
function burnLp(
address _recipient,
uint256 _share,
address[] memory _tokens,
address[] memory _adapters,
address[] memory _pools
) external nonReentrant returns (bool) {
require(lp != address(0), "DAO: LP not set yet");
require(msg.sender == lp, "DAO: only for LP");
require(
!_hasDuplicate(_tokens),
"DAO: duplicates are prohibited (tokens)"
);
for (uint256 i = 0; i < _tokens.length; i++) {
require(
_tokens[i] != lp && _tokens[i] != address(this),
"DAO: LP and GT cannot be part of a share"
);
}
require(_adapters.length == _pools.length, "DAO: adapters error");
if (_adapters.length > 0) {
uint256 length = _adapters.length;
if (length > 1) {
for (uint256 i = 0; i < length - 1; i++) {
for (uint256 j = i + 1; j < length; j++) {
require(
!(_adapters[i] == _adapters[j] &&
_pools[i] == _pools[j]),
"DAO: duplicates are prohibited (adapters)"
);
}
}
}
}
// ETH
payable(_recipient).sendValue((address(this).balance * _share) / 1e18);
// Tokens
if (_tokens.length > 0) {
uint256[] memory _tokenShares = new uint256[](_tokens.length);
for (uint256 i = 0; i < _tokens.length; i++) {
_tokenShares[i] = ((IERC20(_tokens[i]).balanceOf(
address(this)
) * _share) / 1e18);
}
for (uint256 i = 0; i < _tokens.length; i++) {
IERC20(_tokens[i]).safeTransfer(_recipient, _tokenShares[i]);
}
}
// Adapters
if (_adapters.length > 0) {
uint256 length = _adapters.length;
for (uint256 i = 0; i < length; i++) {
require(
adapters.contains(_adapters[i]),
"DAO: this is not an adapter"
);
require(
permitted.contains(_adapters[i]),
"DAO: this adapter is not permitted"
);
bool b = IAdapter(_adapters[i]).withdraw(
_recipient,
_pools[i],
_share
);
require(b, "DAO: withdrawal error");
}
}
return true;
}
/*----GT MANAGEMENT----------------------------------*/
function mint(address _to, uint256 _amount)
external
onlyDao
returns (bool)
{
require(mintable, "DAO: GT minting is disabled");
_mint(_to, _amount);
return true;
}
function burn(address _to, uint256 _amount)
external
onlyDao
returns (bool)
{
require(burnable, "DAO: GT burning is disabled");
_burn(_to, _amount);
return true;
}
function move(
address _sender,
address _recipient,
uint256 _amount
) external onlyDao returns (bool) {
_transfer(_sender, _recipient, _amount);
return true;
}
function disableMinting() external onlyDao returns (bool) {
mintable = false;
return true;
}
function disableBurning() external onlyDao returns (bool) {
burnable = false;
return true;
}
/*----ADAPTERS & PERMITTED---------------------------*/
function addAdapter(address a) external onlyDao returns (bool) {
require(adapters.add(a), "DAO: already an adapter");
permitted.add(a);
return true;
}
function removeAdapter(address a) external onlyDao returns (bool) {
require(adapters.remove(a), "DAO: not an adapter");
permitted.remove(a);
return true;
}
function addPermitted(address p) external onlyDao returns (bool) {
require(permitted.add(p), "DAO: already permitted");
return true;
}
function removePermitted(address p) external onlyDao returns (bool) {
require(permitted.remove(p), "DAO: not a permitted");
return true;
}
/*----LP---------------------------------------------*/
function setLp(address _lp) external returns (bool) {
require(lp == address(0), "DAO: LP address has already been set");
require(msg.sender == shop, "DAO: only Shop can set LP");
lp = _lp;
return true;
}
/*----QUORUM-----------------------------------------*/
function changeQuorum(uint8 _q) external onlyDao returns (bool) {
require(_q >= 1 && _q <= 100, "DAO: quorum should be 1 <= q <= 100");
quorum = _q;
return true;
}
/*----VIEW FUNCTIONS---------------------------------*/
function executedVotingByIndex(uint256 _index)
external
view
returns (ExecutedVoting memory)
{
return executedVoting[_index];
}
function getExecutedVoting()
external
view
returns (ExecutedVoting[] memory)
{
return executedVoting;
}
function getExecutedPermitted()
external
view
returns (ExecutedPermitted[] memory)
{
return executedPermitted;
}
function numberOfAdapters() external view returns (uint256) {
return adapters.length();
}
function containsAdapter(address a) external view returns (bool) {
return adapters.contains(a);
}
function getAdapters() external view returns (address[] memory) {
uint256 adaptersLength = adapters.length();
if (adaptersLength == 0) {
return new address[](0);
} else {
address[] memory adaptersArray = new address[](adaptersLength);
for (uint256 i = 0; i < adaptersLength; i++) {
adaptersArray[i] = adapters.at(i);
}
return adaptersArray;
}
}
function numberOfPermitted() external view returns (uint256) {
return permitted.length();
}
function containsPermitted(address p) external view returns (bool) {
return permitted.contains(p);
}
function getPermitted() external view returns (address[] memory) {
uint256 permittedLength = permitted.length();
if (permittedLength == 0) {
return new address[](0);
} else {
address[] memory permittedArray = new address[](permittedLength);
for (uint256 i = 0; i < permittedLength; i++) {
permittedArray[i] = permitted.at(i);
}
return permittedArray;
}
}
/*----PURE FUNCTIONS---------------------------------*/
function _hasDuplicate(address[] memory A) internal pure returns (bool) {
if (A.length <= 1) {
return false;
} else {
for (uint256 i = 0; i < A.length - 1; i++) {
address current = A[i];
for (uint256 j = i + 1; j < A.length; j++) {
if (current == A[j]) {
return true;
}
}
}
}
return false;
}
function transfer(address, uint256) public pure override returns (bool) {
revert("GT: transfer is prohibited");
}
function transferFrom(
address,
address,
uint256
) public pure override returns (bool) {
revert("GT: transferFrom is prohibited");
}
/*----RECEIVE ETH------------------------------------*/
event Received(address indexed, uint256);
receive() external payable {
emit Received(msg.sender, msg.value);
}
}
// File contracts/core/Factory.sol
/*
██ ██ ██████ █████ ██████ ███████ █████ ██████ ████████ ██████ ██████ ██ ██
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
███ ██ ██ ███████ ██ ██ █████ ███████ ██ ██ ██ ██ ██████ ████
██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██ ██
██ ██ ██████ ██ ██ ██████ ██ ██ ██ ██████ ██ ██████ ██ ██ ██
*/
pragma solidity ^0.8.6;
contract Factory is Ownable {
using EnumerableSet for EnumerableSet.AddressSet;
using SafeERC20 for IERC20;
address public immutable shop;
address public immutable xdao;
mapping(address => uint256) public subscriptions;
uint256 public monthlyCost;
uint256 public freeTrial;
function subscribe(address _dao) external returns (bool) {
require(daos.contains(_dao));
if (subscriptions[_dao] < block.timestamp) {
subscriptions[_dao] = block.timestamp + 30 days;
} else {
subscriptions[_dao] += 30 days;
}
IERC20(xdao).safeTransferFrom(msg.sender, owner(), monthlyCost);
return true;
}
function changeMonthlyCost(uint256 _m) external onlyOwner returns (bool) {
monthlyCost = _m;
return true;
}
function changeFreeTrial(uint256 _freeTrial)
external
onlyOwner
returns (bool)
{
freeTrial = _freeTrial;
return true;
}
event DaoCreated(address indexed dao);
constructor(address _shop, address _xdao) {
shop = _shop;
xdao = _xdao;
}
EnumerableSet.AddressSet private daos;
function create(
string memory _daoName,
string memory _daoSymbol,
uint8 _quorum,
address[] memory _partners,
uint256[] memory _shares
) external returns (bool) {
Dao dao = new Dao(_daoName, _daoSymbol, _quorum, _partners, _shares);
subscriptions[address(dao)] = block.timestamp + freeTrial;
require(daos.add(address(dao)));
emit DaoCreated(address(dao));
return true;
}
/*----VIEW FUNCTIONS---------------------------------*/
function daoAt(uint256 _i) external view returns (address) {
return daos.at(_i);
}
function containsDao(address _dao) external view returns (bool) {
return daos.contains(_dao);
}
function numberOfDaos() external view returns (uint256) {
return daos.length();
}
function getDaos() external view returns (address[] memory) {
uint256 daosLength = daos.length();
if (daosLength == 0) {
return new address[](0);
} else {
address[] memory daosArray = new address[](daosLength);
for (uint256 i = 0; i < daosLength; i++) {
daosArray[i] = daos.at(i);
}
return daosArray;
}
}
}

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_shop","internalType":"address"},{"type":"address","name":"_xdao","internalType":"address"}]},{"type":"event","name":"DaoCreated","inputs":[{"type":"address","name":"dao","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"changeFreeTrial","inputs":[{"type":"uint256","name":"_freeTrial","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"changeMonthlyCost","inputs":[{"type":"uint256","name":"_m","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"containsDao","inputs":[{"type":"address","name":"_dao","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"create","inputs":[{"type":"string","name":"_daoName","internalType":"string"},{"type":"string","name":"_daoSymbol","internalType":"string"},{"type":"uint8","name":"_quorum","internalType":"uint8"},{"type":"address[]","name":"_partners","internalType":"address[]"},{"type":"uint256[]","name":"_shares","internalType":"uint256[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"daoAt","inputs":[{"type":"uint256","name":"_i","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"freeTrial","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address[]","name":"","internalType":"address[]"}],"name":"getDaos","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"monthlyCost","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"numberOfDaos","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":"address","name":"","internalType":"address"}],"name":"shop","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"subscribe","inputs":[{"type":"address","name":"_dao","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"subscriptions","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"xdao","inputs":[]}]
            

Deployed ByteCode

0x60806040523480156200001157600080fd5b5060043610620001155760003560e01c8063862bb2bd11620000a3578063b2dabed4116200006e578063b2dabed41462000258578063df4f1410146200026f578063f046395a1462000286578063f2fde38b14620002a957600080fd5b8063862bb2bd14620001ee5780638da5cb5b146200021657806396d054e51462000228578063a1d36ce7146200023f57600080fd5b806355a569d711620000e457806355a569d714620001b75780635bb4d1a114620001ce5780636d61d1f514620001d8578063715018a614620001e257600080fd5b80630881fa0d146200011a57806324f2ff16146200015f57806341a7726a14620001785780634349de9014620001a0575b600080fd5b620001427f000000000000000000000000ca49ecf7e7bb9bbc9d1d295384663f6ba5c0e36681565b6040516001600160a01b0390911681526020015b60405180910390f35b62000169620002c0565b60405190815260200162000156565b6200018f6200018936600462000c5e565b620002d3565b604051901515815260200162000156565b6200018f620001b136600462000d76565b620003c4565b6200018f620001c836600462000ca0565b62000409565b6200016960035481565b6200016960025481565b620001ec620004d0565b005b620001427f00000000000000000000000071eeba415a523f5c952cc2f06361d5443545ad2881565b6000546001600160a01b031662000142565b6200018f6200023936600462000c5e565b6200050b565b6200024962000520565b60405162000156919062000e22565b620001426200026936600462000d76565b620005f9565b6200018f6200028036600462000d76565b62000608565b620001696200029736600462000c5e565b60016020526000908152604090205481565b620001ec620002ba36600462000c5e565b6200063f565b6000620002ce6004620006e1565b905090565b6000620002e2600483620006ec565b620002ec57600080fd5b6001600160a01b0382166000908152600160205260409020544211156200033b576200031c4262278d0062000f6c565b6001600160a01b0383166000908152600160205260409020556200036e565b6001600160a01b0382166000908152600160205260408120805462278d0092906200036890849062000f6c565b90915550505b620003bc33620003866000546001600160a01b031690565b6002546001600160a01b037f00000000000000000000000071eeba415a523f5c952cc2f06361d5443545ad281692919062000711565b506001919050565b600080546001600160a01b03163314620003fb5760405162461bcd60e51b8152600401620003f29062000edc565b60405180910390fd5b50600381905560015b919050565b60008086868686866040516200041f9062000ad7565b6200042f95949392919062000e4c565b604051809103906000f0801580156200044c573d6000803e3d6000fd5b509050600354426200045f919062000f6c565b6001600160a01b0382166000908152600160205260409020556200048560048262000773565b6200048f57600080fd5b6040516001600160a01b038216907f87fc1796dbc913ab997ce574688bcad88f5eb317373be9ec71de2bde33e5c83090600090a25060019695505050505050565b6000546001600160a01b03163314620004fd5760405162461bcd60e51b8152600401620003f29062000edc565b6200050960006200078a565b565b60006200051a600483620006ec565b92915050565b60606000620005306004620006e1565b9050806200054c57505060408051600081526020810190915290565b60008167ffffffffffffffff8111156200056a576200056a62001000565b60405190808252806020026020018201604052801562000594578160200160208202803683370190505b50905060005b82811015620005f257620005b0600482620007da565b828281518110620005c557620005c562000fea565b6001600160a01b039092166020928302919091019091015280620005e98162000fb6565b9150506200059a565b5092915050565b60006200051a600483620007da565b600080546001600160a01b03163314620006365760405162461bcd60e51b8152600401620003f29062000edc565b50600255600190565b6000546001600160a01b031633146200066c5760405162461bcd60e51b8152600401620003f29062000edc565b6001600160a01b038116620006d35760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401620003f2565b620006de816200078a565b50565b60006200051a825490565b6001600160a01b038116600090815260018301602052604081205415155b9392505050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b1790526200076d908590620007e8565b50505050565b60006200070a836001600160a01b038416620008c6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60006200070a838362000918565b60006200083f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316620009459092919063ffffffff16565b805190915015620008c1578080602001905181019062000860919062000c7c565b620008c15760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401620003f2565b505050565b60008181526001830160205260408120546200090f575081546001818101845560008481526020808220909301849055845484825282860190935260409020919091556200051a565b5060006200051a565b600082600001828154811062000932576200093262000fea565b9060005260206000200154905092915050565b60606200095684846000856200095e565b949350505050565b606082471015620009c15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401620003f2565b6001600160a01b0385163b62000a1a5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401620003f2565b600080866001600160a01b0316858760405162000a38919062000e04565b60006040518083038185875af1925050503d806000811462000a77576040519150601f19603f3d011682016040523d82523d6000602084013e62000a7c565b606091505b509150915062000a8e82828662000a99565b979650505050505050565b6060831562000aaa5750816200070a565b82511562000abb5782518084602001fd5b8160405162461bcd60e51b8152600401620003f2919062000e37565b614eff806200101783390190565b80356001600160a01b03811681146200040457600080fd5b600082601f83011262000b0f57600080fd5b8135602062000b2862000b228362000f45565b62000f11565b80838252828201915082860187848660051b890101111562000b4957600080fd5b60005b8581101562000b735762000b608262000ae5565b8452928401929084019060010162000b4c565b5090979650505050505050565b600082601f83011262000b9257600080fd5b8135602062000ba562000b228362000f45565b80838252828201915082860187848660051b890101111562000bc657600080fd5b60005b8581101562000b735781358452928401929084019060010162000bc9565b600082601f83011262000bf957600080fd5b813567ffffffffffffffff81111562000c165762000c1662001000565b62000c2b601f8201601f191660200162000f11565b81815284602083860101111562000c4157600080fd5b816020850160208301376000918101602001919091529392505050565b60006020828403121562000c7157600080fd5b6200070a8262000ae5565b60006020828403121562000c8f57600080fd5b815180151581146200070a57600080fd5b600080600080600060a0868803121562000cb957600080fd5b853567ffffffffffffffff8082111562000cd257600080fd5b62000ce089838a0162000be7565b9650602088013591508082111562000cf757600080fd5b62000d0589838a0162000be7565b95506040880135915060ff8216821462000d1e57600080fd5b9093506060870135908082111562000d3557600080fd5b62000d4389838a0162000afd565b9350608088013591508082111562000d5a57600080fd5b5062000d698882890162000b80565b9150509295509295909350565b60006020828403121562000d8957600080fd5b5035919050565b600081518084526020808501945080840160005b8381101562000dcb5781516001600160a01b03168752958201959082019060010162000da4565b509495945050505050565b6000815180845262000df081602086016020860162000f87565b601f01601f19169290920160200192915050565b6000825162000e1881846020870162000f87565b9190910192915050565b6020815260006200070a602083018462000d90565b6020815260006200070a602083018462000dd6565b60a08152600062000e6160a083018862000dd6565b60208382038185015262000e76828962000dd6565b915060ff87166040850152838203606085015262000e95828762000d90565b8481036080860152855180825282870193509082019060005b8181101562000ecc5784518352938301939183019160010162000eae565b50909a9950505050505050505050565b6020808252818101527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604082015260600190565b604051601f8201601f1916810167ffffffffffffffff8111828210171562000f3d5762000f3d62001000565b604052919050565b600067ffffffffffffffff82111562000f625762000f6262001000565b5060051b60200190565b6000821982111562000f825762000f8262000fd4565b500190565b60005b8381101562000fa457818101518382015260200162000f8a565b838111156200076d5750506000910152565b600060001982141562000fcd5762000fcd62000fd4565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfe60c0604052600a80546001600160a01b0319169055600e805461ffff19166101011790553480156200003057600080fd5b5060405162004eff38038062004eff8339810160408190526200005391620005d4565b6001600055845185908590620000719060049060208501906200036d565b508051620000879060059060208401906200036d565b50505033606081901b60805260408051630881fa0d60e01b81529051630881fa0d91600480820192602092909190829003018186803b158015620000ca57600080fd5b505afa158015620000df573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001059190620005af565b60601b6001600160601b03191660a052600160ff8416108015906200012e575060648360ff1611155b6200018c5760405162461bcd60e51b815260206004820152602360248201527f44414f3a2071756f72756d2073686f756c642062652031203c3d2071203c3d2060448201526203130360ec1b60648201526084015b60405180910390fd5b600a805460ff60a01b1916600160a01b60ff861602179055815115801590620001b6575080518251145b620002105760405162461bcd60e51b815260206004820152602360248201527f44414f3a2073686172657320646973747269627574696f6e20697320696e76616044820152621b1a5960ea1b606482015260840162000183565b60005b82518110156200027c57620002678382815181106200023657620002366200078d565b60200260200101518383815181106200025357620002536200078d565b60200260200101516200028860201b60201c565b80620002738162000759565b91505062000213565b505050505050620007b9565b6001600160a01b038216620002e05760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015260640162000183565b8060036000828254620002f4919062000701565b90915550506001600160a01b038216600090815260016020526040812080548392906200032390849062000701565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b8280546200037b906200071c565b90600052602060002090601f0160209004810192826200039f5760008555620003ea565b82601f10620003ba57805160ff1916838001178555620003ea565b82800160010185558215620003ea579182015b82811115620003ea578251825591602001919060010190620003cd565b50620003f8929150620003fc565b5090565b5b80821115620003f85760008155600101620003fd565b80516001600160a01b03811681146200042b57600080fd5b919050565b600082601f8301126200044257600080fd5b815160206200045b6200045583620006db565b620006a8565b80838252828201915082860187848660051b89010111156200047c57600080fd5b60005b85811015620004a657620004938262000413565b845292840192908401906001016200047f565b5090979650505050505050565b600082601f830112620004c557600080fd5b81516020620004d86200045583620006db565b80838252828201915082860187848660051b8901011115620004f957600080fd5b60005b85811015620004a657815184529284019290840190600101620004fc565b600082601f8301126200052c57600080fd5b81516001600160401b03811115620005485762000548620007a3565b60206200055e601f8301601f19168201620006a8565b82815285828487010111156200057357600080fd5b60005b838110156200059357858101830151828201840152820162000576565b83811115620005a55760008385840101525b5095945050505050565b600060208284031215620005c257600080fd5b620005cd8262000413565b9392505050565b600080600080600060a08688031215620005ed57600080fd5b85516001600160401b03808211156200060557600080fd5b6200061389838a016200051a565b965060208801519150808211156200062a57600080fd5b6200063889838a016200051a565b95506040880151915060ff821682146200065157600080fd5b6060880151919450808211156200066757600080fd5b6200067589838a0162000430565b935060808801519150808211156200068c57600080fd5b506200069b88828901620004b3565b9150509295509295909350565b604051601f8201601f191681016001600160401b0381118282101715620006d357620006d3620007a3565b604052919050565b60006001600160401b03821115620006f757620006f7620007a3565b5060051b60200190565b6000821982111562000717576200071762000777565b500190565b600181811c908216806200073157607f821691505b602082108114156200075357634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141562000770576200077062000777565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b60805160601c60a05160601c614705620007fa60003960008181610320015261209a0152600081816107c4015281816112e6015261139401526147056000f3fe6080604052600436106102765760003560e01c806360d54d411161014f578063a457c2d7116100c1578063cdb2c0421161007a578063cdb2c042146107e6578063d1e3002514610816578063d293aba414610836578063dd62ed3e14610856578063f4c2baa91461089c578063fba4e62e146108bc57600080fd5b8063a457c2d71461071d578063a9059cbb1461073d578063aafd338b1461075d578063b82e16e31461077d578063bb35783b14610792578063c45a0155146107b257600080fd5b806393435d501161011357806393435d501461066857806395d89b411461068857806398603cca1461069d5780639dc29fac146106b2578063a07c7ce4146106d2578063a438d208146106f157600080fd5b806360d54d41146105c65780636e2e9c18146105e657806370a08231146105fb57806372376b8d146106315780637e5cd5c11461065357600080fd5b8063313c06a0116101e857806340c10f19116101ac57806340c10f19146105205780634a1d18ce146105405780634bf365df146105625780634faa2e7b1461057c57806356d6b2d014610591578063585cd34b146105a657600080fd5b8063313c06a01461048c578063313ce567146104ac5780633372358f146104c057806339509351146104e05780633d4581831461050057600080fd5b806314197ed01161023a57806314197ed01461039a5780631703a018146103c757806318160ddd146103fa5780631854063d1461041957806323b872dd1461043b578063251664d41461045b57600080fd5b806305cf79b9146102b757806306fdde03146102ec5780630881fa0d1461030e578063095ea7b31461035a5780630c9562441461037a57600080fd5b366102b25760405134815233907f88a5966d370b9919b20f3e2c13ff65706f196a4e32cc2c12bf57088f885258749060200160405180910390a2005b600080fd5b3480156102c357600080fd5b506102d76102d2366004614093565b6108dc565b60405190151581526020015b60405180910390f35b3480156102f857600080fd5b50610301610997565b6040516102e39190614454565b34801561031a57600080fd5b506103427f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016102e3565b34801561036657600080fd5b506102d7610375366004613f73565b610a29565b34801561038657600080fd5b506102d7610395366004613ca1565b610a43565b3480156103a657600080fd5b506103ba6103b5366004614061565b610a50565b6040516102e391906144e0565b3480156103d357600080fd5b50600a546103e890600160a01b900460ff1681565b60405160ff90911681526020016102e3565b34801561040657600080fd5b506003545b6040519081526020016102e3565b34801561042557600080fd5b5061042e610c8b565b6040516102e3919061428e565b34801561044757600080fd5b506102d7610456366004613cef565b610d76565b34801561046757600080fd5b5061047b610476366004614061565b610dc1565b6040516102e395949392919061424d565b34801561049857600080fd5b50600a54610342906001600160a01b031681565b3480156104b857600080fd5b5060126103e8565b3480156104cc57600080fd5b5061040b6104db366004613d84565b610ea0565b3480156104ec57600080fd5b506102d76104fb366004613f73565b610ee3565b34801561050c57600080fd5b506102d761051b366004613ca1565b610f22565b34801561052c57600080fd5b506102d761053b366004613f73565b610f2f565b34801561054c57600080fd5b50610555610fb5565b6040516102e39190614382565b34801561056e57600080fd5b50600e546102d79060ff1681565b34801561058857600080fd5b5061040b6111c8565b34801561059d57600080fd5b5061040b6111d9565b3480156105b257600080fd5b506102d76105c1366004613ca1565b6111e5565b3480156105d257600080fd5b506102d76105e1366004613ca1565b61125e565b3480156105f257600080fd5b506102d76112e1565b34801561060757600080fd5b5061040b610616366004613ca1565b6001600160a01b031660009081526001602052604090205490565b34801561063d57600080fd5b50610646611429565b6040516102e391906142db565b34801561065f57600080fd5b506102d7611554565b34801561067457600080fd5b506102d7610683366004613ca1565b611585565b34801561069457600080fd5b506103016115fc565b3480156106a957600080fd5b506102d761160b565b3480156106be57600080fd5b506102d76106cd366004613f73565b61163d565b3480156106de57600080fd5b50600e546102d790610100900460ff1681565b3480156106fd57600080fd5b506107086203f48081565b60405163ffffffff90911681526020016102e3565b34801561072957600080fd5b506102d7610738366004613f73565b6116bf565b34801561074957600080fd5b506102d7610758366004613f73565b61175c565b34801561076957600080fd5b506102d7610778366004613ca1565b6117a7565b34801561078957600080fd5b5061042e611818565b34801561079e57600080fd5b506102d76107ad366004613cef565b6118cc565b3480156107be57600080fd5b506103427f000000000000000000000000000000000000000000000000000000000000000081565b3480156107f257600080fd5b506102d7610801366004614061565b600c6020526000908152604090205460ff1681565b34801561082257600080fd5b506102d7610831366004613df0565b611903565b34801561084257600080fd5b506102d7610851366004613d2b565b611d4c565b34801561086257600080fd5b5061040b610871366004613cbc565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3480156108a857600080fd5b506102d76108b7366004613ca1565b612027565b3480156108c857600080fd5b506102d76108d7366004613f9d565b61212d565b60003330146109065760405162461bcd60e51b81526004016108fd90614467565b60405180910390fd5b60018260ff161015801561091e575060648260ff1611155b6109765760405162461bcd60e51b815260206004820152602360248201527f44414f3a2071756f72756d2073686f756c642062652031203c3d2071203c3d2060448201526203130360ec1b60648201526084016108fd565b50600a805460ff60a01b1916600160a01b60ff84160217905560015b919050565b6060600480546109a6906145e2565b80601f01602080910402602001604051908101604052809291908181526020018280546109d2906145e2565b8015610a1f5780601f106109f457610100808354040283529160200191610a1f565b820191906000526020600020905b815481529060010190602001808311610a0257829003601f168201915b5050505050905090565b600033610a37818585612910565b60019150505b92915050565b6000610a3d600683612a35565b610aa460405180610100016040528060006001600160a01b03168152602001606081526020016000815260200160008152602001600081526020016000815260200160008019168152602001606081525090565b600b8281548110610ab757610ab761467a565b600091825260209182902060408051610100810190915260089092020180546001600160a01b031682526001810180549293919291840191610af8906145e2565b80601f0160208091040260200160405190810160405280929190818152602001828054610b24906145e2565b8015610b715780601f10610b4657610100808354040283529160200191610b71565b820191906000526020600020905b815481529060010190602001808311610b5457829003601f168201915b50505050508152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b82821015610c7d578382906000526020600020018054610bf0906145e2565b80601f0160208091040260200160405190810160405280929190818152602001828054610c1c906145e2565b8015610c695780601f10610c3e57610100808354040283529160200191610c69565b820191906000526020600020905b815481529060010190602001808311610c4c57829003601f168201915b505050505081526020019060010190610bd1565b505050915250909392505050565b60606000610c996006612a57565b905080610cd35760005b604051908082528060200260200182016040528015610ccc578160200160208202803683370190505b5091505090565b6000816001600160401b03811115610ced57610ced614690565b604051908082528060200260200182016040528015610d16578160200160208202803683370190505b50905060005b82811015610d6b57610d2f600682612a61565b828281518110610d4157610d4161467a565b6001600160a01b039092166020928302919091019091015280610d638161461d565b915050610d1c565b5092915050565b5090565b60405162461bcd60e51b815260206004820152601e60248201527f47543a207472616e7366657246726f6d2069732070726f68696269746564000060448201526000906064016108fd565b600d8181548110610dd157600080fd5b6000918252602090912060059091020180546001820180546001600160a01b03909216935090610e00906145e2565b80601f0160208091040260200160405190810160405280929190818152602001828054610e2c906145e2565b8015610e795780601f10610e4e57610100808354040283529160200191610e79565b820191906000526020600020905b815481529060010190602001808311610e5c57829003601f168201915b5050505060028301546003840154600490940154929390929091506001600160a01b031685565b60003087878787878746604051602001610ec19897969594939291906141f9565b6040516020818303038152906040528051906020012090509695505050505050565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909190610a379082908690610f1d908790614546565b612910565b6000610a3d600883612a35565b6000333014610f505760405162461bcd60e51b81526004016108fd90614467565b600e5460ff16610fa25760405162461bcd60e51b815260206004820152601b60248201527f44414f3a204754206d696e74696e672069732064697361626c6564000000000060448201526064016108fd565b610fac8383612a6d565b50600192915050565b6060600b805480602002602001604051908101604052809291908181526020016000905b828210156111bf5760008481526020908190206040805161010081019091526008850290910180546001600160a01b031682526001810180549293919291840191611023906145e2565b80601f016020809104026020016040519081016040528092919081815260200182805461104f906145e2565b801561109c5780601f106110715761010080835404028352916020019161109c565b820191906000526020600020905b81548152906001019060200180831161107f57829003601f168201915b50505050508152602001600282015481526020016003820154815260200160048201548152602001600582015481526020016006820154815260200160078201805480602002602001604051908101604052809291908181526020016000905b828210156111a857838290600052602060002001805461111b906145e2565b80601f0160208091040260200160405190810160405280929190818152602001828054611147906145e2565b80156111945780601f1061116957610100808354040283529160200191611194565b820191906000526020600020905b81548152906001019060200180831161117757829003601f168201915b5050505050815260200190600101906110fc565b505050508152505081526020019060010190610fd9565b50505050905090565b60006111d46008612a57565b905090565b60006111d46006612a57565b60003330146112065760405162461bcd60e51b81526004016108fd90614467565b611211600883612b4c565b6112535760405162461bcd60e51b81526020600482015260136024820152722220a79d103737ba1030b71030b230b83a32b960691b60448201526064016108fd565b610fac600683612b4c565b600033301461127f5760405162461bcd60e51b81526004016108fd90614467565b61128a600883612b61565b6112d65760405162461bcd60e51b815260206004820152601760248201527f44414f3a20616c726561647920616e206164617074657200000000000000000060448201526064016108fd565b610fac600683612b61565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316636d61d1f56040518163ffffffff1660e01b815260040160206040518083038186803b15801561133d57600080fd5b505afa158015611351573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611375919061407a565b11801561141857506040516378231cad60e11b815230600482015242907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03169063f046395a9060240160206040518083038186803b1580156113de57600080fd5b505afa1580156113f2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611416919061407a565b105b156114235750600090565b50600190565b6060600d805480602002602001604051908101604052809291908181526020016000905b828210156111bf5760008481526020908190206040805160a081019091526005850290910180546001600160a01b031682526001810180549293919291840191611496906145e2565b80601f01602080910402602001604051908101604052809291908181526020018280546114c2906145e2565b801561150f5780601f106114e45761010080835404028352916020019161150f565b820191906000526020600020905b8154815290600101906020018083116114f257829003601f168201915b50505091835250506002820154602080830191909152600383015460408301526004909201546001600160a01b0316606090910152908252600192909201910161144d565b60003330146115755760405162461bcd60e51b81526004016108fd90614467565b50600e805460ff19169055600190565b60003330146115a65760405162461bcd60e51b81526004016108fd90614467565b6115b1600683612b4c565b6115f45760405162461bcd60e51b8152602060048201526014602482015273111053ce881b9bdd0818481c195c9b5a5d1d195960621b60448201526064016108fd565b506001919050565b6060600580546109a6906145e2565b600033301461162c5760405162461bcd60e51b81526004016108fd90614467565b50600e805461ff0019169055600190565b600033301461165e5760405162461bcd60e51b81526004016108fd90614467565b600e54610100900460ff166116b55760405162461bcd60e51b815260206004820152601b60248201527f44414f3a204754206275726e696e672069732064697361626c6564000000000060448201526064016108fd565b610fac8383612b76565b3360008181526002602090815260408083206001600160a01b0387168452909152812054909190838110156117445760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016108fd565b6117518286868403612910565b506001949350505050565b60405162461bcd60e51b815260206004820152601a60248201527f47543a207472616e736665722069732070726f6869626974656400000000000060448201526000906064016108fd565b60003330146117c85760405162461bcd60e51b81526004016108fd90614467565b6117d3600683612b61565b6115f45760405162461bcd60e51b8152602060048201526016602482015275111053ce88185b1c9958591e481c195c9b5a5d1d195960521b60448201526064016108fd565b606060006118266008612a57565b905080611834576000610ca3565b6000816001600160401b0381111561184e5761184e614690565b604051908082528060200260200182016040528015611877578160200160208202803683370190505b50905060005b82811015610d6b57611890600882612a61565b8282815181106118a2576118a261467a565b6001600160a01b0390921660209283029190910190910152806118c48161461d565b91505061187d565b60003330146118ed5760405162461bcd60e51b81526004016108fd90614467565b6118f8848484612cc1565b5060015b9392505050565b6000600260005414156119285760405162461bcd60e51b81526004016108fd906144a9565b60026000556119356112e1565b6119815760405162461bcd60e51b815260206004820152601a60248201527f44414f3a20737562736372697074696f6e206e6f74207061696400000000000060448201526064016108fd565b33600090815260016020526040812054116119d65760405162461bcd60e51b815260206004820152601560248201527444414f3a206f6e6c7920666f72206d656d6265727360581b60448201526064016108fd565b426119e46203f48085614546565b1015611a285760405162461bcd60e51b81526020600482015260136024820152722220a79d103b37ba34b7339034b99037bb32b960691b60448201526064016108fd565b6000611a38898989898989610ea0565b6000818152600c602052604090205490915060ff1615611a9a5760405162461bcd60e51b815260206004820152601c60248201527f44414f3a20766f74696e6720616c72656164792065786563757465640000000060448201526064016108fd565b611aa48382612e91565b611af05760405162461bcd60e51b815260206004820152601a60248201527f44414f3a2071756f72756d206973206e6f74207265616368656400000000000060448201526064016108fd565b6000818152600c6020908152604091829020805460ff191660011790558151610100810183526001600160a01b038c1681528251601f8b01839004830281018301909352898352600b92909182810191908c908c9081908401838280828437600092018290525093855250505060208083018b9052604083018a90526060830189905242608084015260a0830186905260c090920187905283546001808201865594825290829020835160089092020180546001600160a01b0319166001600160a01b0390921691909117815582820151805193949193611bd993928501929190910190613a8b565b5060408201516002820155606082015160038201556080820151600482015560a0820151600582015560c0820151600682015560e08201518051611c27916007840191602090910190613b0b565b50505084896001600160a01b03167fbd456668f700390d892b45c86161989dd1c22b58f45c8427d29e45dca046fafc8a8a8a8942888b604051611c709796959493929190614408565b60405180910390a386611c9557611c906001600160a01b038a16876130b3565b611d37565b85611cea57611ce488888080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506001600160a01b038d16929150506131cc565b50611d37565b611d3588888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050506001600160a01b038c169190508861320e565b505b60019150506001600055979650505050505050565b600060026000541415611d715760405162461bcd60e51b81526004016108fd906144a9565b6002600055611d7e6112e1565b611dca5760405162461bcd60e51b815260206004820152601a60248201527f44414f3a20737562736372697074696f6e206e6f74207061696400000000000060448201526064016108fd565b611dd5600633612a35565b611e215760405162461bcd60e51b815260206004820152601760248201527f44414f3a206f6e6c7920666f72207065726d697474656400000000000000000060448201526064016108fd565b600d6040518060a00160405280876001600160a01b0316815260200186868080601f016020809104026020016040519081016040528093929190818152602001838380828437600092018290525093855250505060208083018790524260408401523360609093019290925283546001808201865594825290829020835160059092020180546001600160a01b0319166001600160a01b0390921691909117815582820151805193949193611ede93928501929190910190613a8b565b50604082810151600283015560608301516003830155608090920151600490910180546001600160a01b0319166001600160a01b03928316179055905133918716907f2fcf7d8fdbdd29355c4dd2538a3202ab25781f676add9a36bcfe961319efbaa790611f51908890889088906143e4565b60405180910390a382611f7657611f716001600160a01b038616836130b3565b612018565b81611fcb57611fc584848080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250506001600160a01b038916929150506131cc565b50612018565b61201684848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050506001600160a01b0388169190508461320e565b505b50600180600055949350505050565b600a546000906001600160a01b03161561208f5760405162461bcd60e51b8152602060048201526024808201527f44414f3a204c5020616464726573732068617320616c7265616479206265656e604482015263081cd95d60e21b60648201526084016108fd565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146121075760405162461bcd60e51b815260206004820152601960248201527f44414f3a206f6e6c792053686f702063616e20736574204c500000000000000060448201526064016108fd565b50600a80546001600160a01b0319166001600160a01b0392909216919091179055600190565b6000600260005414156121525760405162461bcd60e51b81526004016108fd906144a9565b6002600055600a546001600160a01b03166121a55760405162461bcd60e51b8152602060048201526013602482015272111053ce881314081b9bdd081cd95d081e595d606a1b60448201526064016108fd565b600a546001600160a01b031633146121f25760405162461bcd60e51b815260206004820152601060248201526f044414f3a206f6e6c7920666f72204c560841b60448201526064016108fd565b6121fb8461323c565b156122585760405162461bcd60e51b815260206004820152602760248201527f44414f3a206475706c696361746573206172652070726f686962697465642028604482015266746f6b656e732960c81b60648201526084016108fd565b60005b845181101561234057600a5485516001600160a01b03909116908690839081106122875761228761467a565b60200260200101516001600160a01b0316141580156122d15750306001600160a01b03168582815181106122bd576122bd61467a565b60200260200101516001600160a01b031614155b61232e5760405162461bcd60e51b815260206004820152602860248201527f44414f3a204c5020616e642047542063616e6e6f742062652070617274206f66604482015267206120736861726560c01b60648201526084016108fd565b806123388161461d565b91505061225b565b5081518351146123885760405162461bcd60e51b81526020600482015260136024820152722220a79d1030b230b83a32b9399032b93937b960691b60448201526064016108fd565b8251156124e557825160018111156124e35760005b6123a860018361459f565b8110156124e15760006123bc826001614546565b90505b828110156124ce578581815181106123d9576123d961467a565b60200260200101516001600160a01b03168683815181106123fc576123fc61467a565b60200260200101516001600160a01b031614801561245d57508481815181106124275761242761467a565b60200260200101516001600160a01b031685838151811061244a5761244a61467a565b60200260200101516001600160a01b0316145b156124bc5760405162461bcd60e51b815260206004820152602960248201527f44414f3a206475706c696361746573206172652070726f68696269746564202860448201526861646170746572732960b81b60648201526084016108fd565b806124c68161461d565b9150506123bf565b50806124d98161461d565b91505061239d565b505b505b612515670de0b6b3a76400006124fb8747614580565b612505919061455e565b6001600160a01b038816906130b3565b8351156126c357600084516001600160401b0381111561253757612537614690565b604051908082528060200260200182016040528015612560578160200160208202803683370190505b50905060005b855181101561265157670de0b6b3a76400008787838151811061258b5761258b61467a565b60209081029190910101516040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b1580156125d657600080fd5b505afa1580156125ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260e919061407a565b6126189190614580565b612622919061455e565b8282815181106126345761263461467a565b6020908102919091010152806126498161461d565b915050612566565b5060005b85518110156126c0576126ae888383815181106126745761267461467a565b602002602001015188848151811061268e5761268e61467a565b60200260200101516001600160a01b031661330e9092919063ffffffff16565b806126b88161461d565b915050612655565b50505b82511561290057825160005b818110156128fd576127048582815181106126ec576126ec61467a565b60200260200101516008612a3590919063ffffffff16565b6127505760405162461bcd60e51b815260206004820152601b60248201527f44414f3a2074686973206973206e6f7420616e2061646170746572000000000060448201526064016108fd565b61277d8582815181106127655761276561467a565b60200260200101516006612a3590919063ffffffff16565b6127d45760405162461bcd60e51b815260206004820152602260248201527f44414f3a20746869732061646170746572206973206e6f74207065726d697474604482015261195960f21b60648201526084016108fd565b60008582815181106127e8576127e861467a565b60200260200101516001600160a01b031663d9caed128a8785815181106128115761281161467a565b60209081029190910101516040516001600160e01b031960e085901b1681526001600160a01b03928316600482015291166024820152604481018b9052606401602060405180830381600087803b15801561286b57600080fd5b505af115801561287f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a3919061403f565b9050806128ea5760405162461bcd60e51b81526020600482015260156024820152742220a79d103bb4ba34323930bbb0b61032b93937b960591b60448201526064016108fd565b50806128f58161461d565b9150506126cf565b50505b5060018060005595945050505050565b6001600160a01b0383166129725760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016108fd565b6001600160a01b0382166129d35760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016108fd565b6001600160a01b0383811660008181526002602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038116600090815260018301602052604081205415156118fc565b6000610a3d825490565b60006118fc8383613360565b6001600160a01b038216612ac35760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016108fd565b8060036000828254612ad59190614546565b90915550506001600160a01b03821660009081526001602052604081208054839290612b02908490614546565b90915550506040518181526001600160a01b038316906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9060200160405180910390a35050565b60006118fc836001600160a01b03841661338a565b60006118fc836001600160a01b03841661347d565b6001600160a01b038216612bd65760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f206164647265736044820152607360f81b60648201526084016108fd565b6001600160a01b03821660009081526001602052604090205481811015612c4a5760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e604482015261636560f01b60648201526084016108fd565b6001600160a01b0383166000908152600160205260408120838303905560038054849290612c7990849061459f565b90915550506040518281526000906001600160a01b038516907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90602001612a28565b505050565b6001600160a01b038316612d255760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016108fd565b6001600160a01b038216612d875760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016108fd565b6001600160a01b03831660009081526001602052604090205481811015612dff5760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016108fd565b6001600160a01b03808516600090815260016020526040808220858503905591851681529081208054849290612e36908490614546565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051612e8291815260200190565b60405180910390a35b50505050565b600080612eeb836040517f19457468657265756d205369676e6564204d6573736167653a0a3332000000006020820152603c8101829052600090605c01604051602081830303815290604052805190602001209050919050565b905060008085516001600160401b03811115612f0957612f09614690565b604051908082528060200260200182016040528015612f32578160200160208202803683370190505b50905060005b8651811015612faf576000612f6f888381518110612f5857612f5861467a565b6020026020010151866134cc90919063ffffffff16565b905080838381518110612f8457612f8461467a565b6001600160a01b03909216602092830291909101909101525080612fa78161461d565b915050612f38565b50612fb98161323c565b156130065760405162461bcd60e51b815260206004820152601e60248201527f44414f3a207369676e61747572657320617265206e6f7420756e69717565000060448201526064016108fd565b60005b81518110156130685761304a8282815181106130275761302761467a565b60200260200101516001600160a01b031660009081526001602052604090205490565b6130549084614546565b9250806130608161461d565b915050613009565b50600a5460ff600160a01b9091041661308060035490565b61308a9190614580565b613095836064614580565b10156130a75760009350505050610a3d565b50600195945050505050565b804710156131035760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e636500000060448201526064016108fd565b6000826001600160a01b03168260405160006040518083038185875af1925050503d8060008114613150576040519150601f19603f3d011682016040523d82523d6000602084013e613155565b606091505b5050905080612cbc5760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d6179206861766520726576657274656400000000000060648201526084016108fd565b60606118fc83836040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c656400008152506134f0565b60606132348484846040518060600160405280602981526020016146a7602991396134fb565b949350505050565b6000600182511161324f57506000919050565b60005b60018351613260919061459f565b81101561330557600083828151811061327b5761327b61467a565b6020026020010151905060008260016132949190614546565b90505b84518110156132f0578481815181106132b2576132b261467a565b60200260200101516001600160a01b0316826001600160a01b031614156132de57506001949350505050565b806132e88161461d565b915050613297565b505080806132fd9061461d565b915050613252565b50506000919050565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b179052612cbc90849061362c565b60008260000182815481106133775761337761467a565b9060005260206000200154905092915050565b600081815260018301602052604081205480156134735760006133ae60018361459f565b85549091506000906133c29060019061459f565b90508181146134275760008660000182815481106133e2576133e261467a565b90600052602060002001549050808760000184815481106134055761340561467a565b6000918252602080832090910192909255918252600188019052604090208390555b855486908061343857613438614664565b600190038181906000526020600020016000905590558560010160008681526020019081526020016000206000905560019350505050610a3d565b6000915050610a3d565b60008181526001830160205260408120546134c457508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610a3d565b506000610a3d565b60008060006134db85856136fe565b915091506134e88161376e565b509392505050565b606061323484846000855b60608247101561355c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b60648201526084016108fd565b6001600160a01b0385163b6135b35760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016108fd565b600080866001600160a01b031685876040516135cf91906141dd565b60006040518083038185875af1925050503d806000811461360c576040519150601f19603f3d011682016040523d82523d6000602084013e613611565b606091505b509150915061362182828661392c565b979650505050505050565b6000613681826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166134f09092919063ffffffff16565b805190915015612cbc578080602001905181019061369f919061403f565b612cbc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016108fd565b6000808251604114156137355760208301516040840151606085015160001a61372987828585613965565b94509450505050613767565b82516040141561375f5760208301516040840151613754868383613a52565b935093505050613767565b506000905060025b9250929050565b60008160048111156137825761378261464e565b141561378b5750565b600181600481111561379f5761379f61464e565b14156137ed5760405162461bcd60e51b815260206004820152601860248201527f45434453413a20696e76616c6964207369676e6174757265000000000000000060448201526064016108fd565b60028160048111156138015761380161464e565b141561384f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e6774680060448201526064016108fd565b60038160048111156138635761386361464e565b14156138bc5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b60648201526084016108fd565b60048160048111156138d0576138d061464e565b14156139295760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202776272076616c604482015261756560f01b60648201526084016108fd565b50565b6060831561393b5750816118fc565b82511561394b5782518084602001fd5b8160405162461bcd60e51b81526004016108fd9190614454565b6000807f7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a083111561399c5750600090506003613a49565b8460ff16601b141580156139b457508460ff16601c14155b156139c55750600090506004613a49565b6040805160008082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015613a19573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116613a4257600060019250925050613a49565b9150600090505b94509492505050565b6000806001600160ff1b03831681613a6f60ff86901c601b614546565b9050613a7d87828885613965565b935093505050935093915050565b828054613a97906145e2565b90600052602060002090601f016020900481019282613ab95760008555613aff565b82601f10613ad257805160ff1916838001178555613aff565b82800160010185558215613aff579182015b82811115613aff578251825591602001919060010190613ae4565b50610d72929150613b64565b828054828255906000526020600020908101928215613b58579160200282015b82811115613b585782518051613b48918491602090910190613a8b565b5091602001919060010190613b2b565b50610d72929150613b79565b5b80821115610d725760008155600101613b65565b80821115610d72576000613b8d8282613b96565b50600101613b79565b508054613ba2906145e2565b6000825580601f10613bb2575050565b601f0160209004906000526020600020908101906139299190613b64565b80356001600160a01b038116811461099257600080fd5b600082601f830112613bf857600080fd5b81356020613c0d613c0883614523565b6144f3565b80838252828201915082860187848660051b8901011115613c2d57600080fd5b60005b85811015613c5357613c4182613bd0565b84529284019290840190600101613c30565b5090979650505050505050565b60008083601f840112613c7257600080fd5b5081356001600160401b03811115613c8957600080fd5b60208301915083602082850101111561376757600080fd5b600060208284031215613cb357600080fd5b6118fc82613bd0565b60008060408385031215613ccf57600080fd5b613cd883613bd0565b9150613ce660208401613bd0565b90509250929050565b600080600060608486031215613d0457600080fd5b613d0d84613bd0565b9250613d1b60208501613bd0565b9150604084013590509250925092565b60008060008060608587031215613d4157600080fd5b613d4a85613bd0565b935060208501356001600160401b03811115613d6557600080fd5b613d7187828801613c60565b9598909750949560400135949350505050565b60008060008060008060a08789031215613d9d57600080fd5b613da687613bd0565b955060208701356001600160401b03811115613dc157600080fd5b613dcd89828a01613c60565b979a90995096976040810135976060820135975060809091013595509350505050565b600080600080600080600060c0888a031215613e0b57600080fd5b613e1488613bd0565b96506001600160401b0360208901351115613e2e57600080fd5b613e3e8960208a01358a01613c60565b90965094506040880135935060608801359250608088013591506001600160401b0360a08901351115613e7057600080fd5b60a0880135880189601f820112613e8657600080fd5b613e93613c088235614523565b8082358252602082019150602083018c6020853560051b8601011115613eb857600080fd5b60005b8435811015613f5f576001600160401b0382351115613ed957600080fd5b8d603f833587010112613eeb57600080fd5b60208235860101356001600160401b03811115613f0a57613f0a614690565b613f1d601f8201601f19166020016144f3565b8181528f60408386358a0101011115613f3557600080fd5b81604085358901016020830137600060209282018301528552938401939190910190600101613ebb565b505080935050505092959891949750929550565b60008060408385031215613f8657600080fd5b613f8f83613bd0565b946020939093013593505050565b600080600080600060a08688031215613fb557600080fd5b613fbe86613bd0565b94506020860135935060408601356001600160401b0380821115613fe157600080fd5b613fed89838a01613be7565b9450606088013591508082111561400357600080fd5b61400f89838a01613be7565b9350608088013591508082111561402557600080fd5b5061403288828901613be7565b9150509295509295909350565b60006020828403121561405157600080fd5b815180151581146118fc57600080fd5b60006020828403121561407357600080fd5b5035919050565b60006020828403121561408c57600080fd5b5051919050565b6000602082840312156140a557600080fd5b813560ff811681146118fc57600080fd5b600081518084526020808501808196508360051b8101915082860160005b858110156140fe5782840389526140ec848351614134565b988501989350908401906001016140d4565b5091979650505050505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6000815180845261414c8160208601602086016145b6565b601f01601f19169290920160200192915050565b600061010060018060a01b038351168452602083015181602086015261418882860182614134565b91505060408301516040850152606083015160608501526080830151608085015260a083015160a085015260c083015160c085015260e083015184820360e08601526141d482826140b6565b95945050505050565b600082516141ef8184602087016145b6565b9190910192915050565b6001600160a01b0389811682528816602082015260e060408201819052600090614226908301888a61410b565b90508560608301528460808301528360a08301528260c08301529998505050505050505050565b600060018060a01b03808816835260a0602084015261426f60a0840188614134565b6040840196909652606083019490945250911660809091015292915050565b6020808252825182820181905260009190848201906040850190845b818110156142cf5783516001600160a01b0316835292840192918401916001016142aa565b50909695505050505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561437457888303603f19018552815180516001600160a01b0390811685528882015160a08a8701819052919061433e83880182614134565b848b0151888c01526060808601519089015260809485015190921693909601929092525094870194925090860190600101614302565b509098975050505050505050565b6000602080830181845280855180835260408601915060408160051b870101925083870160005b828110156143d757603f198886030184526143c5858351614160565b945092850192908501906001016143a9565b5092979650505050505050565b6040815260006143f860408301858761410b565b9050826020830152949350505050565b60c08152600061441c60c08301898b61410b565b87602084015286604084015285606084015284608084015282810360a084015261444681856140b6565b9a9950505050505050505050565b6020815260006118fc6020830184614134565b60208082526022908201527f44414f3a20746869732066756e6374696f6e206973206f6e6c7920666f722044604082015261414f60f01b606082015260800190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b6020815260006118fc6020830184614160565b604051601f8201601f191681016001600160401b038111828210171561451b5761451b614690565b604052919050565b60006001600160401b0382111561453c5761453c614690565b5060051b60200190565b6000821982111561455957614559614638565b500190565b60008261457b57634e487b7160e01b600052601260045260246000fd5b500490565b600081600019048311821515161561459a5761459a614638565b500290565b6000828210156145b1576145b1614638565b500390565b60005b838110156145d15781810151838201526020016145b9565b83811115612e8b5750506000910152565b600181811c908216806145f657607f821691505b6020821081141561461757634e487b7160e01b600052602260045260246000fd5b50919050565b600060001982141561463157614631614638565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052602160045260246000fd5b634e487b7160e01b600052603160045260246000fd5b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fdfe416464726573733a206c6f772d6c6576656c2063616c6c20776974682076616c7565206661696c6564a2646970667358221220b77924211efcf124d7c83a19ae86cc9d9a239a5e46376b891656d23505fac4b764736f6c63430008060033a26469706673582212206c7a2faf0d26814e59d5cf1b6f69cfca1b93fda7fb186cf71aa1f3b7832214f064736f6c63430008060033