Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- pDexStableSwapThreePoolDeployer
- Optimization enabled
- true
- Compiler version
- v0.8.10+commit.fc410830
- Optimization runs
- 400
- EVM Version
- istanbul
- Verified at
- 2025-04-24T15:18:00.023613Z
contracts/pDexStableSwapThreePoolDeployer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import '@openzeppelin/contracts/access/Ownable.sol';
import './pDexStableSwapThreePool.sol';
contract pDexStableSwapThreePoolDeployer is Ownable {
uint256 public constant N_COINS = 3;
/**
* @notice constructor
*/
constructor() {}
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(
address tokenA,
address tokenB,
address tokenC
) internal pure returns (address, address, address) {
require(tokenA != tokenB && tokenA != tokenC && tokenB != tokenC, 'IDENTICAL_ADDRESSES');
address tmp;
if (tokenA > tokenB) {
tmp = tokenA;
tokenA = tokenB;
tokenB = tmp;
}
if (tokenB > tokenC) {
tmp = tokenB;
tokenB = tokenC;
tokenC = tmp;
if (tokenA > tokenB) {
tmp = tokenA;
tokenA = tokenB;
tokenB = tmp;
}
}
return (tokenA, tokenB, tokenC);
}
/**
* @notice createSwapPair
* @param _tokenA: Addresses of ERC20 conracts .
* @param _tokenB: Addresses of ERC20 conracts .
* @param _tokenC: Addresses of ERC20 conracts .
* @param _A: Amplification coefficient multiplied by n * (n - 1)
* @param _fee: Fee to charge for exchanges
* @param _admin_fee: Admin fee
* @param _admin: Admin
* @param _LP: LP
*/
function createSwapPair(
address _tokenA,
address _tokenB,
address _tokenC,
uint256 _A,
uint256 _fee,
uint256 _admin_fee,
address _admin,
address _LP
) external onlyOwner returns (address) {
require(_tokenA != address(0) && _tokenB != address(0) && _tokenA != _tokenB, 'Illegal token');
(address t0, address t1, address t2) = sortTokens(_tokenA, _tokenB, _tokenC);
address[N_COINS] memory coins = [t0, t1, t2];
// create swap contract
bytes memory bytecode = type(pDexStableSwapThreePool).creationCode;
bytes32 salt = keccak256(abi.encodePacked(t0, t1, t2, msg.sender, block.timestamp, block.chainid));
address swapContract;
assembly {
swapContract := create2(0, add(bytecode, 32), mload(bytecode), salt)
}
pDexStableSwapThreePool(swapContract).initialize(coins, _A, _fee, _admin_fee, _admin, _LP);
return swapContract;
}
}
@openzeppelin/contracts/access/Ownable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev Leaves the contract without owner. It will not be possible to call
* `onlyOwner` functions. Can only be called by the current owner.
*
* NOTE: Renouncing ownership will leave the contract without an owner,
* thereby disabling any functionality that is only available to the owner.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}
@openzeppelin/contracts/security/ReentrancyGuard.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol)
pragma solidity ^0.8.0;
/**
* @dev Contract module that helps prevent reentrant calls to a function.
*
* Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
* available, which can be applied to functions to make sure there are no nested
* (reentrant) calls to them.
*
* Note that because there is a single `nonReentrant` guard, functions marked as
* `nonReentrant` may not call one another. This can be worked around by making
* those functions `private`, and then adding `external` `nonReentrant` entry
* points to them.
*
* TIP: If you would like to learn more about reentrancy and alternative ways
* to protect against it, check out our blog post
* https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
*/
abstract contract ReentrancyGuard {
// Booleans are more expensive than uint256 or any type that takes up a full
// word because each write operation emits an extra SLOAD to first read the
// slot's contents, replace the bits taken up by the boolean, and then write
// back. This is the compiler's defense against contract upgrades and
// pointer aliasing, and it cannot be disabled.
// The values being non-zero value makes deployment a bit more expensive,
// but in exchange the refund on every call to nonReentrant will be lower in
// amount. Since refunds are capped to a percentage of the total
// transaction's gas, it is best to keep them low in cases like this one, to
// increase the likelihood of the full refund coming into effect.
uint256 private constant _NOT_ENTERED = 1;
uint256 private constant _ENTERED = 2;
uint256 private _status;
constructor() {
_status = _NOT_ENTERED;
}
/**
* @dev Prevents a contract from calling itself, directly or indirectly.
* Calling a `nonReentrant` function from another `nonReentrant`
* function is not supported. It is possible to prevent this from happening
* by making the `nonReentrant` function external, and making it call a
* `private` function that does the actual work.
*/
modifier nonReentrant() {
_nonReentrantBefore();
_;
_nonReentrantAfter();
}
function _nonReentrantBefore() private {
// On the first call to nonReentrant, _status will be _NOT_ENTERED
require(_status != _ENTERED, "ReentrancyGuard: reentrant call");
// Any calls to nonReentrant after this point will fail
_status = _ENTERED;
}
function _nonReentrantAfter() private {
// By storing the original value once again, a refund is triggered (see
// https://eips.ethereum.org/EIPS/eip-2200)
_status = _NOT_ENTERED;
}
/**
* @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
* `nonReentrant` function in the call stack.
*/
function _reentrancyGuardEntered() internal view returns (bool) {
return _status == _ENTERED;
}
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}
@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
/**
* @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);
}
@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}
@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}
@openzeppelin/contracts/utils/Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}
@openzeppelin/contracts/utils/Context.sol
// 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;
}
}
contracts/interfaces/IpDexStableSwapLP.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
interface IpDexStableSwapLP {
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
function mint(address _to, uint256 _amount) external;
function burnFrom(address _to, uint256 _amount) external;
function setMinter(address _newMinter) external;
}
contracts/pDexStableSwapThreePool.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import '@openzeppelin/contracts/access/Ownable.sol';
import '@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol';
import '@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol';
import '@openzeppelin/contracts/security/ReentrancyGuard.sol';
import './interfaces/IpDexStableSwapLP.sol';
contract pDexStableSwapThreePool is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
uint256 public constant N_COINS = 3;
uint256 public constant MAX_DECIMAL = 18;
uint256 public constant FEE_DENOMINATOR = 1e10;
uint256 public constant PRECISION = 1e18;
uint256[N_COINS] public PRECISION_MUL;
uint256[N_COINS] public RATES;
uint256 public constant MAX_ADMIN_FEE = 1e10;
uint256 public constant MAX_FEE = 5e9;
uint256 public constant MAX_A = 1e6;
uint256 public constant MAX_A_CHANGE = 10;
uint256 public constant MIN_ETH_GAS = 2300;
uint256 public constant MAX_ETH_GAS = 23000;
uint256 public constant ADMIN_ACTIONS_DELAY = 3 days;
uint256 public constant MIN_RAMP_TIME = 1 days;
address[N_COINS] public coins;
uint256[N_COINS] public balances;
uint256 public fee; // fee * 1e10.
uint256 public admin_fee; // admin_fee * 1e10.
uint256 public eth_gas = 4029; // transfer eth gas.
IpDexStableSwapLP public token;
address constant ETH_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
bool support_ETH;
uint256 public initial_A;
uint256 public future_A;
uint256 public initial_A_time;
uint256 public future_A_time;
uint256 public admin_actions_deadline;
uint256 public future_fee;
uint256 public future_admin_fee;
uint256 public kill_deadline;
uint256 public constant KILL_DEADLINE_DT = 2 * 30 days;
bool public is_killed;
address public immutable STABLESWAP_FACTORY;
bool public isInitialized;
event TokenExchange(
address indexed buyer,
uint256 sold_id,
uint256 tokens_sold,
uint256 bought_id,
uint256 tokens_bought
);
event AddLiquidity(
address indexed provider,
uint256[N_COINS] token_amounts,
uint256[N_COINS] fees,
uint256 invariant,
uint256 token_supply
);
event RemoveLiquidity(
address indexed provider,
uint256[N_COINS] token_amounts,
uint256[N_COINS] fees,
uint256 token_supply
);
event RemoveLiquidityOne(address indexed provider, uint256 index, uint256 token_amount, uint256 coin_amount);
event RemoveLiquidityImbalance(
address indexed provider,
uint256[N_COINS] token_amounts,
uint256[N_COINS] fees,
uint256 invariant,
uint256 token_supply
);
event CommitNewFee(uint256 indexed deadline, uint256 fee, uint256 admin_fee);
event NewFee(uint256 fee, uint256 admin_fee);
event RampA(uint256 old_A, uint256 new_A, uint256 initial_time, uint256 future_time);
event StopRampA(uint256 A, uint256 t);
event SetETHGas(uint256 eth_gas);
event RevertParameters();
event DonateAdminFees();
event Kill();
event Unkill();
/**
* @notice constructor
*/
constructor() {
STABLESWAP_FACTORY = msg.sender;
}
/**
* @notice initialize
* @param _coins: Addresses of ERC20 conracts of coins (c-tokens) involved
* @param _A: Amplification coefficient multiplied by n * (n - 1)
* @param _fee: Fee to charge for exchanges
* @param _admin_fee: Admin fee
* @param _owner: Owner
* @param _LP: LP address
*/
function initialize(
address[N_COINS] memory _coins,
uint256 _A,
uint256 _fee,
uint256 _admin_fee,
address _owner,
address _LP
) external {
require(!isInitialized, 'Operations: Already initialized');
require(msg.sender == STABLESWAP_FACTORY, 'Operations: Not factory');
require(_A <= MAX_A, '_A exceeds maximum');
require(_fee <= MAX_FEE, '_fee exceeds maximum');
require(_admin_fee <= MAX_ADMIN_FEE, '_admin_fee exceeds maximum');
isInitialized = true;
for (uint256 i = 0; i < N_COINS; i++) {
require(_coins[i] != address(0), 'ZERO Address');
uint256 coinDecimal;
if (_coins[i] == ETH_ADDRESS) {
coinDecimal = 18;
support_ETH = true;
} else {
coinDecimal = IERC20Metadata(_coins[i]).decimals();
}
require(coinDecimal <= MAX_DECIMAL, 'The maximum decimal cannot exceed 18');
//set PRECISION_MUL and RATES
PRECISION_MUL[i] = 10 ** (MAX_DECIMAL - coinDecimal);
RATES[i] = PRECISION * PRECISION_MUL[i];
}
coins = _coins;
initial_A = _A;
future_A = _A;
fee = _fee;
admin_fee = _admin_fee;
kill_deadline = block.timestamp + KILL_DEADLINE_DT;
token = IpDexStableSwapLP(_LP);
transferOwnership(_owner);
}
function get_A() internal view returns (uint256) {
//Handle ramping A up or down
uint256 t1 = future_A_time;
uint256 A1 = future_A;
if (block.timestamp < t1) {
uint256 A0 = initial_A;
uint256 t0 = initial_A_time;
// Expressions in uint256 cannot have negative numbers, thus "if"
if (A1 > A0) {
return A0 + ((A1 - A0) * (block.timestamp - t0)) / (t1 - t0);
} else {
return A0 - ((A0 - A1) * (block.timestamp - t0)) / (t1 - t0);
}
} else {
// when t1 == 0 or block.timestamp >= t1
return A1;
}
}
function A() external view returns (uint256) {
return get_A();
}
function _xp() internal view returns (uint256[N_COINS] memory result) {
result = RATES;
for (uint256 i = 0; i < N_COINS; i++) {
result[i] = (result[i] * balances[i]) / PRECISION;
}
}
function _xp_mem(uint256[N_COINS] memory _balances) internal view returns (uint256[N_COINS] memory result) {
result = RATES;
for (uint256 i = 0; i < N_COINS; i++) {
result[i] = (result[i] * _balances[i]) / PRECISION;
}
}
function get_D(uint256[N_COINS] memory xp, uint256 amp) internal pure returns (uint256) {
uint256 S;
for (uint256 i = 0; i < N_COINS; i++) {
S += xp[i];
}
if (S == 0) {
return 0;
}
uint256 Dprev;
uint256 D = S;
uint256 Ann = amp * N_COINS;
for (uint256 j = 0; j < 255; j++) {
uint256 D_P = D;
for (uint256 k = 0; k < N_COINS; k++) {
D_P = (D_P * D) / (xp[k] * N_COINS); // If division by 0, this will be borked: only withdrawal will work. And that is good
}
Dprev = D;
D = ((Ann * S + D_P * N_COINS) * D) / ((Ann - 1) * D + (N_COINS + 1) * D_P);
// Equality with the precision of 1
if (D > Dprev) {
if (D - Dprev <= 1) {
break;
}
} else {
if (Dprev - D <= 1) {
break;
}
}
}
return D;
}
function get_D_mem(uint256[N_COINS] memory _balances, uint256 amp) internal view returns (uint256) {
return get_D(_xp_mem(_balances), amp);
}
function get_virtual_price() external view returns (uint256) {
/**
Returns portfolio virtual price (for calculating profit)
scaled up by 1e18
*/
uint256 D = get_D(_xp(), get_A());
/**
D is in the units similar to DAI (e.g. converted to precision 1e18)
When balanced, D = n * x_u - total virtual value of the portfolio
*/
uint256 token_supply = token.totalSupply();
return (D * PRECISION) / token_supply;
}
function calc_token_amount(uint256[N_COINS] memory amounts, bool deposit) external view returns (uint256) {
/**
Simplified method to calculate addition or reduction in token supply at
deposit or withdrawal without taking fees into account (but looking at
slippage).
Needed to prevent front-running, not for precise calculations!
*/
uint256[N_COINS] memory _balances = balances;
uint256 amp = get_A();
uint256 D0 = get_D_mem(_balances, amp);
for (uint256 i = 0; i < N_COINS; i++) {
if (deposit) {
_balances[i] += amounts[i];
} else {
_balances[i] -= amounts[i];
}
}
uint256 D1 = get_D_mem(_balances, amp);
uint256 token_amount = token.totalSupply();
uint256 difference;
if (deposit) {
difference = D1 - D0;
} else {
difference = D0 - D1;
}
return (difference * token_amount) / D0;
}
function add_liquidity(uint256[N_COINS] memory amounts, uint256 min_mint_amount) external payable nonReentrant {
//Amounts is amounts of c-tokens
require(!is_killed, 'Killed');
if (!support_ETH) {
require(msg.value == 0, 'Inconsistent quantity'); // Avoid sending ETH by mistake.
}
uint256[N_COINS] memory fees;
uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
uint256 _admin_fee = admin_fee;
uint256 amp = get_A();
uint256 token_supply = token.totalSupply();
//Initial invariant
uint256 D0;
uint256[N_COINS] memory old_balances = balances;
if (token_supply > 0) {
D0 = get_D_mem(old_balances, amp);
}
uint256[N_COINS] memory new_balances = [old_balances[0], old_balances[1], old_balances[2]];
for (uint256 i = 0; i < N_COINS; i++) {
if (token_supply == 0) {
require(amounts[i] > 0, 'Initial deposit requires all coins');
}
// balances store amounts of c-tokens
new_balances[i] = old_balances[i] + amounts[i];
}
// Invariant after change
uint256 D1 = get_D_mem(new_balances, amp);
require(D1 > D0, 'D1 must be greater than D0');
// We need to recalculate the invariant accounting for fees
// to calculate fair user's share
uint256 D2 = D1;
if (token_supply > 0) {
// Only account for fees if we are not the first to deposit
for (uint256 i = 0; i < N_COINS; i++) {
uint256 ideal_balance = (D1 * old_balances[i]) / D0;
uint256 difference;
if (ideal_balance > new_balances[i]) {
difference = ideal_balance - new_balances[i];
} else {
difference = new_balances[i] - ideal_balance;
}
fees[i] = (_fee * difference) / FEE_DENOMINATOR;
balances[i] = new_balances[i] - ((fees[i] * _admin_fee) / FEE_DENOMINATOR);
new_balances[i] -= fees[i];
}
D2 = get_D_mem(new_balances, amp);
} else {
balances = new_balances;
}
// Calculate, how much pool tokens to mint
uint256 mint_amount;
if (token_supply == 0) {
mint_amount = D1; // Take the dust if there was any
} else {
mint_amount = (token_supply * (D2 - D0)) / D0;
}
require(mint_amount >= min_mint_amount, 'Slippage screwed you');
// Take coins from the sender
for (uint256 i = 0; i < N_COINS; i++) {
uint256 amount = amounts[i];
address coin = coins[i];
transfer_in(coin, amount);
}
// Mint pool tokens
token.mint(msg.sender, mint_amount);
emit AddLiquidity(msg.sender, amounts, fees, D1, token_supply + mint_amount);
}
function get_y(uint256 i, uint256 j, uint256 x, uint256[N_COINS] memory xp_) internal view returns (uint256) {
// x in the input is converted to the same price/precision
require((i != j) && (i < N_COINS) && (j < N_COINS), 'Illegal parameter');
uint256 amp = get_A();
uint256 D = get_D(xp_, amp);
uint256 c = D;
uint256 S_;
uint256 Ann = amp * N_COINS;
uint256 _x;
for (uint256 k = 0; k < N_COINS; k++) {
if (k == i) {
_x = x;
} else if (k != j) {
_x = xp_[k];
} else {
continue;
}
S_ += _x;
c = (c * D) / (_x * N_COINS);
}
c = (c * D) / (Ann * N_COINS);
uint256 b = S_ + D / Ann; // - D
uint256 y_prev;
uint256 y = D;
for (uint256 m = 0; m < 255; m++) {
y_prev = y;
y = (y * y + c) / (2 * y + b - D);
// Equality with the precision of 1
if (y > y_prev) {
if (y - y_prev <= 1) {
break;
}
} else {
if (y_prev - y <= 1) {
break;
}
}
}
return y;
}
function get_dy(uint256 i, uint256 j, uint256 dx) external view returns (uint256) {
// dx and dy in c-units
uint256[N_COINS] memory rates = RATES;
uint256[N_COINS] memory xp = _xp();
uint256 x = xp[i] + ((dx * rates[i]) / PRECISION);
uint256 y = get_y(i, j, x, xp);
uint256 dy = ((xp[j] - y - 1) * PRECISION) / rates[j];
uint256 _fee = (fee * dy) / FEE_DENOMINATOR;
return dy - _fee;
}
function get_dy_underlying(uint256 i, uint256 j, uint256 dx) external view returns (uint256) {
// dx and dy in underlying units
uint256[N_COINS] memory xp = _xp();
uint256[N_COINS] memory precisions = PRECISION_MUL;
uint256 x = xp[i] + dx * precisions[i];
uint256 y = get_y(i, j, x, xp);
uint256 dy = (xp[j] - y - 1) / precisions[j];
uint256 _fee = (fee * dy) / FEE_DENOMINATOR;
return dy - _fee;
}
function exchange(uint256 i, uint256 j, uint256 dx, uint256 min_dy) external payable nonReentrant {
require(!is_killed, 'Killed');
if (!support_ETH) {
require(msg.value == 0, 'Inconsistent quantity'); // Avoid sending ETH by mistake.
}
uint256[N_COINS] memory old_balances = balances;
uint256[N_COINS] memory xp = _xp_mem(old_balances);
uint256 x = xp[i] + (dx * RATES[i]) / PRECISION;
uint256 y = get_y(i, j, x, xp);
uint256 dy = xp[j] - y - 1; // -1 just in case there were some rounding errors
uint256 dy_fee = (dy * fee) / FEE_DENOMINATOR;
// Convert all to real units
dy = ((dy - dy_fee) * PRECISION) / RATES[j];
require(dy >= min_dy, 'Exchange resulted in fewer coins than expected');
uint256 dy_admin_fee = (dy_fee * admin_fee) / FEE_DENOMINATOR;
dy_admin_fee = (dy_admin_fee * PRECISION) / RATES[j];
// Change balances exactly in same way as we change actual ERC20 coin amounts
balances[i] = old_balances[i] + dx;
// When rounding errors happen, we undercharge admin fee in favor of LP
balances[j] = old_balances[j] - dy - dy_admin_fee;
address iAddress = coins[i];
if (iAddress == ETH_ADDRESS) {
require(dx == msg.value, 'Inconsistent quantity');
} else {
IERC20(iAddress).safeTransferFrom(msg.sender, address(this), dx);
}
address jAddress = coins[j];
transfer_out(jAddress, dy);
emit TokenExchange(msg.sender, i, dx, j, dy);
}
function remove_liquidity(uint256 _amount, uint256[N_COINS] memory min_amounts) external nonReentrant {
uint256 total_supply = token.totalSupply();
uint256[N_COINS] memory amounts;
uint256[N_COINS] memory fees; //Fees are unused but we've got them historically in event
for (uint256 i = 0; i < N_COINS; i++) {
uint256 value = (balances[i] * _amount) / total_supply;
require(value >= min_amounts[i], 'Withdrawal resulted in fewer coins than expected');
balances[i] -= value;
amounts[i] = value;
transfer_out(coins[i], value);
}
token.burnFrom(msg.sender, _amount); // dev: insufficient funds
emit RemoveLiquidity(msg.sender, amounts, fees, total_supply - _amount);
}
function remove_liquidity_imbalance(
uint256[N_COINS] memory amounts,
uint256 max_burn_amount
) external nonReentrant {
require(!is_killed, 'Killed');
uint256 token_supply = token.totalSupply();
require(token_supply > 0, 'dev: zero total supply');
uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
uint256 _admin_fee = admin_fee;
uint256 amp = get_A();
uint256[N_COINS] memory old_balances = balances;
uint256[N_COINS] memory new_balances = [old_balances[0], old_balances[1], old_balances[2]];
uint256 D0 = get_D_mem(old_balances, amp);
for (uint256 i = 0; i < N_COINS; i++) {
new_balances[i] -= amounts[i];
}
uint256 D1 = get_D_mem(new_balances, amp);
uint256[N_COINS] memory fees;
for (uint256 i = 0; i < N_COINS; i++) {
uint256 ideal_balance = (D1 * old_balances[i]) / D0;
uint256 difference;
if (ideal_balance > new_balances[i]) {
difference = ideal_balance - new_balances[i];
} else {
difference = new_balances[i] - ideal_balance;
}
fees[i] = (_fee * difference) / FEE_DENOMINATOR;
balances[i] = new_balances[i] - ((fees[i] * _admin_fee) / FEE_DENOMINATOR);
new_balances[i] -= fees[i];
}
uint256 D2 = get_D_mem(new_balances, amp);
uint256 token_amount = ((D0 - D2) * token_supply) / D0;
require(token_amount > 0, 'token_amount must be greater than 0');
token_amount += 1; // In case of rounding errors - make it unfavorable for the "attacker"
require(token_amount <= max_burn_amount, 'Slippage screwed you');
token.burnFrom(msg.sender, token_amount); // dev: insufficient funds
for (uint256 i = 0; i < N_COINS; i++) {
if (amounts[i] > 0) {
transfer_out(coins[i], amounts[i]);
}
}
token_supply -= token_amount;
emit RemoveLiquidityImbalance(msg.sender, amounts, fees, D1, token_supply);
}
function get_y_D(uint256 A_, uint256 i, uint256[N_COINS] memory xp, uint256 D) internal pure returns (uint256) {
/**
Calculate x[i] if one reduces D from being calculated for xp to D
Done by solving quadratic equation iteratively.
x_1**2 + x1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
x_1**2 + b*x_1 = c
x_1 = (x_1**2 + c) / (2*x_1 + b)
*/
// x in the input is converted to the same price/precision
require(i < N_COINS, 'dev: i above N_COINS');
uint256 c = D;
uint256 S_;
uint256 Ann = A_ * N_COINS;
uint256 _x;
for (uint256 k = 0; k < N_COINS; k++) {
if (k != i) {
_x = xp[k];
} else {
continue;
}
S_ += _x;
c = (c * D) / (_x * N_COINS);
}
c = (c * D) / (Ann * N_COINS);
uint256 b = S_ + D / Ann;
uint256 y_prev;
uint256 y = D;
for (uint256 k = 0; k < 255; k++) {
y_prev = y;
y = (y * y + c) / (2 * y + b - D);
// Equality with the precision of 1
if (y > y_prev) {
if (y - y_prev <= 1) {
break;
}
} else {
if (y_prev - y <= 1) {
break;
}
}
}
return y;
}
function _calc_withdraw_one_coin(uint256 _token_amount, uint256 i) internal view returns (uint256, uint256) {
// First, need to calculate
// * Get current D
// * Solve Eqn against y_i for D - _token_amount
uint256 amp = get_A();
uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
uint256[N_COINS] memory precisions = PRECISION_MUL;
uint256 total_supply = token.totalSupply();
uint256[N_COINS] memory xp = _xp();
uint256 D0 = get_D(xp, amp);
uint256 D1 = D0 - (_token_amount * D0) / total_supply;
uint256[N_COINS] memory xp_reduced = xp;
uint256 new_y = get_y_D(amp, i, xp, D1);
uint256 dy_0 = (xp[i] - new_y) / precisions[i]; // w/o fees
for (uint256 k = 0; k < N_COINS; k++) {
uint256 dx_expected;
if (k == i) {
dx_expected = (xp[k] * D1) / D0 - new_y;
} else {
dx_expected = xp[k] - (xp[k] * D1) / D0;
}
xp_reduced[k] -= (_fee * dx_expected) / FEE_DENOMINATOR;
}
uint256 dy = xp_reduced[i] - get_y_D(amp, i, xp_reduced, D1);
dy = (dy - 1) / precisions[i]; // Withdraw less to account for rounding errors
return (dy, dy_0 - dy);
}
function calc_withdraw_one_coin(uint256 _token_amount, uint256 i) external view returns (uint256) {
(uint256 dy, ) = _calc_withdraw_one_coin(_token_amount, i);
return dy;
}
function remove_liquidity_one_coin(uint256 _token_amount, uint256 i, uint256 min_amount) external nonReentrant {
// Remove _amount of liquidity all in a form of coin i
require(!is_killed, 'Killed');
(uint256 dy, uint256 dy_fee) = _calc_withdraw_one_coin(_token_amount, i);
require(dy >= min_amount, 'Not enough coins removed');
balances[i] -= (dy + (dy_fee * admin_fee) / FEE_DENOMINATOR);
token.burnFrom(msg.sender, _token_amount); // dev: insufficient funds
transfer_out(coins[i], dy);
emit RemoveLiquidityOne(msg.sender, i, _token_amount, dy);
}
function transfer_out(address coin_address, uint256 value) internal {
if (coin_address == ETH_ADDRESS) {
_safeTransferETH(msg.sender, value);
} else {
IERC20(coin_address).safeTransfer(msg.sender, value);
}
}
function transfer_in(address coin_address, uint256 value) internal {
if (coin_address == ETH_ADDRESS) {
require(value == msg.value, 'Inconsistent quantity');
} else {
IERC20(coin_address).safeTransferFrom(msg.sender, address(this), value);
}
}
function _safeTransferETH(address to, uint256 value) internal {
(bool success, ) = to.call{gas: eth_gas, value: value}('');
require(success, 'ETH transfer failed');
}
// Admin functions
function set_eth_gas(uint256 _eth_gas) external onlyOwner {
require(_eth_gas >= MIN_ETH_GAS && _eth_gas <= MAX_ETH_GAS, 'Illegal gas');
eth_gas = _eth_gas;
emit SetETHGas(_eth_gas);
}
function ramp_A(uint256 _future_A, uint256 _future_time) external onlyOwner {
require(block.timestamp >= initial_A_time + MIN_RAMP_TIME, 'dev : too early');
require(_future_time >= block.timestamp + MIN_RAMP_TIME, 'dev: insufficient time');
uint256 _initial_A = get_A();
require(_future_A > 0 && _future_A < MAX_A, '_future_A must be between 0 and MAX_A');
require(
(_future_A >= _initial_A && _future_A <= _initial_A * MAX_A_CHANGE) ||
(_future_A < _initial_A && _future_A * MAX_A_CHANGE >= _initial_A),
'Illegal parameter _future_A'
);
initial_A = _initial_A;
future_A = _future_A;
initial_A_time = block.timestamp;
future_A_time = _future_time;
emit RampA(_initial_A, _future_A, block.timestamp, _future_time);
}
function stop_rampget_A() external onlyOwner {
uint256 current_A = get_A();
initial_A = current_A;
future_A = current_A;
initial_A_time = block.timestamp;
future_A_time = block.timestamp;
// now (block.timestamp < t1) is always False, so we return saved A
emit StopRampA(current_A, block.timestamp);
}
function commit_new_fee(uint256 new_fee, uint256 new_admin_fee) external onlyOwner {
require(admin_actions_deadline == 0, 'admin_actions_deadline must be 0'); // dev: active action
require(new_fee <= MAX_FEE, 'dev: fee exceeds maximum');
require(new_admin_fee <= MAX_ADMIN_FEE, 'dev: admin fee exceeds maximum');
admin_actions_deadline = block.timestamp + ADMIN_ACTIONS_DELAY;
future_fee = new_fee;
future_admin_fee = new_admin_fee;
emit CommitNewFee(admin_actions_deadline, new_fee, new_admin_fee);
}
function apply_new_fee() external onlyOwner {
require(block.timestamp >= admin_actions_deadline, 'dev: insufficient time');
require(admin_actions_deadline != 0, 'admin_actions_deadline should not be 0');
admin_actions_deadline = 0;
fee = future_fee;
admin_fee = future_admin_fee;
emit NewFee(fee, admin_fee);
}
function revert_new_parameters() external onlyOwner {
admin_actions_deadline = 0;
emit RevertParameters();
}
function admin_balances(uint256 i) external view returns (uint256) {
if (coins[i] == ETH_ADDRESS) {
return address(this).balance - balances[i];
} else {
return IERC20(coins[i]).balanceOf(address(this)) - balances[i];
}
}
function withdraw_admin_fees() external onlyOwner {
for (uint256 i = 0; i < N_COINS; i++) {
uint256 value;
if (coins[i] == ETH_ADDRESS) {
value = address(this).balance - balances[i];
} else {
value = IERC20(coins[i]).balanceOf(address(this)) - balances[i];
}
if (value > 0) {
transfer_out(coins[i], value);
}
}
}
function donate_admin_fees() external onlyOwner {
for (uint256 i = 0; i < N_COINS; i++) {
if (coins[i] == ETH_ADDRESS) {
balances[i] = address(this).balance;
} else {
balances[i] = IERC20(coins[i]).balanceOf(address(this));
}
}
emit DonateAdminFees();
}
function kill_me() external onlyOwner {
require(kill_deadline > block.timestamp, 'Exceeded deadline');
is_killed = true;
emit Kill();
}
function unkill_me() external onlyOwner {
is_killed = false;
emit Unkill();
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":400,"enabled":true},"metadata":{"bytecodeHash":"none"},"libraries":{},"evmVersion":"istanbul"}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[]},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"N_COINS","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"createSwapPair","inputs":[{"type":"address","name":"_tokenA","internalType":"address"},{"type":"address","name":"_tokenB","internalType":"address"},{"type":"address","name":"_tokenC","internalType":"address"},{"type":"uint256","name":"_A","internalType":"uint256"},{"type":"uint256","name":"_fee","internalType":"uint256"},{"type":"uint256","name":"_admin_fee","internalType":"uint256"},{"type":"address","name":"_admin","internalType":"address"},{"type":"address","name":"_LP","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614fc88061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063293577501461005c5780634cedbfc714610077578063715018a6146100a25780638da5cb5b146100ac578063f2fde38b146100bd575b600080fd5b610064600381565b6040519081526020015b60405180910390f35b61008a610085366004610552565b6100d0565b6040516001600160a01b03909116815260200161006e565b6100aa6102da565b005b6000546001600160a01b031661008a565b6100aa6100cb3660046105d4565b6102ee565b60006100da610367565b6001600160a01b038916158015906100fa57506001600160a01b03881615155b80156101185750876001600160a01b0316896001600160a01b031614155b6101595760405162461bcd60e51b815260206004820152600d60248201526c24b63632b3b0b6103a37b5b2b760991b60448201526064015b60405180910390fd5b60008060006101698c8c8c6103c1565b92509250925060006040518060600160405280856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681525090506000604051806020016101d690610529565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606088811b8216602084015287811b8216603484015286811b8216604884015233901b16605c82015242607082015246609082015290915060009060b0016040516020818303038152906040528051906020012090506000818351602085016000f59050806001600160a01b0316634eac4835858f8f8f8f8f6040518763ffffffff1660e01b8152600401610293969594939291906105f6565b600060405180830381600087803b1580156102ad57600080fd5b505af11580156102c1573d6000803e3d6000fd5b5092995050505050505050505098975050505050505050565b6102e2610367565b6102ec60006104cc565b565b6102f6610367565b6001600160a01b03811661035b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610150565b610364816104cc565b50565b6000546001600160a01b031633146102ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610150565b6000806000846001600160a01b0316866001600160a01b0316141580156103fa5750836001600160a01b0316866001600160a01b031614155b80156104185750836001600160a01b0316856001600160a01b031614155b6104645760405162461bcd60e51b815260206004820152601360248201527f4944454e544943414c5f414444524553534553000000000000000000000000006044820152606401610150565b6000856001600160a01b0316876001600160a01b031611156104865750939493845b846001600160a01b0316866001600160a01b031611156104bf5750929392836001600160a01b0380871690881611156104bf5750939493845b5094959394509192915050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61495c8061066083390190565b80356001600160a01b038116811461054d57600080fd5b919050565b600080600080600080600080610100898b03121561056f57600080fd5b61057889610536565b975061058660208a01610536565b965061059460408a01610536565b9550606089013594506080890135935060a089013592506105b760c08a01610536565b91506105c560e08a01610536565b90509295985092959890939650565b6000602082840312156105e657600080fd5b6105ef82610536565b9392505050565b6101008101818860005b60038110156106285781516001600160a01b0316835260209283019290910190600101610600565b5050506060820196909652608081019490945260a08401929092526001600160a01b0390811660c08401521660e09091015291905056fe60a0604052610fbd6010553480156200001757600080fd5b50620000233362000031565b600180553360805262000081565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6080516148b8620000a46000396000818161076a015261165d01526148b86000f3fe6080604052600436106103815760003560e01c806375bacd56116101d1578063ca8ca15411610102578063ecb586a5116100a0578063f3de03621161006f578063f3de036214610836578063f446c1d01461093e578063fc0c546a14610953578063fee3f7f91461097357600080fd5b8063ecb586a5146108c7578063edfb7801146108e7578063f1dc3cc9146108fe578063f2fde38b1461091e57600080fd5b8063e2e7d264116100dc578063e2e7d26414610865578063e369885314610885578063e38244621461089a578063e5d9e903146108b057600080fd5b8063ca8ca15414610821578063d73792a914610836578063ddca3f431461084f57600080fd5b8063a6b0a7181161016f578063b4b577ad11610149578063b4b577ad146107bd578063bb7b8b80146107d3578063bc063e1a146107e8578063c66106571461080157600080fd5b8063a6b0a71814610758578063aaf5eb681461078c578063ab5ac061146107a857600080fd5b80638da5cb5b116101ab5780638da5cb5b146106d6578063923e563c146107085780639c868ac01461071e5780639fdaea0c1461073857600080fd5b806375bacd56146106805780637dafa3641461069657806385f11d1e146106b657600080fd5b80634903b0d1116102b657806358680d0b1161025457806362203d741161022357806362203d74146106205780636d4366b714610640578063715018a61461065557806373d459e41461066a57600080fd5b806358680d0b146105b75780635b41b908146105cd5780635b5a1467146105e0578063610358a91461060057600080fd5b80634fb08c5e116102905780634fb08c5e1461054c578063524c39011461056c5780635409491a14610581578063556d6e9f1461059757600080fd5b80634903b0d1146104f75780634eac4835146105175780634f12fe971461053757600080fd5b806330c540851161032357806339698415116102fd57806339698415146104975780633c157e64146104ae578063405e28f8146104ce5780634515cef3146104e457600080fd5b806330c54085146104335780633883e11914610448578063392e53cd1461046857600080fd5b8063226840fb1161035f578063226840fb146103dc57806329357750146103f35780632a426896146104085780633046f9721461041e57600080fd5b806306e9481c1461038657806314052288146103b05780632081066c146103c6575b600080fd5b34801561039257600080fd5b5061039d6201518081565b6040519081526020015b60405180910390f35b3480156103bc57600080fd5b5061039d60155481565b3480156103d257600080fd5b5061039d60145481565b3480156103e857600080fd5b506103f1610989565b005b3480156103ff57600080fd5b5061039d600381565b34801561041457600080fd5b5061039d60195481565b34801561042a57600080fd5b506103f16109c1565b34801561043f57600080fd5b506103f16109fe565b34801561045457600080fd5b5061039d6104633660046143bb565b610b56565b34801561047457600080fd5b50601a5461048790610100900460ff1681565b60405190151581526020016103a7565b3480156104a357600080fd5b5061039d620f424081565b3480156104ba57600080fd5b506103f16104c93660046143f3565b610d1d565b3480156104da57600080fd5b5061039d60165481565b6103f16104f2366004614415565b610f2f565b34801561050357600080fd5b5061039d610512366004614440565b6115e3565b34801561052357600080fd5b506103f1610532366004614470565b6115fa565b34801561054357600080fd5b506103f1611a4d565b34801561055857600080fd5b5061039d6105673660046143f3565b611b54565b34801561057857600080fd5b506103f1611b6a565b34801561058d57600080fd5b5061039d60125481565b3480156105a357600080fd5b5061039d6105b2366004614510565b611ca4565b3480156105c357600080fd5b5061039d60175481565b6103f16105db36600461453c565b611dee565b3480156105ec57600080fd5b506103f16105fb3660046143f3565b612223565b34801561060c57600080fd5b506103f161061b366004614440565b61237e565b34801561062c57600080fd5b5061039d61063b366004614440565b612410565b34801561064c57600080fd5b5061039d601281565b34801561066157600080fd5b506103f1612420565b34801561067657600080fd5b5061039d6159d881565b34801561068c57600080fd5b5061039d60105481565b3480156106a257600080fd5b5061039d6106b1366004614440565b612434565b3480156106c257600080fd5b5061039d6106d1366004614510565b612444565b3480156106e257600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103a7565b34801561071457600080fd5b5061039d6108fc81565b34801561072a57600080fd5b50601a546104879060ff1681565b34801561074457600080fd5b506103f1610753366004614415565b612522565b34801561076457600080fd5b506106f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561079857600080fd5b5061039d670de0b6b3a764000081565b3480156107b457600080fd5b5061039d600a81565b3480156107c957600080fd5b5061039d60135481565b3480156107df57600080fd5b5061039d612b23565b3480156107f457600080fd5b5061039d64012a05f20081565b34801561080d57600080fd5b506106f061081c366004614440565b612bdf565b34801561082d57600080fd5b506103f1612bff565b34801561084257600080fd5b5061039d6402540be40081565b34801561085b57600080fd5b5061039d600e5481565b34801561087157600080fd5b5061039d610880366004614440565b612c60565b34801561089157600080fd5b506103f1612d5c565b3480156108a657600080fd5b5061039d60185481565b3480156108bc57600080fd5b5061039d6203f48081565b3480156108d357600080fd5b506103f16108e236600461456e565b612ded565b3480156108f357600080fd5b5061039d624f1a0081565b34801561090a57600080fd5b506103f1610919366004614510565b613053565b34801561092a57600080fd5b506103f161093936600461459b565b613226565b34801561094a57600080fd5b5061039d61329c565b34801561095f57600080fd5b506011546106f0906001600160a01b031681565b34801561097f57600080fd5b5061039d600f5481565b6109916132ab565b600060168190556040517f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a19190a1565b6109c96132ab565b601a805460ff191690556040517f061284ffa2814ace135f62907c78a7cff0f070efe7e6a0a42740ea1da2c8bdc890600090a1565b610a066132ab565b60005b6003811015610b5357600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088360038110610a3c57610a3c6145b6565b01546001600160a01b03161415610a7357600b8260038110610a6057610a606145b6565b0154610a6c90476145e2565b9050610b13565b600b8260038110610a8657610a866145b6565b015460088360038110610a9b57610a9b6145b6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0691906145f9565b610b1091906145e2565b90505b8015610b4057610b4060088360038110610b2f57610b2f6145b6565b01546001600160a01b031682613305565b5080610b4b81614612565b915050610a09565b50565b604080516060810191829052600091829190600b9060039082845b815481526020019060010190808311610b7157505050505090506000610b95613348565b90506000610ba383836133e9565b905060005b6003811015610c49578515610bf957868160038110610bc957610bc96145b6565b6020020151848260038110610be057610be06145b6565b60200201818151610bf1919061462d565b905250610c37565b868160038110610c0b57610c0b6145b6565b6020020151848260038110610c2257610c226145b6565b60200201818151610c3391906145e2565b9052505b80610c4181614612565b915050610ba8565b506000610c5684846133e9565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd191906145f9565b905060008715610cec57610ce584846145e2565b9050610cf9565b610cf683856145e2565b90505b83610d048383614645565b610d0e9190614664565b96505050505050505b92915050565b610d256132ab565b62015180601454610d36919061462d565b421015610d7c5760405162461bcd60e51b815260206004820152600f60248201526e646576203a20746f6f206561726c7960881b60448201526064015b60405180910390fd5b610d89620151804261462d565b811015610dd15760405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b6044820152606401610d73565b6000610ddb613348565b9050600083118015610def5750620f424083105b610e495760405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e64206044820152644d41585f4160d81b6064820152608401610d73565b808310158015610e635750610e5f600a82614645565b8311155b80610e8257508083108015610e82575080610e7f600a85614645565b10155b610ece5760405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f4100000000006044820152606401610d73565b60128190556013839055426014819055601583905560408051838152602081018690528082019290925260608201849052517fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c2549181900360800190a1505050565b610f37613404565b601a5460ff1615610f735760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d73565b601154600160a01b900460ff16610fca573415610fca5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d73565b610fd2614271565b6000610fe0600160036145e2565b610feb906004614645565b6003600e54610ffa9190614645565b6110049190614664565b600f549091506000611014613348565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561106b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108f91906145f9565b6040805160608101918290529192506000918291600b9060039082845b8154815260200190600101908083116110ac575050505050905060008311156110dc576110d981856133e9565b91505b60006040518060600160405280836000600381106110fc576110fc6145b6565b6020020151815260200183600160038110611119576111196145b6565b6020020151815260200183600260038110611136576111366145b6565b60200201519052905060005b600381101561122257846111c15760008b8260038110611164576111646145b6565b6020020151116111c15760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f696044820152616e7360f01b6064820152608401610d73565b8a81600381106111d3576111d36145b6565b60200201518382600381106111ea576111ea6145b6565b60200201516111f9919061462d565b82826003811061120b5761120b6145b6565b60200201528061121a81614612565b915050611142565b50600061122f82876133e9565b90508381116112805760405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e2044300000000000006044820152606401610d73565b80851561142e5760005b600381101561141c576000868683600381106112a8576112a86145b6565b60200201516112b79086614645565b6112c19190614664565b905060008583600381106112d7576112d76145b6565b602002015182111561130b578583600381106112f5576112f56145b6565b602002015161130490836145e2565b9050611330565b8186846003811061131e5761131e6145b6565b602002015161132d91906145e2565b90505b6402540be400611340828e614645565b61134a9190614664565b8d846003811061135c5761135c6145b6565b60200201526402540be4008b8e856003811061137a5761137a6145b6565b60200201516113899190614645565b6113939190614664565b8684600381106113a5576113a56145b6565b60200201516113b491906145e2565b600b84600381106113c7576113c76145b6565b01558c83600381106113db576113db6145b6565b60200201518684600381106113f2576113f26145b6565b6020020181815161140391906145e2565b905250829150611414905081614612565b91505061128a565b5061142783886133e9565b905061143d565b61143b600b84600361428f565b505b60008661144b57508161146d565b8561145681846145e2565b6114609089614645565b61146a9190614664565b90505b8b8110156114b45760405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b6044820152606401610d73565b60005b600381101561151c5760008e82600381106114d4576114d46145b6565b602002015190506000600883600381106114f0576114f06145b6565b01546001600160a01b03169050611507818361345e565b5050808061151490614612565b9150506114b7565b506011546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b503392507f423f6495a08fc652425cf4ed0d1f9e37e571d9b9529b1c1c23cce780b2e7df0d91508f90508d866115b3868d61462d565b6040516115c394939291906146a9565b60405180910390a250505050505050505050506115df60018055565b5050565b600b81600381106115f357600080fd5b0154905081565b601a54610100900460ff16156116525760405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a6564006044820152606401610d73565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116ca5760405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f72790000000000000000006044820152606401610d73565b620f424085111561171d5760405162461bcd60e51b815260206004820152601260248201527f5f412065786365656473206d6178696d756d00000000000000000000000000006044820152606401610d73565b64012a05f2008411156117725760405162461bcd60e51b815260206004820152601460248201527f5f6665652065786365656473206d6178696d756d0000000000000000000000006044820152606401610d73565b6402540be4008311156117c75760405162461bcd60e51b815260206004820152601a60248201527f5f61646d696e5f6665652065786365656473206d6178696d756d0000000000006044820152606401610d73565b601a805461ff00191661010017905560005b60038110156119ee5760008782600381106117f6576117f66145b6565b60200201516001600160a01b031614156118415760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204164647265737360a01b6044820152606401610d73565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee88836003811061186a5761186a6145b6565b60200201516001600160a01b0316141561189957506011805460ff60a01b1916600160a01b1790556012611917565b8782600381106118ab576118ab6145b6565b60200201516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191191906146d7565b60ff1690505b60128111156119745760405162461bcd60e51b8152602060048201526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f742065786365656044820152630c84062760e31b6064820152608401610d73565b61197f8160126145e2565b61198a90600a6147de565b6002836003811061199d5761199d6145b6565b0155600282600381106119b2576119b26145b6565b01546119c690670de0b6b3a7640000614645565b600583600381106119d9576119d96145b6565b015550806119e681614612565b9150506117d9565b506119fc60088760036142c9565b5060128590556013859055600e849055600f839055611a1e624f1a004261462d565b601955601180546001600160a01b0319166001600160a01b038316179055611a4582613226565b505050505050565b611a556132ab565b601654421015611aa05760405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b6044820152606401610d73565b601654611afe5760405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201526507420626520360d41b6064820152608401610d73565b6000601655601754600e819055601854600f8190556040517fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d192611b4a92908252602082015260400190565b60405180910390a1565b600080611b6184846134df565b50949350505050565b611b726132ab565b60005b6003811015611c785773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088260038110611ba657611ba66145b6565b01546001600160a01b03161415611bd25747600b8260038110611bcb57611bcb6145b6565b0155611c66565b60088160038110611be557611be56145b6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611c2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5091906145f9565b600b8260038110611c6357611c636145b6565b01555b80611c7081614612565b915050611b75565b506040517f2c7203581ca666b8c5094c11c03f0b19b3750234a9d281bcbc88a260bcb006de90600090a1565b60408051606081019182905260009182919060059060039082845b815481526020019060010190808311611cbf57505050505090506000611ce36137e1565b90506000670de0b6b3a7640000838860038110611d0257611d026145b6565b6020020151611d119087614645565b611d1b9190614664565b828860038110611d2d57611d2d6145b6565b6020020151611d3c919061462d565b90506000611d4c8888848661389b565b90506000848860038110611d6257611d626145b6565b6020020151670de0b6b3a7640000600184878c60038110611d8557611d856145b6565b6020020151611d9491906145e2565b611d9e91906145e2565b611da89190614645565b611db29190614664565b905060006402540be40082600e54611dca9190614645565b611dd49190614664565b9050611de081836145e2565b9a9950505050505050505050565b611df6613404565b601a5460ff1615611e325760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d73565b601154600160a01b900460ff16611e89573415611e895760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d73565b604080516060810191829052600091600b9060039082845b815481526020019060010190808311611ea157505050505090506000611ec682613aa5565b90506000670de0b6b3a764000060058860038110611ee657611ee66145b6565b0154611ef29087614645565b611efc9190614664565b828860038110611f0e57611f0e6145b6565b6020020151611f1d919061462d565b90506000611f2d8888848661389b565b90506000600182858a60038110611f4657611f466145b6565b6020020151611f5591906145e2565b611f5f91906145e2565b905060006402540be400600e5483611f779190614645565b611f819190614664565b905060058960038110611f9657611f966145b6565b0154670de0b6b3a7640000611fab83856145e2565b611fb59190614645565b611fbf9190614664565b9150868210156120285760405162461bcd60e51b815260206004820152602e60248201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201526d081d1a185b88195e1c1958dd195960921b6064820152608401610d73565b60006402540be400600f548361203e9190614645565b6120489190614664565b905060058a6003811061205d5761205d6145b6565b0154612071670de0b6b3a764000083614645565b61207b9190614664565b905088878c60038110612090576120906145b6565b602002015161209f919061462d565b600b8c600381106120b2576120b26145b6565b01558083888c600381106120c8576120c86145b6565b60200201516120d791906145e2565b6120e191906145e2565b600b8b600381106120f4576120f46145b6565b0155600060088c6003811061210b5761210b6145b6565b01546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81141561218057348a1461217b5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d73565b612195565b6121956001600160a01b03821633308d613b63565b600060088c600381106121aa576121aa6145b6565b01546001600160a01b031690506121c18186613305565b604080518e8152602081018d90529081018d90526060810186905233907fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989060800160405180910390a250505050505050505061221d60018055565b50505050565b61222b6132ab565b6016541561227b5760405162461bcd60e51b815260206004820181905260248201527f61646d696e5f616374696f6e735f646561646c696e65206d75737420626520306044820152606401610d73565b64012a05f2008211156122d05760405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d00000000000000006044820152606401610d73565b6402540be4008111156123255760405162461bcd60e51b815260206004820152601e60248201527f6465763a2061646d696e206665652065786365656473206d6178696d756d00006044820152606401610d73565b6123326203f4804261462d565b60168190556017839055601882905560408051848152602081018490527f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe0910160405180910390a25050565b6123866132ab565b6108fc811015801561239a57506159d88111155b6123d45760405162461bcd60e51b815260206004820152600b60248201526a496c6c6567616c2067617360a81b6044820152606401610d73565b60108190556040518181527f2464fc1685c7ca97fc1e1c439a8d567d9ee1522118c0a0b3079220ca5f8fc3f6906020015b60405180910390a150565b600581600381106115f357600080fd5b6124286132ab565b6124326000613bfb565b565b600281600381106115f357600080fd5b60008061244f6137e1565b6040805160608101918290529192506000919060029060039082845b81548152602001906001019080831161246b57505050505090506000818760038110612499576124996145b6565b60200201516124a89086614645565b8388600381106124ba576124ba6145b6565b60200201516124c9919061462d565b905060006124d98888848761389b565b905060008388600381106124ef576124ef6145b6565b6020020151600183878b60038110612509576125096145b6565b602002015161251891906145e2565b611da891906145e2565b61252a613404565b601a5460ff16156125665760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d73565b601154604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa1580156125b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d491906145f9565b9050600081116126265760405162461bcd60e51b815260206004820152601660248201527f6465763a207a65726f20746f74616c20737570706c79000000000000000000006044820152606401610d73565b6000612634600160036145e2565b61263f906004614645565b6003600e5461264e9190614645565b6126589190614664565b600f549091506000612668613348565b60408051606081019182905291925060009190600b9060039082845b815481526020019060010190808311612684575050505050905060006040518060600160405280836000600381106126be576126be6145b6565b60200201518152602001836001600381106126db576126db6145b6565b60200201518152602001836002600381106126f8576126f86145b6565b602002015190529050600061270d83856133e9565b905060005b600381101561276a5789816003811061272d5761272d6145b6565b6020020151838260038110612744576127446145b6565b6020020181815161275591906145e2565b9052508061276281614612565b915050612712565b50600061277783866133e9565b9050612781614271565b60005b6003811015612916576000848783600381106127a2576127a26145b6565b60200201516127b19086614645565b6127bb9190614664565b905060008683600381106127d1576127d16145b6565b6020020151821115612805578683600381106127ef576127ef6145b6565b60200201516127fe90836145e2565b905061282a565b81878460038110612818576128186145b6565b602002015161282791906145e2565b90505b6402540be40061283a828d614645565b6128449190614664565b848460038110612856576128566145b6565b60200201526402540be4008a858560038110612874576128746145b6565b60200201516128839190614645565b61288d9190614664565b87846003811061289f5761289f6145b6565b60200201516128ae91906145e2565b600b84600381106128c1576128c16145b6565b01558383600381106128d5576128d56145b6565b60200201518784600381106128ec576128ec6145b6565b602002018181516128fd91906145e2565b90525082915061290e905081614612565b915050612784565b50600061292385886133e9565b90506000848b61293384836145e2565b61293d9190614645565b6129479190614664565b9050600081116129a55760405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201526206e20360ec1b6064820152608401610d73565b6129b060018261462d565b90508b8111156129f95760405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b6044820152606401610d73565b60115460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612a4557600080fd5b505af1158015612a59573d6000803e3d6000fd5b5050505060005b6003811015612ad75760008e8260038110612a7d57612a7d6145b6565b60200201511115612ac557612ac560088260038110612a9e57612a9e6145b6565b01546001600160a01b03168f8360038110612abb57612abb6145b6565b6020020151613305565b80612acf81614612565b915050612a60565b50612ae2818c6145e2565b9a50336001600160a01b03167f173599dbf9c6ca6f7c3b590df07ae98a45d74ff54065505141e7de6c46a624c28e85878f6040516115c394939291906146a9565b600080612b3e612b316137e1565b612b39613348565b613c4b565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bb991906145f9565b905080612bce670de0b6b3a764000084614645565b612bd89190614664565b9250505090565b60088160038110612bef57600080fd5b01546001600160a01b0316905081565b612c076132ab565b6000612c11613348565b6012819055601381905542601481905560158190556040519192507f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc2019389161240591848252602082015260400190565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088360038110612c8a57612c8a6145b6565b01546001600160a01b03161415612cba57600b8260038110612cae57612cae6145b6565b0154610d1790476145e2565b600b8260038110612ccd57612ccd6145b6565b015460088360038110612ce257612ce26145b6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612d29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d4d91906145f9565b610d1791906145e2565b919050565b612d646132ab565b4260195411612db55760405162461bcd60e51b815260206004820152601160248201527f457863656564656420646561646c696e650000000000000000000000000000006044820152606401610d73565b601a805460ff191660011790556040517fbe26733c2bf6ff3ea5ba8cfe744422bd49052ff9ed5685c9e81e6f9321dbaddd90600090a1565b612df5613404565b601154604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015612e3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6391906145f9565b9050612e6d614271565b612e75614271565b60005b6003811015612f9a5760008487600b8460038110612e9857612e986145b6565b0154612ea49190614645565b612eae9190614664565b9050858260038110612ec257612ec26145b6565b6020020151811015612f2f5760405162461bcd60e51b815260206004820152603060248201527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201526f1b9cc81d1a185b88195e1c1958dd195960821b6064820152608401610d73565b80600b8360038110612f4357612f436145b6565b016000828254612f5391906145e2565b90915550819050848360038110612f6c57612f6c6145b6565b6020020152612f8760088360038110610b2f57610b2f6145b6565b5080612f9281614612565b915050612e78565b5060115460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612fe757600080fd5b505af1158015612ffb573d6000803e3d6000fd5b503392507fa49d4cf02656aebf8c771f5a8585638a2a15ee6c97cf7205d4208ed7c1df252d91508490508361303089886145e2565b60405161303f939291906147ea565b60405180910390a25050506115df60018055565b61305b613404565b601a5460ff16156130975760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d73565b6000806130a485856134df565b91509150828210156130f85760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f76656400000000000000006044820152606401610d73565b6402540be400600f548261310c9190614645565b6131169190614664565b613120908361462d565b600b8560038110613133576131336145b6565b01600082825461314391906145e2565b909155505060115460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561319457600080fd5b505af11580156131a8573d6000803e3d6000fd5b505050506131d3600885600381106131c2576131c26145b6565b01546001600160a01b031683613305565b604080518581526020810187905290810183905233907f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a09060600160405180910390a2505061322160018055565b505050565b61322e6132ab565b6001600160a01b0381166132935760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d73565b610b5381613bfb565b60006132a6613348565b905090565b6000546001600160a01b031633146124325760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d73565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415613334576115df3382613de1565b6115df6001600160a01b0383163383613e88565b6015546013546000919042821115610d1757601254601454818311156133ad5761337281856145e2565b61337c82426145e2565b61338684866145e2565b6133909190614645565b61339a9190614664565b6133a4908361462d565b94505050505090565b6133b781856145e2565b6133c182426145e2565b6133cb85856145e2565b6133d59190614645565b6133df9190614664565b6133a490836145e2565b60006133fd6133f784613aa5565b83613c4b565b9392505050565b600260015414156134575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d73565b6002600155565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156134ca573481146115df5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d73565b6115df6001600160a01b038316333084613b63565b60008060006134ec613348565b905060006134fc600160036145e2565b613507906004614645565b6003600e546135169190614645565b6135209190614664565b6040805160608101918290529192506000919060029060039082845b81548152602001906001019080831161353c57505050505090506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156135ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135cf91906145f9565b905060006135db6137e1565b905060006135e98287613c4b565b90506000836135f8838d614645565b6136029190614664565b61360c90836145e2565b905082600061361d898d8486613eb8565b90506000878d60038110613633576136336145b6565b602002015182878f6003811061364b5761364b6145b6565b602002015161365a91906145e2565b6136649190614664565b905060005b60038110156137605760008e8214156136bb578387878a8560038110613691576136916145b6565b60200201516136a09190614645565b6136aa9190614664565b6136b491906145e2565b905061370c565b86868984600381106136cf576136cf6145b6565b60200201516136de9190614645565b6136e89190614664565b8883600381106136fa576136fa6145b6565b602002015161370991906145e2565b90505b6402540be40061371c828d614645565b6137269190614664565b858360038110613738576137386145b6565b6020020181815161374991906145e2565b90525081905061375881614612565b915050613669565b50600061376f8b8f8688613eb8565b848f60038110613781576137816145b6565b602002015161379091906145e2565b9050888e600381106137a4576137a46145b6565b60200201516137b46001836145e2565b6137be9190614664565b9050806137cb81846145e2565b9c509c5050505050505050505050509250929050565b6137e9614271565b6040805160608101918290529060059060039082845b8154815260200190600101908083116137ff575050505050905060005b600381101561389757670de0b6b3a7640000600b8260038110613841576138416145b6565b0154838360038110613855576138556145b6565b60200201516138649190614645565b61386e9190614664565b828260038110613880576138806145b6565b60200201528061388f81614612565b91505061381c565b5090565b60008385141580156138ad5750600385105b80156138b95750600384105b6139055760405162461bcd60e51b815260206004820152601160248201527f496c6c6567616c20706172616d657465720000000000000000000000000000006044820152606401610d73565b600061390f613348565b9050600061391d8483613c4b565b90508060008061392e600386614645565b90506000805b60038110156139b7578b81141561394d57899150613977565b8a811461397257888160038110613966576139666145b6565b60200201519150613977565b6139a5565b613981828561462d565b935061398e600383614645565b6139988787614645565b6139a29190614664565b94505b806139af81614612565b915050613934565b506139c3600383614645565b6139cd8686614645565b6139d79190614664565b935060006139e58387614664565b6139ef908561462d565b9050600086815b60ff811015613a91578192508884836002613a119190614645565b613a1b919061462d565b613a2591906145e2565b88613a308480614645565b613a3a919061462d565b613a449190614664565b915082821115613a69576001613a5a84846145e2565b11613a6457613a91565b613a7f565b6001613a7583856145e2565b11613a7f57613a91565b80613a8981614612565b9150506139f6565b50985050505050505050505b949350505050565b613aad614271565b6040805160608101918290529060059060039082845b815481526020019060010190808311613ac3575050505050905060005b6003811015613b5d57670de0b6b3a7640000838260038110613b0457613b046145b6565b6020020151838360038110613b1b57613b1b6145b6565b6020020151613b2a9190614645565b613b349190614664565b828260038110613b4657613b466145b6565b602002015280613b5581614612565b915050613ae0565b50919050565b6040516001600160a01b038085166024830152831660448201526064810182905261221d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261407c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060005b6003811015613c8f57848160038110613c6c57613c6c6145b6565b6020020151613c7b908361462d565b915080613c8781614612565b915050613c51565b5080613c9f576000915050610d17565b60008181613cae600387614645565b905060005b60ff811015613dd5578260005b6003811015613d145760038a8260038110613cdd57613cdd6145b6565b6020020151613cec9190614645565b613cf68684614645565b613d009190614664565b915080613d0c81614612565b915050613cc0565b508394508060036001613d27919061462d565b613d319190614645565b84613d3d6001866145e2565b613d479190614645565b613d51919061462d565b84613d5d600384614645565b613d678987614645565b613d71919061462d565b613d7b9190614645565b613d859190614664565b935084841115613dab576001613d9b86866145e2565b11613da65750613dd5565b613dc2565b6001613db785876145e2565b11613dc25750613dd5565b5080613dcd81614612565b915050613cb3565b50909695505050505050565b6000826001600160a01b031660105483604051600060405180830381858888f193505050503d8060008114613e32576040519150601f19603f3d011682016040523d82523d6000602084013e613e37565b606091505b50509050806132215760405162461bcd60e51b815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610d73565b6040516001600160a01b03831660248201526044810182905261322190849063a9059cbb60e01b90606401613b97565b600060038410613f0a5760405162461bcd60e51b815260206004820152601460248201527f6465763a20692061626f7665204e5f434f494e530000000000000000000000006044820152606401610d73565b81600080613f19600389614645565b90506000805b6003811015613f9257888114613f4d57878160038110613f4157613f416145b6565b60200201519150613f52565b613f80565b613f5c828561462d565b9350613f69600383614645565b613f738887614645565b613f7d9190614664565b94505b80613f8a81614612565b915050613f1f565b50613f9e600383614645565b613fa88786614645565b613fb29190614664565b93506000613fc08388614664565b613fca908561462d565b9050600087815b60ff81101561406c578192508984836002613fec9190614645565b613ff6919061462d565b61400091906145e2565b8861400b8480614645565b614015919061462d565b61401f9190614664565b91508282111561404457600161403584846145e2565b1161403f5761406c565b61405a565b600161405083856145e2565b1161405a5761406c565b8061406481614612565b915050613fd1565b509b9a5050505050505050505050565b60006140d1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166141519092919063ffffffff16565b90508051600014806140f25750808060200190518101906140f29190614813565b6132215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610d73565b6060613a9d848460008585600080866001600160a01b03168587604051614178919061485c565b60006040518083038185875af1925050503d80600081146141b5576040519150601f19603f3d011682016040523d82523d6000602084013e6141ba565b606091505b50915091506141cb878383876141d6565b979650505050505050565b6060831561424257825161423b576001600160a01b0385163b61423b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d73565b5081613a9d565b613a9d83838151156142575781518083602001fd5b8060405162461bcd60e51b8152600401610d739190614878565b60405180606001604052806003906020820280368337509192915050565b82600381019282156142bd579160200282015b828111156142bd5782518255916020019190600101906142a2565b50613897929150614311565b82600381019282156142bd579160200282015b828111156142bd57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906142dc565b5b808211156138975760008155600101614312565b6040516060810167ffffffffffffffff8111828210171561435757634e487b7160e01b600052604160045260246000fd5b60405290565b600082601f83011261436e57600080fd5b614376614326565b80606084018581111561438857600080fd5b845b818110156143a257803584526020938401930161438a565b509095945050505050565b8015158114610b5357600080fd5b600080608083850312156143ce57600080fd5b6143d8848461435d565b915060608301356143e8816143ad565b809150509250929050565b6000806040838503121561440657600080fd5b50508035926020909101359150565b6000806080838503121561442857600080fd5b614432848461435d565b946060939093013593505050565b60006020828403121561445257600080fd5b5035919050565b80356001600160a01b0381168114612d5757600080fd5b600080600080600080610100878903121561448a57600080fd5b87601f88011261449957600080fd5b6144a1614326565b80606089018a8111156144b357600080fd5b895b818110156144d4576144c681614459565b8452602093840193016144b5565b50909750359550506080870135935060a087013592506144f660c08801614459565b915061450460e08801614459565b90509295509295509295565b60008060006060848603121561452557600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561455257600080fd5b5050823594602084013594506040840135936060013592509050565b6000806080838503121561458157600080fd5b82359150614592846020850161435d565b90509250929050565b6000602082840312156145ad57600080fd5b6133fd82614459565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156145f4576145f46145cc565b500390565b60006020828403121561460b57600080fd5b5051919050565b6000600019821415614626576146266145cc565b5060010190565b60008219821115614640576146406145cc565b500190565b600081600019048311821515161561465f5761465f6145cc565b500290565b60008261468157634e487b7160e01b600052601260045260246000fd5b500490565b8060005b600381101561221d57815184526020938401939091019060010161468a565b61010081016146b88287614686565b6146c56060830186614686565b60c082019390935260e0015292915050565b6000602082840312156146e957600080fd5b815160ff811681146133fd57600080fd5b600181815b8085111561473557816000190482111561471b5761471b6145cc565b8085161561472857918102915b93841c93908002906146ff565b509250929050565b60008261474c57506001610d17565b8161475957506000610d17565b816001811461476f576002811461477957614795565b6001915050610d17565b60ff84111561478a5761478a6145cc565b50506001821b610d17565b5060208310610133831016604e8410600b84101617156147b8575081810a610d17565b6147c283836146fa565b80600019048211156147d6576147d66145cc565b029392505050565b60006133fd838361473d565b60e081016147f88286614686565b6148056060830185614686565b8260c0830152949350505050565b60006020828403121561482557600080fd5b81516133fd816143ad565b60005b8381101561484b578181015183820152602001614833565b8381111561221d5750506000910152565b6000825161486e818460208701614830565b9190910192915050565b6020815260008251806020840152614897816040850160208701614830565b601f01601f1916919091016040019291505056fea164736f6c634300080a000aa164736f6c634300080a000a
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063293577501461005c5780634cedbfc714610077578063715018a6146100a25780638da5cb5b146100ac578063f2fde38b146100bd575b600080fd5b610064600381565b6040519081526020015b60405180910390f35b61008a610085366004610552565b6100d0565b6040516001600160a01b03909116815260200161006e565b6100aa6102da565b005b6000546001600160a01b031661008a565b6100aa6100cb3660046105d4565b6102ee565b60006100da610367565b6001600160a01b038916158015906100fa57506001600160a01b03881615155b80156101185750876001600160a01b0316896001600160a01b031614155b6101595760405162461bcd60e51b815260206004820152600d60248201526c24b63632b3b0b6103a37b5b2b760991b60448201526064015b60405180910390fd5b60008060006101698c8c8c6103c1565b92509250925060006040518060600160405280856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681525090506000604051806020016101d690610529565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606088811b8216602084015287811b8216603484015286811b8216604884015233901b16605c82015242607082015246609082015290915060009060b0016040516020818303038152906040528051906020012090506000818351602085016000f59050806001600160a01b0316634eac4835858f8f8f8f8f6040518763ffffffff1660e01b8152600401610293969594939291906105f6565b600060405180830381600087803b1580156102ad57600080fd5b505af11580156102c1573d6000803e3d6000fd5b5092995050505050505050505098975050505050505050565b6102e2610367565b6102ec60006104cc565b565b6102f6610367565b6001600160a01b03811661035b5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610150565b610364816104cc565b50565b6000546001600160a01b031633146102ec5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610150565b6000806000846001600160a01b0316866001600160a01b0316141580156103fa5750836001600160a01b0316866001600160a01b031614155b80156104185750836001600160a01b0316856001600160a01b031614155b6104645760405162461bcd60e51b815260206004820152601360248201527f4944454e544943414c5f414444524553534553000000000000000000000000006044820152606401610150565b6000856001600160a01b0316876001600160a01b031611156104865750939493845b846001600160a01b0316866001600160a01b031611156104bf5750929392836001600160a01b0380871690881611156104bf5750939493845b5094959394509192915050565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61495c8061066083390190565b80356001600160a01b038116811461054d57600080fd5b919050565b600080600080600080600080610100898b03121561056f57600080fd5b61057889610536565b975061058660208a01610536565b965061059460408a01610536565b9550606089013594506080890135935060a089013592506105b760c08a01610536565b91506105c560e08a01610536565b90509295985092959890939650565b6000602082840312156105e657600080fd5b6105ef82610536565b9392505050565b6101008101818860005b60038110156106285781516001600160a01b0316835260209283019290910190600101610600565b5050506060820196909652608081019490945260a08401929092526001600160a01b0390811660c08401521660e09091015291905056fe60a0604052610fbd6010553480156200001757600080fd5b50620000233362000031565b600180553360805262000081565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6080516148b8620000a46000396000818161076a015261165d01526148b86000f3fe6080604052600436106103815760003560e01c806375bacd56116101d1578063ca8ca15411610102578063ecb586a5116100a0578063f3de03621161006f578063f3de036214610836578063f446c1d01461093e578063fc0c546a14610953578063fee3f7f91461097357600080fd5b8063ecb586a5146108c7578063edfb7801146108e7578063f1dc3cc9146108fe578063f2fde38b1461091e57600080fd5b8063e2e7d264116100dc578063e2e7d26414610865578063e369885314610885578063e38244621461089a578063e5d9e903146108b057600080fd5b8063ca8ca15414610821578063d73792a914610836578063ddca3f431461084f57600080fd5b8063a6b0a7181161016f578063b4b577ad11610149578063b4b577ad146107bd578063bb7b8b80146107d3578063bc063e1a146107e8578063c66106571461080157600080fd5b8063a6b0a71814610758578063aaf5eb681461078c578063ab5ac061146107a857600080fd5b80638da5cb5b116101ab5780638da5cb5b146106d6578063923e563c146107085780639c868ac01461071e5780639fdaea0c1461073857600080fd5b806375bacd56146106805780637dafa3641461069657806385f11d1e146106b657600080fd5b80634903b0d1116102b657806358680d0b1161025457806362203d741161022357806362203d74146106205780636d4366b714610640578063715018a61461065557806373d459e41461066a57600080fd5b806358680d0b146105b75780635b41b908146105cd5780635b5a1467146105e0578063610358a91461060057600080fd5b80634fb08c5e116102905780634fb08c5e1461054c578063524c39011461056c5780635409491a14610581578063556d6e9f1461059757600080fd5b80634903b0d1146104f75780634eac4835146105175780634f12fe971461053757600080fd5b806330c540851161032357806339698415116102fd57806339698415146104975780633c157e64146104ae578063405e28f8146104ce5780634515cef3146104e457600080fd5b806330c54085146104335780633883e11914610448578063392e53cd1461046857600080fd5b8063226840fb1161035f578063226840fb146103dc57806329357750146103f35780632a426896146104085780633046f9721461041e57600080fd5b806306e9481c1461038657806314052288146103b05780632081066c146103c6575b600080fd5b34801561039257600080fd5b5061039d6201518081565b6040519081526020015b60405180910390f35b3480156103bc57600080fd5b5061039d60155481565b3480156103d257600080fd5b5061039d60145481565b3480156103e857600080fd5b506103f1610989565b005b3480156103ff57600080fd5b5061039d600381565b34801561041457600080fd5b5061039d60195481565b34801561042a57600080fd5b506103f16109c1565b34801561043f57600080fd5b506103f16109fe565b34801561045457600080fd5b5061039d6104633660046143bb565b610b56565b34801561047457600080fd5b50601a5461048790610100900460ff1681565b60405190151581526020016103a7565b3480156104a357600080fd5b5061039d620f424081565b3480156104ba57600080fd5b506103f16104c93660046143f3565b610d1d565b3480156104da57600080fd5b5061039d60165481565b6103f16104f2366004614415565b610f2f565b34801561050357600080fd5b5061039d610512366004614440565b6115e3565b34801561052357600080fd5b506103f1610532366004614470565b6115fa565b34801561054357600080fd5b506103f1611a4d565b34801561055857600080fd5b5061039d6105673660046143f3565b611b54565b34801561057857600080fd5b506103f1611b6a565b34801561058d57600080fd5b5061039d60125481565b3480156105a357600080fd5b5061039d6105b2366004614510565b611ca4565b3480156105c357600080fd5b5061039d60175481565b6103f16105db36600461453c565b611dee565b3480156105ec57600080fd5b506103f16105fb3660046143f3565b612223565b34801561060c57600080fd5b506103f161061b366004614440565b61237e565b34801561062c57600080fd5b5061039d61063b366004614440565b612410565b34801561064c57600080fd5b5061039d601281565b34801561066157600080fd5b506103f1612420565b34801561067657600080fd5b5061039d6159d881565b34801561068c57600080fd5b5061039d60105481565b3480156106a257600080fd5b5061039d6106b1366004614440565b612434565b3480156106c257600080fd5b5061039d6106d1366004614510565b612444565b3480156106e257600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103a7565b34801561071457600080fd5b5061039d6108fc81565b34801561072a57600080fd5b50601a546104879060ff1681565b34801561074457600080fd5b506103f1610753366004614415565b612522565b34801561076457600080fd5b506106f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561079857600080fd5b5061039d670de0b6b3a764000081565b3480156107b457600080fd5b5061039d600a81565b3480156107c957600080fd5b5061039d60135481565b3480156107df57600080fd5b5061039d612b23565b3480156107f457600080fd5b5061039d64012a05f20081565b34801561080d57600080fd5b506106f061081c366004614440565b612bdf565b34801561082d57600080fd5b506103f1612bff565b34801561084257600080fd5b5061039d6402540be40081565b34801561085b57600080fd5b5061039d600e5481565b34801561087157600080fd5b5061039d610880366004614440565b612c60565b34801561089157600080fd5b506103f1612d5c565b3480156108a657600080fd5b5061039d60185481565b3480156108bc57600080fd5b5061039d6203f48081565b3480156108d357600080fd5b506103f16108e236600461456e565b612ded565b3480156108f357600080fd5b5061039d624f1a0081565b34801561090a57600080fd5b506103f1610919366004614510565b613053565b34801561092a57600080fd5b506103f161093936600461459b565b613226565b34801561094a57600080fd5b5061039d61329c565b34801561095f57600080fd5b506011546106f0906001600160a01b031681565b34801561097f57600080fd5b5061039d600f5481565b6109916132ab565b600060168190556040517f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a19190a1565b6109c96132ab565b601a805460ff191690556040517f061284ffa2814ace135f62907c78a7cff0f070efe7e6a0a42740ea1da2c8bdc890600090a1565b610a066132ab565b60005b6003811015610b5357600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088360038110610a3c57610a3c6145b6565b01546001600160a01b03161415610a7357600b8260038110610a6057610a606145b6565b0154610a6c90476145e2565b9050610b13565b600b8260038110610a8657610a866145b6565b015460088360038110610a9b57610a9b6145b6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b0691906145f9565b610b1091906145e2565b90505b8015610b4057610b4060088360038110610b2f57610b2f6145b6565b01546001600160a01b031682613305565b5080610b4b81614612565b915050610a09565b50565b604080516060810191829052600091829190600b9060039082845b815481526020019060010190808311610b7157505050505090506000610b95613348565b90506000610ba383836133e9565b905060005b6003811015610c49578515610bf957868160038110610bc957610bc96145b6565b6020020151848260038110610be057610be06145b6565b60200201818151610bf1919061462d565b905250610c37565b868160038110610c0b57610c0b6145b6565b6020020151848260038110610c2257610c226145b6565b60200201818151610c3391906145e2565b9052505b80610c4181614612565b915050610ba8565b506000610c5684846133e9565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd191906145f9565b905060008715610cec57610ce584846145e2565b9050610cf9565b610cf683856145e2565b90505b83610d048383614645565b610d0e9190614664565b96505050505050505b92915050565b610d256132ab565b62015180601454610d36919061462d565b421015610d7c5760405162461bcd60e51b815260206004820152600f60248201526e646576203a20746f6f206561726c7960881b60448201526064015b60405180910390fd5b610d89620151804261462d565b811015610dd15760405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b6044820152606401610d73565b6000610ddb613348565b9050600083118015610def5750620f424083105b610e495760405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e64206044820152644d41585f4160d81b6064820152608401610d73565b808310158015610e635750610e5f600a82614645565b8311155b80610e8257508083108015610e82575080610e7f600a85614645565b10155b610ece5760405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f4100000000006044820152606401610d73565b60128190556013839055426014819055601583905560408051838152602081018690528082019290925260608201849052517fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c2549181900360800190a1505050565b610f37613404565b601a5460ff1615610f735760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d73565b601154600160a01b900460ff16610fca573415610fca5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d73565b610fd2614271565b6000610fe0600160036145e2565b610feb906004614645565b6003600e54610ffa9190614645565b6110049190614664565b600f549091506000611014613348565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561106b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061108f91906145f9565b6040805160608101918290529192506000918291600b9060039082845b8154815260200190600101908083116110ac575050505050905060008311156110dc576110d981856133e9565b91505b60006040518060600160405280836000600381106110fc576110fc6145b6565b6020020151815260200183600160038110611119576111196145b6565b6020020151815260200183600260038110611136576111366145b6565b60200201519052905060005b600381101561122257846111c15760008b8260038110611164576111646145b6565b6020020151116111c15760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f696044820152616e7360f01b6064820152608401610d73565b8a81600381106111d3576111d36145b6565b60200201518382600381106111ea576111ea6145b6565b60200201516111f9919061462d565b82826003811061120b5761120b6145b6565b60200201528061121a81614612565b915050611142565b50600061122f82876133e9565b90508381116112805760405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e2044300000000000006044820152606401610d73565b80851561142e5760005b600381101561141c576000868683600381106112a8576112a86145b6565b60200201516112b79086614645565b6112c19190614664565b905060008583600381106112d7576112d76145b6565b602002015182111561130b578583600381106112f5576112f56145b6565b602002015161130490836145e2565b9050611330565b8186846003811061131e5761131e6145b6565b602002015161132d91906145e2565b90505b6402540be400611340828e614645565b61134a9190614664565b8d846003811061135c5761135c6145b6565b60200201526402540be4008b8e856003811061137a5761137a6145b6565b60200201516113899190614645565b6113939190614664565b8684600381106113a5576113a56145b6565b60200201516113b491906145e2565b600b84600381106113c7576113c76145b6565b01558c83600381106113db576113db6145b6565b60200201518684600381106113f2576113f26145b6565b6020020181815161140391906145e2565b905250829150611414905081614612565b91505061128a565b5061142783886133e9565b905061143d565b61143b600b84600361428f565b505b60008661144b57508161146d565b8561145681846145e2565b6114609089614645565b61146a9190614664565b90505b8b8110156114b45760405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b6044820152606401610d73565b60005b600381101561151c5760008e82600381106114d4576114d46145b6565b602002015190506000600883600381106114f0576114f06145b6565b01546001600160a01b03169050611507818361345e565b5050808061151490614612565b9150506114b7565b506011546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b15801561156957600080fd5b505af115801561157d573d6000803e3d6000fd5b503392507f423f6495a08fc652425cf4ed0d1f9e37e571d9b9529b1c1c23cce780b2e7df0d91508f90508d866115b3868d61462d565b6040516115c394939291906146a9565b60405180910390a250505050505050505050506115df60018055565b5050565b600b81600381106115f357600080fd5b0154905081565b601a54610100900460ff16156116525760405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a6564006044820152606401610d73565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146116ca5760405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f72790000000000000000006044820152606401610d73565b620f424085111561171d5760405162461bcd60e51b815260206004820152601260248201527f5f412065786365656473206d6178696d756d00000000000000000000000000006044820152606401610d73565b64012a05f2008411156117725760405162461bcd60e51b815260206004820152601460248201527f5f6665652065786365656473206d6178696d756d0000000000000000000000006044820152606401610d73565b6402540be4008311156117c75760405162461bcd60e51b815260206004820152601a60248201527f5f61646d696e5f6665652065786365656473206d6178696d756d0000000000006044820152606401610d73565b601a805461ff00191661010017905560005b60038110156119ee5760008782600381106117f6576117f66145b6565b60200201516001600160a01b031614156118415760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204164647265737360a01b6044820152606401610d73565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee88836003811061186a5761186a6145b6565b60200201516001600160a01b0316141561189957506011805460ff60a01b1916600160a01b1790556012611917565b8782600381106118ab576118ab6145b6565b60200201516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118ed573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061191191906146d7565b60ff1690505b60128111156119745760405162461bcd60e51b8152602060048201526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f742065786365656044820152630c84062760e31b6064820152608401610d73565b61197f8160126145e2565b61198a90600a6147de565b6002836003811061199d5761199d6145b6565b0155600282600381106119b2576119b26145b6565b01546119c690670de0b6b3a7640000614645565b600583600381106119d9576119d96145b6565b015550806119e681614612565b9150506117d9565b506119fc60088760036142c9565b5060128590556013859055600e849055600f839055611a1e624f1a004261462d565b601955601180546001600160a01b0319166001600160a01b038316179055611a4582613226565b505050505050565b611a556132ab565b601654421015611aa05760405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b6044820152606401610d73565b601654611afe5760405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201526507420626520360d41b6064820152608401610d73565b6000601655601754600e819055601854600f8190556040517fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d192611b4a92908252602082015260400190565b60405180910390a1565b600080611b6184846134df565b50949350505050565b611b726132ab565b60005b6003811015611c785773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088260038110611ba657611ba66145b6565b01546001600160a01b03161415611bd25747600b8260038110611bcb57611bcb6145b6565b0155611c66565b60088160038110611be557611be56145b6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611c2c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c5091906145f9565b600b8260038110611c6357611c636145b6565b01555b80611c7081614612565b915050611b75565b506040517f2c7203581ca666b8c5094c11c03f0b19b3750234a9d281bcbc88a260bcb006de90600090a1565b60408051606081019182905260009182919060059060039082845b815481526020019060010190808311611cbf57505050505090506000611ce36137e1565b90506000670de0b6b3a7640000838860038110611d0257611d026145b6565b6020020151611d119087614645565b611d1b9190614664565b828860038110611d2d57611d2d6145b6565b6020020151611d3c919061462d565b90506000611d4c8888848661389b565b90506000848860038110611d6257611d626145b6565b6020020151670de0b6b3a7640000600184878c60038110611d8557611d856145b6565b6020020151611d9491906145e2565b611d9e91906145e2565b611da89190614645565b611db29190614664565b905060006402540be40082600e54611dca9190614645565b611dd49190614664565b9050611de081836145e2565b9a9950505050505050505050565b611df6613404565b601a5460ff1615611e325760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d73565b601154600160a01b900460ff16611e89573415611e895760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d73565b604080516060810191829052600091600b9060039082845b815481526020019060010190808311611ea157505050505090506000611ec682613aa5565b90506000670de0b6b3a764000060058860038110611ee657611ee66145b6565b0154611ef29087614645565b611efc9190614664565b828860038110611f0e57611f0e6145b6565b6020020151611f1d919061462d565b90506000611f2d8888848661389b565b90506000600182858a60038110611f4657611f466145b6565b6020020151611f5591906145e2565b611f5f91906145e2565b905060006402540be400600e5483611f779190614645565b611f819190614664565b905060058960038110611f9657611f966145b6565b0154670de0b6b3a7640000611fab83856145e2565b611fb59190614645565b611fbf9190614664565b9150868210156120285760405162461bcd60e51b815260206004820152602e60248201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201526d081d1a185b88195e1c1958dd195960921b6064820152608401610d73565b60006402540be400600f548361203e9190614645565b6120489190614664565b905060058a6003811061205d5761205d6145b6565b0154612071670de0b6b3a764000083614645565b61207b9190614664565b905088878c60038110612090576120906145b6565b602002015161209f919061462d565b600b8c600381106120b2576120b26145b6565b01558083888c600381106120c8576120c86145b6565b60200201516120d791906145e2565b6120e191906145e2565b600b8b600381106120f4576120f46145b6565b0155600060088c6003811061210b5761210b6145b6565b01546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81141561218057348a1461217b5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d73565b612195565b6121956001600160a01b03821633308d613b63565b600060088c600381106121aa576121aa6145b6565b01546001600160a01b031690506121c18186613305565b604080518e8152602081018d90529081018d90526060810186905233907fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989060800160405180910390a250505050505050505061221d60018055565b50505050565b61222b6132ab565b6016541561227b5760405162461bcd60e51b815260206004820181905260248201527f61646d696e5f616374696f6e735f646561646c696e65206d75737420626520306044820152606401610d73565b64012a05f2008211156122d05760405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d00000000000000006044820152606401610d73565b6402540be4008111156123255760405162461bcd60e51b815260206004820152601e60248201527f6465763a2061646d696e206665652065786365656473206d6178696d756d00006044820152606401610d73565b6123326203f4804261462d565b60168190556017839055601882905560408051848152602081018490527f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe0910160405180910390a25050565b6123866132ab565b6108fc811015801561239a57506159d88111155b6123d45760405162461bcd60e51b815260206004820152600b60248201526a496c6c6567616c2067617360a81b6044820152606401610d73565b60108190556040518181527f2464fc1685c7ca97fc1e1c439a8d567d9ee1522118c0a0b3079220ca5f8fc3f6906020015b60405180910390a150565b600581600381106115f357600080fd5b6124286132ab565b6124326000613bfb565b565b600281600381106115f357600080fd5b60008061244f6137e1565b6040805160608101918290529192506000919060029060039082845b81548152602001906001019080831161246b57505050505090506000818760038110612499576124996145b6565b60200201516124a89086614645565b8388600381106124ba576124ba6145b6565b60200201516124c9919061462d565b905060006124d98888848761389b565b905060008388600381106124ef576124ef6145b6565b6020020151600183878b60038110612509576125096145b6565b602002015161251891906145e2565b611da891906145e2565b61252a613404565b601a5460ff16156125665760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d73565b601154604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa1580156125b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125d491906145f9565b9050600081116126265760405162461bcd60e51b815260206004820152601660248201527f6465763a207a65726f20746f74616c20737570706c79000000000000000000006044820152606401610d73565b6000612634600160036145e2565b61263f906004614645565b6003600e5461264e9190614645565b6126589190614664565b600f549091506000612668613348565b60408051606081019182905291925060009190600b9060039082845b815481526020019060010190808311612684575050505050905060006040518060600160405280836000600381106126be576126be6145b6565b60200201518152602001836001600381106126db576126db6145b6565b60200201518152602001836002600381106126f8576126f86145b6565b602002015190529050600061270d83856133e9565b905060005b600381101561276a5789816003811061272d5761272d6145b6565b6020020151838260038110612744576127446145b6565b6020020181815161275591906145e2565b9052508061276281614612565b915050612712565b50600061277783866133e9565b9050612781614271565b60005b6003811015612916576000848783600381106127a2576127a26145b6565b60200201516127b19086614645565b6127bb9190614664565b905060008683600381106127d1576127d16145b6565b6020020151821115612805578683600381106127ef576127ef6145b6565b60200201516127fe90836145e2565b905061282a565b81878460038110612818576128186145b6565b602002015161282791906145e2565b90505b6402540be40061283a828d614645565b6128449190614664565b848460038110612856576128566145b6565b60200201526402540be4008a858560038110612874576128746145b6565b60200201516128839190614645565b61288d9190614664565b87846003811061289f5761289f6145b6565b60200201516128ae91906145e2565b600b84600381106128c1576128c16145b6565b01558383600381106128d5576128d56145b6565b60200201518784600381106128ec576128ec6145b6565b602002018181516128fd91906145e2565b90525082915061290e905081614612565b915050612784565b50600061292385886133e9565b90506000848b61293384836145e2565b61293d9190614645565b6129479190614664565b9050600081116129a55760405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201526206e20360ec1b6064820152608401610d73565b6129b060018261462d565b90508b8111156129f95760405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b6044820152606401610d73565b60115460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612a4557600080fd5b505af1158015612a59573d6000803e3d6000fd5b5050505060005b6003811015612ad75760008e8260038110612a7d57612a7d6145b6565b60200201511115612ac557612ac560088260038110612a9e57612a9e6145b6565b01546001600160a01b03168f8360038110612abb57612abb6145b6565b6020020151613305565b80612acf81614612565b915050612a60565b50612ae2818c6145e2565b9a50336001600160a01b03167f173599dbf9c6ca6f7c3b590df07ae98a45d74ff54065505141e7de6c46a624c28e85878f6040516115c394939291906146a9565b600080612b3e612b316137e1565b612b39613348565b613c4b565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612b95573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612bb991906145f9565b905080612bce670de0b6b3a764000084614645565b612bd89190614664565b9250505090565b60088160038110612bef57600080fd5b01546001600160a01b0316905081565b612c076132ab565b6000612c11613348565b6012819055601381905542601481905560158190556040519192507f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc2019389161240591848252602082015260400190565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088360038110612c8a57612c8a6145b6565b01546001600160a01b03161415612cba57600b8260038110612cae57612cae6145b6565b0154610d1790476145e2565b600b8260038110612ccd57612ccd6145b6565b015460088360038110612ce257612ce26145b6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612d29573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612d4d91906145f9565b610d1791906145e2565b919050565b612d646132ab565b4260195411612db55760405162461bcd60e51b815260206004820152601160248201527f457863656564656420646561646c696e650000000000000000000000000000006044820152606401610d73565b601a805460ff191660011790556040517fbe26733c2bf6ff3ea5ba8cfe744422bd49052ff9ed5685c9e81e6f9321dbaddd90600090a1565b612df5613404565b601154604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015612e3f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6391906145f9565b9050612e6d614271565b612e75614271565b60005b6003811015612f9a5760008487600b8460038110612e9857612e986145b6565b0154612ea49190614645565b612eae9190614664565b9050858260038110612ec257612ec26145b6565b6020020151811015612f2f5760405162461bcd60e51b815260206004820152603060248201527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201526f1b9cc81d1a185b88195e1c1958dd195960821b6064820152608401610d73565b80600b8360038110612f4357612f436145b6565b016000828254612f5391906145e2565b90915550819050848360038110612f6c57612f6c6145b6565b6020020152612f8760088360038110610b2f57610b2f6145b6565b5080612f9281614612565b915050612e78565b5060115460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612fe757600080fd5b505af1158015612ffb573d6000803e3d6000fd5b503392507fa49d4cf02656aebf8c771f5a8585638a2a15ee6c97cf7205d4208ed7c1df252d91508490508361303089886145e2565b60405161303f939291906147ea565b60405180910390a25050506115df60018055565b61305b613404565b601a5460ff16156130975760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d73565b6000806130a485856134df565b91509150828210156130f85760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f76656400000000000000006044820152606401610d73565b6402540be400600f548261310c9190614645565b6131169190614664565b613120908361462d565b600b8560038110613133576131336145b6565b01600082825461314391906145e2565b909155505060115460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561319457600080fd5b505af11580156131a8573d6000803e3d6000fd5b505050506131d3600885600381106131c2576131c26145b6565b01546001600160a01b031683613305565b604080518581526020810187905290810183905233907f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a09060600160405180910390a2505061322160018055565b505050565b61322e6132ab565b6001600160a01b0381166132935760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610d73565b610b5381613bfb565b60006132a6613348565b905090565b6000546001600160a01b031633146124325760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d73565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415613334576115df3382613de1565b6115df6001600160a01b0383163383613e88565b6015546013546000919042821115610d1757601254601454818311156133ad5761337281856145e2565b61337c82426145e2565b61338684866145e2565b6133909190614645565b61339a9190614664565b6133a4908361462d565b94505050505090565b6133b781856145e2565b6133c182426145e2565b6133cb85856145e2565b6133d59190614645565b6133df9190614664565b6133a490836145e2565b60006133fd6133f784613aa5565b83613c4b565b9392505050565b600260015414156134575760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d73565b6002600155565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156134ca573481146115df5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d73565b6115df6001600160a01b038316333084613b63565b60008060006134ec613348565b905060006134fc600160036145e2565b613507906004614645565b6003600e546135169190614645565b6135209190614664565b6040805160608101918290529192506000919060029060039082845b81548152602001906001019080831161353c57505050505090506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156135ab573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135cf91906145f9565b905060006135db6137e1565b905060006135e98287613c4b565b90506000836135f8838d614645565b6136029190614664565b61360c90836145e2565b905082600061361d898d8486613eb8565b90506000878d60038110613633576136336145b6565b602002015182878f6003811061364b5761364b6145b6565b602002015161365a91906145e2565b6136649190614664565b905060005b60038110156137605760008e8214156136bb578387878a8560038110613691576136916145b6565b60200201516136a09190614645565b6136aa9190614664565b6136b491906145e2565b905061370c565b86868984600381106136cf576136cf6145b6565b60200201516136de9190614645565b6136e89190614664565b8883600381106136fa576136fa6145b6565b602002015161370991906145e2565b90505b6402540be40061371c828d614645565b6137269190614664565b858360038110613738576137386145b6565b6020020181815161374991906145e2565b90525081905061375881614612565b915050613669565b50600061376f8b8f8688613eb8565b848f60038110613781576137816145b6565b602002015161379091906145e2565b9050888e600381106137a4576137a46145b6565b60200201516137b46001836145e2565b6137be9190614664565b9050806137cb81846145e2565b9c509c5050505050505050505050509250929050565b6137e9614271565b6040805160608101918290529060059060039082845b8154815260200190600101908083116137ff575050505050905060005b600381101561389757670de0b6b3a7640000600b8260038110613841576138416145b6565b0154838360038110613855576138556145b6565b60200201516138649190614645565b61386e9190614664565b828260038110613880576138806145b6565b60200201528061388f81614612565b91505061381c565b5090565b60008385141580156138ad5750600385105b80156138b95750600384105b6139055760405162461bcd60e51b815260206004820152601160248201527f496c6c6567616c20706172616d657465720000000000000000000000000000006044820152606401610d73565b600061390f613348565b9050600061391d8483613c4b565b90508060008061392e600386614645565b90506000805b60038110156139b7578b81141561394d57899150613977565b8a811461397257888160038110613966576139666145b6565b60200201519150613977565b6139a5565b613981828561462d565b935061398e600383614645565b6139988787614645565b6139a29190614664565b94505b806139af81614612565b915050613934565b506139c3600383614645565b6139cd8686614645565b6139d79190614664565b935060006139e58387614664565b6139ef908561462d565b9050600086815b60ff811015613a91578192508884836002613a119190614645565b613a1b919061462d565b613a2591906145e2565b88613a308480614645565b613a3a919061462d565b613a449190614664565b915082821115613a69576001613a5a84846145e2565b11613a6457613a91565b613a7f565b6001613a7583856145e2565b11613a7f57613a91565b80613a8981614612565b9150506139f6565b50985050505050505050505b949350505050565b613aad614271565b6040805160608101918290529060059060039082845b815481526020019060010190808311613ac3575050505050905060005b6003811015613b5d57670de0b6b3a7640000838260038110613b0457613b046145b6565b6020020151838360038110613b1b57613b1b6145b6565b6020020151613b2a9190614645565b613b349190614664565b828260038110613b4657613b466145b6565b602002015280613b5581614612565b915050613ae0565b50919050565b6040516001600160a01b038085166024830152831660448201526064810182905261221d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261407c565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060005b6003811015613c8f57848160038110613c6c57613c6c6145b6565b6020020151613c7b908361462d565b915080613c8781614612565b915050613c51565b5080613c9f576000915050610d17565b60008181613cae600387614645565b905060005b60ff811015613dd5578260005b6003811015613d145760038a8260038110613cdd57613cdd6145b6565b6020020151613cec9190614645565b613cf68684614645565b613d009190614664565b915080613d0c81614612565b915050613cc0565b508394508060036001613d27919061462d565b613d319190614645565b84613d3d6001866145e2565b613d479190614645565b613d51919061462d565b84613d5d600384614645565b613d678987614645565b613d71919061462d565b613d7b9190614645565b613d859190614664565b935084841115613dab576001613d9b86866145e2565b11613da65750613dd5565b613dc2565b6001613db785876145e2565b11613dc25750613dd5565b5080613dcd81614612565b915050613cb3565b50909695505050505050565b6000826001600160a01b031660105483604051600060405180830381858888f193505050503d8060008114613e32576040519150601f19603f3d011682016040523d82523d6000602084013e613e37565b606091505b50509050806132215760405162461bcd60e51b815260206004820152601360248201527f455448207472616e73666572206661696c6564000000000000000000000000006044820152606401610d73565b6040516001600160a01b03831660248201526044810182905261322190849063a9059cbb60e01b90606401613b97565b600060038410613f0a5760405162461bcd60e51b815260206004820152601460248201527f6465763a20692061626f7665204e5f434f494e530000000000000000000000006044820152606401610d73565b81600080613f19600389614645565b90506000805b6003811015613f9257888114613f4d57878160038110613f4157613f416145b6565b60200201519150613f52565b613f80565b613f5c828561462d565b9350613f69600383614645565b613f738887614645565b613f7d9190614664565b94505b80613f8a81614612565b915050613f1f565b50613f9e600383614645565b613fa88786614645565b613fb29190614664565b93506000613fc08388614664565b613fca908561462d565b9050600087815b60ff81101561406c578192508984836002613fec9190614645565b613ff6919061462d565b61400091906145e2565b8861400b8480614645565b614015919061462d565b61401f9190614664565b91508282111561404457600161403584846145e2565b1161403f5761406c565b61405a565b600161405083856145e2565b1161405a5761406c565b8061406481614612565b915050613fd1565b509b9a5050505050505050505050565b60006140d1826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166141519092919063ffffffff16565b90508051600014806140f25750808060200190518101906140f29190614813565b6132215760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610d73565b6060613a9d848460008585600080866001600160a01b03168587604051614178919061485c565b60006040518083038185875af1925050503d80600081146141b5576040519150601f19603f3d011682016040523d82523d6000602084013e6141ba565b606091505b50915091506141cb878383876141d6565b979650505050505050565b6060831561424257825161423b576001600160a01b0385163b61423b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d73565b5081613a9d565b613a9d83838151156142575781518083602001fd5b8060405162461bcd60e51b8152600401610d739190614878565b60405180606001604052806003906020820280368337509192915050565b82600381019282156142bd579160200282015b828111156142bd5782518255916020019190600101906142a2565b50613897929150614311565b82600381019282156142bd579160200282015b828111156142bd57825182546001600160a01b0319166001600160a01b039091161782556020909201916001909101906142dc565b5b808211156138975760008155600101614312565b6040516060810167ffffffffffffffff8111828210171561435757634e487b7160e01b600052604160045260246000fd5b60405290565b600082601f83011261436e57600080fd5b614376614326565b80606084018581111561438857600080fd5b845b818110156143a257803584526020938401930161438a565b509095945050505050565b8015158114610b5357600080fd5b600080608083850312156143ce57600080fd5b6143d8848461435d565b915060608301356143e8816143ad565b809150509250929050565b6000806040838503121561440657600080fd5b50508035926020909101359150565b6000806080838503121561442857600080fd5b614432848461435d565b946060939093013593505050565b60006020828403121561445257600080fd5b5035919050565b80356001600160a01b0381168114612d5757600080fd5b600080600080600080610100878903121561448a57600080fd5b87601f88011261449957600080fd5b6144a1614326565b80606089018a8111156144b357600080fd5b895b818110156144d4576144c681614459565b8452602093840193016144b5565b50909750359550506080870135935060a087013592506144f660c08801614459565b915061450460e08801614459565b90509295509295509295565b60008060006060848603121561452557600080fd5b505081359360208301359350604090920135919050565b6000806000806080858703121561455257600080fd5b5050823594602084013594506040840135936060013592509050565b6000806080838503121561458157600080fd5b82359150614592846020850161435d565b90509250929050565b6000602082840312156145ad57600080fd5b6133fd82614459565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156145f4576145f46145cc565b500390565b60006020828403121561460b57600080fd5b5051919050565b6000600019821415614626576146266145cc565b5060010190565b60008219821115614640576146406145cc565b500190565b600081600019048311821515161561465f5761465f6145cc565b500290565b60008261468157634e487b7160e01b600052601260045260246000fd5b500490565b8060005b600381101561221d57815184526020938401939091019060010161468a565b61010081016146b88287614686565b6146c56060830186614686565b60c082019390935260e0015292915050565b6000602082840312156146e957600080fd5b815160ff811681146133fd57600080fd5b600181815b8085111561473557816000190482111561471b5761471b6145cc565b8085161561472857918102915b93841c93908002906146ff565b509250929050565b60008261474c57506001610d17565b8161475957506000610d17565b816001811461476f576002811461477957614795565b6001915050610d17565b60ff84111561478a5761478a6145cc565b50506001821b610d17565b5060208310610133831016604e8410600b84101617156147b8575081810a610d17565b6147c283836146fa565b80600019048211156147d6576147d66145cc565b029392505050565b60006133fd838361473d565b60e081016147f88286614686565b6148056060830185614686565b8260c0830152949350505050565b60006020828403121561482557600080fd5b81516133fd816143ad565b60005b8381101561484b578181015183820152602001614833565b8381111561221d5750506000910152565b6000825161486e818460208701614830565b9190910192915050565b6020815260008251806020840152614897816040850160208701614830565b601f01601f1916919091016040019291505056fea164736f6c634300080a000aa164736f6c634300080a000a