Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- PancakeStableSwapTwoPoolDeployer
- Optimization enabled
- true
- Compiler version
- v0.8.10+commit.fc410830
- Optimization runs
- 1000
- EVM Version
- default
- Verified at
- 2024-11-08T12:32:19.228082Z
contracts/PancakeStableSwapTwoPoolDeployer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./PancakeStableSwapTwoPool.sol";
contract PancakeStableSwapTwoPoolDeployer 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(PancakeStableSwapTwoPool).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)
}
PancakeStableSwapTwoPool(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/PancakeStableSwapTwoPool.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/IPancakeStableSwapLP.sol";
contract PancakeStableSwapTwoPool 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_BNB_GAS = 2300;
uint256 public constant MAX_BNB_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 bnb_gas = 4029; // transfer bnb gas.
IPancakeStableSwapLP public token;
address constant BNB_ADDRESS = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE;
bool support_BNB;
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 SetBNBGas(uint256 bnb_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] == BNB_ADDRESS) {
coinDecimal = 18;
support_BNB = 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 = IPancakeStableSwapLP(_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_BNB) {
require(msg.value == 0, "Inconsistent quantity"); // Avoid sending BNB 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_BNB) {
require(msg.value == 0, "Inconsistent quantity"); // Avoid sending BNB 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 == BNB_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 == BNB_ADDRESS) {
_safeTransferBNB(msg.sender, value);
} else {
IERC20(coin_address).safeTransfer(msg.sender, value);
}
}
function transfer_in(address coin_address, uint256 value) internal {
if (coin_address == BNB_ADDRESS) {
require(value == msg.value, "Inconsistent quantity");
} else {
IERC20(coin_address).safeTransferFrom(msg.sender, address(this), value);
}
}
function _safeTransferBNB(address to, uint256 value) internal {
(bool success, ) = to.call{gas: bnb_gas, value: value}("");
require(success, "BNB transfer failed");
}
// Admin functions
function set_bnb_gas(uint256 _bnb_gas) external onlyOwner {
require(_bnb_gas >= MIN_BNB_GAS && _bnb_gas <= MAX_BNB_GAS, "Illegal gas");
bnb_gas = _bnb_gas;
emit SetBNBGas(_bnb_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] == BNB_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] == BNB_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] == BNB_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();
}
}
interfaces/IPancakeStableSwapLP.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.7.5;
interface IPancakeStableSwapLP {
/**
* @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;
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers","metadata"],"":["ast"]}},"optimizer":{"runs":1000,"enabled":true},"libraries":{}}
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
0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6150fe8061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c80638da5cb5b116100505780638da5cb5b146100915780639013148d146100b6578063f2fde38b146100c957600080fd5b8063293577501461006c578063715018a614610087575b600080fd5b610074600281565b6040519081526020015b60405180910390f35b61008f6100dc565b005b6000546001600160a01b03165b6040516001600160a01b03909116815260200161007e565b61009e6100c43660046104ef565b6100f0565b61008f6100d7366004610560565b6102e1565b6100e4610371565b6100ee60006103cb565b565b60006100fa610371565b6001600160a01b0388161580159061011a57506001600160a01b03871615155b80156101385750866001600160a01b0316886001600160a01b031614155b6101895760405162461bcd60e51b815260206004820152600d60248201527f496c6c6567616c20746f6b656e0000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000806101968a8a610433565b9150915060006040518060400160405280846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681525090506000604051806020016101e9906104c6565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606087811b8216602084015286811b8216603484015233901b16604882015242605c82015246607c820152909150600090609c016040516020818303038152906040528051906020012090506000818351602085016000f59050806001600160a01b0316634239b1c1858e8e8e8e8e6040518763ffffffff1660e01b815260040161029c96959493929190610582565b600060405180830381600087803b1580156102b657600080fd5b505af11580156102ca573d6000803e3d6000fd5b509298505050505050505050979650505050505050565b6102e9610371565b6001600160a01b0381166103655760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610180565b61036e816103cb565b50565b6000546001600160a01b031633146100ee5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610180565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080826001600160a01b0316846001600160a01b031614156104985760405162461bcd60e51b815260206004820152601360248201527f4944454e544943414c5f414444524553534553000000000000000000000000006044820152606401610180565b826001600160a01b0316846001600160a01b0316106104b85782846104bb565b83835b909590945092505050565b614ade806105eb83390190565b80356001600160a01b03811681146104ea57600080fd5b919050565b600080600080600080600060e0888a03121561050a57600080fd5b610513886104d3565b9650610521602089016104d3565b955060408801359450606088013593506080880135925061054460a089016104d3565b915061055260c089016104d3565b905092959891949750929550565b60006020828403121561057257600080fd5b61057b826104d3565b9392505050565b60e08101818860005b60028110156105b35781516001600160a01b031683526020928301929091019060010161058b565b5050506040820196909652606081019490945260808401929092526001600160a01b0390811660a08401521660c09091015291905056fe60a0604052610fbd600c553480156200001757600080fd5b50620000233362000031565b600180553360805262000081565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b608051614a3a620000a46000396000818161074a01526114cb0152614a3a6000f3fe6080604052600436106103815760003560e01c80637dafa364116101d1578063d73792a911610102578063ed8e84f3116100a0578063f3de03621161006f578063f3de036214610816578063f446c1d01461093e578063fc0c546a14610953578063fee3f7f91461097357600080fd5b8063ed8e84f3146108c7578063edfb7801146108e7578063f1dc3cc9146108fe578063f2fde38b1461091e57600080fd5b8063e3103273116100dc578063e310327314610865578063e369885314610885578063e38244621461089a578063e5d9e903146108b057600080fd5b8063d73792a914610816578063ddca3f431461082f578063e2e7d2641461084557600080fd5b8063aaf5eb681161016f578063bb7b8b8011610149578063bb7b8b80146107b3578063bc063e1a146107c8578063c6610657146107e1578063ca8ca1541461080157600080fd5b8063aaf5eb681461076c578063ab5ac06114610788578063b4b577ad1461079d57600080fd5b80639a1d6ed3116101ab5780639a1d6ed3146106e85780639c868ac0146106fe578063a139c37014610718578063a6b0a7181461073857600080fd5b80637dafa3641461067657806385f11d1e146106965780638da5cb5b146106b657600080fd5b80634239b1c1116102b6578063556d6e9f116102545780635b5a1467116102235780635b5a14671461060c57806362203d741461062c5780636d4366b71461064c578063715018a61461066157600080fd5b8063556d6e9f146105a357806358680d0b146105c35780635b36389c146105d95780635b41b908146105f957600080fd5b80634f12fe97116102905780634f12fe97146105435780634fb08c5e14610558578063524c3901146105785780635409491a1461058d57600080fd5b80634239b1c1146104ed5780634488ddf01461050d5780634903b0d11461052357600080fd5b80632a42689611610323578063392e53cd116102fd578063392e53cd1461047157806339698415146104a05780633c157e64146104b7578063405e28f8146104d757600080fd5b80632a426896146104315780633046f9721461044757806330c540851461045c57600080fd5b80632081066c1161035f5780632081066c146103db578063226840fb146103f157806325d2edf014610406578063293577501461041c57600080fd5b806306e9481c146103865780630b4c7e4d146103b057806314052288146103c5575b600080fd5b34801561039257600080fd5b5061039d6201518081565b6040519081526020015b60405180910390f35b6103c36103be366004614508565b610989565b005b3480156103d157600080fd5b5061039d60115481565b3480156103e757600080fd5b5061039d60105481565b3480156103fd57600080fd5b506103c3611061565b34801561041257600080fd5b5061039d6159d881565b34801561042857600080fd5b5061039d600281565b34801561043d57600080fd5b5061039d60155481565b34801561045357600080fd5b506103c3611099565b34801561046857600080fd5b506103c36110d6565b34801561047d57600080fd5b5060165461049090610100900460ff1681565b60405190151581526020016103a7565b3480156104ac57600080fd5b5061039d620f424081565b3480156104c357600080fd5b506103c36104d2366004614533565b61122e565b3480156104e357600080fd5b5061039d60125481565b3480156104f957600080fd5b506103c361050836600461456c565b611468565b34801561051957600080fd5b5061039d600c5481565b34801561052f57600080fd5b5061039d61053e36600461460b565b61190c565b34801561054f57600080fd5b506103c3611923565b34801561056457600080fd5b5061039d610573366004614533565b611a48565b34801561058457600080fd5b506103c3611a60565b34801561059957600080fd5b5061039d600e5481565b3480156105af57600080fd5b5061039d6105be366004614624565b611b9a565b3480156105cf57600080fd5b5061039d60135481565b3480156105e557600080fd5b506103c36105f4366004614650565b611ce3565b6103c361060736600461467d565b611f56565b34801561061857600080fd5b506103c3610627366004614533565b612399565b34801561063857600080fd5b5061039d61064736600461460b565b6124f4565b34801561065857600080fd5b5061039d601281565b34801561066d57600080fd5b506103c3612504565b34801561068257600080fd5b5061039d61069136600461460b565b612518565b3480156106a257600080fd5b5061039d6106b1366004614624565b612528565b3480156106c257600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103a7565b3480156106f457600080fd5b5061039d6108fc81565b34801561070a57600080fd5b506016546104909060ff1681565b34801561072457600080fd5b506103c361073336600461460b565b612604565b34801561074457600080fd5b506106d07f000000000000000000000000000000000000000000000000000000000000000081565b34801561077857600080fd5b5061039d670de0b6b3a764000081565b34801561079457600080fd5b5061039d600a81565b3480156107a957600080fd5b5061039d600f5481565b3480156107bf57600080fd5b5061039d6126a8565b3480156107d457600080fd5b5061039d64012a05f20081565b3480156107ed57600080fd5b506106d06107fc36600461460b565b612764565b34801561080d57600080fd5b506103c3612784565b34801561082257600080fd5b5061039d6402540be40081565b34801561083b57600080fd5b5061039d600a5481565b34801561085157600080fd5b5061039d61086036600461460b565b6127e5565b34801561087157600080fd5b506103c3610880366004614508565b6128e1565b34801561089157600080fd5b506103c3612ee7565b3480156108a657600080fd5b5061039d60145481565b3480156108bc57600080fd5b5061039d6203f48081565b3480156108d357600080fd5b5061039d6108e23660046146bd565b612f78565b3480156108f357600080fd5b5061039d624f1a0081565b34801561090a57600080fd5b506103c3610919366004614624565b61313c565b34801561092a57600080fd5b506103c36109393660046146f5565b61330f565b34801561094a57600080fd5b5061039d61339c565b34801561095f57600080fd5b50600d546106d0906001600160a01b031681565b34801561097f57600080fd5b5061039d600b5481565b6109916133ab565b60165460ff16156109d25760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064015b60405180910390fd5b600d54600160a01b900460ff16610a29573415610a295760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b610a316143bf565b6000610a3f60016002614726565b610a4a90600461473d565b6002600a54610a59919061473d565b610a63919061475c565b600b549091506000610a73613405565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aee919061477e565b6040805180820191829052919250600091829160089060029082845b815481526020019060010190808311610b0a57505050505090506000831115610b3a57610b3781856134a6565b91505b6000604051806040016040528083600060028110610b5a57610b5a614797565b6020020151815260200183600160028110610b7757610b77614797565b60200201519052905060005b6002811015610c7e5784610c1d5760008b8260028110610ba557610ba5614797565b602002015111610c1d5760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f6960448201527f6e7300000000000000000000000000000000000000000000000000000000000060648201526084016109c9565b8a8160028110610c2f57610c2f614797565b6020020151838260028110610c4657610c46614797565b6020020151610c5591906147ad565b828260028110610c6757610c67614797565b602002015280610c76816147c5565b915050610b83565b506000610c8b82876134a6565b9050838111610cdc5760405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e20443000000000000060448201526064016109c9565b808515610e8a5760005b6002811015610e7857600086868360028110610d0457610d04614797565b6020020151610d13908661473d565b610d1d919061475c565b90506000858360028110610d3357610d33614797565b6020020151821115610d6757858360028110610d5157610d51614797565b6020020151610d609083614726565b9050610d8c565b81868460028110610d7a57610d7a614797565b6020020151610d899190614726565b90505b6402540be400610d9c828e61473d565b610da6919061475c565b8d8460028110610db857610db8614797565b60200201526402540be4008b8e8560028110610dd657610dd6614797565b6020020151610de5919061473d565b610def919061475c565b868460028110610e0157610e01614797565b6020020151610e109190614726565b60088460028110610e2357610e23614797565b01558c8360028110610e3757610e37614797565b6020020151868460028110610e4e57610e4e614797565b60200201818151610e5f9190614726565b905250829150610e709050816147c5565b915050610ce6565b50610e8383886134a6565b9050610e99565b610e9760088460026143dd565b505b600086610ea7575081610ec9565b85610eb28184614726565b610ebc908961473d565b610ec6919061475c565b90505b8b811015610f195760405162461bcd60e51b815260206004820152601460248201527f536c697070616765207363726577656420796f7500000000000000000000000060448201526064016109c9565b60005b6002811015610f815760008e8260028110610f3957610f39614797565b60200201519050600060068360028110610f5557610f55614797565b01546001600160a01b03169050610f6c81836134c1565b50508080610f79906147c5565b915050610f1c565b50600d546040517f40c10f19000000000000000000000000000000000000000000000000000000008152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015610fe757600080fd5b505af1158015610ffb573d6000803e3d6000fd5b503392507f26f55a85081d24974e85c6c00045d0f0453991e95873f52bff0d21af4079a76891508f90508d86611031868d6147ad565b6040516110419493929190614803565b60405180910390a2505050505050505050505061105d60018055565b5050565b611069613542565b600060128190556040517f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a19190a1565b6110a1613542565b6016805460ff191690556040517f061284ffa2814ace135f62907c78a7cff0f070efe7e6a0a42740ea1da2c8bdc890600090a1565b6110de613542565b60005b600281101561122b57600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6006836002811061111457611114614797565b01546001600160a01b0316141561114b576008826002811061113857611138614797565b01546111449047614726565b90506111eb565b6008826002811061115e5761115e614797565b01546006836002811061117357611173614797565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156111ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111de919061477e565b6111e89190614726565b90505b8015611218576112186006836002811061120757611207614797565b01546001600160a01b03168261359c565b5080611223816147c5565b9150506110e1565b50565b611236613542565b6201518060105461124791906147ad565b4210156112965760405162461bcd60e51b815260206004820152600f60248201527f646576203a20746f6f206561726c79000000000000000000000000000000000060448201526064016109c9565b6112a362015180426147ad565b8110156112f25760405162461bcd60e51b815260206004820152601660248201527f6465763a20696e73756666696369656e742074696d650000000000000000000060448201526064016109c9565b60006112fc613405565b90506000831180156113105750620f424083105b6113825760405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e642060448201527f4d41585f4100000000000000000000000000000000000000000000000000000060648201526084016109c9565b80831015801561139c5750611398600a8261473d565b8311155b806113bb575080831080156113bb5750806113b8600a8561473d565b10155b6114075760405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f41000000000060448201526064016109c9565b600e819055600f839055426010819055601183905560408051838152602081018690528082019290925260608201849052517fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c2549181900360800190a1505050565b601654610100900460ff16156114c05760405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a65640060448201526064016109c9565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146115385760405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f727900000000000000000060448201526064016109c9565b620f424085111561158b5760405162461bcd60e51b815260206004820152601260248201527f5f412065786365656473206d6178696d756d000000000000000000000000000060448201526064016109c9565b64012a05f2008411156115e05760405162461bcd60e51b815260206004820152601460248201527f5f6665652065786365656473206d6178696d756d00000000000000000000000060448201526064016109c9565b6402540be4008311156116355760405162461bcd60e51b815260206004820152601a60248201527f5f61646d696e5f6665652065786365656473206d6178696d756d00000000000060448201526064016109c9565b6016805461ff00191661010017905560005b60028110156118a057600087826002811061166457611664614797565b60200201516001600160a01b031614156116c05760405162461bcd60e51b815260206004820152600c60248201527f5a45524f2041646472657373000000000000000000000000000000000000000060448201526064016109c9565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8883600281106116e9576116e9614797565b60200201516001600160a01b031614156117335750600d80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17905560126117b1565b87826002811061174557611745614797565b60200201516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611787573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ab9190614830565b60ff1690505b60128111156118275760405162461bcd60e51b8152602060048201526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f7420657863656560448201527f642031380000000000000000000000000000000000000000000000000000000060648201526084016109c9565b611832816012614726565b61183d90600a614937565b6002836002811061185057611850614797565b015560028281811061186457611864614797565b015461187890670de0b6b3a764000061473d565b6004836002811061188b5761188b614797565b01555080611898816147c5565b915050611647565b506118ae6006876002614417565b50600e859055600f859055600a849055600b8390556118d0624f1a00426147ad565b601555600d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383161790556119048261330f565b505050505050565b6008816002811061191c57600080fd5b0154905081565b61192b613542565b60125442101561197d5760405162461bcd60e51b815260206004820152601660248201527f6465763a20696e73756666696369656e742074696d650000000000000000000060448201526064016109c9565b6012546119f25760405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201527f742062652030000000000000000000000000000000000000000000000000000060648201526084016109c9565b6000601255601354600a819055601454600b8190556040517fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d192611a3e92908252602082015260400190565b60405180910390a1565b600080611a5584846135df565b509150505b92915050565b611a68613542565b60005b6002811015611b6e5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60068260028110611a9c57611a9c614797565b01546001600160a01b03161415611ac8574760088260028110611ac157611ac1614797565b0155611b5c565b60068160028110611adb57611adb614797565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611b22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b46919061477e565b60088260028110611b5957611b59614797565b01555b80611b66816147c5565b915050611a6b565b506040517f2c7203581ca666b8c5094c11c03f0b19b3750234a9d281bcbc88a260bcb006de90600090a1565b604080518082019182905260009182919060049060029082845b815481526020019060010190808311611bb457505050505090506000611bd86138df565b90506000670de0b6b3a7640000838860028110611bf757611bf7614797565b6020020151611c06908761473d565b611c10919061475c565b828860028110611c2257611c22614797565b6020020151611c3191906147ad565b90506000611c4188888486613998565b90506000848860028110611c5757611c57614797565b6020020151670de0b6b3a7640000600184878c60028110611c7a57611c7a614797565b6020020151611c899190614726565b611c939190614726565b611c9d919061473d565b611ca7919061475c565b905060006402540be40082600a54611cbf919061473d565b611cc9919061475c565b9050611cd58183614726565b9a9950505050505050505050565b611ceb6133ab565b600d54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015611d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d59919061477e565b9050611d636143bf565b611d6b6143bf565b60005b6002811015611e9d576000848760088460028110611d8e57611d8e614797565b0154611d9a919061473d565b611da4919061475c565b9050858260028110611db857611db8614797565b6020020151811015611e325760405162461bcd60e51b815260206004820152603060248201527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201527f6e73207468616e2065787065637465640000000000000000000000000000000060648201526084016109c9565b8060088360028110611e4657611e46614797565b016000828254611e569190614726565b90915550819050848360028110611e6f57611e6f614797565b6020020152611e8a6006836002811061120757611207614797565b5080611e95816147c5565b915050611d6e565b50600d5460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015611eea57600080fd5b505af1158015611efe573d6000803e3d6000fd5b503392507f7c363854ccf79623411f8995b362bce5eddff18c927edc6f5dbbb5e05819a82c915084905083611f338988614726565b604051611f4293929190614943565b60405180910390a250505061105d60018055565b611f5e6133ab565b60165460ff1615611f9a5760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600d54600160a01b900460ff16611ff1573415611ff15760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b604080518082019182905260009160089060029082845b8154815260200190600101908083116120085750505050509050600061202d82613ba2565b90506000670de0b6b3a76400006004886002811061204d5761204d614797565b0154612059908761473d565b612063919061475c565b82886002811061207557612075614797565b602002015161208491906147ad565b9050600061209488888486613998565b90506000600182858a600281106120ad576120ad614797565b60200201516120bc9190614726565b6120c69190614726565b905060006402540be400600a54836120de919061473d565b6120e8919061475c565b9050600489600281106120fd576120fd614797565b0154670de0b6b3a76400006121128385614726565b61211c919061473d565b612126919061475c565b91508682101561219e5760405162461bcd60e51b815260206004820152602e60248201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201527f207468616e20657870656374656400000000000000000000000000000000000060648201526084016109c9565b60006402540be400600b54836121b4919061473d565b6121be919061475c565b905060048a600281106121d3576121d3614797565b01546121e7670de0b6b3a76400008361473d565b6121f1919061475c565b905088878c6002811061220657612206614797565b602002015161221591906147ad565b60088c6002811061222857612228614797565b01558083888c6002811061223e5761223e614797565b602002015161224d9190614726565b6122579190614726565b60088b6002811061226a5761226a614797565b0155600060068c6002811061228157612281614797565b01546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8114156122f657348a146122f15760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b61230b565b61230b6001600160a01b03821633308d613c5f565b600060068c6002811061232057612320614797565b01546001600160a01b03169050612337818661359c565b604080518e8152602081018d90529081018d90526060810186905233907fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989060800160405180910390a250505050505050505061239360018055565b50505050565b6123a1613542565b601254156123f15760405162461bcd60e51b815260206004820181905260248201527f61646d696e5f616374696f6e735f646561646c696e65206d757374206265203060448201526064016109c9565b64012a05f2008211156124465760405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d000000000000000060448201526064016109c9565b6402540be40081111561249b5760405162461bcd60e51b815260206004820152601e60248201527f6465763a2061646d696e206665652065786365656473206d6178696d756d000060448201526064016109c9565b6124a86203f480426147ad565b60128190556013839055601482905560408051848152602081018490527f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe0910160405180910390a25050565b6004816002811061191c57600080fd5b61250c613542565b6125166000613d10565b565b6002816002811061191c57600080fd5b6000806125336138df565b604080518082019182905291925060009190600290819081845b81548152602001906001019080831161254d5750505050509050600081876002811061257b5761257b614797565b602002015161258a908661473d565b83886002811061259c5761259c614797565b60200201516125ab91906147ad565b905060006125bb88888487613998565b905060008388600281106125d1576125d1614797565b6020020151600183878b600281106125eb576125eb614797565b60200201516125fa9190614726565b611c9d9190614726565b61260c613542565b6108fc811015801561262057506159d88111155b61266c5760405162461bcd60e51b815260206004820152600b60248201527f496c6c6567616c2067617300000000000000000000000000000000000000000060448201526064016109c9565b600c8190556040518181527f320c5e7159406866d39a81979ca1c22276b644dfcfd52ee1f335ee467ad0ec67906020015b60405180910390a150565b6000806126c36126b66138df565b6126be613405565b613d6d565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561271a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273e919061477e565b905080612753670de0b6b3a76400008461473d565b61275d919061475c565b9250505090565b6006816002811061277457600080fd5b01546001600160a01b0316905081565b61278c613542565b6000612796613405565b600e819055600f81905542601081905560118190556040519192507f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc2019389161269d91848252602082015260400190565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6006836002811061280f5761280f614797565b01546001600160a01b0316141561283f576008826002811061283357612833614797565b0154611a5a9047614726565b6008826002811061285257612852614797565b01546006836002811061286757612867614797565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156128ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d2919061477e565b611a5a9190614726565b919050565b6128e96133ab565b60165460ff16156129255760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600d54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa15801561296f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612993919061477e565b9050600081116129e55760405162461bcd60e51b815260206004820152601660248201527f6465763a207a65726f20746f74616c20737570706c790000000000000000000060448201526064016109c9565b60006129f360016002614726565b6129fe90600461473d565b6002600a54612a0d919061473d565b612a17919061475c565b600b549091506000612a27613405565b60408051808201918290529192506000919060089060029082845b815481526020019060010190808311612a4257505050505090506000604051806040016040528083600060028110612a7c57612a7c614797565b6020020151815260200183600160028110612a9957612a99614797565b6020020151905290506000612aae83856134a6565b905060005b6002811015612b0b57898160028110612ace57612ace614797565b6020020151838260028110612ae557612ae5614797565b60200201818151612af69190614726565b90525080612b03816147c5565b915050612ab3565b506000612b1883866134a6565b9050612b226143bf565b60005b6002811015612cb757600084878360028110612b4357612b43614797565b6020020151612b52908661473d565b612b5c919061475c565b90506000868360028110612b7257612b72614797565b6020020151821115612ba657868360028110612b9057612b90614797565b6020020151612b9f9083614726565b9050612bcb565b81878460028110612bb957612bb9614797565b6020020151612bc89190614726565b90505b6402540be400612bdb828d61473d565b612be5919061475c565b848460028110612bf757612bf7614797565b60200201526402540be4008a858560028110612c1557612c15614797565b6020020151612c24919061473d565b612c2e919061475c565b878460028110612c4057612c40614797565b6020020151612c4f9190614726565b60088460028110612c6257612c62614797565b0155838360028110612c7657612c76614797565b6020020151878460028110612c8d57612c8d614797565b60200201818151612c9e9190614726565b905250829150612caf9050816147c5565b915050612b25565b506000612cc485886134a6565b90506000848b612cd48483614726565b612cde919061473d565b612ce8919061475c565b905060008111612d605760405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201527f6e2030000000000000000000000000000000000000000000000000000000000060648201526084016109c9565b612d6b6001826147ad565b90508b811115612dbd5760405162461bcd60e51b815260206004820152601460248201527f536c697070616765207363726577656420796f7500000000000000000000000060448201526064016109c9565b600d5460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612e0957600080fd5b505af1158015612e1d573d6000803e3d6000fd5b5050505060005b6002811015612e9b5760008e8260028110612e4157612e41614797565b60200201511115612e8957612e8960068260028110612e6257612e62614797565b01546001600160a01b03168f8360028110612e7f57612e7f614797565b602002015161359c565b80612e93816147c5565b915050612e24565b50612ea6818c614726565b9a50336001600160a01b03167f2b5508378d7e19e0d5fa338419034731416c4f5b219a10379956f764317fd47e8e85878f6040516110419493929190614803565b612eef613542565b4260155411612f405760405162461bcd60e51b815260206004820152601160248201527f457863656564656420646561646c696e6500000000000000000000000000000060448201526064016109c9565b6016805460ff191660011790556040517fbe26733c2bf6ff3ea5ba8cfe744422bd49052ff9ed5685c9e81e6f9321dbaddd90600090a1565b604080518082019182905260009182919060089060029082845b815481526020019060010190808311612f9257505050505090506000612fb6613405565b90506000612fc483836134a6565b905060005b600281101561306a57851561301a57868160028110612fea57612fea614797565b602002015184826002811061300157613001614797565b6020020181815161301291906147ad565b905250613058565b86816002811061302c5761302c614797565b602002015184826002811061304357613043614797565b602002018181516130549190614726565b9052505b80613062816147c5565b915050612fc9565b50600061307784846134a6565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130f2919061477e565b90506000871561310d576131068484614726565b905061311a565b6131178385614726565b90505b83613125838361473d565b61312f919061475c565b9998505050505050505050565b6131446133ab565b60165460ff16156131805760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b60008061318d85856135df565b91509150828210156131e15760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f766564000000000000000060448201526064016109c9565b6402540be400600b54826131f5919061473d565b6131ff919061475c565b61320990836147ad565b6008856002811061321c5761321c614797565b01600082825461322c9190614726565b9091555050600d5460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561327d57600080fd5b505af1158015613291573d6000803e3d6000fd5b505050506132bc600685600281106132ab576132ab614797565b01546001600160a01b03168361359c565b604080518581526020810187905290810183905233907f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a09060600160405180910390a2505061330a60018055565b505050565b613317613542565b6001600160a01b0381166133935760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016109c9565b61122b81613d10565b60006133a6613405565b905090565b600260015414156133fe5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109c9565b6002600155565b601154600f546000919042821115611a5a57600e546010548183111561346a5761342f8185614726565b6134398242614726565b6134438486614726565b61344d919061473d565b613457919061475c565b61346190836147ad565b94505050505090565b6134748185614726565b61347e8242614726565b6134888585614726565b613492919061473d565b61349c919061475c565b6134619083614726565b60006134ba6134b484613ba2565b83613d6d565b9392505050565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561352d5734811461105d5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b61105d6001600160a01b038316333084613c5f565b6000546001600160a01b031633146125165760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109c9565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156135cb5761105d3382613f03565b61105d6001600160a01b0383163383613faa565b60008060006135ec613405565b905060006135fc60016002614726565b61360790600461473d565b6002600a54613616919061473d565b613620919061475c565b604080518082019182905291925060009190600290819081845b81548152602001906001019080831161363a57505050505090506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156136a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136cd919061477e565b905060006136d96138df565b905060006136e78287613d6d565b90506000836136f6838d61473d565b613700919061475c565b61370a9083614726565b905082600061371b898d8486613ff3565b90506000878d6002811061373157613731614797565b602002015182878f6002811061374957613749614797565b60200201516137589190614726565b613762919061475c565b905060005b600281101561385e5760008e8214156137b9578387878a856002811061378f5761378f614797565b602002015161379e919061473d565b6137a8919061475c565b6137b29190614726565b905061380a565b86868984600281106137cd576137cd614797565b60200201516137dc919061473d565b6137e6919061475c565b8883600281106137f8576137f8614797565b60200201516138079190614726565b90505b6402540be40061381a828d61473d565b613824919061475c565b85836002811061383657613836614797565b602002018181516138479190614726565b905250819050613856816147c5565b915050613767565b50600061386d8b8f8688613ff3565b848f6002811061387f5761387f614797565b602002015161388e9190614726565b9050888e600281106138a2576138a2614797565b60200201516138b2600183614726565b6138bc919061475c565b9050806138c98184614726565b9c509c5050505050505050505050509250929050565b6138e76143bf565b60408051808201918290529060049060029082845b8154815260200190600101908083116138fc575050505050905060005b600281101561399457670de0b6b3a76400006008826002811061393e5761393e614797565b015483836002811061395257613952614797565b6020020151613961919061473d565b61396b919061475c565b82826002811061397d5761397d614797565b60200201528061398c816147c5565b915050613919565b5090565b60008385141580156139aa5750600285105b80156139b65750600284105b613a025760405162461bcd60e51b815260206004820152601160248201527f496c6c6567616c20706172616d6574657200000000000000000000000000000060448201526064016109c9565b6000613a0c613405565b90506000613a1a8483613d6d565b905080600080613a2b60028661473d565b90506000805b6002811015613ab4578b811415613a4a57899150613a74565b8a8114613a6f57888160028110613a6357613a63614797565b60200201519150613a74565b613aa2565b613a7e82856147ad565b9350613a8b60028361473d565b613a95878761473d565b613a9f919061475c565b94505b80613aac816147c5565b915050613a31565b50613ac060028361473d565b613aca868661473d565b613ad4919061475c565b93506000613ae2838761475c565b613aec90856147ad565b9050600086815b60ff811015613b8e578192508884836002613b0e919061473d565b613b1891906147ad565b613b229190614726565b88613b2d848061473d565b613b3791906147ad565b613b41919061475c565b915082821115613b66576001613b578484614726565b11613b6157613b8e565b613b7c565b6001613b728385614726565b11613b7c57613b8e565b80613b86816147c5565b915050613af3565b50985050505050505050505b949350505050565b613baa6143bf565b60408051808201918290529060049060029082845b815481526020019060010190808311613bbf575050505050905060005b6002811015613c5957670de0b6b3a7640000838260028110613c0057613c00614797565b6020020151838360028110613c1757613c17614797565b6020020151613c26919061473d565b613c30919061475c565b828260028110613c4257613c42614797565b602002015280613c51816147c5565b915050613bdc565b50919050565b6040516001600160a01b03808516602483015283166044820152606481018290526123939085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526141b7565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060005b6002811015613db157848160028110613d8e57613d8e614797565b6020020151613d9d90836147ad565b915080613da9816147c5565b915050613d73565b5080613dc1576000915050611a5a565b60008181613dd060028761473d565b905060005b60ff811015613ef7578260005b6002811015613e365760028a8260028110613dff57613dff614797565b6020020151613e0e919061473d565b613e18868461473d565b613e22919061475c565b915080613e2e816147c5565b915050613de2565b508394508060026001613e4991906147ad565b613e53919061473d565b84613e5f600186614726565b613e69919061473d565b613e7391906147ad565b84613e7f60028461473d565b613e89898761473d565b613e9391906147ad565b613e9d919061473d565b613ea7919061475c565b935084841115613ecd576001613ebd8686614726565b11613ec85750613ef7565b613ee4565b6001613ed98587614726565b11613ee45750613ef7565b5080613eef816147c5565b915050613dd5565b50909695505050505050565b6000826001600160a01b0316600c5483604051600060405180830381858888f193505050503d8060008114613f54576040519150601f19603f3d011682016040523d82523d6000602084013e613f59565b606091505b505090508061330a5760405162461bcd60e51b815260206004820152601360248201527f424e42207472616e73666572206661696c65640000000000000000000000000060448201526064016109c9565b6040516001600160a01b03831660248201526044810182905261330a9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401613cac565b6000600284106140455760405162461bcd60e51b815260206004820152601460248201527f6465763a20692061626f7665204e5f434f494e5300000000000000000000000060448201526064016109c9565b8160008061405460028961473d565b90506000805b60028110156140cd578881146140885787816002811061407c5761407c614797565b6020020151915061408d565b6140bb565b61409782856147ad565b93506140a460028361473d565b6140ae888761473d565b6140b8919061475c565b94505b806140c5816147c5565b91505061405a565b506140d960028361473d565b6140e3878661473d565b6140ed919061475c565b935060006140fb838861475c565b61410590856147ad565b9050600087815b60ff8110156141a7578192508984836002614127919061473d565b61413191906147ad565b61413b9190614726565b88614146848061473d565b61415091906147ad565b61415a919061475c565b91508282111561417f5760016141708484614726565b1161417a576141a7565b614195565b600161418b8385614726565b11614195576141a7565b8061419f816147c5565b91505061410c565b509b9a5050505050505050505050565b600061420c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661429f9092919063ffffffff16565b905080516000148061422d57508080602001905181019061422d919061496c565b61330a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016109c9565b6060613b9a848460008585600080866001600160a01b031685876040516142c691906149b5565b60006040518083038185875af1925050503d8060008114614303576040519150601f19603f3d011682016040523d82523d6000602084013e614308565b606091505b509150915061431987838387614324565b979650505050505050565b60608315614390578251614389576001600160a01b0385163b6143895760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109c9565b5081613b9a565b613b9a83838151156143a55781518083602001fd5b8060405162461bcd60e51b81526004016109c991906149d1565b60405180604001604052806002906020820280368337509192915050565b826002810192821561440b579160200282015b8281111561440b5782518255916020019190600101906143f0565b5061399492915061446c565b826002810192821561440b579160200282015b8281111561440b578251825473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390911617825560209092019160019091019061442a565b5b80821115613994576000815560010161446d565b6040805190810167ffffffffffffffff811182821017156144b257634e487b7160e01b600052604160045260246000fd5b60405290565b600082601f8301126144c957600080fd5b6144d1614481565b8060408401858111156144e357600080fd5b845b818110156144fd5780358452602093840193016144e5565b509095945050505050565b6000806060838503121561451b57600080fd5b61452584846144b8565b946040939093013593505050565b6000806040838503121561454657600080fd5b50508035926020909101359150565b80356001600160a01b03811681146128dc57600080fd5b60008060008060008060e0878903121561458557600080fd5b87601f88011261459457600080fd5b61459c614481565b80604089018a8111156145ae57600080fd5b895b818110156145cf576145c181614555565b8452602093840193016145b0565b509097503595505060608701359350608087013592506145f160a08801614555565b91506145ff60c08801614555565b90509295509295509295565b60006020828403121561461d57600080fd5b5035919050565b60008060006060848603121561463957600080fd5b505081359360208301359350604090920135919050565b6000806060838503121561466357600080fd5b8235915061467484602085016144b8565b90509250929050565b6000806000806080858703121561469357600080fd5b5050823594602084013594506040840135936060013592509050565b801515811461122b57600080fd5b600080606083850312156146d057600080fd5b6146da84846144b8565b915060408301356146ea816146af565b809150509250929050565b60006020828403121561470757600080fd5b6134ba82614555565b634e487b7160e01b600052601160045260246000fd5b60008282101561473857614738614710565b500390565b600081600019048311821515161561475757614757614710565b500290565b60008261477957634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561479057600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600082198211156147c0576147c0614710565b500190565b60006000198214156147d9576147d9614710565b5060010190565b8060005b60028110156123935781518452602093840193909101906001016147e4565b60c0810161481182876147e0565b61481e60408301866147e0565b608082019390935260a0015292915050565b60006020828403121561484257600080fd5b815160ff811681146134ba57600080fd5b600181815b8085111561488e57816000190482111561487457614874614710565b8085161561488157918102915b93841c9390800290614858565b509250929050565b6000826148a557506001611a5a565b816148b257506000611a5a565b81600181146148c857600281146148d2576148ee565b6001915050611a5a565b60ff8411156148e3576148e3614710565b50506001821b611a5a565b5060208310610133831016604e8410600b8410161715614911575081810a611a5a565b61491b8383614853565b806000190482111561492f5761492f614710565b029392505050565b60006134ba8383614896565b60a0810161495182866147e0565b61495e60408301856147e0565b826080830152949350505050565b60006020828403121561497e57600080fd5b81516134ba816146af565b60005b838110156149a457818101518382015260200161498c565b838111156123935750506000910152565b600082516149c7818460208701614989565b9190910192915050565b60208152600082518060208401526149f0816040850160208701614989565b601f01601f1916919091016040019291505056fea26469706673582212207fd8ba3b22ed00cc883b4cc9206f65e25c2ea39f2b2e15e55f6b33b33b2f2af764736f6c634300080a0033a2646970667358221220dca2cb1adc0b39e6818f025bd2b747cf4c62686a88927a425b83377a7c96294f64736f6c634300080a0033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100675760003560e01c80638da5cb5b116100505780638da5cb5b146100915780639013148d146100b6578063f2fde38b146100c957600080fd5b8063293577501461006c578063715018a614610087575b600080fd5b610074600281565b6040519081526020015b60405180910390f35b61008f6100dc565b005b6000546001600160a01b03165b6040516001600160a01b03909116815260200161007e565b61009e6100c43660046104ef565b6100f0565b61008f6100d7366004610560565b6102e1565b6100e4610371565b6100ee60006103cb565b565b60006100fa610371565b6001600160a01b0388161580159061011a57506001600160a01b03871615155b80156101385750866001600160a01b0316886001600160a01b031614155b6101895760405162461bcd60e51b815260206004820152600d60248201527f496c6c6567616c20746f6b656e0000000000000000000000000000000000000060448201526064015b60405180910390fd5b6000806101968a8a610433565b9150915060006040518060400160405280846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681525090506000604051806020016101e9906104c6565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606087811b8216602084015286811b8216603484015233901b16604882015242605c82015246607c820152909150600090609c016040516020818303038152906040528051906020012090506000818351602085016000f59050806001600160a01b0316634239b1c1858e8e8e8e8e6040518763ffffffff1660e01b815260040161029c96959493929190610582565b600060405180830381600087803b1580156102b657600080fd5b505af11580156102ca573d6000803e3d6000fd5b509298505050505050505050979650505050505050565b6102e9610371565b6001600160a01b0381166103655760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610180565b61036e816103cb565b50565b6000546001600160a01b031633146100ee5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610180565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080826001600160a01b0316846001600160a01b031614156104985760405162461bcd60e51b815260206004820152601360248201527f4944454e544943414c5f414444524553534553000000000000000000000000006044820152606401610180565b826001600160a01b0316846001600160a01b0316106104b85782846104bb565b83835b909590945092505050565b614ade806105eb83390190565b80356001600160a01b03811681146104ea57600080fd5b919050565b600080600080600080600060e0888a03121561050a57600080fd5b610513886104d3565b9650610521602089016104d3565b955060408801359450606088013593506080880135925061054460a089016104d3565b915061055260c089016104d3565b905092959891949750929550565b60006020828403121561057257600080fd5b61057b826104d3565b9392505050565b60e08101818860005b60028110156105b35781516001600160a01b031683526020928301929091019060010161058b565b5050506040820196909652606081019490945260808401929092526001600160a01b0390811660a08401521660c09091015291905056fe60a0604052610fbd600c553480156200001757600080fd5b50620000233362000031565b600180553360805262000081565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b608051614a3a620000a46000396000818161074a01526114cb0152614a3a6000f3fe6080604052600436106103815760003560e01c80637dafa364116101d1578063d73792a911610102578063ed8e84f3116100a0578063f3de03621161006f578063f3de036214610816578063f446c1d01461093e578063fc0c546a14610953578063fee3f7f91461097357600080fd5b8063ed8e84f3146108c7578063edfb7801146108e7578063f1dc3cc9146108fe578063f2fde38b1461091e57600080fd5b8063e3103273116100dc578063e310327314610865578063e369885314610885578063e38244621461089a578063e5d9e903146108b057600080fd5b8063d73792a914610816578063ddca3f431461082f578063e2e7d2641461084557600080fd5b8063aaf5eb681161016f578063bb7b8b8011610149578063bb7b8b80146107b3578063bc063e1a146107c8578063c6610657146107e1578063ca8ca1541461080157600080fd5b8063aaf5eb681461076c578063ab5ac06114610788578063b4b577ad1461079d57600080fd5b80639a1d6ed3116101ab5780639a1d6ed3146106e85780639c868ac0146106fe578063a139c37014610718578063a6b0a7181461073857600080fd5b80637dafa3641461067657806385f11d1e146106965780638da5cb5b146106b657600080fd5b80634239b1c1116102b6578063556d6e9f116102545780635b5a1467116102235780635b5a14671461060c57806362203d741461062c5780636d4366b71461064c578063715018a61461066157600080fd5b8063556d6e9f146105a357806358680d0b146105c35780635b36389c146105d95780635b41b908146105f957600080fd5b80634f12fe97116102905780634f12fe97146105435780634fb08c5e14610558578063524c3901146105785780635409491a1461058d57600080fd5b80634239b1c1146104ed5780634488ddf01461050d5780634903b0d11461052357600080fd5b80632a42689611610323578063392e53cd116102fd578063392e53cd1461047157806339698415146104a05780633c157e64146104b7578063405e28f8146104d757600080fd5b80632a426896146104315780633046f9721461044757806330c540851461045c57600080fd5b80632081066c1161035f5780632081066c146103db578063226840fb146103f157806325d2edf014610406578063293577501461041c57600080fd5b806306e9481c146103865780630b4c7e4d146103b057806314052288146103c5575b600080fd5b34801561039257600080fd5b5061039d6201518081565b6040519081526020015b60405180910390f35b6103c36103be366004614508565b610989565b005b3480156103d157600080fd5b5061039d60115481565b3480156103e757600080fd5b5061039d60105481565b3480156103fd57600080fd5b506103c3611061565b34801561041257600080fd5b5061039d6159d881565b34801561042857600080fd5b5061039d600281565b34801561043d57600080fd5b5061039d60155481565b34801561045357600080fd5b506103c3611099565b34801561046857600080fd5b506103c36110d6565b34801561047d57600080fd5b5060165461049090610100900460ff1681565b60405190151581526020016103a7565b3480156104ac57600080fd5b5061039d620f424081565b3480156104c357600080fd5b506103c36104d2366004614533565b61122e565b3480156104e357600080fd5b5061039d60125481565b3480156104f957600080fd5b506103c361050836600461456c565b611468565b34801561051957600080fd5b5061039d600c5481565b34801561052f57600080fd5b5061039d61053e36600461460b565b61190c565b34801561054f57600080fd5b506103c3611923565b34801561056457600080fd5b5061039d610573366004614533565b611a48565b34801561058457600080fd5b506103c3611a60565b34801561059957600080fd5b5061039d600e5481565b3480156105af57600080fd5b5061039d6105be366004614624565b611b9a565b3480156105cf57600080fd5b5061039d60135481565b3480156105e557600080fd5b506103c36105f4366004614650565b611ce3565b6103c361060736600461467d565b611f56565b34801561061857600080fd5b506103c3610627366004614533565b612399565b34801561063857600080fd5b5061039d61064736600461460b565b6124f4565b34801561065857600080fd5b5061039d601281565b34801561066d57600080fd5b506103c3612504565b34801561068257600080fd5b5061039d61069136600461460b565b612518565b3480156106a257600080fd5b5061039d6106b1366004614624565b612528565b3480156106c257600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103a7565b3480156106f457600080fd5b5061039d6108fc81565b34801561070a57600080fd5b506016546104909060ff1681565b34801561072457600080fd5b506103c361073336600461460b565b612604565b34801561074457600080fd5b506106d07f000000000000000000000000000000000000000000000000000000000000000081565b34801561077857600080fd5b5061039d670de0b6b3a764000081565b34801561079457600080fd5b5061039d600a81565b3480156107a957600080fd5b5061039d600f5481565b3480156107bf57600080fd5b5061039d6126a8565b3480156107d457600080fd5b5061039d64012a05f20081565b3480156107ed57600080fd5b506106d06107fc36600461460b565b612764565b34801561080d57600080fd5b506103c3612784565b34801561082257600080fd5b5061039d6402540be40081565b34801561083b57600080fd5b5061039d600a5481565b34801561085157600080fd5b5061039d61086036600461460b565b6127e5565b34801561087157600080fd5b506103c3610880366004614508565b6128e1565b34801561089157600080fd5b506103c3612ee7565b3480156108a657600080fd5b5061039d60145481565b3480156108bc57600080fd5b5061039d6203f48081565b3480156108d357600080fd5b5061039d6108e23660046146bd565b612f78565b3480156108f357600080fd5b5061039d624f1a0081565b34801561090a57600080fd5b506103c3610919366004614624565b61313c565b34801561092a57600080fd5b506103c36109393660046146f5565b61330f565b34801561094a57600080fd5b5061039d61339c565b34801561095f57600080fd5b50600d546106d0906001600160a01b031681565b34801561097f57600080fd5b5061039d600b5481565b6109916133ab565b60165460ff16156109d25760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064015b60405180910390fd5b600d54600160a01b900460ff16610a29573415610a295760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b610a316143bf565b6000610a3f60016002614726565b610a4a90600461473d565b6002600a54610a59919061473d565b610a63919061475c565b600b549091506000610a73613405565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aca573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aee919061477e565b6040805180820191829052919250600091829160089060029082845b815481526020019060010190808311610b0a57505050505090506000831115610b3a57610b3781856134a6565b91505b6000604051806040016040528083600060028110610b5a57610b5a614797565b6020020151815260200183600160028110610b7757610b77614797565b60200201519052905060005b6002811015610c7e5784610c1d5760008b8260028110610ba557610ba5614797565b602002015111610c1d5760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f6960448201527f6e7300000000000000000000000000000000000000000000000000000000000060648201526084016109c9565b8a8160028110610c2f57610c2f614797565b6020020151838260028110610c4657610c46614797565b6020020151610c5591906147ad565b828260028110610c6757610c67614797565b602002015280610c76816147c5565b915050610b83565b506000610c8b82876134a6565b9050838111610cdc5760405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e20443000000000000060448201526064016109c9565b808515610e8a5760005b6002811015610e7857600086868360028110610d0457610d04614797565b6020020151610d13908661473d565b610d1d919061475c565b90506000858360028110610d3357610d33614797565b6020020151821115610d6757858360028110610d5157610d51614797565b6020020151610d609083614726565b9050610d8c565b81868460028110610d7a57610d7a614797565b6020020151610d899190614726565b90505b6402540be400610d9c828e61473d565b610da6919061475c565b8d8460028110610db857610db8614797565b60200201526402540be4008b8e8560028110610dd657610dd6614797565b6020020151610de5919061473d565b610def919061475c565b868460028110610e0157610e01614797565b6020020151610e109190614726565b60088460028110610e2357610e23614797565b01558c8360028110610e3757610e37614797565b6020020151868460028110610e4e57610e4e614797565b60200201818151610e5f9190614726565b905250829150610e709050816147c5565b915050610ce6565b50610e8383886134a6565b9050610e99565b610e9760088460026143dd565b505b600086610ea7575081610ec9565b85610eb28184614726565b610ebc908961473d565b610ec6919061475c565b90505b8b811015610f195760405162461bcd60e51b815260206004820152601460248201527f536c697070616765207363726577656420796f7500000000000000000000000060448201526064016109c9565b60005b6002811015610f815760008e8260028110610f3957610f39614797565b60200201519050600060068360028110610f5557610f55614797565b01546001600160a01b03169050610f6c81836134c1565b50508080610f79906147c5565b915050610f1c565b50600d546040517f40c10f19000000000000000000000000000000000000000000000000000000008152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b158015610fe757600080fd5b505af1158015610ffb573d6000803e3d6000fd5b503392507f26f55a85081d24974e85c6c00045d0f0453991e95873f52bff0d21af4079a76891508f90508d86611031868d6147ad565b6040516110419493929190614803565b60405180910390a2505050505050505050505061105d60018055565b5050565b611069613542565b600060128190556040517f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a19190a1565b6110a1613542565b6016805460ff191690556040517f061284ffa2814ace135f62907c78a7cff0f070efe7e6a0a42740ea1da2c8bdc890600090a1565b6110de613542565b60005b600281101561122b57600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6006836002811061111457611114614797565b01546001600160a01b0316141561114b576008826002811061113857611138614797565b01546111449047614726565b90506111eb565b6008826002811061115e5761115e614797565b01546006836002811061117357611173614797565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156111ba573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111de919061477e565b6111e89190614726565b90505b8015611218576112186006836002811061120757611207614797565b01546001600160a01b03168261359c565b5080611223816147c5565b9150506110e1565b50565b611236613542565b6201518060105461124791906147ad565b4210156112965760405162461bcd60e51b815260206004820152600f60248201527f646576203a20746f6f206561726c79000000000000000000000000000000000060448201526064016109c9565b6112a362015180426147ad565b8110156112f25760405162461bcd60e51b815260206004820152601660248201527f6465763a20696e73756666696369656e742074696d650000000000000000000060448201526064016109c9565b60006112fc613405565b90506000831180156113105750620f424083105b6113825760405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e642060448201527f4d41585f4100000000000000000000000000000000000000000000000000000060648201526084016109c9565b80831015801561139c5750611398600a8261473d565b8311155b806113bb575080831080156113bb5750806113b8600a8561473d565b10155b6114075760405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f41000000000060448201526064016109c9565b600e819055600f839055426010819055601183905560408051838152602081018690528082019290925260608201849052517fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c2549181900360800190a1505050565b601654610100900460ff16156114c05760405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a65640060448201526064016109c9565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146115385760405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f727900000000000000000060448201526064016109c9565b620f424085111561158b5760405162461bcd60e51b815260206004820152601260248201527f5f412065786365656473206d6178696d756d000000000000000000000000000060448201526064016109c9565b64012a05f2008411156115e05760405162461bcd60e51b815260206004820152601460248201527f5f6665652065786365656473206d6178696d756d00000000000000000000000060448201526064016109c9565b6402540be4008311156116355760405162461bcd60e51b815260206004820152601a60248201527f5f61646d696e5f6665652065786365656473206d6178696d756d00000000000060448201526064016109c9565b6016805461ff00191661010017905560005b60028110156118a057600087826002811061166457611664614797565b60200201516001600160a01b031614156116c05760405162461bcd60e51b815260206004820152600c60248201527f5a45524f2041646472657373000000000000000000000000000000000000000060448201526064016109c9565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8883600281106116e9576116e9614797565b60200201516001600160a01b031614156117335750600d80547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17905560126117b1565b87826002811061174557611745614797565b60200201516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611787573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ab9190614830565b60ff1690505b60128111156118275760405162461bcd60e51b8152602060048201526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f7420657863656560448201527f642031380000000000000000000000000000000000000000000000000000000060648201526084016109c9565b611832816012614726565b61183d90600a614937565b6002836002811061185057611850614797565b015560028281811061186457611864614797565b015461187890670de0b6b3a764000061473d565b6004836002811061188b5761188b614797565b01555080611898816147c5565b915050611647565b506118ae6006876002614417565b50600e859055600f859055600a849055600b8390556118d0624f1a00426147ad565b601555600d805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0383161790556119048261330f565b505050505050565b6008816002811061191c57600080fd5b0154905081565b61192b613542565b60125442101561197d5760405162461bcd60e51b815260206004820152601660248201527f6465763a20696e73756666696369656e742074696d650000000000000000000060448201526064016109c9565b6012546119f25760405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201527f742062652030000000000000000000000000000000000000000000000000000060648201526084016109c9565b6000601255601354600a819055601454600b8190556040517fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d192611a3e92908252602082015260400190565b60405180910390a1565b600080611a5584846135df565b509150505b92915050565b611a68613542565b60005b6002811015611b6e5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60068260028110611a9c57611a9c614797565b01546001600160a01b03161415611ac8574760088260028110611ac157611ac1614797565b0155611b5c565b60068160028110611adb57611adb614797565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611b22573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b46919061477e565b60088260028110611b5957611b59614797565b01555b80611b66816147c5565b915050611a6b565b506040517f2c7203581ca666b8c5094c11c03f0b19b3750234a9d281bcbc88a260bcb006de90600090a1565b604080518082019182905260009182919060049060029082845b815481526020019060010190808311611bb457505050505090506000611bd86138df565b90506000670de0b6b3a7640000838860028110611bf757611bf7614797565b6020020151611c06908761473d565b611c10919061475c565b828860028110611c2257611c22614797565b6020020151611c3191906147ad565b90506000611c4188888486613998565b90506000848860028110611c5757611c57614797565b6020020151670de0b6b3a7640000600184878c60028110611c7a57611c7a614797565b6020020151611c899190614726565b611c939190614726565b611c9d919061473d565b611ca7919061475c565b905060006402540be40082600a54611cbf919061473d565b611cc9919061475c565b9050611cd58183614726565b9a9950505050505050505050565b611ceb6133ab565b600d54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015611d35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d59919061477e565b9050611d636143bf565b611d6b6143bf565b60005b6002811015611e9d576000848760088460028110611d8e57611d8e614797565b0154611d9a919061473d565b611da4919061475c565b9050858260028110611db857611db8614797565b6020020151811015611e325760405162461bcd60e51b815260206004820152603060248201527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201527f6e73207468616e2065787065637465640000000000000000000000000000000060648201526084016109c9565b8060088360028110611e4657611e46614797565b016000828254611e569190614726565b90915550819050848360028110611e6f57611e6f614797565b6020020152611e8a6006836002811061120757611207614797565b5080611e95816147c5565b915050611d6e565b50600d5460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015611eea57600080fd5b505af1158015611efe573d6000803e3d6000fd5b503392507f7c363854ccf79623411f8995b362bce5eddff18c927edc6f5dbbb5e05819a82c915084905083611f338988614726565b604051611f4293929190614943565b60405180910390a250505061105d60018055565b611f5e6133ab565b60165460ff1615611f9a5760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600d54600160a01b900460ff16611ff1573415611ff15760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b604080518082019182905260009160089060029082845b8154815260200190600101908083116120085750505050509050600061202d82613ba2565b90506000670de0b6b3a76400006004886002811061204d5761204d614797565b0154612059908761473d565b612063919061475c565b82886002811061207557612075614797565b602002015161208491906147ad565b9050600061209488888486613998565b90506000600182858a600281106120ad576120ad614797565b60200201516120bc9190614726565b6120c69190614726565b905060006402540be400600a54836120de919061473d565b6120e8919061475c565b9050600489600281106120fd576120fd614797565b0154670de0b6b3a76400006121128385614726565b61211c919061473d565b612126919061475c565b91508682101561219e5760405162461bcd60e51b815260206004820152602e60248201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201527f207468616e20657870656374656400000000000000000000000000000000000060648201526084016109c9565b60006402540be400600b54836121b4919061473d565b6121be919061475c565b905060048a600281106121d3576121d3614797565b01546121e7670de0b6b3a76400008361473d565b6121f1919061475c565b905088878c6002811061220657612206614797565b602002015161221591906147ad565b60088c6002811061222857612228614797565b01558083888c6002811061223e5761223e614797565b602002015161224d9190614726565b6122579190614726565b60088b6002811061226a5761226a614797565b0155600060068c6002811061228157612281614797565b01546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8114156122f657348a146122f15760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b61230b565b61230b6001600160a01b03821633308d613c5f565b600060068c6002811061232057612320614797565b01546001600160a01b03169050612337818661359c565b604080518e8152602081018d90529081018d90526060810186905233907fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989060800160405180910390a250505050505050505061239360018055565b50505050565b6123a1613542565b601254156123f15760405162461bcd60e51b815260206004820181905260248201527f61646d696e5f616374696f6e735f646561646c696e65206d757374206265203060448201526064016109c9565b64012a05f2008211156124465760405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d000000000000000060448201526064016109c9565b6402540be40081111561249b5760405162461bcd60e51b815260206004820152601e60248201527f6465763a2061646d696e206665652065786365656473206d6178696d756d000060448201526064016109c9565b6124a86203f480426147ad565b60128190556013839055601482905560408051848152602081018490527f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe0910160405180910390a25050565b6004816002811061191c57600080fd5b61250c613542565b6125166000613d10565b565b6002816002811061191c57600080fd5b6000806125336138df565b604080518082019182905291925060009190600290819081845b81548152602001906001019080831161254d5750505050509050600081876002811061257b5761257b614797565b602002015161258a908661473d565b83886002811061259c5761259c614797565b60200201516125ab91906147ad565b905060006125bb88888487613998565b905060008388600281106125d1576125d1614797565b6020020151600183878b600281106125eb576125eb614797565b60200201516125fa9190614726565b611c9d9190614726565b61260c613542565b6108fc811015801561262057506159d88111155b61266c5760405162461bcd60e51b815260206004820152600b60248201527f496c6c6567616c2067617300000000000000000000000000000000000000000060448201526064016109c9565b600c8190556040518181527f320c5e7159406866d39a81979ca1c22276b644dfcfd52ee1f335ee467ad0ec67906020015b60405180910390a150565b6000806126c36126b66138df565b6126be613405565b613d6d565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561271a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273e919061477e565b905080612753670de0b6b3a76400008461473d565b61275d919061475c565b9250505090565b6006816002811061277457600080fd5b01546001600160a01b0316905081565b61278c613542565b6000612796613405565b600e819055600f81905542601081905560118190556040519192507f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc2019389161269d91848252602082015260400190565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6006836002811061280f5761280f614797565b01546001600160a01b0316141561283f576008826002811061283357612833614797565b0154611a5a9047614726565b6008826002811061285257612852614797565b01546006836002811061286757612867614797565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa1580156128ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128d2919061477e565b611a5a9190614726565b919050565b6128e96133ab565b60165460ff16156129255760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b600d54604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa15801561296f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612993919061477e565b9050600081116129e55760405162461bcd60e51b815260206004820152601660248201527f6465763a207a65726f20746f74616c20737570706c790000000000000000000060448201526064016109c9565b60006129f360016002614726565b6129fe90600461473d565b6002600a54612a0d919061473d565b612a17919061475c565b600b549091506000612a27613405565b60408051808201918290529192506000919060089060029082845b815481526020019060010190808311612a4257505050505090506000604051806040016040528083600060028110612a7c57612a7c614797565b6020020151815260200183600160028110612a9957612a99614797565b6020020151905290506000612aae83856134a6565b905060005b6002811015612b0b57898160028110612ace57612ace614797565b6020020151838260028110612ae557612ae5614797565b60200201818151612af69190614726565b90525080612b03816147c5565b915050612ab3565b506000612b1883866134a6565b9050612b226143bf565b60005b6002811015612cb757600084878360028110612b4357612b43614797565b6020020151612b52908661473d565b612b5c919061475c565b90506000868360028110612b7257612b72614797565b6020020151821115612ba657868360028110612b9057612b90614797565b6020020151612b9f9083614726565b9050612bcb565b81878460028110612bb957612bb9614797565b6020020151612bc89190614726565b90505b6402540be400612bdb828d61473d565b612be5919061475c565b848460028110612bf757612bf7614797565b60200201526402540be4008a858560028110612c1557612c15614797565b6020020151612c24919061473d565b612c2e919061475c565b878460028110612c4057612c40614797565b6020020151612c4f9190614726565b60088460028110612c6257612c62614797565b0155838360028110612c7657612c76614797565b6020020151878460028110612c8d57612c8d614797565b60200201818151612c9e9190614726565b905250829150612caf9050816147c5565b915050612b25565b506000612cc485886134a6565b90506000848b612cd48483614726565b612cde919061473d565b612ce8919061475c565b905060008111612d605760405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201527f6e2030000000000000000000000000000000000000000000000000000000000060648201526084016109c9565b612d6b6001826147ad565b90508b811115612dbd5760405162461bcd60e51b815260206004820152601460248201527f536c697070616765207363726577656420796f7500000000000000000000000060448201526064016109c9565b600d5460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612e0957600080fd5b505af1158015612e1d573d6000803e3d6000fd5b5050505060005b6002811015612e9b5760008e8260028110612e4157612e41614797565b60200201511115612e8957612e8960068260028110612e6257612e62614797565b01546001600160a01b03168f8360028110612e7f57612e7f614797565b602002015161359c565b80612e93816147c5565b915050612e24565b50612ea6818c614726565b9a50336001600160a01b03167f2b5508378d7e19e0d5fa338419034731416c4f5b219a10379956f764317fd47e8e85878f6040516110419493929190614803565b612eef613542565b4260155411612f405760405162461bcd60e51b815260206004820152601160248201527f457863656564656420646561646c696e6500000000000000000000000000000060448201526064016109c9565b6016805460ff191660011790556040517fbe26733c2bf6ff3ea5ba8cfe744422bd49052ff9ed5685c9e81e6f9321dbaddd90600090a1565b604080518082019182905260009182919060089060029082845b815481526020019060010190808311612f9257505050505090506000612fb6613405565b90506000612fc483836134a6565b905060005b600281101561306a57851561301a57868160028110612fea57612fea614797565b602002015184826002811061300157613001614797565b6020020181815161301291906147ad565b905250613058565b86816002811061302c5761302c614797565b602002015184826002811061304357613043614797565b602002018181516130549190614726565b9052505b80613062816147c5565b915050612fc9565b50600061307784846134a6565b90506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156130ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906130f2919061477e565b90506000871561310d576131068484614726565b905061311a565b6131178385614726565b90505b83613125838361473d565b61312f919061475c565b9998505050505050505050565b6131446133ab565b60165460ff16156131805760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b60448201526064016109c9565b60008061318d85856135df565b91509150828210156131e15760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f766564000000000000000060448201526064016109c9565b6402540be400600b54826131f5919061473d565b6131ff919061475c565b61320990836147ad565b6008856002811061321c5761321c614797565b01600082825461322c9190614726565b9091555050600d5460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561327d57600080fd5b505af1158015613291573d6000803e3d6000fd5b505050506132bc600685600281106132ab576132ab614797565b01546001600160a01b03168361359c565b604080518581526020810187905290810183905233907f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a09060600160405180910390a2505061330a60018055565b505050565b613317613542565b6001600160a01b0381166133935760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016109c9565b61122b81613d10565b60006133a6613405565b905090565b600260015414156133fe5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064016109c9565b6002600155565b601154600f546000919042821115611a5a57600e546010548183111561346a5761342f8185614726565b6134398242614726565b6134438486614726565b61344d919061473d565b613457919061475c565b61346190836147ad565b94505050505090565b6134748185614726565b61347e8242614726565b6134888585614726565b613492919061473d565b61349c919061475c565b6134619083614726565b60006134ba6134b484613ba2565b83613d6d565b9392505050565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561352d5734811461105d5760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b60448201526064016109c9565b61105d6001600160a01b038316333084613c5f565b6000546001600160a01b031633146125165760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016109c9565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee14156135cb5761105d3382613f03565b61105d6001600160a01b0383163383613faa565b60008060006135ec613405565b905060006135fc60016002614726565b61360790600461473d565b6002600a54613616919061473d565b613620919061475c565b604080518082019182905291925060009190600290819081845b81548152602001906001019080831161363a57505050505090506000600d60009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156136a9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136cd919061477e565b905060006136d96138df565b905060006136e78287613d6d565b90506000836136f6838d61473d565b613700919061475c565b61370a9083614726565b905082600061371b898d8486613ff3565b90506000878d6002811061373157613731614797565b602002015182878f6002811061374957613749614797565b60200201516137589190614726565b613762919061475c565b905060005b600281101561385e5760008e8214156137b9578387878a856002811061378f5761378f614797565b602002015161379e919061473d565b6137a8919061475c565b6137b29190614726565b905061380a565b86868984600281106137cd576137cd614797565b60200201516137dc919061473d565b6137e6919061475c565b8883600281106137f8576137f8614797565b60200201516138079190614726565b90505b6402540be40061381a828d61473d565b613824919061475c565b85836002811061383657613836614797565b602002018181516138479190614726565b905250819050613856816147c5565b915050613767565b50600061386d8b8f8688613ff3565b848f6002811061387f5761387f614797565b602002015161388e9190614726565b9050888e600281106138a2576138a2614797565b60200201516138b2600183614726565b6138bc919061475c565b9050806138c98184614726565b9c509c5050505050505050505050509250929050565b6138e76143bf565b60408051808201918290529060049060029082845b8154815260200190600101908083116138fc575050505050905060005b600281101561399457670de0b6b3a76400006008826002811061393e5761393e614797565b015483836002811061395257613952614797565b6020020151613961919061473d565b61396b919061475c565b82826002811061397d5761397d614797565b60200201528061398c816147c5565b915050613919565b5090565b60008385141580156139aa5750600285105b80156139b65750600284105b613a025760405162461bcd60e51b815260206004820152601160248201527f496c6c6567616c20706172616d6574657200000000000000000000000000000060448201526064016109c9565b6000613a0c613405565b90506000613a1a8483613d6d565b905080600080613a2b60028661473d565b90506000805b6002811015613ab4578b811415613a4a57899150613a74565b8a8114613a6f57888160028110613a6357613a63614797565b60200201519150613a74565b613aa2565b613a7e82856147ad565b9350613a8b60028361473d565b613a95878761473d565b613a9f919061475c565b94505b80613aac816147c5565b915050613a31565b50613ac060028361473d565b613aca868661473d565b613ad4919061475c565b93506000613ae2838761475c565b613aec90856147ad565b9050600086815b60ff811015613b8e578192508884836002613b0e919061473d565b613b1891906147ad565b613b229190614726565b88613b2d848061473d565b613b3791906147ad565b613b41919061475c565b915082821115613b66576001613b578484614726565b11613b6157613b8e565b613b7c565b6001613b728385614726565b11613b7c57613b8e565b80613b86816147c5565b915050613af3565b50985050505050505050505b949350505050565b613baa6143bf565b60408051808201918290529060049060029082845b815481526020019060010190808311613bbf575050505050905060005b6002811015613c5957670de0b6b3a7640000838260028110613c0057613c00614797565b6020020151838360028110613c1757613c17614797565b6020020151613c26919061473d565b613c30919061475c565b828260028110613c4257613c42614797565b602002015280613c51816147c5565b915050613bdc565b50919050565b6040516001600160a01b03808516602483015283166044820152606481018290526123939085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526141b7565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060005b6002811015613db157848160028110613d8e57613d8e614797565b6020020151613d9d90836147ad565b915080613da9816147c5565b915050613d73565b5080613dc1576000915050611a5a565b60008181613dd060028761473d565b905060005b60ff811015613ef7578260005b6002811015613e365760028a8260028110613dff57613dff614797565b6020020151613e0e919061473d565b613e18868461473d565b613e22919061475c565b915080613e2e816147c5565b915050613de2565b508394508060026001613e4991906147ad565b613e53919061473d565b84613e5f600186614726565b613e69919061473d565b613e7391906147ad565b84613e7f60028461473d565b613e89898761473d565b613e9391906147ad565b613e9d919061473d565b613ea7919061475c565b935084841115613ecd576001613ebd8686614726565b11613ec85750613ef7565b613ee4565b6001613ed98587614726565b11613ee45750613ef7565b5080613eef816147c5565b915050613dd5565b50909695505050505050565b6000826001600160a01b0316600c5483604051600060405180830381858888f193505050503d8060008114613f54576040519150601f19603f3d011682016040523d82523d6000602084013e613f59565b606091505b505090508061330a5760405162461bcd60e51b815260206004820152601360248201527f424e42207472616e73666572206661696c65640000000000000000000000000060448201526064016109c9565b6040516001600160a01b03831660248201526044810182905261330a9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401613cac565b6000600284106140455760405162461bcd60e51b815260206004820152601460248201527f6465763a20692061626f7665204e5f434f494e5300000000000000000000000060448201526064016109c9565b8160008061405460028961473d565b90506000805b60028110156140cd578881146140885787816002811061407c5761407c614797565b6020020151915061408d565b6140bb565b61409782856147ad565b93506140a460028361473d565b6140ae888761473d565b6140b8919061475c565b94505b806140c5816147c5565b91505061405a565b506140d960028361473d565b6140e3878661473d565b6140ed919061475c565b935060006140fb838861475c565b61410590856147ad565b9050600087815b60ff8110156141a7578192508984836002614127919061473d565b61413191906147ad565b61413b9190614726565b88614146848061473d565b61415091906147ad565b61415a919061475c565b91508282111561417f5760016141708484614726565b1161417a576141a7565b614195565b600161418b8385614726565b11614195576141a7565b8061419f816147c5565b91505061410c565b509b9a5050505050505050505050565b600061420c826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031661429f9092919063ffffffff16565b905080516000148061422d57508080602001905181019061422d919061496c565b61330a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016109c9565b6060613b9a848460008585600080866001600160a01b031685876040516142c691906149b5565b60006040518083038185875af1925050503d8060008114614303576040519150601f19603f3d011682016040523d82523d6000602084013e614308565b606091505b509150915061431987838387614324565b979650505050505050565b60608315614390578251614389576001600160a01b0385163b6143895760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016109c9565b5081613b9a565b613b9a83838151156143a55781518083602001fd5b8060405162461bcd60e51b81526004016109c991906149d1565b60405180604001604052806002906020820280368337509192915050565b826002810192821561440b579160200282015b8281111561440b5782518255916020019190600101906143f0565b5061399492915061446c565b826002810192821561440b579160200282015b8281111561440b578251825473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b0390911617825560209092019160019091019061442a565b5b80821115613994576000815560010161446d565b6040805190810167ffffffffffffffff811182821017156144b257634e487b7160e01b600052604160045260246000fd5b60405290565b600082601f8301126144c957600080fd5b6144d1614481565b8060408401858111156144e357600080fd5b845b818110156144fd5780358452602093840193016144e5565b509095945050505050565b6000806060838503121561451b57600080fd5b61452584846144b8565b946040939093013593505050565b6000806040838503121561454657600080fd5b50508035926020909101359150565b80356001600160a01b03811681146128dc57600080fd5b60008060008060008060e0878903121561458557600080fd5b87601f88011261459457600080fd5b61459c614481565b80604089018a8111156145ae57600080fd5b895b818110156145cf576145c181614555565b8452602093840193016145b0565b509097503595505060608701359350608087013592506145f160a08801614555565b91506145ff60c08801614555565b90509295509295509295565b60006020828403121561461d57600080fd5b5035919050565b60008060006060848603121561463957600080fd5b505081359360208301359350604090920135919050565b6000806060838503121561466357600080fd5b8235915061467484602085016144b8565b90509250929050565b6000806000806080858703121561469357600080fd5b5050823594602084013594506040840135936060013592509050565b801515811461122b57600080fd5b600080606083850312156146d057600080fd5b6146da84846144b8565b915060408301356146ea816146af565b809150509250929050565b60006020828403121561470757600080fd5b6134ba82614555565b634e487b7160e01b600052601160045260246000fd5b60008282101561473857614738614710565b500390565b600081600019048311821515161561475757614757614710565b500290565b60008261477957634e487b7160e01b600052601260045260246000fd5b500490565b60006020828403121561479057600080fd5b5051919050565b634e487b7160e01b600052603260045260246000fd5b600082198211156147c0576147c0614710565b500190565b60006000198214156147d9576147d9614710565b5060010190565b8060005b60028110156123935781518452602093840193909101906001016147e4565b60c0810161481182876147e0565b61481e60408301866147e0565b608082019390935260a0015292915050565b60006020828403121561484257600080fd5b815160ff811681146134ba57600080fd5b600181815b8085111561488e57816000190482111561487457614874614710565b8085161561488157918102915b93841c9390800290614858565b509250929050565b6000826148a557506001611a5a565b816148b257506000611a5a565b81600181146148c857600281146148d2576148ee565b6001915050611a5a565b60ff8411156148e3576148e3614710565b50506001821b611a5a565b5060208310610133831016604e8410600b8410161715614911575081810a611a5a565b61491b8383614853565b806000190482111561492f5761492f614710565b029392505050565b60006134ba8383614896565b60a0810161495182866147e0565b61495e60408301856147e0565b826080830152949350505050565b60006020828403121561497e57600080fd5b81516134ba816146af565b60005b838110156149a457818101518382015260200161498c565b838111156123935750506000910152565b600082516149c7818460208701614989565b9190910192915050565b60208152600082518060208401526149f0816040850160208701614989565b601f01601f1916919091016040019291505056fea26469706673582212207fd8ba3b22ed00cc883b4cc9206f65e25c2ea39f2b2e15e55f6b33b33b2f2af764736f6c634300080a0033a2646970667358221220dca2cb1adc0b39e6818f025bd2b747cf4c62686a88927a425b83377a7c96294f64736f6c634300080a0033