false
true
0

Contract Address Details

0xe72569f027F18Dd2a9a1bfdffC79709C04DE6eb8

Contract Name
pDexStableSwapTwoPoolDeployer
Creator
0x615470–83d2bf at 0x20b9ce–da370b
Balance
0 PLS ( )
Tokens
Fetching tokens...
Transactions
1 Transactions
Transfers
0 Transfers
Gas Used
28,619
Last Balance Update
25956778
Contract is not verified. However, we found a verified contract with the same bytecode in Blockscout DB 0xcd31d98782dd1fc438563a7814de4785744623f6.
All metadata displayed below is from that contract. In order to verify current contract, click Verify & Publish button
Verify & Publish
Contract name:
pDexStableSwapTwoPoolDeployer




Optimization enabled
true
Compiler version
v0.8.10+commit.fc410830




Optimization runs
400
Verified at
2025-04-24T15:15:07.510265Z

contracts/pDexStableSwapTwoPoolDeployer.sol

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

import '@openzeppelin/contracts/access/Ownable.sol';
import './pDexStableSwapTwoPool.sol';

contract pDexStableSwapTwoPoolDeployer is Ownable {
    uint256 public constant N_COINS = 2;

    /**
     * @notice constructor
     */
    constructor() {}

    // returns sorted token addresses, used to handle return values from pairs sorted in this order
    function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {
        require(tokenA != tokenB, 'IDENTICAL_ADDRESSES');
        (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);
    }

    /**
     * @notice createSwapPair
     * @param _tokenA: Addresses of ERC20 conracts .
     * @param _tokenB: 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,
        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) = sortTokens(_tokenA, _tokenB);
        address[N_COINS] memory coins = [t0, t1];
        // create swap contract
        bytes memory bytecode = type(pDexStableSwapTwoPool).creationCode;
        bytes32 salt = keccak256(abi.encodePacked(t0, t1, msg.sender, block.timestamp, block.chainid));
        address swapContract;
        assembly {
            swapContract := create2(0, add(bytecode, 32), mload(bytecode), salt)
        }
        pDexStableSwapTwoPool(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/pDexStableSwapTwoPool.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 pDexStableSwapTwoPool is Ownable, ReentrancyGuard {
    using SafeERC20 for IERC20;

    uint256 public constant N_COINS = 2;

    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]];

        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]];
        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":"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

Verify & Publish
0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614ec98061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100575760003560e01c8063293577501461005c578063715018a6146100775780638da5cb5b146100815780639013148d146100a6578063f2fde38b146100b9575b600080fd5b610064600281565b6040519081526020015b60405180910390f35b61007f6100cc565b005b6000546001600160a01b03165b6040516001600160a01b03909116815260200161006e565b61008e6100b43660046104ad565b6100e0565b61007f6100c736600461051e565b6102c1565b6100d461033a565b6100de6000610394565b565b60006100ea61033a565b6001600160a01b0388161580159061010a57506001600160a01b03871615155b80156101285750866001600160a01b0316886001600160a01b031614155b6101695760405162461bcd60e51b815260206004820152600d60248201526c24b63632b3b0b6103a37b5b2b760991b60448201526064015b60405180910390fd5b6000806101768a8a6103f1565b9150915060006040518060400160405280846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681525090506000604051806020016101c990610484565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606087811b8216602084015286811b8216603484015233901b16604882015242605c82015246607c820152909150600090609c016040516020818303038152906040528051906020012090506000818351602085016000f59050806001600160a01b0316634239b1c1858e8e8e8e8e6040518763ffffffff1660e01b815260040161027c96959493929190610540565b600060405180830381600087803b15801561029657600080fd5b505af11580156102aa573d6000803e3d6000fd5b509298505050505050505050979650505050505050565b6102c961033a565b6001600160a01b03811661032e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610160565b61033781610394565b50565b6000546001600160a01b031633146100de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610160565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080826001600160a01b0316846001600160a01b031614156104565760405162461bcd60e51b815260206004820152601360248201527f4944454e544943414c5f414444524553534553000000000000000000000000006044820152606401610160565b826001600160a01b0316846001600160a01b031610610476578284610479565b83835b909590945092505050565b614914806105a983390190565b80356001600160a01b03811681146104a857600080fd5b919050565b600080600080600080600060e0888a0312156104c857600080fd5b6104d188610491565b96506104df60208901610491565b955060408801359450606088013593506080880135925061050260a08901610491565b915061051060c08901610491565b905092959891949750929550565b60006020828403121561053057600080fd5b61053982610491565b9392505050565b60e08101818860005b60028110156105715781516001600160a01b0316835260209283019290910190600101610549565b5050506040820196909652606081019490945260808401929092526001600160a01b0390811660a08401521660c09091015291905056fe60a0604052610fbd600c553480156200001757600080fd5b50620000233362000031565b600180553360805262000081565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b608051614870620000a46000396000818161074a015261146101526148706000f3fe6080604052600436106103815760003560e01c806375bacd56116101d1578063d73792a911610102578063ed8e84f3116100a0578063f3de03621161006f578063f3de036214610816578063f446c1d01461093e578063fc0c546a14610953578063fee3f7f91461097357600080fd5b8063ed8e84f3146108c7578063edfb7801146108e7578063f1dc3cc9146108fe578063f2fde38b1461091e57600080fd5b8063e3103273116100dc578063e310327314610865578063e369885314610885578063e38244621461089a578063e5d9e903146108b057600080fd5b8063d73792a914610816578063ddca3f431461082f578063e2e7d2641461084557600080fd5b8063aaf5eb681161016f578063bb7b8b8011610149578063bb7b8b80146107b3578063bc063e1a146107c8578063c6610657146107e1578063ca8ca1541461080157600080fd5b8063aaf5eb681461076c578063ab5ac06114610788578063b4b577ad1461079d57600080fd5b80638da5cb5b116101ab5780638da5cb5b146106d6578063923e563c146107085780639c868ac01461071e578063a6b0a7181461073857600080fd5b806375bacd56146106805780637dafa3641461069657806385f11d1e146106b657600080fd5b80634903b0d1116102b65780635b36389c1161025457806362203d741161022357806362203d74146106205780636d4366b714610640578063715018a61461065557806373d459e41461066a57600080fd5b80635b36389c146105ad5780635b41b908146105cd5780635b5a1467146105e0578063610358a91461060057600080fd5b8063524c390111610290578063524c39011461054c5780635409491a14610561578063556d6e9f1461057757806358680d0b1461059757600080fd5b80634903b0d1146104f75780634f12fe97146105175780634fb08c5e1461052c57600080fd5b80633046f9721161032357806339698415116102fd578063396984151461048a5780633c157e64146104a1578063405e28f8146104c15780634239b1c1146104d757600080fd5b80633046f9721461043157806330c5408514610446578063392e53cd1461045b57600080fd5b80632081066c1161035f5780632081066c146103db578063226840fb146103f157806329357750146104065780632a4268961461041b57600080fd5b806306e9481c146103865780630b4c7e4d146103b057806314052288146103c5575b600080fd5b34801561039257600080fd5b5061039d6201518081565b6040519081526020015b60405180910390f35b6103c36103be366004614367565b610989565b005b3480156103d157600080fd5b5061039d60115481565b3480156103e757600080fd5b5061039d60105481565b3480156103fd57600080fd5b506103c3611024565b34801561041257600080fd5b5061039d600281565b34801561042757600080fd5b5061039d60155481565b34801561043d57600080fd5b506103c361105c565b34801561045257600080fd5b506103c3611099565b34801561046757600080fd5b5060165461047a90610100900460ff1681565b60405190151581526020016103a7565b34801561049657600080fd5b5061039d620f424081565b3480156104ad57600080fd5b506103c36104bc366004614392565b6111f1565b3480156104cd57600080fd5b5061039d60125481565b3480156104e357600080fd5b506103c36104f23660046143cb565b6113fe565b34801561050357600080fd5b5061039d61051236600461446a565b611850565b34801561052357600080fd5b506103c3611867565b34801561053857600080fd5b5061039d610547366004614392565b61196e565b34801561055857600080fd5b506103c3611986565b34801561056d57600080fd5b5061039d600e5481565b34801561058357600080fd5b5061039d610592366004614483565b611ac0565b3480156105a357600080fd5b5061039d60135481565b3480156105b957600080fd5b506103c36105c83660046144af565b611c09565b6103c36105db3660046144dc565b611e6f565b3480156105ec57600080fd5b506103c36105fb366004614392565b6122a3565b34801561060c57600080fd5b506103c361061b36600461446a565b6123fe565b34801561062c57600080fd5b5061039d61063b36600461446a565b612490565b34801561064c57600080fd5b5061039d601281565b34801561066157600080fd5b506103c36124a0565b34801561067657600080fd5b5061039d6159d881565b34801561068c57600080fd5b5061039d600c5481565b3480156106a257600080fd5b5061039d6106b136600461446a565b6124b4565b3480156106c257600080fd5b5061039d6106d1366004614483565b6124c4565b3480156106e257600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103a7565b34801561071457600080fd5b5061039d6108fc81565b34801561072a57600080fd5b5060165461047a9060ff1681565b34801561074457600080fd5b506106f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561077857600080fd5b5061039d670de0b6b3a764000081565b34801561079457600080fd5b5061039d600a81565b3480156107a957600080fd5b5061039d600f5481565b3480156107bf57600080fd5b5061039d6125a0565b3480156107d457600080fd5b5061039d64012a05f20081565b3480156107ed57600080fd5b506106f06107fc36600461446a565b61265c565b34801561080d57600080fd5b506103c361267c565b34801561082257600080fd5b5061039d6402540be40081565b34801561083b57600080fd5b5061039d600a5481565b34801561085157600080fd5b5061039d61086036600461446a565b6126dd565b34801561087157600080fd5b506103c3610880366004614367565b6127d9565b34801561089157600080fd5b506103c3612dbc565b3480156108a657600080fd5b5061039d60145481565b3480156108bc57600080fd5b5061039d6203f48081565b3480156108d357600080fd5b5061039d6108e236600461451c565b612e4d565b3480156108f357600080fd5b5061039d624f1a0081565b34801561090a57600080fd5b506103c3610919366004614483565b613011565b34801561092a57600080fd5b506103c3610939366004614554565b6131e4565b34801561094a57600080fd5b5061039d61325a565b34801561095f57600080fd5b50600d546106f0906001600160a01b031681565b34801561097f57600080fd5b5061039d600b5481565b610991613269565b60165460ff16156109d25760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064015b60405180910390fd5b600d54600160a01b900460ff16610a29573415610a295760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b610a3161422b565b6000610a3f60016002614585565b610a4a90600461459c565b6002600a54610a59919061459c565b610a6391906145bb565b600b549091506000610a736132c3565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aee91906145dd565b6040805180820191829052919250600091829160089060029082845b815481526020019060010190808311610b0a57505050505090506000831115610b3a57610b378185613364565b91505b6000604051806040016040528083600060028110610b5a57610b5a6145f6565b6020020151815260200183600160028110610b7757610b776145f6565b60200201519052905060005b6002811015610c635784610c025760008b8260028110610ba557610ba56145f6565b602002015111610c025760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f696044820152616e7360f01b60648201526084016109c9565b8a8160028110610c1457610c146145f6565b6020020151838260028110610c2b57610c2b6145f6565b6020020151610c3a919061460c565b828260028110610c4c57610c4c6145f6565b602002015280610c5b81614624565b915050610b83565b506000610c708287613364565b9050838111610cc15760405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e20443000000000000060448201526064016109c9565b808515610e6f5760005b6002811015610e5d57600086868360028110610ce957610ce96145f6565b6020020151610cf8908661459c565b610d0291906145bb565b90506000858360028110610d1857610d186145f6565b6020020151821115610d4c57858360028110610d3657610d366145f6565b6020020151610d459083614585565b9050610d71565b81868460028110610d5f57610d5f6145f6565b6020020151610d6e9190614585565b90505b6402540be400610d81828e61459c565b610d8b91906145bb565b8d8460028110610d9d57610d9d6145f6565b60200201526402540be4008b8e8560028110610dbb57610dbb6145f6565b6020020151610dca919061459c565b610dd491906145bb565b868460028110610de657610de66145f6565b6020020151610df59190614585565b60088460028110610e0857610e086145f6565b01558c8360028110610e1c57610e1c6145f6565b6020020151868460028110610e3357610e336145f6565b60200201818151610e449190614585565b905250829150610e55905081614624565b915050610ccb565b50610e688388613364565b9050610e7e565b610e7c6008846002614249565b505b600086610e8c575081610eae565b85610e978184614585565b610ea1908961459c565b610eab91906145bb565b90505b8b811015610ef55760405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b60448201526064016109c9565b60005b6002811015610f5d5760008e8260028110610f1557610f156145f6565b60200201519050600060068360028110610f3157610f316145f6565b01546001600160a01b03169050610f48818361337f565b50508080610f5590614624565b915050610ef8565b50600d546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015610faa57600080fd5b505af1158015610fbe573d6000803e3d6000fd5b503392507f26f55a85081d24974e85c6c00045d0f0453991e95873f52bff0d21af4079a76891508f90508d86610ff4868d61460c565b6040516110049493929190614662565b60405180910390a2505050505050505050505061102060018055565b5050565b61102c613400565b600060128190556040517f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a19190a1565b611064613400565b6016805460ff191690556040517f061284ffa2814ace135f62907c78a7cff0f070efe7e6a0a42740ea1da2c8bdc890600090a1565b6110a1613400565b60005b60028110156111ee57600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600683600281106110d7576110d76145f6565b01546001600160a01b0316141561110e57600882600281106110fb576110fb6145f6565b01546111079047614585565b90506111ae565b60088260028110611121576111216145f6565b015460068360028110611136576111366145f6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561117d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a191906145dd565b6111ab9190614585565b90505b80156111db576111db600683600281106111ca576111ca6145f6565b01546001600160a01b03168261345a565b50806111e681614624565b9150506110a4565b50565b6111f9613400565b6201518060105461120a919061460c565b42101561124b5760405162461bcd60e51b815260206004820152600f60248201526e646576203a20746f6f206561726c7960881b60448201526064016109c9565b611258620151804261460c565b8110156112a05760405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b60448201526064016109c9565b60006112aa6132c3565b90506000831180156112be5750620f424083105b6113185760405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e64206044820152644d41585f4160d81b60648201526084016109c9565b808310158015611332575061132e600a8261459c565b8311155b806113515750808310801561135157508061134e600a8561459c565b10155b61139d5760405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f41000000000060448201526064016109c9565b600e819055600f839055426010819055601183905560408051838152602081018690528082019290925260608201849052517fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c2549181900360800190a1505050565b601654610100900460ff16156114565760405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a65640060448201526064016109c9565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146114ce5760405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f727900000000000000000060448201526064016109c9565b620f42408511156115215760405162461bcd60e51b815260206004820152601260248201527f5f412065786365656473206d6178696d756d000000000000000000000000000060448201526064016109c9565b64012a05f2008411156115765760405162461bcd60e51b815260206004820152601460248201527f5f6665652065786365656473206d6178696d756d00000000000000000000000060448201526064016109c9565b6402540be4008311156115cb5760405162461bcd60e51b815260206004820152601a60248201527f5f61646d696e5f6665652065786365656473206d6178696d756d00000000000060448201526064016109c9565b6016805461ff00191661010017905560005b60028110156117f15760008782600281106115fa576115fa6145f6565b60200201516001600160a01b031614156116455760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204164647265737360a01b60448201526064016109c9565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee88836002811061166e5761166e6145f6565b60200201516001600160a01b0316141561169d5750600d805460ff60a01b1916600160a01b179055601261171b565b8782600281106116af576116af6145f6565b60200201516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611715919061468f565b60ff1690505b60128111156117785760405162461bcd60e51b8152602060048201526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f742065786365656044820152630c84062760e31b60648201526084016109c9565b611783816012614585565b61178e90600a614796565b600283600281106117a1576117a16145f6565b01556002828181106117b5576117b56145f6565b01546117c990670de0b6b3a764000061459c565b600483600281106117dc576117dc6145f6565b015550806117e981614624565b9150506115dd565b506117ff6006876002614283565b50600e859055600f859055600a849055600b839055611821624f1a004261460c565b601555600d80546001600160a01b0319166001600160a01b038316179055611848826131e4565b505050505050565b6008816002811061186057600080fd5b0154905081565b61186f613400565b6012544210156118ba5760405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b60448201526064016109c9565b6012546119185760405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201526507420626520360d41b60648201526084016109c9565b6000601255601354600a819055601454600b8190556040517fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d19261196492908252602082015260400190565b60405180910390a1565b60008061197b848461349d565b509150505b92915050565b61198e613400565b60005b6002811015611a945773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600682600281106119c2576119c26145f6565b01546001600160a01b031614156119ee5747600882600281106119e7576119e76145f6565b0155611a82565b60068160028110611a0157611a016145f6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6c91906145dd565b60088260028110611a7f57611a7f6145f6565b01555b80611a8c81614624565b915050611991565b506040517f2c7203581ca666b8c5094c11c03f0b19b3750234a9d281bcbc88a260bcb006de90600090a1565b604080518082019182905260009182919060049060029082845b815481526020019060010190808311611ada57505050505090506000611afe61379d565b90506000670de0b6b3a7640000838860028110611b1d57611b1d6145f6565b6020020151611b2c908761459c565b611b3691906145bb565b828860028110611b4857611b486145f6565b6020020151611b57919061460c565b90506000611b6788888486613856565b90506000848860028110611b7d57611b7d6145f6565b6020020151670de0b6b3a7640000600184878c60028110611ba057611ba06145f6565b6020020151611baf9190614585565b611bb99190614585565b611bc3919061459c565b611bcd91906145bb565b905060006402540be40082600a54611be5919061459c565b611bef91906145bb565b9050611bfb8183614585565b9a9950505050505050505050565b611c11613269565b600d54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015611c5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7f91906145dd565b9050611c8961422b565b611c9161422b565b60005b6002811015611db6576000848760088460028110611cb457611cb46145f6565b0154611cc0919061459c565b611cca91906145bb565b9050858260028110611cde57611cde6145f6565b6020020151811015611d4b5760405162461bcd60e51b815260206004820152603060248201527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201526f1b9cc81d1a185b88195e1c1958dd195960821b60648201526084016109c9565b8060088360028110611d5f57611d5f6145f6565b016000828254611d6f9190614585565b90915550819050848360028110611d8857611d886145f6565b6020020152611da3600683600281106111ca576111ca6145f6565b5080611dae81614624565b915050611c94565b50600d5460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015611e0357600080fd5b505af1158015611e17573d6000803e3d6000fd5b503392507f7c363854ccf79623411f8995b362bce5eddff18c927edc6f5dbbb5e05819a82c915084905083611e4c8988614585565b604051611e5b939291906147a2565b60405180910390a250505061102060018055565b611e77613269565b60165460ff1615611eb35760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600d54600160a01b900460ff16611f0a573415611f0a5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b604080518082019182905260009160089060029082845b815481526020019060010190808311611f2157505050505090506000611f4682613a60565b90506000670de0b6b3a764000060048860028110611f6657611f666145f6565b0154611f72908761459c565b611f7c91906145bb565b828860028110611f8e57611f8e6145f6565b6020020151611f9d919061460c565b90506000611fad88888486613856565b90506000600182858a60028110611fc657611fc66145f6565b6020020151611fd59190614585565b611fdf9190614585565b905060006402540be400600a5483611ff7919061459c565b61200191906145bb565b905060048960028110612016576120166145f6565b0154670de0b6b3a764000061202b8385614585565b612035919061459c565b61203f91906145bb565b9150868210156120a85760405162461bcd60e51b815260206004820152602e60248201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201526d081d1a185b88195e1c1958dd195960921b60648201526084016109c9565b60006402540be400600b54836120be919061459c565b6120c891906145bb565b905060048a600281106120dd576120dd6145f6565b01546120f1670de0b6b3a76400008361459c565b6120fb91906145bb565b905088878c60028110612110576121106145f6565b602002015161211f919061460c565b60088c60028110612132576121326145f6565b01558083888c60028110612148576121486145f6565b60200201516121579190614585565b6121619190614585565b60088b60028110612174576121746145f6565b0155600060068c6002811061218b5761218b6145f6565b01546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81141561220057348a146121fb5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b612215565b6122156001600160a01b03821633308d613b1d565b600060068c6002811061222a5761222a6145f6565b01546001600160a01b03169050612241818661345a565b604080518e8152602081018d90529081018d90526060810186905233907fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989060800160405180910390a250505050505050505061229d60018055565b50505050565b6122ab613400565b601254156122fb5760405162461bcd60e51b815260206004820181905260248201527f61646d696e5f616374696f6e735f646561646c696e65206d757374206265203060448201526064016109c9565b64012a05f2008211156123505760405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d000000000000000060448201526064016109c9565b6402540be4008111156123a55760405162461bcd60e51b815260206004820152601e60248201527f6465763a2061646d696e206665652065786365656473206d6178696d756d000060448201526064016109c9565b6123b26203f4804261460c565b60128190556013839055601482905560408051848152602081018490527f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe0910160405180910390a25050565b612406613400565b6108fc811015801561241a57506159d88111155b6124545760405162461bcd60e51b815260206004820152600b60248201526a496c6c6567616c2067617360a81b60448201526064016109c9565b600c8190556040518181527f2464fc1685c7ca97fc1e1c439a8d567d9ee1522118c0a0b3079220ca5f8fc3f6906020015b60405180910390a150565b6004816002811061186057600080fd5b6124a8613400565b6124b26000613bb5565b565b6002816002811061186057600080fd5b6000806124cf61379d565b604080518082019182905291925060009190600290819081845b8154815260200190600101908083116124e957505050505090506000818760028110612517576125176145f6565b6020020151612526908661459c565b838860028110612538576125386145f6565b6020020151612547919061460c565b9050600061255788888487613856565b9050600083886002811061256d5761256d6145f6565b6020020151600183878b60028110612587576125876145f6565b60200201516125969190614585565b611bc39190614585565b6000806125bb6125ae61379d565b6125b66132c3565b613c05565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612612573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061263691906145dd565b90508061264b670de0b6b3a76400008461459c565b61265591906145bb565b9250505090565b6006816002811061266c57600080fd5b01546001600160a01b0316905081565b612684613400565b600061268e6132c3565b600e819055600f81905542601081905560118190556040519192507f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc2019389161248591848252602082015260400190565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60068360028110612707576127076145f6565b01546001600160a01b03161415612737576008826002811061272b5761272b6145f6565b01546119809047614585565b6008826002811061274a5761274a6145f6565b01546006836002811061275f5761275f6145f6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156127a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ca91906145dd565b6119809190614585565b919050565b6127e1613269565b60165460ff161561281d5760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600d54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015612867573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061288b91906145dd565b9050600081116128dd5760405162461bcd60e51b815260206004820152601660248201527f6465763a207a65726f20746f74616c20737570706c790000000000000000000060448201526064016109c9565b60006128eb60016002614585565b6128f690600461459c565b6002600a54612905919061459c565b61290f91906145bb565b600b54909150600061291f6132c3565b60408051808201918290529192506000919060089060029082845b81548152602001906001019080831161293a57505050505090506000604051806040016040528083600060028110612974576129746145f6565b6020020151815260200183600160028110612991576129916145f6565b60200201519052905060006129a68385613364565b905060005b6002811015612a03578981600281106129c6576129c66145f6565b60200201518382600281106129dd576129dd6145f6565b602002018181516129ee9190614585565b905250806129fb81614624565b9150506129ab565b506000612a108386613364565b9050612a1a61422b565b60005b6002811015612baf57600084878360028110612a3b57612a3b6145f6565b6020020151612a4a908661459c565b612a5491906145bb565b90506000868360028110612a6a57612a6a6145f6565b6020020151821115612a9e57868360028110612a8857612a886145f6565b6020020151612a979083614585565b9050612ac3565b81878460028110612ab157612ab16145f6565b6020020151612ac09190614585565b90505b6402540be400612ad3828d61459c565b612add91906145bb565b848460028110612aef57612aef6145f6565b60200201526402540be4008a858560028110612b0d57612b0d6145f6565b6020020151612b1c919061459c565b612b2691906145bb565b878460028110612b3857612b386145f6565b6020020151612b479190614585565b60088460028110612b5a57612b5a6145f6565b0155838360028110612b6e57612b6e6145f6565b6020020151878460028110612b8557612b856145f6565b60200201818151612b969190614585565b905250829150612ba7905081614624565b915050612a1d565b506000612bbc8588613364565b90506000848b612bcc8483614585565b612bd6919061459c565b612be091906145bb565b905060008111612c3e5760405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201526206e20360ec1b60648201526084016109c9565b612c4960018261460c565b90508b811115612c925760405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b60448201526064016109c9565b600d5460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612cde57600080fd5b505af1158015612cf2573d6000803e3d6000fd5b5050505060005b6002811015612d705760008e8260028110612d1657612d166145f6565b60200201511115612d5e57612d5e60068260028110612d3757612d376145f6565b01546001600160a01b03168f8360028110612d5457612d546145f6565b602002015161345a565b80612d6881614624565b915050612cf9565b50612d7b818c614585565b9a50336001600160a01b03167f2b5508378d7e19e0d5fa338419034731416c4f5b219a10379956f764317fd47e8e85878f6040516110049493929190614662565b612dc4613400565b4260155411612e155760405162461bcd60e51b815260206004820152601160248201527f457863656564656420646561646c696e6500000000000000000000000000000060448201526064016109c9565b6016805460ff191660011790556040517fbe26733c2bf6ff3ea5ba8cfe744422bd49052ff9ed5685c9e81e6f9321dbaddd90600090a1565b604080518082019182905260009182919060089060029082845b815481526020019060010190808311612e6757505050505090506000612e8b6132c3565b90506000612e998383613364565b905060005b6002811015612f3f578515612eef57868160028110612ebf57612ebf6145f6565b6020020151848260028110612ed657612ed66145f6565b60200201818151612ee7919061460c565b905250612f2d565b868160028110612f0157612f016145f6565b6020020151848260028110612f1857612f186145f6565b60200201818151612f299190614585565b9052505b80612f3781614624565b915050612e9e565b506000612f4c8484613364565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fa3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc791906145dd565b905060008715612fe257612fdb8484614585565b9050612fef565b612fec8385614585565b90505b83612ffa838361459c565b61300491906145bb565b9998505050505050505050565b613019613269565b60165460ff16156130555760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600080613062858561349d565b91509150828210156130b65760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f766564000000000000000060448201526064016109c9565b6402540be400600b54826130ca919061459c565b6130d491906145bb565b6130de908361460c565b600885600281106130f1576130f16145f6565b0160008282546131019190614585565b9091555050600d5460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561315257600080fd5b505af1158015613166573d6000803e3d6000fd5b5050505061319160068560028110613180576131806145f6565b01546001600160a01b03168361345a565b604080518581526020810187905290810183905233907f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a09060600160405180910390a250506131df60018055565b505050565b6131ec613400565b6001600160a01b0381166132515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109c9565b6111ee81613bb5565b60006132646132c3565b905090565b600260015414156132bc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109c9565b6002600155565b601154600f54600091904282111561198057600e5460105481831115613328576132ed8185614585565b6132f78242614585565b6133018486614585565b61330b919061459c565b61331591906145bb565b61331f908361460c565b94505050505090565b6133328185614585565b61333c8242614585565b6133468585614585565b613350919061459c565b61335a91906145bb565b61331f9083614585565b600061337861337284613a60565b83613c05565b9392505050565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156133eb573481146110205760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b6110206001600160a01b038316333084613b1d565b6000546001600160a01b031633146124b25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109c9565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415613489576110203382613d9b565b6110206001600160a01b0383163383613e42565b60008060006134aa6132c3565b905060006134ba60016002614585565b6134c590600461459c565b6002600a546134d4919061459c565b6134de91906145bb565b604080518082019182905291925060009190600290819081845b8154815260200190600101908083116134f857505050505090506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613567573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358b91906145dd565b9050600061359761379d565b905060006135a58287613c05565b90506000836135b4838d61459c565b6135be91906145bb565b6135c89083614585565b90508260006135d9898d8486613e72565b90506000878d600281106135ef576135ef6145f6565b602002015182878f60028110613607576136076145f6565b60200201516136169190614585565b61362091906145bb565b905060005b600281101561371c5760008e821415613677578387878a856002811061364d5761364d6145f6565b602002015161365c919061459c565b61366691906145bb565b6136709190614585565b90506136c8565b868689846002811061368b5761368b6145f6565b602002015161369a919061459c565b6136a491906145bb565b8883600281106136b6576136b66145f6565b60200201516136c59190614585565b90505b6402540be4006136d8828d61459c565b6136e291906145bb565b8583600281106136f4576136f46145f6565b602002018181516137059190614585565b90525081905061371481614624565b915050613625565b50600061372b8b8f8688613e72565b848f6002811061373d5761373d6145f6565b602002015161374c9190614585565b9050888e60028110613760576137606145f6565b6020020151613770600183614585565b61377a91906145bb565b9050806137878184614585565b9c509c5050505050505050505050509250929050565b6137a561422b565b60408051808201918290529060049060029082845b8154815260200190600101908083116137ba575050505050905060005b600281101561385257670de0b6b3a7640000600882600281106137fc576137fc6145f6565b0154838360028110613810576138106145f6565b602002015161381f919061459c565b61382991906145bb565b82826002811061383b5761383b6145f6565b60200201528061384a81614624565b9150506137d7565b5090565b60008385141580156138685750600285105b80156138745750600284105b6138c05760405162461bcd60e51b815260206004820152601160248201527f496c6c6567616c20706172616d6574657200000000000000000000000000000060448201526064016109c9565b60006138ca6132c3565b905060006138d88483613c05565b9050806000806138e960028661459c565b90506000805b6002811015613972578b81141561390857899150613932565b8a811461392d57888160028110613921576139216145f6565b60200201519150613932565b613960565b61393c828561460c565b935061394960028361459c565b613953878761459c565b61395d91906145bb565b94505b8061396a81614624565b9150506138ef565b5061397e60028361459c565b613988868661459c565b61399291906145bb565b935060006139a083876145bb565b6139aa908561460c565b9050600086815b60ff811015613a4c5781925088848360026139cc919061459c565b6139d6919061460c565b6139e09190614585565b886139eb848061459c565b6139f5919061460c565b6139ff91906145bb565b915082821115613a24576001613a158484614585565b11613a1f57613a4c565b613a3a565b6001613a308385614585565b11613a3a57613a4c565b80613a4481614624565b9150506139b1565b50985050505050505050505b949350505050565b613a6861422b565b60408051808201918290529060049060029082845b815481526020019060010190808311613a7d575050505050905060005b6002811015613b1757670de0b6b3a7640000838260028110613abe57613abe6145f6565b6020020151838360028110613ad557613ad56145f6565b6020020151613ae4919061459c565b613aee91906145bb565b828260028110613b0057613b006145f6565b602002015280613b0f81614624565b915050613a9a565b50919050565b6040516001600160a01b038085166024830152831660448201526064810182905261229d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152614036565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060005b6002811015613c4957848160028110613c2657613c266145f6565b6020020151613c35908361460c565b915080613c4181614624565b915050613c0b565b5080613c59576000915050611980565b60008181613c6860028761459c565b905060005b60ff811015613d8f578260005b6002811015613cce5760028a8260028110613c9757613c976145f6565b6020020151613ca6919061459c565b613cb0868461459c565b613cba91906145bb565b915080613cc681614624565b915050613c7a565b508394508060026001613ce1919061460c565b613ceb919061459c565b84613cf7600186614585565b613d01919061459c565b613d0b919061460c565b84613d1760028461459c565b613d21898761459c565b613d2b919061460c565b613d35919061459c565b613d3f91906145bb565b935084841115613d65576001613d558686614585565b11613d605750613d8f565b613d7c565b6001613d718587614585565b11613d7c5750613d8f565b5080613d8781614624565b915050613c6d565b50909695505050505050565b6000826001600160a01b0316600c5483604051600060405180830381858888f193505050503d8060008114613dec576040519150601f19603f3d011682016040523d82523d6000602084013e613df1565b606091505b50509050806131df5760405162461bcd60e51b815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016109c9565b6040516001600160a01b0383166024820152604481018290526131df90849063a9059cbb60e01b90606401613b51565b600060028410613ec45760405162461bcd60e51b815260206004820152601460248201527f6465763a20692061626f7665204e5f434f494e5300000000000000000000000060448201526064016109c9565b81600080613ed360028961459c565b90506000805b6002811015613f4c57888114613f0757878160028110613efb57613efb6145f6565b60200201519150613f0c565b613f3a565b613f16828561460c565b9350613f2360028361459c565b613f2d888761459c565b613f3791906145bb565b94505b80613f4481614624565b915050613ed9565b50613f5860028361459c565b613f62878661459c565b613f6c91906145bb565b93506000613f7a83886145bb565b613f84908561460c565b9050600087815b60ff811015614026578192508984836002613fa6919061459c565b613fb0919061460c565b613fba9190614585565b88613fc5848061459c565b613fcf919061460c565b613fd991906145bb565b915082821115613ffe576001613fef8484614585565b11613ff957614026565b614014565b600161400a8385614585565b1161401457614026565b8061401e81614624565b915050613f8b565b509b9a5050505050505050505050565b600061408b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661410b9092919063ffffffff16565b90508051600014806140ac5750808060200190518101906140ac91906147cb565b6131df5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109c9565b6060613a58848460008585600080866001600160a01b031685876040516141329190614814565b60006040518083038185875af1925050503d806000811461416f576040519150601f19603f3d011682016040523d82523d6000602084013e614174565b606091505b509150915061418587838387614190565b979650505050505050565b606083156141fc5782516141f5576001600160a01b0385163b6141f55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109c9565b5081613a58565b613a5883838151156142115781518083602001fd5b8060405162461bcd60e51b81526004016109c99190614830565b60405180604001604052806002906020820280368337509192915050565b8260028101928215614277579160200282015b8281111561427757825182559160200191906001019061425c565b506138529291506142cb565b8260028101928215614277579160200282015b8281111561427757825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614296565b5b8082111561385257600081556001016142cc565b6040805190810167ffffffffffffffff8111828210171561431157634e487b7160e01b600052604160045260246000fd5b60405290565b600082601f83011261432857600080fd5b6143306142e0565b80604084018581111561434257600080fd5b845b8181101561435c578035845260209384019301614344565b509095945050505050565b6000806060838503121561437a57600080fd5b6143848484614317565b946040939093013593505050565b600080604083850312156143a557600080fd5b50508035926020909101359150565b80356001600160a01b03811681146127d457600080fd5b60008060008060008060e087890312156143e457600080fd5b87601f8801126143f357600080fd5b6143fb6142e0565b80604089018a81111561440d57600080fd5b895b8181101561442e57614420816143b4565b84526020938401930161440f565b5090975035955050606087013593506080870135925061445060a088016143b4565b915061445e60c088016143b4565b90509295509295509295565b60006020828403121561447c57600080fd5b5035919050565b60008060006060848603121561449857600080fd5b505081359360208301359350604090920135919050565b600080606083850312156144c257600080fd5b823591506144d38460208501614317565b90509250929050565b600080600080608085870312156144f257600080fd5b5050823594602084013594506040840135936060013592509050565b80151581146111ee57600080fd5b6000806060838503121561452f57600080fd5b6145398484614317565b915060408301356145498161450e565b809150509250929050565b60006020828403121561456657600080fd5b613378826143b4565b634e487b7160e01b600052601160045260246000fd5b6000828210156145975761459761456f565b500390565b60008160001904831182151516156145b6576145b661456f565b500290565b6000826145d857634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156145ef57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000821982111561461f5761461f61456f565b500190565b60006000198214156146385761463861456f565b5060010190565b8060005b600281101561229d578151845260209384019390910190600101614643565b60c08101614670828761463f565b61467d604083018661463f565b608082019390935260a0015292915050565b6000602082840312156146a157600080fd5b815160ff8116811461337857600080fd5b600181815b808511156146ed5781600019048211156146d3576146d361456f565b808516156146e057918102915b93841c93908002906146b7565b509250929050565b60008261470457506001611980565b8161471157506000611980565b816001811461472757600281146147315761474d565b6001915050611980565b60ff8411156147425761474261456f565b50506001821b611980565b5060208310610133831016604e8410600b8410161715614770575081810a611980565b61477a83836146b2565b806000190482111561478e5761478e61456f565b029392505050565b600061337883836146f5565b60a081016147b0828661463f565b6147bd604083018561463f565b826080830152949350505050565b6000602082840312156147dd57600080fd5b81516133788161450e565b60005b838110156148035781810151838201526020016147eb565b8381111561229d5750506000910152565b600082516148268184602087016147e8565b9190910192915050565b602081526000825180602084015261484f8160408501602087016147e8565b601f01601f1916919091016040019291505056fea164736f6c634300080a000aa164736f6c634300080a000a

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100575760003560e01c8063293577501461005c578063715018a6146100775780638da5cb5b146100815780639013148d146100a6578063f2fde38b146100b9575b600080fd5b610064600281565b6040519081526020015b60405180910390f35b61007f6100cc565b005b6000546001600160a01b03165b6040516001600160a01b03909116815260200161006e565b61008e6100b43660046104ad565b6100e0565b61007f6100c736600461051e565b6102c1565b6100d461033a565b6100de6000610394565b565b60006100ea61033a565b6001600160a01b0388161580159061010a57506001600160a01b03871615155b80156101285750866001600160a01b0316886001600160a01b031614155b6101695760405162461bcd60e51b815260206004820152600d60248201526c24b63632b3b0b6103a37b5b2b760991b60448201526064015b60405180910390fd5b6000806101768a8a6103f1565b9150915060006040518060400160405280846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681525090506000604051806020016101c990610484565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606087811b8216602084015286811b8216603484015233901b16604882015242605c82015246607c820152909150600090609c016040516020818303038152906040528051906020012090506000818351602085016000f59050806001600160a01b0316634239b1c1858e8e8e8e8e6040518763ffffffff1660e01b815260040161027c96959493929190610540565b600060405180830381600087803b15801561029657600080fd5b505af11580156102aa573d6000803e3d6000fd5b509298505050505050505050979650505050505050565b6102c961033a565b6001600160a01b03811661032e5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610160565b61033781610394565b50565b6000546001600160a01b031633146100de5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610160565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080826001600160a01b0316846001600160a01b031614156104565760405162461bcd60e51b815260206004820152601360248201527f4944454e544943414c5f414444524553534553000000000000000000000000006044820152606401610160565b826001600160a01b0316846001600160a01b031610610476578284610479565b83835b909590945092505050565b614914806105a983390190565b80356001600160a01b03811681146104a857600080fd5b919050565b600080600080600080600060e0888a0312156104c857600080fd5b6104d188610491565b96506104df60208901610491565b955060408801359450606088013593506080880135925061050260a08901610491565b915061051060c08901610491565b905092959891949750929550565b60006020828403121561053057600080fd5b61053982610491565b9392505050565b60e08101818860005b60028110156105715781516001600160a01b0316835260209283019290910190600101610549565b5050506040820196909652606081019490945260808401929092526001600160a01b0390811660a08401521660c09091015291905056fe60a0604052610fbd600c553480156200001757600080fd5b50620000233362000031565b600180553360805262000081565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b608051614870620000a46000396000818161074a015261146101526148706000f3fe6080604052600436106103815760003560e01c806375bacd56116101d1578063d73792a911610102578063ed8e84f3116100a0578063f3de03621161006f578063f3de036214610816578063f446c1d01461093e578063fc0c546a14610953578063fee3f7f91461097357600080fd5b8063ed8e84f3146108c7578063edfb7801146108e7578063f1dc3cc9146108fe578063f2fde38b1461091e57600080fd5b8063e3103273116100dc578063e310327314610865578063e369885314610885578063e38244621461089a578063e5d9e903146108b057600080fd5b8063d73792a914610816578063ddca3f431461082f578063e2e7d2641461084557600080fd5b8063aaf5eb681161016f578063bb7b8b8011610149578063bb7b8b80146107b3578063bc063e1a146107c8578063c6610657146107e1578063ca8ca1541461080157600080fd5b8063aaf5eb681461076c578063ab5ac06114610788578063b4b577ad1461079d57600080fd5b80638da5cb5b116101ab5780638da5cb5b146106d6578063923e563c146107085780639c868ac01461071e578063a6b0a7181461073857600080fd5b806375bacd56146106805780637dafa3641461069657806385f11d1e146106b657600080fd5b80634903b0d1116102b65780635b36389c1161025457806362203d741161022357806362203d74146106205780636d4366b714610640578063715018a61461065557806373d459e41461066a57600080fd5b80635b36389c146105ad5780635b41b908146105cd5780635b5a1467146105e0578063610358a91461060057600080fd5b8063524c390111610290578063524c39011461054c5780635409491a14610561578063556d6e9f1461057757806358680d0b1461059757600080fd5b80634903b0d1146104f75780634f12fe97146105175780634fb08c5e1461052c57600080fd5b80633046f9721161032357806339698415116102fd578063396984151461048a5780633c157e64146104a1578063405e28f8146104c15780634239b1c1146104d757600080fd5b80633046f9721461043157806330c5408514610446578063392e53cd1461045b57600080fd5b80632081066c1161035f5780632081066c146103db578063226840fb146103f157806329357750146104065780632a4268961461041b57600080fd5b806306e9481c146103865780630b4c7e4d146103b057806314052288146103c5575b600080fd5b34801561039257600080fd5b5061039d6201518081565b6040519081526020015b60405180910390f35b6103c36103be366004614367565b610989565b005b3480156103d157600080fd5b5061039d60115481565b3480156103e757600080fd5b5061039d60105481565b3480156103fd57600080fd5b506103c3611024565b34801561041257600080fd5b5061039d600281565b34801561042757600080fd5b5061039d60155481565b34801561043d57600080fd5b506103c361105c565b34801561045257600080fd5b506103c3611099565b34801561046757600080fd5b5060165461047a90610100900460ff1681565b60405190151581526020016103a7565b34801561049657600080fd5b5061039d620f424081565b3480156104ad57600080fd5b506103c36104bc366004614392565b6111f1565b3480156104cd57600080fd5b5061039d60125481565b3480156104e357600080fd5b506103c36104f23660046143cb565b6113fe565b34801561050357600080fd5b5061039d61051236600461446a565b611850565b34801561052357600080fd5b506103c3611867565b34801561053857600080fd5b5061039d610547366004614392565b61196e565b34801561055857600080fd5b506103c3611986565b34801561056d57600080fd5b5061039d600e5481565b34801561058357600080fd5b5061039d610592366004614483565b611ac0565b3480156105a357600080fd5b5061039d60135481565b3480156105b957600080fd5b506103c36105c83660046144af565b611c09565b6103c36105db3660046144dc565b611e6f565b3480156105ec57600080fd5b506103c36105fb366004614392565b6122a3565b34801561060c57600080fd5b506103c361061b36600461446a565b6123fe565b34801561062c57600080fd5b5061039d61063b36600461446a565b612490565b34801561064c57600080fd5b5061039d601281565b34801561066157600080fd5b506103c36124a0565b34801561067657600080fd5b5061039d6159d881565b34801561068c57600080fd5b5061039d600c5481565b3480156106a257600080fd5b5061039d6106b136600461446a565b6124b4565b3480156106c257600080fd5b5061039d6106d1366004614483565b6124c4565b3480156106e257600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103a7565b34801561071457600080fd5b5061039d6108fc81565b34801561072a57600080fd5b5060165461047a9060ff1681565b34801561074457600080fd5b506106f07f000000000000000000000000000000000000000000000000000000000000000081565b34801561077857600080fd5b5061039d670de0b6b3a764000081565b34801561079457600080fd5b5061039d600a81565b3480156107a957600080fd5b5061039d600f5481565b3480156107bf57600080fd5b5061039d6125a0565b3480156107d457600080fd5b5061039d64012a05f20081565b3480156107ed57600080fd5b506106f06107fc36600461446a565b61265c565b34801561080d57600080fd5b506103c361267c565b34801561082257600080fd5b5061039d6402540be40081565b34801561083b57600080fd5b5061039d600a5481565b34801561085157600080fd5b5061039d61086036600461446a565b6126dd565b34801561087157600080fd5b506103c3610880366004614367565b6127d9565b34801561089157600080fd5b506103c3612dbc565b3480156108a657600080fd5b5061039d60145481565b3480156108bc57600080fd5b5061039d6203f48081565b3480156108d357600080fd5b5061039d6108e236600461451c565b612e4d565b3480156108f357600080fd5b5061039d624f1a0081565b34801561090a57600080fd5b506103c3610919366004614483565b613011565b34801561092a57600080fd5b506103c3610939366004614554565b6131e4565b34801561094a57600080fd5b5061039d61325a565b34801561095f57600080fd5b50600d546106f0906001600160a01b031681565b34801561097f57600080fd5b5061039d600b5481565b610991613269565b60165460ff16156109d25760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064015b60405180910390fd5b600d54600160a01b900460ff16610a29573415610a295760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b610a3161422b565b6000610a3f60016002614585565b610a4a90600461459c565b6002600a54610a59919061459c565b610a6391906145bb565b600b549091506000610a736132c3565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aee91906145dd565b6040805180820191829052919250600091829160089060029082845b815481526020019060010190808311610b0a57505050505090506000831115610b3a57610b378185613364565b91505b6000604051806040016040528083600060028110610b5a57610b5a6145f6565b6020020151815260200183600160028110610b7757610b776145f6565b60200201519052905060005b6002811015610c635784610c025760008b8260028110610ba557610ba56145f6565b602002015111610c025760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f696044820152616e7360f01b60648201526084016109c9565b8a8160028110610c1457610c146145f6565b6020020151838260028110610c2b57610c2b6145f6565b6020020151610c3a919061460c565b828260028110610c4c57610c4c6145f6565b602002015280610c5b81614624565b915050610b83565b506000610c708287613364565b9050838111610cc15760405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e20443000000000000060448201526064016109c9565b808515610e6f5760005b6002811015610e5d57600086868360028110610ce957610ce96145f6565b6020020151610cf8908661459c565b610d0291906145bb565b90506000858360028110610d1857610d186145f6565b6020020151821115610d4c57858360028110610d3657610d366145f6565b6020020151610d459083614585565b9050610d71565b81868460028110610d5f57610d5f6145f6565b6020020151610d6e9190614585565b90505b6402540be400610d81828e61459c565b610d8b91906145bb565b8d8460028110610d9d57610d9d6145f6565b60200201526402540be4008b8e8560028110610dbb57610dbb6145f6565b6020020151610dca919061459c565b610dd491906145bb565b868460028110610de657610de66145f6565b6020020151610df59190614585565b60088460028110610e0857610e086145f6565b01558c8360028110610e1c57610e1c6145f6565b6020020151868460028110610e3357610e336145f6565b60200201818151610e449190614585565b905250829150610e55905081614624565b915050610ccb565b50610e688388613364565b9050610e7e565b610e7c6008846002614249565b505b600086610e8c575081610eae565b85610e978184614585565b610ea1908961459c565b610eab91906145bb565b90505b8b811015610ef55760405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b60448201526064016109c9565b60005b6002811015610f5d5760008e8260028110610f1557610f156145f6565b60200201519050600060068360028110610f3157610f316145f6565b01546001600160a01b03169050610f48818361337f565b50508080610f5590614624565b915050610ef8565b50600d546040516340c10f1960e01b8152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015610faa57600080fd5b505af1158015610fbe573d6000803e3d6000fd5b503392507f26f55a85081d24974e85c6c00045d0f0453991e95873f52bff0d21af4079a76891508f90508d86610ff4868d61460c565b6040516110049493929190614662565b60405180910390a2505050505050505050505061102060018055565b5050565b61102c613400565b600060128190556040517f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a19190a1565b611064613400565b6016805460ff191690556040517f061284ffa2814ace135f62907c78a7cff0f070efe7e6a0a42740ea1da2c8bdc890600090a1565b6110a1613400565b60005b60028110156111ee57600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600683600281106110d7576110d76145f6565b01546001600160a01b0316141561110e57600882600281106110fb576110fb6145f6565b01546111079047614585565b90506111ae565b60088260028110611121576111216145f6565b015460068360028110611136576111366145f6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa15801561117d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111a191906145dd565b6111ab9190614585565b90505b80156111db576111db600683600281106111ca576111ca6145f6565b01546001600160a01b03168261345a565b50806111e681614624565b9150506110a4565b50565b6111f9613400565b6201518060105461120a919061460c565b42101561124b5760405162461bcd60e51b815260206004820152600f60248201526e646576203a20746f6f206561726c7960881b60448201526064016109c9565b611258620151804261460c565b8110156112a05760405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b60448201526064016109c9565b60006112aa6132c3565b90506000831180156112be5750620f424083105b6113185760405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e64206044820152644d41585f4160d81b60648201526084016109c9565b808310158015611332575061132e600a8261459c565b8311155b806113515750808310801561135157508061134e600a8561459c565b10155b61139d5760405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f41000000000060448201526064016109c9565b600e819055600f839055426010819055601183905560408051838152602081018690528082019290925260608201849052517fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c2549181900360800190a1505050565b601654610100900460ff16156114565760405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a65640060448201526064016109c9565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146114ce5760405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f727900000000000000000060448201526064016109c9565b620f42408511156115215760405162461bcd60e51b815260206004820152601260248201527f5f412065786365656473206d6178696d756d000000000000000000000000000060448201526064016109c9565b64012a05f2008411156115765760405162461bcd60e51b815260206004820152601460248201527f5f6665652065786365656473206d6178696d756d00000000000000000000000060448201526064016109c9565b6402540be4008311156115cb5760405162461bcd60e51b815260206004820152601a60248201527f5f61646d696e5f6665652065786365656473206d6178696d756d00000000000060448201526064016109c9565b6016805461ff00191661010017905560005b60028110156117f15760008782600281106115fa576115fa6145f6565b60200201516001600160a01b031614156116455760405162461bcd60e51b815260206004820152600c60248201526b5a45524f204164647265737360a01b60448201526064016109c9565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee88836002811061166e5761166e6145f6565b60200201516001600160a01b0316141561169d5750600d805460ff60a01b1916600160a01b179055601261171b565b8782600281106116af576116af6145f6565b60200201516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156116f1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611715919061468f565b60ff1690505b60128111156117785760405162461bcd60e51b8152602060048201526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f742065786365656044820152630c84062760e31b60648201526084016109c9565b611783816012614585565b61178e90600a614796565b600283600281106117a1576117a16145f6565b01556002828181106117b5576117b56145f6565b01546117c990670de0b6b3a764000061459c565b600483600281106117dc576117dc6145f6565b015550806117e981614624565b9150506115dd565b506117ff6006876002614283565b50600e859055600f859055600a849055600b839055611821624f1a004261460c565b601555600d80546001600160a01b0319166001600160a01b038316179055611848826131e4565b505050505050565b6008816002811061186057600080fd5b0154905081565b61186f613400565b6012544210156118ba5760405162461bcd60e51b81526020600482015260166024820152756465763a20696e73756666696369656e742074696d6560501b60448201526064016109c9565b6012546119185760405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201526507420626520360d41b60648201526084016109c9565b6000601255601354600a819055601454600b8190556040517fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d19261196492908252602082015260400190565b60405180910390a1565b60008061197b848461349d565b509150505b92915050565b61198e613400565b60005b6002811015611a945773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee600682600281106119c2576119c26145f6565b01546001600160a01b031614156119ee5747600882600281106119e7576119e76145f6565b0155611a82565b60068160028110611a0157611a016145f6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611a48573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6c91906145dd565b60088260028110611a7f57611a7f6145f6565b01555b80611a8c81614624565b915050611991565b506040517f2c7203581ca666b8c5094c11c03f0b19b3750234a9d281bcbc88a260bcb006de90600090a1565b604080518082019182905260009182919060049060029082845b815481526020019060010190808311611ada57505050505090506000611afe61379d565b90506000670de0b6b3a7640000838860028110611b1d57611b1d6145f6565b6020020151611b2c908761459c565b611b3691906145bb565b828860028110611b4857611b486145f6565b6020020151611b57919061460c565b90506000611b6788888486613856565b90506000848860028110611b7d57611b7d6145f6565b6020020151670de0b6b3a7640000600184878c60028110611ba057611ba06145f6565b6020020151611baf9190614585565b611bb99190614585565b611bc3919061459c565b611bcd91906145bb565b905060006402540be40082600a54611be5919061459c565b611bef91906145bb565b9050611bfb8183614585565b9a9950505050505050505050565b611c11613269565b600d54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015611c5b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c7f91906145dd565b9050611c8961422b565b611c9161422b565b60005b6002811015611db6576000848760088460028110611cb457611cb46145f6565b0154611cc0919061459c565b611cca91906145bb565b9050858260028110611cde57611cde6145f6565b6020020151811015611d4b5760405162461bcd60e51b815260206004820152603060248201527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201526f1b9cc81d1a185b88195e1c1958dd195960821b60648201526084016109c9565b8060088360028110611d5f57611d5f6145f6565b016000828254611d6f9190614585565b90915550819050848360028110611d8857611d886145f6565b6020020152611da3600683600281106111ca576111ca6145f6565b5080611dae81614624565b915050611c94565b50600d5460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015611e0357600080fd5b505af1158015611e17573d6000803e3d6000fd5b503392507f7c363854ccf79623411f8995b362bce5eddff18c927edc6f5dbbb5e05819a82c915084905083611e4c8988614585565b604051611e5b939291906147a2565b60405180910390a250505061102060018055565b611e77613269565b60165460ff1615611eb35760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600d54600160a01b900460ff16611f0a573415611f0a5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b604080518082019182905260009160089060029082845b815481526020019060010190808311611f2157505050505090506000611f4682613a60565b90506000670de0b6b3a764000060048860028110611f6657611f666145f6565b0154611f72908761459c565b611f7c91906145bb565b828860028110611f8e57611f8e6145f6565b6020020151611f9d919061460c565b90506000611fad88888486613856565b90506000600182858a60028110611fc657611fc66145f6565b6020020151611fd59190614585565b611fdf9190614585565b905060006402540be400600a5483611ff7919061459c565b61200191906145bb565b905060048960028110612016576120166145f6565b0154670de0b6b3a764000061202b8385614585565b612035919061459c565b61203f91906145bb565b9150868210156120a85760405162461bcd60e51b815260206004820152602e60248201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201526d081d1a185b88195e1c1958dd195960921b60648201526084016109c9565b60006402540be400600b54836120be919061459c565b6120c891906145bb565b905060048a600281106120dd576120dd6145f6565b01546120f1670de0b6b3a76400008361459c565b6120fb91906145bb565b905088878c60028110612110576121106145f6565b602002015161211f919061460c565b60088c60028110612132576121326145f6565b01558083888c60028110612148576121486145f6565b60200201516121579190614585565b6121619190614585565b60088b60028110612174576121746145f6565b0155600060068c6002811061218b5761218b6145f6565b01546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81141561220057348a146121fb5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b612215565b6122156001600160a01b03821633308d613b1d565b600060068c6002811061222a5761222a6145f6565b01546001600160a01b03169050612241818661345a565b604080518e8152602081018d90529081018d90526060810186905233907fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989060800160405180910390a250505050505050505061229d60018055565b50505050565b6122ab613400565b601254156122fb5760405162461bcd60e51b815260206004820181905260248201527f61646d696e5f616374696f6e735f646561646c696e65206d757374206265203060448201526064016109c9565b64012a05f2008211156123505760405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d000000000000000060448201526064016109c9565b6402540be4008111156123a55760405162461bcd60e51b815260206004820152601e60248201527f6465763a2061646d696e206665652065786365656473206d6178696d756d000060448201526064016109c9565b6123b26203f4804261460c565b60128190556013839055601482905560408051848152602081018490527f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe0910160405180910390a25050565b612406613400565b6108fc811015801561241a57506159d88111155b6124545760405162461bcd60e51b815260206004820152600b60248201526a496c6c6567616c2067617360a81b60448201526064016109c9565b600c8190556040518181527f2464fc1685c7ca97fc1e1c439a8d567d9ee1522118c0a0b3079220ca5f8fc3f6906020015b60405180910390a150565b6004816002811061186057600080fd5b6124a8613400565b6124b26000613bb5565b565b6002816002811061186057600080fd5b6000806124cf61379d565b604080518082019182905291925060009190600290819081845b8154815260200190600101908083116124e957505050505090506000818760028110612517576125176145f6565b6020020151612526908661459c565b838860028110612538576125386145f6565b6020020151612547919061460c565b9050600061255788888487613856565b9050600083886002811061256d5761256d6145f6565b6020020151600183878b60028110612587576125876145f6565b60200201516125969190614585565b611bc39190614585565b6000806125bb6125ae61379d565b6125b66132c3565b613c05565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612612573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061263691906145dd565b90508061264b670de0b6b3a76400008461459c565b61265591906145bb565b9250505090565b6006816002811061266c57600080fd5b01546001600160a01b0316905081565b612684613400565b600061268e6132c3565b600e819055600f81905542601081905560118190556040519192507f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc2019389161248591848252602082015260400190565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60068360028110612707576127076145f6565b01546001600160a01b03161415612737576008826002811061272b5761272b6145f6565b01546119809047614585565b6008826002811061274a5761274a6145f6565b01546006836002811061275f5761275f6145f6565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156127a6573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ca91906145dd565b6119809190614585565b919050565b6127e1613269565b60165460ff161561281d5760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600d54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015612867573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061288b91906145dd565b9050600081116128dd5760405162461bcd60e51b815260206004820152601660248201527f6465763a207a65726f20746f74616c20737570706c790000000000000000000060448201526064016109c9565b60006128eb60016002614585565b6128f690600461459c565b6002600a54612905919061459c565b61290f91906145bb565b600b54909150600061291f6132c3565b60408051808201918290529192506000919060089060029082845b81548152602001906001019080831161293a57505050505090506000604051806040016040528083600060028110612974576129746145f6565b6020020151815260200183600160028110612991576129916145f6565b60200201519052905060006129a68385613364565b905060005b6002811015612a03578981600281106129c6576129c66145f6565b60200201518382600281106129dd576129dd6145f6565b602002018181516129ee9190614585565b905250806129fb81614624565b9150506129ab565b506000612a108386613364565b9050612a1a61422b565b60005b6002811015612baf57600084878360028110612a3b57612a3b6145f6565b6020020151612a4a908661459c565b612a5491906145bb565b90506000868360028110612a6a57612a6a6145f6565b6020020151821115612a9e57868360028110612a8857612a886145f6565b6020020151612a979083614585565b9050612ac3565b81878460028110612ab157612ab16145f6565b6020020151612ac09190614585565b90505b6402540be400612ad3828d61459c565b612add91906145bb565b848460028110612aef57612aef6145f6565b60200201526402540be4008a858560028110612b0d57612b0d6145f6565b6020020151612b1c919061459c565b612b2691906145bb565b878460028110612b3857612b386145f6565b6020020151612b479190614585565b60088460028110612b5a57612b5a6145f6565b0155838360028110612b6e57612b6e6145f6565b6020020151878460028110612b8557612b856145f6565b60200201818151612b969190614585565b905250829150612ba7905081614624565b915050612a1d565b506000612bbc8588613364565b90506000848b612bcc8483614585565b612bd6919061459c565b612be091906145bb565b905060008111612c3e5760405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201526206e20360ec1b60648201526084016109c9565b612c4960018261460c565b90508b811115612c925760405162461bcd60e51b8152602060048201526014602482015273536c697070616765207363726577656420796f7560601b60448201526064016109c9565b600d5460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612cde57600080fd5b505af1158015612cf2573d6000803e3d6000fd5b5050505060005b6002811015612d705760008e8260028110612d1657612d166145f6565b60200201511115612d5e57612d5e60068260028110612d3757612d376145f6565b01546001600160a01b03168f8360028110612d5457612d546145f6565b602002015161345a565b80612d6881614624565b915050612cf9565b50612d7b818c614585565b9a50336001600160a01b03167f2b5508378d7e19e0d5fa338419034731416c4f5b219a10379956f764317fd47e8e85878f6040516110049493929190614662565b612dc4613400565b4260155411612e155760405162461bcd60e51b815260206004820152601160248201527f457863656564656420646561646c696e6500000000000000000000000000000060448201526064016109c9565b6016805460ff191660011790556040517fbe26733c2bf6ff3ea5ba8cfe744422bd49052ff9ed5685c9e81e6f9321dbaddd90600090a1565b604080518082019182905260009182919060089060029082845b815481526020019060010190808311612e6757505050505090506000612e8b6132c3565b90506000612e998383613364565b905060005b6002811015612f3f578515612eef57868160028110612ebf57612ebf6145f6565b6020020151848260028110612ed657612ed66145f6565b60200201818151612ee7919061460c565b905250612f2d565b868160028110612f0157612f016145f6565b6020020151848260028110612f1857612f186145f6565b60200201818151612f299190614585565b9052505b80612f3781614624565b915050612e9e565b506000612f4c8484613364565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612fa3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc791906145dd565b905060008715612fe257612fdb8484614585565b9050612fef565b612fec8385614585565b90505b83612ffa838361459c565b61300491906145bb565b9998505050505050505050565b613019613269565b60165460ff16156130555760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600080613062858561349d565b91509150828210156130b65760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f766564000000000000000060448201526064016109c9565b6402540be400600b54826130ca919061459c565b6130d491906145bb565b6130de908361460c565b600885600281106130f1576130f16145f6565b0160008282546131019190614585565b9091555050600d5460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561315257600080fd5b505af1158015613166573d6000803e3d6000fd5b5050505061319160068560028110613180576131806145f6565b01546001600160a01b03168361345a565b604080518581526020810187905290810183905233907f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a09060600160405180910390a250506131df60018055565b505050565b6131ec613400565b6001600160a01b0381166132515760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016109c9565b6111ee81613bb5565b60006132646132c3565b905090565b600260015414156132bc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109c9565b6002600155565b601154600f54600091904282111561198057600e5460105481831115613328576132ed8185614585565b6132f78242614585565b6133018486614585565b61330b919061459c565b61331591906145bb565b61331f908361460c565b94505050505090565b6133328185614585565b61333c8242614585565b6133468585614585565b613350919061459c565b61335a91906145bb565b61331f9083614585565b600061337861337284613a60565b83613c05565b9392505050565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156133eb573481146110205760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b6110206001600160a01b038316333084613b1d565b6000546001600160a01b031633146124b25760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109c9565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415613489576110203382613d9b565b6110206001600160a01b0383163383613e42565b60008060006134aa6132c3565b905060006134ba60016002614585565b6134c590600461459c565b6002600a546134d4919061459c565b6134de91906145bb565b604080518082019182905291925060009190600290819081845b8154815260200190600101908083116134f857505050505090506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015613567573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061358b91906145dd565b9050600061359761379d565b905060006135a58287613c05565b90506000836135b4838d61459c565b6135be91906145bb565b6135c89083614585565b90508260006135d9898d8486613e72565b90506000878d600281106135ef576135ef6145f6565b602002015182878f60028110613607576136076145f6565b60200201516136169190614585565b61362091906145bb565b905060005b600281101561371c5760008e821415613677578387878a856002811061364d5761364d6145f6565b602002015161365c919061459c565b61366691906145bb565b6136709190614585565b90506136c8565b868689846002811061368b5761368b6145f6565b602002015161369a919061459c565b6136a491906145bb565b8883600281106136b6576136b66145f6565b60200201516136c59190614585565b90505b6402540be4006136d8828d61459c565b6136e291906145bb565b8583600281106136f4576136f46145f6565b602002018181516137059190614585565b90525081905061371481614624565b915050613625565b50600061372b8b8f8688613e72565b848f6002811061373d5761373d6145f6565b602002015161374c9190614585565b9050888e60028110613760576137606145f6565b6020020151613770600183614585565b61377a91906145bb565b9050806137878184614585565b9c509c5050505050505050505050509250929050565b6137a561422b565b60408051808201918290529060049060029082845b8154815260200190600101908083116137ba575050505050905060005b600281101561385257670de0b6b3a7640000600882600281106137fc576137fc6145f6565b0154838360028110613810576138106145f6565b602002015161381f919061459c565b61382991906145bb565b82826002811061383b5761383b6145f6565b60200201528061384a81614624565b9150506137d7565b5090565b60008385141580156138685750600285105b80156138745750600284105b6138c05760405162461bcd60e51b815260206004820152601160248201527f496c6c6567616c20706172616d6574657200000000000000000000000000000060448201526064016109c9565b60006138ca6132c3565b905060006138d88483613c05565b9050806000806138e960028661459c565b90506000805b6002811015613972578b81141561390857899150613932565b8a811461392d57888160028110613921576139216145f6565b60200201519150613932565b613960565b61393c828561460c565b935061394960028361459c565b613953878761459c565b61395d91906145bb565b94505b8061396a81614624565b9150506138ef565b5061397e60028361459c565b613988868661459c565b61399291906145bb565b935060006139a083876145bb565b6139aa908561460c565b9050600086815b60ff811015613a4c5781925088848360026139cc919061459c565b6139d6919061460c565b6139e09190614585565b886139eb848061459c565b6139f5919061460c565b6139ff91906145bb565b915082821115613a24576001613a158484614585565b11613a1f57613a4c565b613a3a565b6001613a308385614585565b11613a3a57613a4c565b80613a4481614624565b9150506139b1565b50985050505050505050505b949350505050565b613a6861422b565b60408051808201918290529060049060029082845b815481526020019060010190808311613a7d575050505050905060005b6002811015613b1757670de0b6b3a7640000838260028110613abe57613abe6145f6565b6020020151838360028110613ad557613ad56145f6565b6020020151613ae4919061459c565b613aee91906145bb565b828260028110613b0057613b006145f6565b602002015280613b0f81614624565b915050613a9a565b50919050565b6040516001600160a01b038085166024830152831660448201526064810182905261229d9085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152614036565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060005b6002811015613c4957848160028110613c2657613c266145f6565b6020020151613c35908361460c565b915080613c4181614624565b915050613c0b565b5080613c59576000915050611980565b60008181613c6860028761459c565b905060005b60ff811015613d8f578260005b6002811015613cce5760028a8260028110613c9757613c976145f6565b6020020151613ca6919061459c565b613cb0868461459c565b613cba91906145bb565b915080613cc681614624565b915050613c7a565b508394508060026001613ce1919061460c565b613ceb919061459c565b84613cf7600186614585565b613d01919061459c565b613d0b919061460c565b84613d1760028461459c565b613d21898761459c565b613d2b919061460c565b613d35919061459c565b613d3f91906145bb565b935084841115613d65576001613d558686614585565b11613d605750613d8f565b613d7c565b6001613d718587614585565b11613d7c5750613d8f565b5080613d8781614624565b915050613c6d565b50909695505050505050565b6000826001600160a01b0316600c5483604051600060405180830381858888f193505050503d8060008114613dec576040519150601f19603f3d011682016040523d82523d6000602084013e613df1565b606091505b50509050806131df5760405162461bcd60e51b815260206004820152601360248201527f455448207472616e73666572206661696c65640000000000000000000000000060448201526064016109c9565b6040516001600160a01b0383166024820152604481018290526131df90849063a9059cbb60e01b90606401613b51565b600060028410613ec45760405162461bcd60e51b815260206004820152601460248201527f6465763a20692061626f7665204e5f434f494e5300000000000000000000000060448201526064016109c9565b81600080613ed360028961459c565b90506000805b6002811015613f4c57888114613f0757878160028110613efb57613efb6145f6565b60200201519150613f0c565b613f3a565b613f16828561460c565b9350613f2360028361459c565b613f2d888761459c565b613f3791906145bb565b94505b80613f4481614624565b915050613ed9565b50613f5860028361459c565b613f62878661459c565b613f6c91906145bb565b93506000613f7a83886145bb565b613f84908561460c565b9050600087815b60ff811015614026578192508984836002613fa6919061459c565b613fb0919061460c565b613fba9190614585565b88613fc5848061459c565b613fcf919061460c565b613fd991906145bb565b915082821115613ffe576001613fef8484614585565b11613ff957614026565b614014565b600161400a8385614585565b1161401457614026565b8061401e81614624565b915050613f8b565b509b9a5050505050505050505050565b600061408b826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661410b9092919063ffffffff16565b90508051600014806140ac5750808060200190518101906140ac91906147cb565b6131df5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016109c9565b6060613a58848460008585600080866001600160a01b031685876040516141329190614814565b60006040518083038185875af1925050503d806000811461416f576040519150601f19603f3d011682016040523d82523d6000602084013e614174565b606091505b509150915061418587838387614190565b979650505050505050565b606083156141fc5782516141f5576001600160a01b0385163b6141f55760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109c9565b5081613a58565b613a5883838151156142115781518083602001fd5b8060405162461bcd60e51b81526004016109c99190614830565b60405180604001604052806002906020820280368337509192915050565b8260028101928215614277579160200282015b8281111561427757825182559160200191906001019061425c565b506138529291506142cb565b8260028101928215614277579160200282015b8281111561427757825182546001600160a01b0319166001600160a01b03909116178255602090920191600190910190614296565b5b8082111561385257600081556001016142cc565b6040805190810167ffffffffffffffff8111828210171561431157634e487b7160e01b600052604160045260246000fd5b60405290565b600082601f83011261432857600080fd5b6143306142e0565b80604084018581111561434257600080fd5b845b8181101561435c578035845260209384019301614344565b509095945050505050565b6000806060838503121561437a57600080fd5b6143848484614317565b946040939093013593505050565b600080604083850312156143a557600080fd5b50508035926020909101359150565b80356001600160a01b03811681146127d457600080fd5b60008060008060008060e087890312156143e457600080fd5b87601f8801126143f357600080fd5b6143fb6142e0565b80604089018a81111561440d57600080fd5b895b8181101561442e57614420816143b4565b84526020938401930161440f565b5090975035955050606087013593506080870135925061445060a088016143b4565b915061445e60c088016143b4565b90509295509295509295565b60006020828403121561447c57600080fd5b5035919050565b60008060006060848603121561449857600080fd5b505081359360208301359350604090920135919050565b600080606083850312156144c257600080fd5b823591506144d38460208501614317565b90509250929050565b600080600080608085870312156144f257600080fd5b5050823594602084013594506040840135936060013592509050565b80151581146111ee57600080fd5b6000806060838503121561452f57600080fd5b6145398484614317565b915060408301356145498161450e565b809150509250929050565b60006020828403121561456657600080fd5b613378826143b4565b634e487b7160e01b600052601160045260246000fd5b6000828210156145975761459761456f565b500390565b60008160001904831182151516156145b6576145b661456f565b500290565b6000826145d857634e487b7160e01b600052601260045260246000fd5b500490565b6000602082840312156145ef57600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b6000821982111561461f5761461f61456f565b500190565b60006000198214156146385761463861456f565b5060010190565b8060005b600281101561229d578151845260209384019390910190600101614643565b60c08101614670828761463f565b61467d604083018661463f565b608082019390935260a0015292915050565b6000602082840312156146a157600080fd5b815160ff8116811461337857600080fd5b600181815b808511156146ed5781600019048211156146d3576146d361456f565b808516156146e057918102915b93841c93908002906146b7565b509250929050565b60008261470457506001611980565b8161471157506000611980565b816001811461472757600281146147315761474d565b6001915050611980565b60ff8411156147425761474261456f565b50506001821b611980565b5060208310610133831016604e8410600b8410161715614770575081810a611980565b61477a83836146b2565b806000190482111561478e5761478e61456f565b029392505050565b600061337883836146f5565b60a081016147b0828661463f565b6147bd604083018561463f565b826080830152949350505050565b6000602082840312156147dd57600080fd5b81516133788161450e565b60005b838110156148035781810151838201526020016147eb565b8381111561229d5750506000910152565b600082516148268184602087016147e8565b9190910192915050565b602081526000825180602084015261484f8160408501602087016147e8565b601f01601f1916919091016040019291505056fea164736f6c634300080a000aa164736f6c634300080a000a