Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- KaleidoSwapFactory
- Optimization enabled
- true
- Compiler version
- v0.8.2+commit.661d1103
- Optimization runs
- 1000
- EVM Version
- default
- Verified at
- 2024-03-04T15:23:37.681301Z
Contract source code
// Sources flattened with hardhat v2.19.0 https://hardhat.org
// SPDX-License-Identifier: MIT AND Unlicense
// File @openzeppelin/contracts/access/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev External interface of AccessControl declared to support ERC165 detection.
*/
interface IAccessControl {
/**
* @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`
*
* `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite
* {RoleAdminChanged} not being emitted signaling this.
*
* _Available since v3.1._
*/
event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);
/**
* @dev Emitted when `account` is granted `role`.
*
* `sender` is the account that originated the contract call, an admin role
* bearer except when using {AccessControl-_setupRole}.
*/
event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Emitted when `account` is revoked `role`.
*
* `sender` is the account that originated the contract call:
* - if using `revokeRole`, it is the admin role bearer
* - if using `renounceRole`, it is the role bearer (i.e. `account`)
*/
event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) external view returns (bool);
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {AccessControl-_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) external view returns (bytes32);
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function grantRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*/
function revokeRole(bytes32 role, address account) external;
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been granted `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*/
function renounceRole(bytes32 role, address account) external;
}
// File @openzeppelin/contracts/utils/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (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;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}
// File @openzeppelin/contracts/utils/introspection/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC165 standard, as defined in the
* https://eips.ethereum.org/EIPS/eip-165[EIP].
*
* Implementers can declare support of contract interfaces, which can then be
* queried by others ({ERC165Checker}).
*
* For an implementation, see {ERC165}.
*/
interface IERC165 {
/**
* @dev Returns true if this contract implements the interface defined by
* `interfaceId`. See the corresponding
* https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]
* to learn more about how these ids are created.
*
* This function call must use less than 30 000 gas.
*/
function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
// File @openzeppelin/contracts/utils/introspection/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)
pragma solidity ^0.8.0;
/**
* @dev Implementation of the {IERC165} interface.
*
* Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check
* for the additional interface id that will be supported. For example:
*
* ```solidity
* function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
* return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);
* }
* ```
*
* Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.
*/
abstract contract ERC165 is IERC165 {
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IERC165).interfaceId;
}
}
// File @openzeppelin/contracts/utils/math/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard math utilities missing in the Solidity language.
*/
library Math {
enum Rounding {
Down, // Toward negative infinity
Up, // Toward infinity
Zero // Toward zero
}
/**
* @dev Returns the largest of two numbers.
*/
function max(uint256 a, uint256 b) internal pure returns (uint256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two numbers.
*/
function min(uint256 a, uint256 b) internal pure returns (uint256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two numbers. The result is rounded towards
* zero.
*/
function average(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b) / 2 can overflow.
return (a & b) + (a ^ b) / 2;
}
/**
* @dev Returns the ceiling of the division of two numbers.
*
* This differs from standard division with `/` in that it rounds up instead
* of rounding down.
*/
function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {
// (a + b - 1) / b can overflow on addition, so we distribute.
return a == 0 ? 0 : (a - 1) / b + 1;
}
/**
* @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0
* @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)
* with further edits by Uniswap Labs also under MIT license.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) {
unchecked {
// 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use
// use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256
// variables such that product = prod1 * 2^256 + prod0.
uint256 prod0; // Least significant 256 bits of the product
uint256 prod1; // Most significant 256 bits of the product
assembly {
let mm := mulmod(x, y, not(0))
prod0 := mul(x, y)
prod1 := sub(sub(mm, prod0), lt(mm, prod0))
}
// Handle non-overflow cases, 256 by 256 division.
if (prod1 == 0) {
// Solidity will revert if denominator == 0, unlike the div opcode on its own.
// The surrounding unchecked block does not change this fact.
// See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic.
return prod0 / denominator;
}
// Make sure the result is less than 2^256. Also prevents denominator == 0.
require(denominator > prod1, "Math: mulDiv overflow");
///////////////////////////////////////////////
// 512 by 256 division.
///////////////////////////////////////////////
// Make division exact by subtracting the remainder from [prod1 prod0].
uint256 remainder;
assembly {
// Compute remainder using mulmod.
remainder := mulmod(x, y, denominator)
// Subtract 256 bit number from 512 bit number.
prod1 := sub(prod1, gt(remainder, prod0))
prod0 := sub(prod0, remainder)
}
// Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.
// See https://cs.stackexchange.com/q/138556/92363.
// Does not overflow because the denominator cannot be zero at this stage in the function.
uint256 twos = denominator & (~denominator + 1);
assembly {
// Divide denominator by twos.
denominator := div(denominator, twos)
// Divide [prod1 prod0] by twos.
prod0 := div(prod0, twos)
// Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.
twos := add(div(sub(0, twos), twos), 1)
}
// Shift in bits from prod1 into prod0.
prod0 |= prod1 * twos;
// Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such
// that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for
// four bits. That is, denominator * inv = 1 mod 2^4.
uint256 inverse = (3 * denominator) ^ 2;
// Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works
// in modular arithmetic, doubling the correct bits in each step.
inverse *= 2 - denominator * inverse; // inverse mod 2^8
inverse *= 2 - denominator * inverse; // inverse mod 2^16
inverse *= 2 - denominator * inverse; // inverse mod 2^32
inverse *= 2 - denominator * inverse; // inverse mod 2^64
inverse *= 2 - denominator * inverse; // inverse mod 2^128
inverse *= 2 - denominator * inverse; // inverse mod 2^256
// Because the division is now exact we can divide by multiplying with the modular inverse of denominator.
// This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is
// less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1
// is no longer required.
result = prod0 * inverse;
return result;
}
}
/**
* @notice Calculates x * y / denominator with full precision, following the selected rounding direction.
*/
function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) {
uint256 result = mulDiv(x, y, denominator);
if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {
result += 1;
}
return result;
}
/**
* @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down.
*
* Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11).
*/
function sqrt(uint256 a) internal pure returns (uint256) {
if (a == 0) {
return 0;
}
// For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.
//
// We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have
// `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`.
//
// This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)`
// â `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))`
// â `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)`
//
// Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit.
uint256 result = 1 << (log2(a) >> 1);
// At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,
// since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at
// every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision
// into the expected uint128 result.
unchecked {
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
result = (result + a / result) >> 1;
return min(result, a / result);
}
}
/**
* @notice Calculates sqrt(a), following the selected rounding direction.
*/
function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = sqrt(a);
return result + (rounding == Rounding.Up && result * result < a ? 1 : 0);
}
}
/**
* @dev Return the log in base 2, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 128;
}
if (value >> 64 > 0) {
value >>= 64;
result += 64;
}
if (value >> 32 > 0) {
value >>= 32;
result += 32;
}
if (value >> 16 > 0) {
value >>= 16;
result += 16;
}
if (value >> 8 > 0) {
value >>= 8;
result += 8;
}
if (value >> 4 > 0) {
value >>= 4;
result += 4;
}
if (value >> 2 > 0) {
value >>= 2;
result += 2;
}
if (value >> 1 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 2, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log2(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log2(value);
return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 10, rounded down, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >= 10 ** 64) {
value /= 10 ** 64;
result += 64;
}
if (value >= 10 ** 32) {
value /= 10 ** 32;
result += 32;
}
if (value >= 10 ** 16) {
value /= 10 ** 16;
result += 16;
}
if (value >= 10 ** 8) {
value /= 10 ** 8;
result += 8;
}
if (value >= 10 ** 4) {
value /= 10 ** 4;
result += 4;
}
if (value >= 10 ** 2) {
value /= 10 ** 2;
result += 2;
}
if (value >= 10 ** 1) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 10, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log10(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log10(value);
return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0);
}
}
/**
* @dev Return the log in base 256, rounded down, of a positive value.
* Returns 0 if given 0.
*
* Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string.
*/
function log256(uint256 value) internal pure returns (uint256) {
uint256 result = 0;
unchecked {
if (value >> 128 > 0) {
value >>= 128;
result += 16;
}
if (value >> 64 > 0) {
value >>= 64;
result += 8;
}
if (value >> 32 > 0) {
value >>= 32;
result += 4;
}
if (value >> 16 > 0) {
value >>= 16;
result += 2;
}
if (value >> 8 > 0) {
result += 1;
}
}
return result;
}
/**
* @dev Return the log in base 256, following the selected rounding direction, of a positive value.
* Returns 0 if given 0.
*/
function log256(uint256 value, Rounding rounding) internal pure returns (uint256) {
unchecked {
uint256 result = log256(value);
return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0);
}
}
}
// File @openzeppelin/contracts/utils/math/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol)
pragma solidity ^0.8.0;
/**
* @dev Standard signed math utilities missing in the Solidity language.
*/
library SignedMath {
/**
* @dev Returns the largest of two signed numbers.
*/
function max(int256 a, int256 b) internal pure returns (int256) {
return a > b ? a : b;
}
/**
* @dev Returns the smallest of two signed numbers.
*/
function min(int256 a, int256 b) internal pure returns (int256) {
return a < b ? a : b;
}
/**
* @dev Returns the average of two signed numbers without overflow.
* The result is rounded towards zero.
*/
function average(int256 a, int256 b) internal pure returns (int256) {
// Formula from the book "Hacker's Delight"
int256 x = (a & b) + ((a ^ b) >> 1);
return x + (int256(uint256(x) >> 255) & (a ^ b));
}
/**
* @dev Returns the absolute unsigned value of a signed value.
*/
function abs(int256 n) internal pure returns (uint256) {
unchecked {
// must be unchecked in order to support `n = type(int256).min`
return uint256(n >= 0 ? n : -n);
}
}
}
// File @openzeppelin/contracts/utils/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol)
pragma solidity ^0.8.0;
/**
* @dev String operations.
*/
library Strings {
bytes16 private constant _SYMBOLS = "0123456789abcdef";
uint8 private constant _ADDRESS_LENGTH = 20;
/**
* @dev Converts a `uint256` to its ASCII `string` decimal representation.
*/
function toString(uint256 value) internal pure returns (string memory) {
unchecked {
uint256 length = Math.log10(value) + 1;
string memory buffer = new string(length);
uint256 ptr;
/// @solidity memory-safe-assembly
assembly {
ptr := add(buffer, add(32, length))
}
while (true) {
ptr--;
/// @solidity memory-safe-assembly
assembly {
mstore8(ptr, byte(mod(value, 10), _SYMBOLS))
}
value /= 10;
if (value == 0) break;
}
return buffer;
}
}
/**
* @dev Converts a `int256` to its ASCII `string` decimal representation.
*/
function toString(int256 value) internal pure returns (string memory) {
return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value))));
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.
*/
function toHexString(uint256 value) internal pure returns (string memory) {
unchecked {
return toHexString(value, Math.log256(value) + 1);
}
}
/**
* @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.
*/
function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {
bytes memory buffer = new bytes(2 * length + 2);
buffer[0] = "0";
buffer[1] = "x";
for (uint256 i = 2 * length + 1; i > 1; --i) {
buffer[i] = _SYMBOLS[value & 0xf];
value >>= 4;
}
require(value == 0, "Strings: hex length insufficient");
return string(buffer);
}
/**
* @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.
*/
function toHexString(address addr) internal pure returns (string memory) {
return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);
}
/**
* @dev Returns true if the two strings are equal.
*/
function equal(string memory a, string memory b) internal pure returns (bool) {
return keccak256(bytes(a)) == keccak256(bytes(b));
}
}
// File @openzeppelin/contracts/access/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/AccessControl.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that allows children to implement role-based access
* control mechanisms. This is a lightweight version that doesn't allow enumerating role
* members except through off-chain means by accessing the contract event logs. Some
* applications may benefit from on-chain enumerability, for those cases see
* {AccessControlEnumerable}.
*
* Roles are referred to by their `bytes32` identifier. These should be exposed
* in the external API and be unique. The best way to achieve this is by
* using `public constant` hash digests:
*
* ```solidity
* bytes32 public constant MY_ROLE = keccak256("MY_ROLE");
* ```
*
* Roles can be used to represent a set of permissions. To restrict access to a
* function call, use {hasRole}:
*
* ```solidity
* function foo() public {
* require(hasRole(MY_ROLE, msg.sender));
* ...
* }
* ```
*
* Roles can be granted and revoked dynamically via the {grantRole} and
* {revokeRole} functions. Each role has an associated admin role, and only
* accounts that have a role's admin role can call {grantRole} and {revokeRole}.
*
* By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means
* that only accounts with this role will be able to grant or revoke other
* roles. More complex role relationships can be created by using
* {_setRoleAdmin}.
*
* WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to
* grant and revoke this role. Extra precautions should be taken to secure
* accounts that have been granted it. We recommend using {AccessControlDefaultAdminRules}
* to enforce additional security measures for this role.
*/
abstract contract AccessControl is Context, IAccessControl, ERC165 {
struct RoleData {
mapping(address => bool) members;
bytes32 adminRole;
}
mapping(bytes32 => RoleData) private _roles;
bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;
/**
* @dev Modifier that checks that an account has a specific role. Reverts
* with a standardized message including the required role.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*
* _Available since v4.1._
*/
modifier onlyRole(bytes32 role) {
_checkRole(role);
_;
}
/**
* @dev See {IERC165-supportsInterface}.
*/
function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {
return interfaceId == type(IAccessControl).interfaceId || super.supportsInterface(interfaceId);
}
/**
* @dev Returns `true` if `account` has been granted `role`.
*/
function hasRole(bytes32 role, address account) public view virtual override returns (bool) {
return _roles[role].members[account];
}
/**
* @dev Revert with a standard message if `_msgSender()` is missing `role`.
* Overriding this function changes the behavior of the {onlyRole} modifier.
*
* Format of the revert message is described in {_checkRole}.
*
* _Available since v4.6._
*/
function _checkRole(bytes32 role) internal view virtual {
_checkRole(role, _msgSender());
}
/**
* @dev Revert with a standard message if `account` is missing `role`.
*
* The format of the revert reason is given by the following regular expression:
*
* /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/
*/
function _checkRole(bytes32 role, address account) internal view virtual {
if (!hasRole(role, account)) {
revert(
string(
abi.encodePacked(
"AccessControl: account ",
Strings.toHexString(account),
" is missing role ",
Strings.toHexString(uint256(role), 32)
)
)
);
}
}
/**
* @dev Returns the admin role that controls `role`. See {grantRole} and
* {revokeRole}.
*
* To change a role's admin, use {_setRoleAdmin}.
*/
function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {
return _roles[role].adminRole;
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleGranted} event.
*/
function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_grantRole(role, account);
}
/**
* @dev Revokes `role` from `account`.
*
* If `account` had been granted `role`, emits a {RoleRevoked} event.
*
* Requirements:
*
* - the caller must have ``role``'s admin role.
*
* May emit a {RoleRevoked} event.
*/
function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {
_revokeRole(role, account);
}
/**
* @dev Revokes `role` from the calling account.
*
* Roles are often managed via {grantRole} and {revokeRole}: this function's
* purpose is to provide a mechanism for accounts to lose their privileges
* if they are compromised (such as when a trusted device is misplaced).
*
* If the calling account had been revoked `role`, emits a {RoleRevoked}
* event.
*
* Requirements:
*
* - the caller must be `account`.
*
* May emit a {RoleRevoked} event.
*/
function renounceRole(bytes32 role, address account) public virtual override {
require(account == _msgSender(), "AccessControl: can only renounce roles for self");
_revokeRole(role, account);
}
/**
* @dev Grants `role` to `account`.
*
* If `account` had not been already granted `role`, emits a {RoleGranted}
* event. Note that unlike {grantRole}, this function doesn't perform any
* checks on the calling account.
*
* May emit a {RoleGranted} event.
*
* [WARNING]
* ====
* This function should only be called from the constructor when setting
* up the initial roles for the system.
*
* Using this function in any other way is effectively circumventing the admin
* system imposed by {AccessControl}.
* ====
*
* NOTE: This function is deprecated in favor of {_grantRole}.
*/
function _setupRole(bytes32 role, address account) internal virtual {
_grantRole(role, account);
}
/**
* @dev Sets `adminRole` as ``role``'s admin role.
*
* Emits a {RoleAdminChanged} event.
*/
function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {
bytes32 previousAdminRole = getRoleAdmin(role);
_roles[role].adminRole = adminRole;
emit RoleAdminChanged(role, previousAdminRole, adminRole);
}
/**
* @dev Grants `role` to `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleGranted} event.
*/
function _grantRole(bytes32 role, address account) internal virtual {
if (!hasRole(role, account)) {
_roles[role].members[account] = true;
emit RoleGranted(role, account, _msgSender());
}
}
/**
* @dev Revokes `role` from `account`.
*
* Internal function without access restriction.
*
* May emit a {RoleRevoked} event.
*/
function _revokeRole(bytes32 role, address account) internal virtual {
if (hasRole(role, account)) {
_roles[role].members[account] = false;
emit RoleRevoked(role, account, _msgSender());
}
}
}
// File @openzeppelin/contracts/token/ERC20/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
// File @openzeppelin/contracts/token/ERC20/extensions/[email protected]
// Original license: SPDX_License_Identifier: MIT
// 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/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.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.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How
* to implement supply mechanisms].
*
* The default value of {decimals} is 18. To change this, you should override
* this function so it returns a different value.
*
* 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}.
*
* 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 default value returned by this function, unless
* it's 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, allowance(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 = allowance(owner, spender);
require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero");
unchecked {
_approve(owner, spender, currentAllowance - subtractedValue);
}
return true;
}
/**
* @dev Moves `amount` of tokens from `from` to `to`.
*
* 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;
// Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by
// decrementing then incrementing.
_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;
unchecked {
// Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above.
_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;
// Overflow not possible: amount <= accountBalance <= totalSupply.
_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 Updates `owner` s allowance for `spender` based on spent `amount`.
*
* 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/KaleidoSwap/interfaces/IKaleidoSwapPair.sol
// Original license: SPDX_License_Identifier: Unlicense
pragma solidity ^0.8.2;
interface IKaleidoSwapPair is IERC20 {
function permit(address owner, address spender, uint value, uint deadline, uint8 v, bytes32 r, bytes32 s) external;
event Mint(address indexed sender, uint amount0, uint amount1);
event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);
event Swap(
address indexed sender,
uint amount0In,
uint amount1In,
uint amount0Out,
uint amount1Out,
address indexed to
);
event Sync(uint112 reserve0, uint112 reserve1);
function getReserves() external view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast);
function mint(address to) external returns (uint liquidity);
function burn(address to) external returns (uint amount0, uint amount1);
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external;
function skim(address to) external;
function sync() external;
function initialize(address, address) external;
}
// File contracts/KaleidoSwap/interfaces/IKaleidoSwapFactory.sol
// Original license: SPDX_License_Identifier: Unlicense
pragma solidity ^0.8.2;
interface IKaleidoSwapFactory {
event PairCreated(address indexed token0, address indexed token1, address pair, uint);
function feeTo() external view returns (address);
function getPair(address tokenA, address tokenB) external view returns (address pair);
function createPair(address tokenA, address tokenB) external returns (address pair);
function setFeeTo(address) external;
}
// File @openzeppelin/contracts/utils/math/[email protected]
// Original license: SPDX_License_Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
// File contracts/KaleidoSwap/interfaces/IKaleidoSwapCallee.sol
// Original license: SPDX_License_Identifier: Unlicense
pragma solidity ^0.8.2;
interface IKaleidoSwapCallee {
function kaleidoSwapCall(address sender, uint amount0, uint amount1, bytes calldata data) external;
}
// File contracts/KaleidoSwap/libraries/UQ112x112.sol
// Original license: SPDX_License_Identifier: Unlicense
pragma solidity ^0.8.2;
// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))
// range: [0, 2**112 - 1]
// resolution: 1 / 2**112
library UQ112x112 {
uint224 constant Q112 = 2 ** 112;
// encode a uint112 as a UQ112x112
function encode(uint112 y) internal pure returns (uint224 z) {
z = uint224(y) * Q112; // never overflows
}
// divide a UQ112x112 by a uint112, returning a UQ112x112
function uqdiv(uint224 x, uint112 y) internal pure returns (uint224 z) {
z = x / uint224(y);
}
}
// File contracts/KaleidoSwap/KaleidoSwapPair.sol
// Original license: SPDX_License_Identifier: Unlicense
pragma solidity ^0.8.2;
contract KaleidoSwapPair is IKaleidoSwapPair, ERC20 {
using SafeMath for uint;
using UQ112x112 for uint224;
uint public constant MINIMUM_LIQUIDITY = 10 ** 3;
bytes4 private constant SELECTOR = bytes4(keccak256(bytes("transfer(address,uint256)")));
bytes32 public DOMAIN_SEPARATOR;
// keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)");
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;
address public factory;
address public token0;
address public token1;
uint112 private reserve0; // uses single storage slot, accessible via getReserves
uint112 private reserve1; // uses single storage slot, accessible via getReserves
uint32 private blockTimestampLast; // uses single storage slot, accessible via getReserves
uint public price0CumulativeLast;
uint public price1CumulativeLast;
uint public kLast; // reserve0 * reserve1, as of immediately after the most recent liquidity event
mapping(address => uint) public nonces;
uint private unlocked = 1;
modifier lock() {
require(unlocked == 1, "KaleidoSwap: LOCKED");
unlocked = 0;
_;
unlocked = 1;
}
function getReserves()
public
view
override
returns (uint112 _reserve0, uint112 _reserve1, uint32 _blockTimestampLast)
{
_reserve0 = reserve0;
_reserve1 = reserve1;
_blockTimestampLast = blockTimestampLast;
}
function _safeTransfer(address token, address to, uint value) private {
(bool success, bytes memory data) = token.call(abi.encodeWithSelector(SELECTOR, to, value));
require(success && (data.length == 0 || abi.decode(data, (bool))), "KaleidoSwap: TRANSFER_FAILED");
}
constructor() ERC20("KaleidoSwap", "KALEIS") {
factory = msg.sender;
uint chainId;
assembly {
chainId := chainid()
}
DOMAIN_SEPARATOR = keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes(name())),
keccak256(bytes("1")),
chainId,
address(this)
)
);
}
// called once by the factory at time of deployment
function initialize(address _token0, address _token1) external override {
require(msg.sender == factory, "KaleidoSwap: FORBIDDEN"); // sufficient check
token0 = _token0;
token1 = _token1;
}
// update reserves and, on the first call per block, price accumulators
function _update(uint balance0, uint balance1, uint112 _reserve0, uint112 _reserve1) private {
require(balance0 <= type(uint112).max && balance1 <= type(uint112).max, "KaleidoSwap: OVERFLOW");
uint32 blockTimestamp = uint32(block.timestamp % 2 ** 32);
uint32 timeElapsed = blockTimestamp - blockTimestampLast; // overflow is desired
if (timeElapsed > 0 && _reserve0 != 0 && _reserve1 != 0) {
// * never overflows, and + overflow is desired
price0CumulativeLast += uint(UQ112x112.encode(_reserve1).uqdiv(_reserve0)) * timeElapsed;
price1CumulativeLast += uint(UQ112x112.encode(_reserve0).uqdiv(_reserve1)) * timeElapsed;
}
reserve0 = uint112(balance0);
reserve1 = uint112(balance1);
blockTimestampLast = blockTimestamp;
emit Sync(reserve0, reserve1);
}
// if fee is on, mint liquidity equivalent to 1/6th of the growth in sqrt(k)
function _mintFee(uint112 _reserve0, uint112 _reserve1) private returns (bool feeOn) {
address feeTo = IKaleidoSwapFactory(factory).feeTo();
feeOn = feeTo != address(0);
uint _kLast = kLast; // gas savings
if (feeOn) {
if (_kLast != 0) {
uint rootK = Math.sqrt(uint(_reserve0).mul(_reserve1));
uint rootKLast = Math.sqrt(_kLast);
if (rootK > rootKLast) {
uint numerator = totalSupply().mul(rootK.sub(rootKLast));
uint denominator = rootK.mul(5).add(rootKLast);
uint liquidity = numerator / denominator;
if (liquidity > 0) _mint(feeTo, liquidity);
}
}
} else if (_kLast != 0) {
kLast = 0;
}
}
// this low-level function should be called from a contract which performs important safety checks
function mint(address to) external override lock returns (uint liquidity) {
(uint112 _reserve0, uint112 _reserve1, ) = getReserves(); // gas savings
uint balance0 = IERC20(token0).balanceOf(address(this));
uint balance1 = IERC20(token1).balanceOf(address(this));
uint amount0 = balance0.sub(_reserve0);
uint amount1 = balance1.sub(_reserve1);
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply(); // gas savings, must be defined here since totalSupply can update in _mintFee
if (_totalSupply == 0) {
liquidity = Math.sqrt(amount0.mul(amount1)).sub(MINIMUM_LIQUIDITY);
_mint(address(this), MINIMUM_LIQUIDITY); // permanently lock the first MINIMUM_LIQUIDITY tokens
} else {
liquidity = Math.min(amount0.mul(_totalSupply) / _reserve0, amount1.mul(_totalSupply) / _reserve1);
}
require(liquidity > 0, "KaleidoSwap: INSUFFICIENT_LIQUIDITY_MINTED");
_mint(to, liquidity);
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Mint(msg.sender, amount0, amount1);
}
// this low-level function should be called from a contract which performs important safety checks
function burn(address to) external override lock returns (uint amount0, uint amount1) {
(uint112 _reserve0, uint112 _reserve1, ) = getReserves(); // gas savings
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
uint balance0 = IERC20(_token0).balanceOf(address(this));
uint balance1 = IERC20(_token1).balanceOf(address(this));
uint liquidity = balanceOf(address(this));
bool feeOn = _mintFee(_reserve0, _reserve1);
uint _totalSupply = totalSupply(); // gas savings, must be defined here since totalSupply can update in _mintFee
amount0 = liquidity.mul(balance0) / _totalSupply; // using balances ensures pro-rata distribution
amount1 = liquidity.mul(balance1) / _totalSupply; // using balances ensures pro-rata distribution
require(amount0 > 0 && amount1 > 0, "KaleidoSwap: INSUFFICIENT_LIQUIDITY_BURNED");
_burn(address(this), liquidity);
_safeTransfer(_token0, to, amount0);
_safeTransfer(_token1, to, amount1);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
_update(balance0, balance1, _reserve0, _reserve1);
if (feeOn) kLast = uint(reserve0).mul(reserve1); // reserve0 and reserve1 are up-to-date
emit Burn(msg.sender, amount0, amount1, to);
}
// this low-level function should be called from a contract which performs important safety checks
function swap(uint amount0Out, uint amount1Out, address to, bytes calldata data) external override lock {
require(amount0Out > 0 || amount1Out > 0, "KaleidoSwap: INSUFFICIENT_OUTPUT_AMOUNT");
(uint112 _reserve0, uint112 _reserve1, ) = getReserves(); // gas savings
require(amount0Out < _reserve0 && amount1Out < _reserve1, "KaleidoSwap: INSUFFICIENT_LIQUIDITY");
uint balance0;
uint balance1;
{
// scope for _token{0,1}, avoids stack too deep errors
address _token0 = token0;
address _token1 = token1;
require(to != _token0 && to != _token1, "KaleidoSwap: INVALID_TO");
if (amount0Out > 0) _safeTransfer(_token0, to, amount0Out); // optimistically transfer tokens
if (amount1Out > 0) _safeTransfer(_token1, to, amount1Out); // optimistically transfer tokens
if (data.length > 0) IKaleidoSwapCallee(to).kaleidoSwapCall(msg.sender, amount0Out, amount1Out, data);
balance0 = IERC20(_token0).balanceOf(address(this));
balance1 = IERC20(_token1).balanceOf(address(this));
}
uint amount0In = balance0 > _reserve0 - amount0Out ? balance0 - (_reserve0 - amount0Out) : 0;
uint amount1In = balance1 > _reserve1 - amount1Out ? balance1 - (_reserve1 - amount1Out) : 0;
require(amount0In > 0 || amount1In > 0, "KaleidoSwap: INSUFFICIENT_INPUT_AMOUNT");
{
// scope for reserve{0,1}Adjusted, avoids stack too deep errors
uint balance0Adjusted = balance0.mul(1000).sub(amount0In.mul(3));
uint balance1Adjusted = balance1.mul(1000).sub(amount1In.mul(3));
require(
balance0Adjusted.mul(balance1Adjusted) >= uint(_reserve0).mul(_reserve1).mul(1000 ** 2),
"KaleidoSwap: K"
);
}
_update(balance0, balance1, _reserve0, _reserve1);
emit Swap(msg.sender, amount0In, amount1In, amount0Out, amount1Out, to);
}
// force balances to match reserves
function skim(address to) external override lock {
address _token0 = token0; // gas savings
address _token1 = token1; // gas savings
_safeTransfer(_token0, to, IERC20(_token0).balanceOf(address(this)).sub(reserve0));
_safeTransfer(_token1, to, IERC20(_token1).balanceOf(address(this)).sub(reserve1));
}
// force reserves to match balances
function sync() external override lock {
_update(IERC20(token0).balanceOf(address(this)), IERC20(token1).balanceOf(address(this)), reserve0, reserve1);
}
function permit(
address owner,
address spender,
uint value,
uint deadline,
uint8 v,
bytes32 r,
bytes32 s
) external override {
require(deadline >= block.timestamp, "KaleidoSwap: EXPIRED");
bytes32 digest = keccak256(
abi.encodePacked(
"\x19\x01",
DOMAIN_SEPARATOR,
keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline))
)
);
address recoveredAddress = ecrecover(digest, v, r, s);
require(recoveredAddress != address(0) && recoveredAddress == owner, "KaleidoSwap: INVALID_SIGNATURE");
_approve(owner, spender, value);
}
}
// File contracts/KaleidoSwap/KaleidoSwapFactory.sol
// Original license: SPDX_License_Identifier: Unlicense
pragma solidity ^0.8.2;
contract KaleidoSwapFactory is IKaleidoSwapFactory, AccessControl {
bytes32 private constant ADMIN_ROLE = keccak256("ADMIN_ROLE");
address private _feeTo;
mapping(address => mapping(address => address)) public _pairs;
uint private _allPairs;
constructor() {
address sender = _msgSender();
_setupRole(DEFAULT_ADMIN_ROLE, sender);
_setupRole(ADMIN_ROLE, sender);
_feeTo = sender;
}
function allPairsLength() external view returns (uint) {
return _allPairs;
}
function getPair(address tokenA, address tokenB) external view override returns (address) {
return _pairs[tokenA][tokenB];
}
function createPair(address tokenA, address tokenB) external override returns (address pair) {
require(tokenA != tokenB, "KaleidoSwap: IDENTICAL_ADDRESSES");
(address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
require(token0 != address(0), "KaleidoSwap: ZERO_ADDRESS");
require(_pairs[token0][token1] == address(0), "KaleidoSwap: PAIR_EXISTS"); // single check is sufficient
bytes memory bytecode = type(KaleidoSwapPair).creationCode;
bytes32 salt = keccak256(abi.encodePacked(token0, token1));
assembly {
pair := create2(0, add(bytecode, 32), mload(bytecode), salt)
}
IKaleidoSwapPair(pair).initialize(token0, token1);
_pairs[token0][token1] = pair;
_pairs[token1][token0] = pair; // populate mapping in the reverse direction
_allPairs = _allPairs + 1;
emit PairCreated(token0, token1, pair, _allPairs);
}
function setFeeTo(address feeTo_) external override onlyRole(ADMIN_ROLE) {
_feeTo = feeTo_;
}
function feeTo() external view override returns (address) {
return _feeTo;
}
}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"PairCreated","inputs":[{"type":"address","name":"token0","internalType":"address","indexed":true},{"type":"address","name":"token1","internalType":"address","indexed":true},{"type":"address","name":"pair","internalType":"address","indexed":false},{"type":"uint256","name":"","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"RoleAdminChanged","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"previousAdminRole","internalType":"bytes32","indexed":true},{"type":"bytes32","name":"newAdminRole","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"RoleGranted","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"RoleRevoked","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32","indexed":true},{"type":"address","name":"account","internalType":"address","indexed":true},{"type":"address","name":"sender","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"DEFAULT_ADMIN_ROLE","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"_pairs","inputs":[{"type":"address","name":"","internalType":"address"},{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"allPairsLength","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"pair","internalType":"address"}],"name":"createPair","inputs":[{"type":"address","name":"tokenA","internalType":"address"},{"type":"address","name":"tokenB","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"feeTo","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"getPair","inputs":[{"type":"address","name":"tokenA","internalType":"address"},{"type":"address","name":"tokenB","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getRoleAdmin","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"grantRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"hasRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"revokeRole","inputs":[{"type":"bytes32","name":"role","internalType":"bytes32"},{"type":"address","name":"account","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setFeeTo","inputs":[{"type":"address","name":"feeTo_","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"supportsInterface","inputs":[{"type":"bytes4","name":"interfaceId","internalType":"bytes4"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b503361001d60008261006c565b6100477fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217758261006c565b600180546001600160a01b0319166001600160a01b0392909216919091179055610118565b610076828261007a565b5050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16610076576000828152602081815260408083206001600160a01b03851684529091529020805460ff191660011790556100d43390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b613bc9806101276000396000f3fe60806040523480156200001157600080fd5b5060043610620000f45760003560e01c8063574f2ba31162000099578063c9c65396116200006f578063c9c653961462000233578063d547741f146200024a578063e6a439051462000261578063f46901ed146200029c57620000f4565b8063574f2ba314620001e757806391d1485414620001f0578063a217fddf146200022a57620000f4565b80632f2ff15d11620000cf5780632f2ff15d1462000180578063336287cd146200019957806336568abe14620001d057620000f4565b8063017e7e5814620000f957806301ffc9a71462000123578063248a9ca3146200014b575b600080fd5b6001546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6200013a6200013436600462000c73565b620002b3565b60405190151581526020016200011a565b620001716200015c36600462000c35565b60009081526020819052604090206001015490565b6040519081526020016200011a565b620001976200019136600462000c4e565b6200034f565b005b62000106620001aa36600462000bfe565b60026020908152600092835260408084209091529082529020546001600160a01b031681565b62000197620001e136600462000c4e565b6200037d565b60035462000171565b6200013a6200020136600462000c4e565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b62000171600081565b620001066200024436600462000bfe565b62000411565b620001976200025b36600462000c4e565b62000736565b620001066200027236600462000bfe565b6001600160a01b039182166000908152600260209081526040808320938516835292905220541690565b62000197620002ad36600462000be1565b6200075f565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806200034757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b90505b919050565b6000828152602081905260409020600101546200036c81620007bb565b620003788383620007ca565b505050565b6001600160a01b0381163314620004015760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6200040d82826200086a565b5050565b6000816001600160a01b0316836001600160a01b03161415620004775760405162461bcd60e51b815260206004820181905260248201527f4b616c6569646f537761703a204944454e544943414c5f4144445245535345536044820152606401620003f8565b600080836001600160a01b0316856001600160a01b0316106200049c5783856200049f565b84845b90925090506001600160a01b038216620004fc5760405162461bcd60e51b815260206004820152601960248201527f4b616c6569646f537761703a205a45524f5f41444452455353000000000000006044820152606401620003f8565b6001600160a01b03828116600090815260026020908152604080832085851684529091529020541615620005735760405162461bcd60e51b815260206004820152601860248201527f4b616c6569646f537761703a20504149525f45584953545300000000000000006044820152606401620003f8565b600060405180602001620005879062000bbb565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606086811b8216602084015285901b166034820152909150600090604801604051602081830303815290604052805190602001209050808251602084016000f56040517f485cc9550000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015285811660248301529196509086169063485cc95590604401600060405180830381600087803b1580156200065357600080fd5b505af115801562000668573d6000803e3d6000fd5b5050506001600160a01b0380861660008181526002602081815260408084208a8716855282528084208054968d1673ffffffffffffffffffffffffffffffffffffffff199788168117909155928252808420948452939052919020805490921617905550600354620006dc90600162000d6f565b6003819055604080516001600160a01b0388811682526020820193909352828616928716917f0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9910160405180910390a35050505092915050565b6000828152602081905260409020600101546200075381620007bb565b6200037883836200086a565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756200078b81620007bb565b506001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b620007c78133620008ea565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200040d576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620008263390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156200040d576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200040d576200091e8162000966565b6200092b83602062000979565b6040516020016200093e92919062000cb5565b60408051601f198184030181529082905262461bcd60e51b8252620003f89160040162000d3a565b6060620003476001600160a01b03831660145b606060006200098a83600262000d8a565b6200099790600262000d6f565b67ffffffffffffffff811115620009be57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015620009e9576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811062000a2f57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811062000a8957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600062000aaf84600262000d8a565b62000abc90600162000d6f565b90505b600181111562000b63577f303132333435363738396162636465660000000000000000000000000000000085600f166010811062000b0d57634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811062000b3257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9362000b5b8162000ddf565b905062000abf565b50831562000bb45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401620003f8565b9392505050565b612d848062000e1083390190565b80356001600160a01b03811681146200034a57600080fd5b60006020828403121562000bf3578081fd5b62000bb48262000bc9565b6000806040838503121562000c11578081fd5b62000c1c8362000bc9565b915062000c2c6020840162000bc9565b90509250929050565b60006020828403121562000c47578081fd5b5035919050565b6000806040838503121562000c61578182fd5b8235915062000c2c6020840162000bc9565b60006020828403121562000c85578081fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811462000bb4578182fd5b60007f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008252835162000cef81601785016020880162000dac565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835162000d2e81602884016020880162000dac565b01602801949350505050565b600060208252825180602084015262000d5b81604085016020870162000dac565b601f01601f19169190910160400192915050565b6000821982111562000d855762000d8562000df9565b500190565b600081600019048311821515161562000da75762000da762000df9565b500290565b60005b8381101562000dc957818101518382015260200162000daf565b8381111562000dd9576000848401525b50505050565b60008162000df15762000df162000df9565b506000190190565b634e487b7160e01b600052601160045260246000fdfe60806040526001600e553480156200001657600080fd5b50604080518082018252600b81526a04b616c6569646f537761760ac1b6020808301918252835180850190945260068452654b414c45495360d01b9084015281519192916200006891600391620001df565b5080516200007e906004906020840190620001df565b5050600680546001600160a01b0319163317905550467f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000bf62000145565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018290523060a082015260c00160408051601f19818403018152919052805160209091012060055550620002c2565b606060038054620001569062000285565b80601f0160208091040260200160405190810160405280929190818152602001828054620001849062000285565b8015620001d55780601f10620001a957610100808354040283529160200191620001d5565b820191906000526020600020905b815481529060010190602001808311620001b757829003601f168201915b5050505050905090565b828054620001ed9062000285565b90600052602060002090601f0160209004810192826200021157600085556200025c565b82601f106200022c57805160ff19168380011785556200025c565b828001600101855582156200025c579182015b828111156200025c5782518255916020019190600101906200023f565b506200026a9291506200026e565b5090565b5b808211156200026a57600081556001016200026f565b6002810460018216806200029a57607f821691505b60208210811415620002bc57634e487b7160e01b600052602260045260246000fd5b50919050565b612ab280620002d26000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636a62784211610104578063a9059cbb116100a2578063d21220a711610071578063d21220a714610400578063d505accf14610413578063dd62ed3e14610426578063fff6cae91461045f576101cf565b8063a9059cbb146103be578063ba9a7a56146103d1578063bc25cf77146103da578063c45a0155146103ed576101cf565b80637ecebe00116100de5780637ecebe001461035b57806389afcb441461037b57806395d89b41146103a3578063a457c2d7146103ab576101cf565b80636a6278421461032c57806370a082311461033f5780637464fc3d14610352576101cf565b806330adf81f11610171578063395093511161014b57806339509351146102f4578063485cc955146103075780635909c0d51461031a5780635a3d549314610323576101cf565b806330adf81f146102b5578063313ce567146102dc5780633644e515146102eb576101cf565b8063095ea7b3116101ad578063095ea7b3146102425780630dfe16811461026557806318160ddd1461029057806323b872dd146102a2576101cf565b8063022c0d9f146101d457806306fdde03146101e95780630902f1ac14610207575b600080fd5b6101e76101e2366004612799565b610467565b005b6101f1610a53565b6040516101fe9190612893565b60405180910390f35b600954604080516001600160701b038084168252600160701b8404166020820152600160e01b90920463ffffffff16908201526060016101fe565b610255610250366004612736565b610ae5565b60405190151581526020016101fe565b600754610278906001600160a01b031681565b6040516001600160a01b0390911681526020016101fe565b6002545b6040519081526020016101fe565b6102556102b0366004612681565b610afd565b6102947f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b604051601281526020016101fe565b61029460055481565b610255610302366004612736565b610b21565b6101e7610315366004612649565b610b60565b610294600a5481565b610294600b5481565b61029461033a366004612611565b610c00565b61029461034d366004612611565b610f32565b610294600c5481565b610294610369366004612611565b600d6020526000908152604090205481565b61038e610389366004612611565b610f51565b604080519283526020830191909152016101fe565b6101f1611345565b6102556103b9366004612736565b611354565b6102556103cc366004612736565b6113fe565b6102946103e881565b6101e76103e8366004612611565b61140c565b600654610278906001600160a01b031681565b600854610278906001600160a01b031681565b6101e76104213660046126c1565b611555565b610294610434366004612649565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6101e761178f565b600e546001146104b45760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064015b60405180910390fd5b6000600e55841515806104c75750600084115b6105395760405162461bcd60e51b815260206004820152602760248201527f4b616c6569646f537761703a20494e53554646494349454e545f4f555450555460448201527f5f414d4f554e540000000000000000000000000000000000000000000000000060648201526084016104ab565b60008061056a6009546001600160701b0380821692600160701b83049091169163ffffffff600160e01b9091041690565b5091509150816001600160701b03168710801561058f5750806001600160701b031686105b6106015760405162461bcd60e51b815260206004820152602360248201527f4b616c6569646f537761703a20494e53554646494349454e545f4c495155494460448201527f495459000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b60075460085460009182916001600160a01b0391821691908116908916821480159061063f5750806001600160a01b0316896001600160a01b031614155b61068b5760405162461bcd60e51b815260206004820152601760248201527f4b616c6569646f537761703a20494e56414c49445f544f00000000000000000060448201526064016104ab565b8a1561069c5761069c828a8d6118f7565b89156106ad576106ad818a8c6118f7565b8615610733576040517fa325f2c80000000000000000000000000000000000000000000000000000000081526001600160a01b038a169063a325f2c8906107009033908f908f908e908e90600401612846565b600060405180830381600087803b15801561071a57600080fd5b505af115801561072e573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526001600160a01b038316906370a082319060240160206040518083038186803b15801561077257600080fd5b505afa158015610786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107aa9190612781565b6040516370a0823160e01b81523060048201529094506001600160a01b038216906370a082319060240160206040518083038186803b1580156107ec57600080fd5b505afa158015610800573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108249190612781565b92505050600089856001600160701b031661083f9190612966565b831161084c576000610869565b61085f8a6001600160701b038716612966565b6108699084612966565b905060006108808a6001600160701b038716612966565b831161088d5760006108aa565b6108a08a6001600160701b038716612966565b6108aa9084612966565b905060008211806108bb5750600081115b61092d5760405162461bcd60e51b815260206004820152602660248201527f4b616c6569646f537761703a20494e53554646494349454e545f494e5055545f60448201527f414d4f554e54000000000000000000000000000000000000000000000000000060648201526084016104ab565b600061094f61093d846003611a5b565b610949876103e8611a5b565b90611a6e565b9050600061096161093d846003611a5b565b9050610986620f42406109806001600160701b038b8116908b16611a5b565b90611a5b565b6109908383611a5b565b10156109de5760405162461bcd60e51b815260206004820152600e60248201527f4b616c6569646f537761703a204b00000000000000000000000000000000000060448201526064016104ab565b50506109ec84848888611a7a565b60408051838152602081018390529081018c9052606081018b90526001600160a01b038a169033907fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229060800160405180910390a350506001600e55505050505050505050565b606060038054610a62906129ce565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e906129ce565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050905090565b600033610af3818585611c8f565b5060019392505050565b600033610b0b858285611de8565b610b16858585611e7a565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610af39082908690610b5b9087906128c6565b611c8f565b6006546001600160a01b03163314610bba5760405162461bcd60e51b815260206004820152601660248201527f4b616c6569646f537761703a20464f5242494444454e0000000000000000000060448201526064016104ab565b600780546001600160a01b039384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560088054929093169116179055565b6000600e54600114610c4a5760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064016104ab565b6000600e819055600954600754604080516370a0823160e01b815230600482015290516001600160701b0380851695600160701b9095041693926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610cb357600080fd5b505afa158015610cc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ceb9190612781565b6008546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015610d3457600080fd5b505afa158015610d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6c9190612781565b90506000610d83836001600160701b038716611a6e565b90506000610d9a836001600160701b038716611a6e565b90506000610da88787612067565b90506000610db560025490565b905080610de757610dd46103e8610949610dcf8787611a5b565b6121b2565b9850610de2306103e8612307565b610e2e565b610e2b6001600160701b038916610dfe8684611a5b565b610e089190612904565b6001600160701b038916610e1c8685611a5b565b610e269190612904565b6123c6565b98505b60008911610ea45760405162461bcd60e51b815260206004820152602a60248201527f4b616c6569646f537761703a20494e53554646494349454e545f4c495155494460448201527f4954595f4d494e5445440000000000000000000000000000000000000000000060648201526084016104ab565b610eae8a8a612307565b610eba86868a8a611a7a565b8115610ee457600954610ee0906001600160701b0380821691600160701b900416611a5b565b600c555b604080518581526020810185905233917f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f910160405180910390a250506001600e5550949695505050505050565b6001600160a01b0381166000908152602081905260409020545b919050565b600080600e54600114610f9c5760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064016104ab565b6000600e819055600954600754600854604080516370a0823160e01b815230600482015290516001600160701b0380861696600160701b90960416946001600160a01b0394851694909316929184916370a0823191602480820192602092909190829003018186803b15801561101157600080fd5b505afa158015611025573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110499190612781565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a082319060240160206040518083038186803b15801561108e57600080fd5b505afa1580156110a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c69190612781565b905060006110d330610f32565b905060006110e18888612067565b905060006110ee60025490565b9050806110fb8487611a5b565b6111059190612904565b9a50806111128486611a5b565b61111c9190612904565b995060008b11801561112e575060008a115b6111a05760405162461bcd60e51b815260206004820152602a60248201527f4b616c6569646f537761703a20494e53554646494349454e545f4c495155494460448201527f4954595f4255524e45440000000000000000000000000000000000000000000060648201526084016104ab565b6111aa30846123dc565b6111b5878d8d6118f7565b6111c0868d8c6118f7565b6040516370a0823160e01b81523060048201526001600160a01b038816906370a082319060240160206040518083038186803b1580156111ff57600080fd5b505afa158015611213573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112379190612781565b6040516370a0823160e01b81523060048201529095506001600160a01b038716906370a082319060240160206040518083038186803b15801561127957600080fd5b505afa15801561128d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b19190612781565b93506112bf85858b8b611a7a565b81156112e9576009546112e5906001600160701b0380821691600160701b900416611a5b565b600c555b604080518c8152602081018c90526001600160a01b038e169133917fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496910160405180910390a35050505050505050506001600e81905550915091565b606060048054610a62906129ce565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156113f15760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016104ab565b610b168286868403611c8f565b600033610af3818585611e7a565b600e546001146114545760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064016104ab565b6000600e556007546008546009546040516370a0823160e01b81523060048201526001600160a01b0393841693909216916114fe91849186916114f9916001600160701b039091169084906370a08231906024015b60206040518083038186803b1580156114c157600080fd5b505afa1580156114d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109499190612781565b6118f7565b6009546040516370a0823160e01b815230600482015261154b91839186916114f991600160701b9091046001600160701b0316906001600160a01b038516906370a08231906024016114a9565b50506001600e5550565b428410156115a55760405162461bcd60e51b815260206004820152601460248201527f4b616c6569646f537761703a204558504952454400000000000000000000000060448201526064016104ab565b6005546001600160a01b0388166000908152600d6020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b9190876115f883612a09565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161168c9291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156116f7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580159061172d5750886001600160a01b0316816001600160a01b0316145b6117795760405162461bcd60e51b815260206004820152601e60248201527f4b616c6569646f537761703a20494e56414c49445f5349474e4154555245000060448201526064016104ab565b611784898989611c8f565b505050505050505050565b600e546001146117d75760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064016104ab565b6000600e556007546040516370a0823160e01b81523060048201526118f0916001600160a01b0316906370a082319060240160206040518083038186803b15801561182157600080fd5b505afa158015611835573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118599190612781565b6008546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561189c57600080fd5b505afa1580156118b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118d49190612781565b6009546001600160701b0380821691600160701b900416611a7a565b6001600e55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180516001600160e01b03167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839287169161199c919061282a565b6000604051808303816000865af19150503d80600081146119d9576040519150601f19603f3d011682016040523d82523d6000602084013e6119de565b606091505b5091509150818015611a08575080511580611a08575080806020019051810190611a089190612761565b611a545760405162461bcd60e51b815260206004820152601c60248201527f4b616c6569646f537761703a205452414e534645525f4641494c45440000000060448201526064016104ab565b5050505050565b6000611a678284612947565b9392505050565b6000611a678284612966565b6001600160701b038411801590611a9857506001600160701b038311155b611ae45760405162461bcd60e51b815260206004820152601560248201527f4b616c6569646f537761703a204f564552464c4f57000000000000000000000060448201526064016104ab565b6000611af564010000000042612a24565b600954909150600090611b1590600160e01b900463ffffffff168361297d565b905060008163ffffffff16118015611b3557506001600160701b03841615155b8015611b4957506001600160701b03831615155b15611bd8578063ffffffff16611b7185611b628661253d565b6001600160e01b03169061255c565b6001600160e01b0316611b849190612947565b600a6000828254611b9591906128c6565b909155505063ffffffff8116611bae84611b628761253d565b6001600160e01b0316611bc19190612947565b600b6000828254611bd291906128c6565b90915550505b600980546dffffffffffffffffffffffffffff19166001600160701b03888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff16600160701b8883168102919091176001600160e01b0316600160e01b63ffffffff87160217928390556040805184841681529190930490911660208201527f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1910160405180910390a1505050505050565b6001600160a01b038316611d0a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b038216611d865760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114611e745781811015611e675760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104ab565b611e748484848403611c8f565b50505050565b6001600160a01b038316611ef65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b038216611f725760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b038316600090815260208190526040902054818110156120015760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611e74565b600080600660009054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b1580156120b857600080fd5b505afa1580156120cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120f0919061262d565b600c546001600160a01b03821615801594509192509061219e57801561219957600061212b610dcf6001600160701b03888116908816611a5b565b90506000612138836121b2565b9050808211156121965760006121596121518484611a6e565b600254610980565b905060006121728361216c866005611a5b565b90612571565b905060006121808284612904565b90508015612192576121928782612307565b5050505b50505b6121aa565b80156121aa576000600c555b505092915050565b6000816121c157506000610f4c565b600060016121ce8461257d565b901c6001901b905060018184816121f557634e487b7160e01b600052601260045260246000fd5b048201901c9050600181848161221b57634e487b7160e01b600052601260045260246000fd5b048201901c9050600181848161224157634e487b7160e01b600052601260045260246000fd5b048201901c9050600181848161226757634e487b7160e01b600052601260045260246000fd5b048201901c9050600181848161228d57634e487b7160e01b600052601260045260246000fd5b048201901c905060018184816122b357634e487b7160e01b600052601260045260246000fd5b048201901c905060018184816122d957634e487b7160e01b600052601260045260246000fd5b048201901c9050611a678182858161230157634e487b7160e01b600052601260045260246000fd5b046123c6565b6001600160a01b03821661235d5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104ab565b806002600082825461236f91906128c6565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60008183106123d55781611a67565b5090919050565b6001600160a01b0382166124585760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b038216600090815260208190526040902054818110156124e75760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101611ddb565b6000612556600160701b6001600160701b038416612918565b92915050565b6000611a676001600160701b038316846128de565b6000611a6782846128c6565b600080608083901c1561259257608092831c92015b604083901c156125a457604092831c92015b602083901c156125b657602092831c92015b601083901c156125c857601092831c92015b600883901c156125da57600892831c92015b600483901c156125ec57600492831c92015b600283901c156125fe57600292831c92015b600183901c156125565760010192915050565b600060208284031215612622578081fd5b8135611a6781612a64565b60006020828403121561263e578081fd5b8151611a6781612a64565b6000806040838503121561265b578081fd5b823561266681612a64565b9150602083013561267681612a64565b809150509250929050565b600080600060608486031215612695578081fd5b83356126a081612a64565b925060208401356126b081612a64565b929592945050506040919091013590565b600080600080600080600060e0888a0312156126db578283fd5b87356126e681612a64565b965060208801356126f681612a64565b95506040880135945060608801359350608088013560ff81168114612719578384fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215612748578182fd5b823561275381612a64565b946020939093013593505050565b600060208284031215612772578081fd5b81518015158114611a67578182fd5b600060208284031215612792578081fd5b5051919050565b6000806000806000608086880312156127b0578081fd5b853594506020860135935060408601356127c981612a64565b9250606086013567ffffffffffffffff808211156127e5578283fd5b818801915088601f8301126127f8578283fd5b813581811115612806578384fd5b896020828501011115612817578384fd5b9699959850939650602001949392505050565b6000825161283c8184602087016129a2565b9190910192915050565b60006001600160a01b038716825285602083015284604083015260806060830152826080830152828460a084013781830160a090810191909152601f909201601f19160101949350505050565b60006020825282518060208401526128b28160408501602087016129a2565b601f01601f19169190910160400192915050565b600082198211156128d9576128d9612a38565b500190565b60006001600160e01b03808416806128f8576128f8612a4e565b92169190910492915050565b60008261291357612913612a4e565b500490565b60006001600160e01b038083168185168183048111821515161561293e5761293e612a38565b02949350505050565b600081600019048311821515161561296157612961612a38565b500290565b60008282101561297857612978612a38565b500390565b600063ffffffff8381169083168181101561299a5761299a612a38565b039392505050565b60005b838110156129bd5781810151838201526020016129a5565b83811115611e745750506000910152565b6002810460018216806129e257607f821691505b60208210811415612a0357634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612a1d57612a1d612a38565b5060010190565b600082612a3357612a33612a4e565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b0381168114612a7957600080fd5b5056fea2646970667358221220d1344fae3b65f6b1ae1df2c773ea718fedaa2c984eb5ac06b78fccfe1a264b5a64736f6c63430008020033a26469706673582212206ae2b9ab5c16aaf2c04587b9a5b8d729c51844a2be4f054f48315c0058ceba3364736f6c63430008020033
Deployed ByteCode
0x60806040523480156200001157600080fd5b5060043610620000f45760003560e01c8063574f2ba31162000099578063c9c65396116200006f578063c9c653961462000233578063d547741f146200024a578063e6a439051462000261578063f46901ed146200029c57620000f4565b8063574f2ba314620001e757806391d1485414620001f0578063a217fddf146200022a57620000f4565b80632f2ff15d11620000cf5780632f2ff15d1462000180578063336287cd146200019957806336568abe14620001d057620000f4565b8063017e7e5814620000f957806301ffc9a71462000123578063248a9ca3146200014b575b600080fd5b6001546001600160a01b03165b6040516001600160a01b0390911681526020015b60405180910390f35b6200013a6200013436600462000c73565b620002b3565b60405190151581526020016200011a565b620001716200015c36600462000c35565b60009081526020819052604090206001015490565b6040519081526020016200011a565b620001976200019136600462000c4e565b6200034f565b005b62000106620001aa36600462000bfe565b60026020908152600092835260408084209091529082529020546001600160a01b031681565b62000197620001e136600462000c4e565b6200037d565b60035462000171565b6200013a6200020136600462000c4e565b6000918252602082815260408084206001600160a01b0393909316845291905290205460ff1690565b62000171600081565b620001066200024436600462000bfe565b62000411565b620001976200025b36600462000c4e565b62000736565b620001066200027236600462000bfe565b6001600160a01b039182166000908152600260209081526040808320938516835292905220541690565b62000197620002ad36600462000be1565b6200075f565b60007fffffffff0000000000000000000000000000000000000000000000000000000082167f7965db0b0000000000000000000000000000000000000000000000000000000014806200034757507f01ffc9a7000000000000000000000000000000000000000000000000000000007fffffffff000000000000000000000000000000000000000000000000000000008316145b90505b919050565b6000828152602081905260409020600101546200036c81620007bb565b620003788383620007ca565b505050565b6001600160a01b0381163314620004015760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201527f20726f6c657320666f722073656c66000000000000000000000000000000000060648201526084015b60405180910390fd5b6200040d82826200086a565b5050565b6000816001600160a01b0316836001600160a01b03161415620004775760405162461bcd60e51b815260206004820181905260248201527f4b616c6569646f537761703a204944454e544943414c5f4144445245535345536044820152606401620003f8565b600080836001600160a01b0316856001600160a01b0316106200049c5783856200049f565b84845b90925090506001600160a01b038216620004fc5760405162461bcd60e51b815260206004820152601960248201527f4b616c6569646f537761703a205a45524f5f41444452455353000000000000006044820152606401620003f8565b6001600160a01b03828116600090815260026020908152604080832085851684529091529020541615620005735760405162461bcd60e51b815260206004820152601860248201527f4b616c6569646f537761703a20504149525f45584953545300000000000000006044820152606401620003f8565b600060405180602001620005879062000bbb565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606086811b8216602084015285901b166034820152909150600090604801604051602081830303815290604052805190602001209050808251602084016000f56040517f485cc9550000000000000000000000000000000000000000000000000000000081526001600160a01b03868116600483015285811660248301529196509086169063485cc95590604401600060405180830381600087803b1580156200065357600080fd5b505af115801562000668573d6000803e3d6000fd5b5050506001600160a01b0380861660008181526002602081815260408084208a8716855282528084208054968d1673ffffffffffffffffffffffffffffffffffffffff199788168117909155928252808420948452939052919020805490921617905550600354620006dc90600162000d6f565b6003819055604080516001600160a01b0388811682526020820193909352828616928716917f0d3648bd0f6ba80134a33ba9275ac585d9d315f0ad8355cddefde31afa28d0e9910160405180910390a35050505092915050565b6000828152602081905260409020600101546200075381620007bb565b6200037883836200086a565b7fa49807205ce4d355092ef5a8a18f56e8913cf4a201fbe287825b095693c217756200078b81620007bb565b506001805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0392909216919091179055565b620007c78133620008ea565b50565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200040d576000828152602081815260408083206001600160a01b03851684529091529020805460ff19166001179055620008263390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff16156200040d576000828152602081815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b6000828152602081815260408083206001600160a01b038516845290915290205460ff166200040d576200091e8162000966565b6200092b83602062000979565b6040516020016200093e92919062000cb5565b60408051601f198184030181529082905262461bcd60e51b8252620003f89160040162000d3a565b6060620003476001600160a01b03831660145b606060006200098a83600262000d8a565b6200099790600262000d6f565b67ffffffffffffffff811115620009be57634e487b7160e01b600052604160045260246000fd5b6040519080825280601f01601f191660200182016040528015620009e9576020820181803683370190505b5090507f30000000000000000000000000000000000000000000000000000000000000008160008151811062000a2f57634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a9053507f78000000000000000000000000000000000000000000000000000000000000008160018151811062000a8957634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a905350600062000aaf84600262000d8a565b62000abc90600162000d6f565b90505b600181111562000b63577f303132333435363738396162636465660000000000000000000000000000000085600f166010811062000b0d57634e487b7160e01b600052603260045260246000fd5b1a60f81b82828151811062000b3257634e487b7160e01b600052603260045260246000fd5b60200101906001600160f81b031916908160001a90535060049490941c9362000b5b8162000ddf565b905062000abf565b50831562000bb45760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401620003f8565b9392505050565b612d848062000e1083390190565b80356001600160a01b03811681146200034a57600080fd5b60006020828403121562000bf3578081fd5b62000bb48262000bc9565b6000806040838503121562000c11578081fd5b62000c1c8362000bc9565b915062000c2c6020840162000bc9565b90509250929050565b60006020828403121562000c47578081fd5b5035919050565b6000806040838503121562000c61578182fd5b8235915062000c2c6020840162000bc9565b60006020828403121562000c85578081fd5b81357fffffffff000000000000000000000000000000000000000000000000000000008116811462000bb4578182fd5b60007f416363657373436f6e74726f6c3a206163636f756e74200000000000000000008252835162000cef81601785016020880162000dac565b7f206973206d697373696e6720726f6c6520000000000000000000000000000000601791840191820152835162000d2e81602884016020880162000dac565b01602801949350505050565b600060208252825180602084015262000d5b81604085016020870162000dac565b601f01601f19169190910160400192915050565b6000821982111562000d855762000d8562000df9565b500190565b600081600019048311821515161562000da75762000da762000df9565b500290565b60005b8381101562000dc957818101518382015260200162000daf565b8381111562000dd9576000848401525b50505050565b60008162000df15762000df162000df9565b506000190190565b634e487b7160e01b600052601160045260246000fdfe60806040526001600e553480156200001657600080fd5b50604080518082018252600b81526a04b616c6569646f537761760ac1b6020808301918252835180850190945260068452654b414c45495360d01b9084015281519192916200006891600391620001df565b5080516200007e906004906020840190620001df565b5050600680546001600160a01b0319163317905550467f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f620000bf62000145565b805160209182012060408051808201825260018152603160f81b90840152805192830193909352918101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc66060820152608081018290523060a082015260c00160408051601f19818403018152919052805160209091012060055550620002c2565b606060038054620001569062000285565b80601f0160208091040260200160405190810160405280929190818152602001828054620001849062000285565b8015620001d55780601f10620001a957610100808354040283529160200191620001d5565b820191906000526020600020905b815481529060010190602001808311620001b757829003601f168201915b5050505050905090565b828054620001ed9062000285565b90600052602060002090601f0160209004810192826200021157600085556200025c565b82601f106200022c57805160ff19168380011785556200025c565b828001600101855582156200025c579182015b828111156200025c5782518255916020019190600101906200023f565b506200026a9291506200026e565b5090565b5b808211156200026a57600081556001016200026f565b6002810460018216806200029a57607f821691505b60208210811415620002bc57634e487b7160e01b600052602260045260246000fd5b50919050565b612ab280620002d26000396000f3fe608060405234801561001057600080fd5b50600436106101cf5760003560e01c80636a62784211610104578063a9059cbb116100a2578063d21220a711610071578063d21220a714610400578063d505accf14610413578063dd62ed3e14610426578063fff6cae91461045f576101cf565b8063a9059cbb146103be578063ba9a7a56146103d1578063bc25cf77146103da578063c45a0155146103ed576101cf565b80637ecebe00116100de5780637ecebe001461035b57806389afcb441461037b57806395d89b41146103a3578063a457c2d7146103ab576101cf565b80636a6278421461032c57806370a082311461033f5780637464fc3d14610352576101cf565b806330adf81f11610171578063395093511161014b57806339509351146102f4578063485cc955146103075780635909c0d51461031a5780635a3d549314610323576101cf565b806330adf81f146102b5578063313ce567146102dc5780633644e515146102eb576101cf565b8063095ea7b3116101ad578063095ea7b3146102425780630dfe16811461026557806318160ddd1461029057806323b872dd146102a2576101cf565b8063022c0d9f146101d457806306fdde03146101e95780630902f1ac14610207575b600080fd5b6101e76101e2366004612799565b610467565b005b6101f1610a53565b6040516101fe9190612893565b60405180910390f35b600954604080516001600160701b038084168252600160701b8404166020820152600160e01b90920463ffffffff16908201526060016101fe565b610255610250366004612736565b610ae5565b60405190151581526020016101fe565b600754610278906001600160a01b031681565b6040516001600160a01b0390911681526020016101fe565b6002545b6040519081526020016101fe565b6102556102b0366004612681565b610afd565b6102947f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b604051601281526020016101fe565b61029460055481565b610255610302366004612736565b610b21565b6101e7610315366004612649565b610b60565b610294600a5481565b610294600b5481565b61029461033a366004612611565b610c00565b61029461034d366004612611565b610f32565b610294600c5481565b610294610369366004612611565b600d6020526000908152604090205481565b61038e610389366004612611565b610f51565b604080519283526020830191909152016101fe565b6101f1611345565b6102556103b9366004612736565b611354565b6102556103cc366004612736565b6113fe565b6102946103e881565b6101e76103e8366004612611565b61140c565b600654610278906001600160a01b031681565b600854610278906001600160a01b031681565b6101e76104213660046126c1565b611555565b610294610434366004612649565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6101e761178f565b600e546001146104b45760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064015b60405180910390fd5b6000600e55841515806104c75750600084115b6105395760405162461bcd60e51b815260206004820152602760248201527f4b616c6569646f537761703a20494e53554646494349454e545f4f555450555460448201527f5f414d4f554e540000000000000000000000000000000000000000000000000060648201526084016104ab565b60008061056a6009546001600160701b0380821692600160701b83049091169163ffffffff600160e01b9091041690565b5091509150816001600160701b03168710801561058f5750806001600160701b031686105b6106015760405162461bcd60e51b815260206004820152602360248201527f4b616c6569646f537761703a20494e53554646494349454e545f4c495155494460448201527f495459000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b60075460085460009182916001600160a01b0391821691908116908916821480159061063f5750806001600160a01b0316896001600160a01b031614155b61068b5760405162461bcd60e51b815260206004820152601760248201527f4b616c6569646f537761703a20494e56414c49445f544f00000000000000000060448201526064016104ab565b8a1561069c5761069c828a8d6118f7565b89156106ad576106ad818a8c6118f7565b8615610733576040517fa325f2c80000000000000000000000000000000000000000000000000000000081526001600160a01b038a169063a325f2c8906107009033908f908f908e908e90600401612846565b600060405180830381600087803b15801561071a57600080fd5b505af115801561072e573d6000803e3d6000fd5b505050505b6040516370a0823160e01b81523060048201526001600160a01b038316906370a082319060240160206040518083038186803b15801561077257600080fd5b505afa158015610786573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107aa9190612781565b6040516370a0823160e01b81523060048201529094506001600160a01b038216906370a082319060240160206040518083038186803b1580156107ec57600080fd5b505afa158015610800573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906108249190612781565b92505050600089856001600160701b031661083f9190612966565b831161084c576000610869565b61085f8a6001600160701b038716612966565b6108699084612966565b905060006108808a6001600160701b038716612966565b831161088d5760006108aa565b6108a08a6001600160701b038716612966565b6108aa9084612966565b905060008211806108bb5750600081115b61092d5760405162461bcd60e51b815260206004820152602660248201527f4b616c6569646f537761703a20494e53554646494349454e545f494e5055545f60448201527f414d4f554e54000000000000000000000000000000000000000000000000000060648201526084016104ab565b600061094f61093d846003611a5b565b610949876103e8611a5b565b90611a6e565b9050600061096161093d846003611a5b565b9050610986620f42406109806001600160701b038b8116908b16611a5b565b90611a5b565b6109908383611a5b565b10156109de5760405162461bcd60e51b815260206004820152600e60248201527f4b616c6569646f537761703a204b00000000000000000000000000000000000060448201526064016104ab565b50506109ec84848888611a7a565b60408051838152602081018390529081018c9052606081018b90526001600160a01b038a169033907fd78ad95fa46c994b6551d0da85fc275fe613ce37657fb8d5e3d130840159d8229060800160405180910390a350506001600e55505050505050505050565b606060038054610a62906129ce565b80601f0160208091040260200160405190810160405280929190818152602001828054610a8e906129ce565b8015610adb5780601f10610ab057610100808354040283529160200191610adb565b820191906000526020600020905b815481529060010190602001808311610abe57829003601f168201915b5050505050905090565b600033610af3818585611c8f565b5060019392505050565b600033610b0b858285611de8565b610b16858585611e7a565b506001949350505050565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190610af39082908690610b5b9087906128c6565b611c8f565b6006546001600160a01b03163314610bba5760405162461bcd60e51b815260206004820152601660248201527f4b616c6569646f537761703a20464f5242494444454e0000000000000000000060448201526064016104ab565b600780546001600160a01b039384167fffffffffffffffffffffffff00000000000000000000000000000000000000009182161790915560088054929093169116179055565b6000600e54600114610c4a5760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064016104ab565b6000600e819055600954600754604080516370a0823160e01b815230600482015290516001600160701b0380851695600160701b9095041693926001600160a01b0316916370a08231916024808301926020929190829003018186803b158015610cb357600080fd5b505afa158015610cc7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ceb9190612781565b6008546040516370a0823160e01b81523060048201529192506000916001600160a01b03909116906370a082319060240160206040518083038186803b158015610d3457600080fd5b505afa158015610d48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d6c9190612781565b90506000610d83836001600160701b038716611a6e565b90506000610d9a836001600160701b038716611a6e565b90506000610da88787612067565b90506000610db560025490565b905080610de757610dd46103e8610949610dcf8787611a5b565b6121b2565b9850610de2306103e8612307565b610e2e565b610e2b6001600160701b038916610dfe8684611a5b565b610e089190612904565b6001600160701b038916610e1c8685611a5b565b610e269190612904565b6123c6565b98505b60008911610ea45760405162461bcd60e51b815260206004820152602a60248201527f4b616c6569646f537761703a20494e53554646494349454e545f4c495155494460448201527f4954595f4d494e5445440000000000000000000000000000000000000000000060648201526084016104ab565b610eae8a8a612307565b610eba86868a8a611a7a565b8115610ee457600954610ee0906001600160701b0380821691600160701b900416611a5b565b600c555b604080518581526020810185905233917f4c209b5fc8ad50758f13e2e1088ba56a560dff690a1c6fef26394f4c03821c4f910160405180910390a250506001600e5550949695505050505050565b6001600160a01b0381166000908152602081905260409020545b919050565b600080600e54600114610f9c5760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064016104ab565b6000600e819055600954600754600854604080516370a0823160e01b815230600482015290516001600160701b0380861696600160701b90960416946001600160a01b0394851694909316929184916370a0823191602480820192602092909190829003018186803b15801561101157600080fd5b505afa158015611025573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110499190612781565b6040516370a0823160e01b81523060048201529091506000906001600160a01b038416906370a082319060240160206040518083038186803b15801561108e57600080fd5b505afa1580156110a2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110c69190612781565b905060006110d330610f32565b905060006110e18888612067565b905060006110ee60025490565b9050806110fb8487611a5b565b6111059190612904565b9a50806111128486611a5b565b61111c9190612904565b995060008b11801561112e575060008a115b6111a05760405162461bcd60e51b815260206004820152602a60248201527f4b616c6569646f537761703a20494e53554646494349454e545f4c495155494460448201527f4954595f4255524e45440000000000000000000000000000000000000000000060648201526084016104ab565b6111aa30846123dc565b6111b5878d8d6118f7565b6111c0868d8c6118f7565b6040516370a0823160e01b81523060048201526001600160a01b038816906370a082319060240160206040518083038186803b1580156111ff57600080fd5b505afa158015611213573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112379190612781565b6040516370a0823160e01b81523060048201529095506001600160a01b038716906370a082319060240160206040518083038186803b15801561127957600080fd5b505afa15801561128d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112b19190612781565b93506112bf85858b8b611a7a565b81156112e9576009546112e5906001600160701b0380821691600160701b900416611a5b565b600c555b604080518c8152602081018c90526001600160a01b038e169133917fdccd412f0b1252819cb1fd330b93224ca42612892bb3f4f789976e6d81936496910160405180910390a35050505050505050506001600e81905550915091565b606060048054610a62906129ce565b3360008181526001602090815260408083206001600160a01b0387168452909152812054909190838110156113f15760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760448201527f207a65726f00000000000000000000000000000000000000000000000000000060648201526084016104ab565b610b168286868403611c8f565b600033610af3818585611e7a565b600e546001146114545760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064016104ab565b6000600e556007546008546009546040516370a0823160e01b81523060048201526001600160a01b0393841693909216916114fe91849186916114f9916001600160701b039091169084906370a08231906024015b60206040518083038186803b1580156114c157600080fd5b505afa1580156114d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109499190612781565b6118f7565b6009546040516370a0823160e01b815230600482015261154b91839186916114f991600160701b9091046001600160701b0316906001600160a01b038516906370a08231906024016114a9565b50506001600e5550565b428410156115a55760405162461bcd60e51b815260206004820152601460248201527f4b616c6569646f537761703a204558504952454400000000000000000000000060448201526064016104ab565b6005546001600160a01b0388166000908152600d6020526040812080549192917f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9918b918b918b9190876115f883612a09565b909155506040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810187905260e0016040516020818303038152906040528051906020012060405160200161168c9291907f190100000000000000000000000000000000000000000000000000000000000081526002810192909252602282015260420190565b60408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa1580156116f7573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b0381161580159061172d5750886001600160a01b0316816001600160a01b0316145b6117795760405162461bcd60e51b815260206004820152601e60248201527f4b616c6569646f537761703a20494e56414c49445f5349474e4154555245000060448201526064016104ab565b611784898989611c8f565b505050505050505050565b600e546001146117d75760405162461bcd60e51b815260206004820152601360248201527212d85b195a591bd4ddd85c0e881313d0d2d151606a1b60448201526064016104ab565b6000600e556007546040516370a0823160e01b81523060048201526118f0916001600160a01b0316906370a082319060240160206040518083038186803b15801561182157600080fd5b505afa158015611835573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118599190612781565b6008546040516370a0823160e01b81523060048201526001600160a01b03909116906370a082319060240160206040518083038186803b15801561189c57600080fd5b505afa1580156118b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118d49190612781565b6009546001600160701b0380821691600160701b900416611a7a565b6001600e55565b604080518082018252601981527f7472616e7366657228616464726573732c75696e74323536290000000000000060209182015281516001600160a01b0385811660248301526044808301869052845180840390910181526064909201845291810180516001600160e01b03167fa9059cbb000000000000000000000000000000000000000000000000000000001790529151600092839287169161199c919061282a565b6000604051808303816000865af19150503d80600081146119d9576040519150601f19603f3d011682016040523d82523d6000602084013e6119de565b606091505b5091509150818015611a08575080511580611a08575080806020019051810190611a089190612761565b611a545760405162461bcd60e51b815260206004820152601c60248201527f4b616c6569646f537761703a205452414e534645525f4641494c45440000000060448201526064016104ab565b5050505050565b6000611a678284612947565b9392505050565b6000611a678284612966565b6001600160701b038411801590611a9857506001600160701b038311155b611ae45760405162461bcd60e51b815260206004820152601560248201527f4b616c6569646f537761703a204f564552464c4f57000000000000000000000060448201526064016104ab565b6000611af564010000000042612a24565b600954909150600090611b1590600160e01b900463ffffffff168361297d565b905060008163ffffffff16118015611b3557506001600160701b03841615155b8015611b4957506001600160701b03831615155b15611bd8578063ffffffff16611b7185611b628661253d565b6001600160e01b03169061255c565b6001600160e01b0316611b849190612947565b600a6000828254611b9591906128c6565b909155505063ffffffff8116611bae84611b628761253d565b6001600160e01b0316611bc19190612947565b600b6000828254611bd291906128c6565b90915550505b600980546dffffffffffffffffffffffffffff19166001600160701b03888116919091177fffffffff0000000000000000000000000000ffffffffffffffffffffffffffff16600160701b8883168102919091176001600160e01b0316600160e01b63ffffffff87160217928390556040805184841681529190930490911660208201527f1c411e9a96e071241c2f21f7726b17ae89e3cab4c78be50e062b03a9fffbbad1910160405180910390a1505050505050565b6001600160a01b038316611d0a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460448201527f726573730000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b038216611d865760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f20616464726560448201527f737300000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92591015b60405180910390a3505050565b6001600160a01b038381166000908152600160209081526040808320938616835292905220546000198114611e745781811015611e675760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e636500000060448201526064016104ab565b611e748484848403611c8f565b50505050565b6001600160a01b038316611ef65760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f20616460448201527f647265737300000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b038216611f725760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201527f657373000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b038316600090815260208190526040902054818110156120015760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e742065786365656473206260448201527f616c616e6365000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b03848116600081815260208181526040808320878703905593871680835291849020805487019055925185815290927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a3611e74565b600080600660009054906101000a90046001600160a01b03166001600160a01b031663017e7e586040518163ffffffff1660e01b815260040160206040518083038186803b1580156120b857600080fd5b505afa1580156120cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906120f0919061262d565b600c546001600160a01b03821615801594509192509061219e57801561219957600061212b610dcf6001600160701b03888116908816611a5b565b90506000612138836121b2565b9050808211156121965760006121596121518484611a6e565b600254610980565b905060006121728361216c866005611a5b565b90612571565b905060006121808284612904565b90508015612192576121928782612307565b5050505b50505b6121aa565b80156121aa576000600c555b505092915050565b6000816121c157506000610f4c565b600060016121ce8461257d565b901c6001901b905060018184816121f557634e487b7160e01b600052601260045260246000fd5b048201901c9050600181848161221b57634e487b7160e01b600052601260045260246000fd5b048201901c9050600181848161224157634e487b7160e01b600052601260045260246000fd5b048201901c9050600181848161226757634e487b7160e01b600052601260045260246000fd5b048201901c9050600181848161228d57634e487b7160e01b600052601260045260246000fd5b048201901c905060018184816122b357634e487b7160e01b600052601260045260246000fd5b048201901c905060018184816122d957634e487b7160e01b600052601260045260246000fd5b048201901c9050611a678182858161230157634e487b7160e01b600052601260045260246000fd5b046123c6565b6001600160a01b03821661235d5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f20616464726573730060448201526064016104ab565b806002600082825461236f91906128c6565b90915550506001600160a01b038216600081815260208181526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef910160405180910390a35050565b60008183106123d55781611a67565b5090919050565b6001600160a01b0382166124585760405162461bcd60e51b815260206004820152602160248201527f45524332303a206275726e2066726f6d20746865207a65726f2061646472657360448201527f730000000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b038216600090815260208190526040902054818110156124e75760405162461bcd60e51b815260206004820152602260248201527f45524332303a206275726e20616d6f756e7420657863656564732062616c616e60448201527f636500000000000000000000000000000000000000000000000000000000000060648201526084016104ab565b6001600160a01b0383166000818152602081815260408083208686039055600280548790039055518581529192917fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9101611ddb565b6000612556600160701b6001600160701b038416612918565b92915050565b6000611a676001600160701b038316846128de565b6000611a6782846128c6565b600080608083901c1561259257608092831c92015b604083901c156125a457604092831c92015b602083901c156125b657602092831c92015b601083901c156125c857601092831c92015b600883901c156125da57600892831c92015b600483901c156125ec57600492831c92015b600283901c156125fe57600292831c92015b600183901c156125565760010192915050565b600060208284031215612622578081fd5b8135611a6781612a64565b60006020828403121561263e578081fd5b8151611a6781612a64565b6000806040838503121561265b578081fd5b823561266681612a64565b9150602083013561267681612a64565b809150509250929050565b600080600060608486031215612695578081fd5b83356126a081612a64565b925060208401356126b081612a64565b929592945050506040919091013590565b600080600080600080600060e0888a0312156126db578283fd5b87356126e681612a64565b965060208801356126f681612a64565b95506040880135945060608801359350608088013560ff81168114612719578384fd5b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215612748578182fd5b823561275381612a64565b946020939093013593505050565b600060208284031215612772578081fd5b81518015158114611a67578182fd5b600060208284031215612792578081fd5b5051919050565b6000806000806000608086880312156127b0578081fd5b853594506020860135935060408601356127c981612a64565b9250606086013567ffffffffffffffff808211156127e5578283fd5b818801915088601f8301126127f8578283fd5b813581811115612806578384fd5b896020828501011115612817578384fd5b9699959850939650602001949392505050565b6000825161283c8184602087016129a2565b9190910192915050565b60006001600160a01b038716825285602083015284604083015260806060830152826080830152828460a084013781830160a090810191909152601f909201601f19160101949350505050565b60006020825282518060208401526128b28160408501602087016129a2565b601f01601f19169190910160400192915050565b600082198211156128d9576128d9612a38565b500190565b60006001600160e01b03808416806128f8576128f8612a4e565b92169190910492915050565b60008261291357612913612a4e565b500490565b60006001600160e01b038083168185168183048111821515161561293e5761293e612a38565b02949350505050565b600081600019048311821515161561296157612961612a38565b500290565b60008282101561297857612978612a38565b500390565b600063ffffffff8381169083168181101561299a5761299a612a38565b039392505050565b60005b838110156129bd5781810151838201526020016129a5565b83811115611e745750506000910152565b6002810460018216806129e257607f821691505b60208210811415612a0357634e487b7160e01b600052602260045260246000fd5b50919050565b6000600019821415612a1d57612a1d612a38565b5060010190565b600082612a3357612a33612a4e565b500690565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b6001600160a01b0381168114612a7957600080fd5b5056fea2646970667358221220d1344fae3b65f6b1ae1df2c773ea718fedaa2c984eb5ac06b78fccfe1a264b5a64736f6c63430008020033a26469706673582212206ae2b9ab5c16aaf2c04587b9a5b8d729c51844a2be4f054f48315c0058ceba3364736f6c63430008020033