Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- PancakeStableSwapThreePoolDeployer
- Optimization enabled
- true
- Compiler version
- v0.8.10+commit.fc410830
- Optimization runs
- 1000
- EVM Version
- default
- Verified at
- 2024-11-08T12:28:43.056738Z
contracts/PancakeStableSwapThreePoolDeployer.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;
import "@openzeppelin/contracts/access/Ownable.sol";
import "./PancakeStableSwapThreePool.sol";
contract PancakeStableSwapThreePoolDeployer is Ownable {
uint256 public constant N_COINS = 3;
/**
* @notice constructor
*/
constructor() {}
// returns sorted token addresses, used to handle return values from pairs sorted in this order
function sortTokens(
address tokenA,
address tokenB,
address tokenC
)
internal
pure
returns (
address,
address,
address
)
{
require(tokenA != tokenB && tokenA != tokenC && tokenB != tokenC, "IDENTICAL_ADDRESSES");
address tmp;
if (tokenA > tokenB) {
tmp = tokenA;
tokenA = tokenB;
tokenB = tmp;
}
if (tokenB > tokenC) {
tmp = tokenB;
tokenB = tokenC;
tokenC = tmp;
if (tokenA > tokenB) {
tmp = tokenA;
tokenA = tokenB;
tokenB = tmp;
}
}
return (tokenA, tokenB, tokenC);
}
/**
* @notice createSwapPair
* @param _tokenA: Addresses of ERC20 conracts .
* @param _tokenB: Addresses of ERC20 conracts .
* @param _tokenC: Addresses of ERC20 conracts .
* @param _A: Amplification coefficient multiplied by n * (n - 1)
* @param _fee: Fee to charge for exchanges
* @param _admin_fee: Admin fee
* @param _admin: Admin
* @param _LP: LP
*/
function createSwapPair(
address _tokenA,
address _tokenB,
address _tokenC,
uint256 _A,
uint256 _fee,
uint256 _admin_fee,
address _admin,
address _LP
) external onlyOwner returns (address) {
require(_tokenA != address(0) && _tokenB != address(0) && _tokenA != _tokenB, "Illegal token");
(address t0, address t1, address t2) = sortTokens(_tokenA, _tokenB, _tokenC);
address[N_COINS] memory coins = [t0, t1, t2];
// create swap contract
bytes memory bytecode = type(PancakeStableSwapThreePool).creationCode;
bytes32 salt = keccak256(abi.encodePacked(t0, t1, t2, msg.sender, block.timestamp, block.chainid));
address swapContract;
assembly {
swapContract := create2(0, add(bytecode, 32), mload(bytecode), salt)
}
PancakeStableSwapThreePool(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/PancakeStableSwapThreePool.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 PancakeStableSwapThreePool is Ownable, ReentrancyGuard {
using SafeERC20 for IERC20;
uint256 public constant N_COINS = 3;
uint256 public constant MAX_DECIMAL = 18;
uint256 public constant FEE_DENOMINATOR = 1e10;
uint256 public constant PRECISION = 1e18;
uint256[N_COINS] public PRECISION_MUL;
uint256[N_COINS] public RATES;
uint256 public constant MAX_ADMIN_FEE = 1e10;
uint256 public constant MAX_FEE = 5e9;
uint256 public constant MAX_A = 1e6;
uint256 public constant MAX_A_CHANGE = 10;
uint256 public constant MIN_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], old_balances[2]];
for (uint256 i = 0; i < N_COINS; i++) {
if (token_supply == 0) {
require(amounts[i] > 0, "Initial deposit requires all coins");
}
// balances store amounts of c-tokens
new_balances[i] = old_balances[i] + amounts[i];
}
// Invariant after change
uint256 D1 = get_D_mem(new_balances, amp);
require(D1 > D0, "D1 must be greater than D0");
// We need to recalculate the invariant accounting for fees
// to calculate fair user's share
uint256 D2 = D1;
if (token_supply > 0) {
// Only account for fees if we are not the first to deposit
for (uint256 i = 0; i < N_COINS; i++) {
uint256 ideal_balance = (D1 * old_balances[i]) / D0;
uint256 difference;
if (ideal_balance > new_balances[i]) {
difference = ideal_balance - new_balances[i];
} else {
difference = new_balances[i] - ideal_balance;
}
fees[i] = (_fee * difference) / FEE_DENOMINATOR;
balances[i] = new_balances[i] - ((fees[i] * _admin_fee) / FEE_DENOMINATOR);
new_balances[i] -= fees[i];
}
D2 = get_D_mem(new_balances, amp);
} else {
balances = new_balances;
}
// Calculate, how much pool tokens to mint
uint256 mint_amount;
if (token_supply == 0) {
mint_amount = D1; // Take the dust if there was any
} else {
mint_amount = (token_supply * (D2 - D0)) / D0;
}
require(mint_amount >= min_mint_amount, "Slippage screwed you");
// Take coins from the sender
for (uint256 i = 0; i < N_COINS; i++) {
uint256 amount = amounts[i];
address coin = coins[i];
transfer_in(coin, amount);
}
// Mint pool tokens
token.mint(msg.sender, mint_amount);
emit AddLiquidity(msg.sender, amounts, fees, D1, token_supply + mint_amount);
}
function get_y(
uint256 i,
uint256 j,
uint256 x,
uint256[N_COINS] memory xp_
) internal view returns (uint256) {
// x in the input is converted to the same price/precision
require((i != j) && (i < N_COINS) && (j < N_COINS), "Illegal parameter");
uint256 amp = get_A();
uint256 D = get_D(xp_, amp);
uint256 c = D;
uint256 S_;
uint256 Ann = amp * N_COINS;
uint256 _x;
for (uint256 k = 0; k < N_COINS; k++) {
if (k == i) {
_x = x;
} else if (k != j) {
_x = xp_[k];
} else {
continue;
}
S_ += _x;
c = (c * D) / (_x * N_COINS);
}
c = (c * D) / (Ann * N_COINS);
uint256 b = S_ + D / Ann; // - D
uint256 y_prev;
uint256 y = D;
for (uint256 m = 0; m < 255; m++) {
y_prev = y;
y = (y * y + c) / (2 * y + b - D);
// Equality with the precision of 1
if (y > y_prev) {
if (y - y_prev <= 1) {
break;
}
} else {
if (y_prev - y <= 1) {
break;
}
}
}
return y;
}
function get_dy(
uint256 i,
uint256 j,
uint256 dx
) external view returns (uint256) {
// dx and dy in c-units
uint256[N_COINS] memory rates = RATES;
uint256[N_COINS] memory xp = _xp();
uint256 x = xp[i] + ((dx * rates[i]) / PRECISION);
uint256 y = get_y(i, j, x, xp);
uint256 dy = ((xp[j] - y - 1) * PRECISION) / rates[j];
uint256 _fee = (fee * dy) / FEE_DENOMINATOR;
return dy - _fee;
}
function get_dy_underlying(
uint256 i,
uint256 j,
uint256 dx
) external view returns (uint256) {
// dx and dy in underlying units
uint256[N_COINS] memory xp = _xp();
uint256[N_COINS] memory precisions = PRECISION_MUL;
uint256 x = xp[i] + dx * precisions[i];
uint256 y = get_y(i, j, x, xp);
uint256 dy = (xp[j] - y - 1) / precisions[j];
uint256 _fee = (fee * dy) / FEE_DENOMINATOR;
return dy - _fee;
}
function exchange(
uint256 i,
uint256 j,
uint256 dx,
uint256 min_dy
) external payable nonReentrant {
require(!is_killed, "Killed");
if (!support_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], old_balances[2]];
uint256 D0 = get_D_mem(old_balances, amp);
for (uint256 i = 0; i < N_COINS; i++) {
new_balances[i] -= amounts[i];
}
uint256 D1 = get_D_mem(new_balances, amp);
uint256[N_COINS] memory fees;
for (uint256 i = 0; i < N_COINS; i++) {
uint256 ideal_balance = (D1 * old_balances[i]) / D0;
uint256 difference;
if (ideal_balance > new_balances[i]) {
difference = ideal_balance - new_balances[i];
} else {
difference = new_balances[i] - ideal_balance;
}
fees[i] = (_fee * difference) / FEE_DENOMINATOR;
balances[i] = new_balances[i] - ((fees[i] * _admin_fee) / FEE_DENOMINATOR);
new_balances[i] -= fees[i];
}
uint256 D2 = get_D_mem(new_balances, amp);
uint256 token_amount = ((D0 - D2) * token_supply) / D0;
require(token_amount > 0, "token_amount must be greater than 0");
token_amount += 1; // In case of rounding errors - make it unfavorable for the "attacker"
require(token_amount <= max_burn_amount, "Slippage screwed you");
token.burnFrom(msg.sender, token_amount); // dev: insufficient funds
for (uint256 i = 0; i < N_COINS; i++) {
if (amounts[i] > 0) {
transfer_out(coins[i], amounts[i]);
}
}
token_supply -= token_amount;
emit RemoveLiquidityImbalance(msg.sender, amounts, fees, D1, token_supply);
}
function get_y_D(
uint256 A_,
uint256 i,
uint256[N_COINS] memory xp,
uint256 D
) internal pure returns (uint256) {
/**
Calculate x[i] if one reduces D from being calculated for xp to D
Done by solving quadratic equation iteratively.
x_1**2 + x1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
x_1**2 + b*x_1 = c
x_1 = (x_1**2 + c) / (2*x_1 + b)
*/
// x in the input is converted to the same price/precision
require(i < N_COINS, "dev: i above N_COINS");
uint256 c = D;
uint256 S_;
uint256 Ann = A_ * N_COINS;
uint256 _x;
for (uint256 k = 0; k < N_COINS; k++) {
if (k != i) {
_x = xp[k];
} else {
continue;
}
S_ += _x;
c = (c * D) / (_x * N_COINS);
}
c = (c * D) / (Ann * N_COINS);
uint256 b = S_ + D / Ann;
uint256 y_prev;
uint256 y = D;
for (uint256 k = 0; k < 255; k++) {
y_prev = y;
y = (y * y + c) / (2 * y + b - D);
// Equality with the precision of 1
if (y > y_prev) {
if (y - y_prev <= 1) {
break;
}
} else {
if (y_prev - y <= 1) {
break;
}
}
}
return y;
}
function _calc_withdraw_one_coin(uint256 _token_amount, uint256 i) internal view returns (uint256, uint256) {
// First, need to calculate
// * Get current D
// * Solve Eqn against y_i for D - _token_amount
uint256 amp = get_A();
uint256 _fee = (fee * N_COINS) / (4 * (N_COINS - 1));
uint256[N_COINS] memory precisions = PRECISION_MUL;
uint256 total_supply = token.totalSupply();
uint256[N_COINS] memory xp = _xp();
uint256 D0 = get_D(xp, amp);
uint256 D1 = D0 - (_token_amount * D0) / total_supply;
uint256[N_COINS] memory xp_reduced = xp;
uint256 new_y = get_y_D(amp, i, xp, D1);
uint256 dy_0 = (xp[i] - new_y) / precisions[i]; // w/o fees
for (uint256 k = 0; k < N_COINS; k++) {
uint256 dx_expected;
if (k == i) {
dx_expected = (xp[k] * D1) / D0 - new_y;
} else {
dx_expected = xp[k] - (xp[k] * D1) / D0;
}
xp_reduced[k] -= (_fee * dx_expected) / FEE_DENOMINATOR;
}
uint256 dy = xp_reduced[i] - get_y_D(amp, i, xp_reduced, D1);
dy = (dy - 1) / precisions[i]; // Withdraw less to account for rounding errors
return (dy, dy_0 - dy);
}
function calc_withdraw_one_coin(uint256 _token_amount, uint256 i) external view returns (uint256) {
(uint256 dy, ) = _calc_withdraw_one_coin(_token_amount, i);
return dy;
}
function remove_liquidity_one_coin(
uint256 _token_amount,
uint256 i,
uint256 min_amount
) external nonReentrant {
// Remove _amount of liquidity all in a form of coin i
require(!is_killed, "Killed");
(uint256 dy, uint256 dy_fee) = _calc_withdraw_one_coin(_token_amount, i);
require(dy >= min_amount, "Not enough coins removed");
balances[i] -= (dy + (dy_fee * admin_fee) / FEE_DENOMINATOR);
token.burnFrom(msg.sender, _token_amount); // dev: insufficient funds
transfer_out(coins[i], dy);
emit RemoveLiquidityOne(msg.sender, i, _token_amount, dy);
}
function transfer_out(address coin_address, uint256 value) internal {
if (coin_address == 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":"address","name":"_tokenC","internalType":"address"},{"type":"uint256","name":"_A","internalType":"uint256"},{"type":"uint256","name":"_fee","internalType":"uint256"},{"type":"uint256","name":"_admin_fee","internalType":"uint256"},{"type":"address","name":"_admin","internalType":"address"},{"type":"address","name":"_LP","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b5061001a3361001f565b61006f565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b6151fd8061007e6000396000f3fe608060405234801561001057600080fd5b50600436106100675760003560e01c8063715018a611610050578063715018a6146100b25780638da5cb5b146100bc578063f2fde38b146100cd57600080fd5b8063293577501461006c5780634cedbfc714610087575b600080fd5b610074600381565b6040519081526020015b60405180910390f35b61009a610095366004610594565b6100e0565b6040516001600160a01b03909116815260200161007e565b6100ba6102fa565b005b6000546001600160a01b031661009a565b6100ba6100db366004610616565b61030e565b60006100ea61039e565b6001600160a01b0389161580159061010a57506001600160a01b03881615155b80156101285750876001600160a01b0316896001600160a01b031614155b6101795760405162461bcd60e51b815260206004820152600d60248201527f496c6c6567616c20746f6b656e0000000000000000000000000000000000000060448201526064015b60405180910390fd5b60008060006101898c8c8c6103f8565b92509250925060006040518060600160405280856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681525090506000604051806020016101f69061056b565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606088811b8216602084015287811b8216603484015286811b8216604884015233901b16605c82015242607082015246609082015290915060009060b0016040516020818303038152906040528051906020012090506000818351602085016000f59050806001600160a01b0316634eac4835858f8f8f8f8f6040518763ffffffff1660e01b81526004016102b396959493929190610638565b600060405180830381600087803b1580156102cd57600080fd5b505af11580156102e1573d6000803e3d6000fd5b5092995050505050505050505098975050505050505050565b61030261039e565b61030c6000610503565b565b61031661039e565b6001600160a01b0381166103925760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610170565b61039b81610503565b50565b6000546001600160a01b0316331461030c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610170565b6000806000846001600160a01b0316866001600160a01b0316141580156104315750836001600160a01b0316866001600160a01b031614155b801561044f5750836001600160a01b0316856001600160a01b031614155b61049b5760405162461bcd60e51b815260206004820152601360248201527f4944454e544943414c5f414444524553534553000000000000000000000000006044820152606401610170565b6000856001600160a01b0316876001600160a01b031611156104bd5750939493845b846001600160a01b0316866001600160a01b031611156104f65750929392836001600160a01b0380871690881611156104f65750939493845b5094959394509192915050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614b26806106a283390190565b80356001600160a01b038116811461058f57600080fd5b919050565b600080600080600080600080610100898b0312156105b157600080fd5b6105ba89610578565b97506105c860208a01610578565b96506105d660408a01610578565b9550606089013594506080890135935060a089013592506105f960c08a01610578565b915061060760e08a01610578565b90509295985092959890939650565b60006020828403121561062857600080fd5b61063182610578565b9392505050565b6101008101818860005b600381101561066a5781516001600160a01b0316835260209283019290910190600101610642565b5050506060820196909652608081019490945260a08401929092526001600160a01b0390811660c08401521660e09091015291905056fe60a0604052610fbd6010553480156200001757600080fd5b50620000233362000031565b600180553360805262000081565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b608051614a82620000a46000396000818161076a01526116c70152614a826000f3fe6080604052600436106103815760003560e01c80637dafa364116101d1578063ca8ca15411610102578063ecb586a5116100a0578063f3de03621161006f578063f3de036214610836578063f446c1d01461093e578063fc0c546a14610953578063fee3f7f91461097357600080fd5b8063ecb586a5146108c7578063edfb7801146108e7578063f1dc3cc9146108fe578063f2fde38b1461091e57600080fd5b8063e2e7d264116100dc578063e2e7d26414610865578063e369885314610885578063e38244621461089a578063e5d9e903146108b057600080fd5b8063ca8ca15414610821578063d73792a914610836578063ddca3f431461084f57600080fd5b8063a6b0a7181161016f578063b4b577ad11610149578063b4b577ad146107bd578063bb7b8b80146107d3578063bc063e1a146107e8578063c66106571461080157600080fd5b8063a6b0a71814610758578063aaf5eb681461078c578063ab5ac061146107a857600080fd5b80639a1d6ed3116101ab5780639a1d6ed3146106e85780639c868ac0146106fe5780639fdaea0c14610718578063a139c3701461073857600080fd5b80637dafa3641461067657806385f11d1e146106965780638da5cb5b146106b657600080fd5b80634488ddf0116102b65780635409491a116102545780635b5a1467116102235780635b5a14671461060c57806362203d741461062c5780636d4366b71461064c578063715018a61461066157600080fd5b80635409491a146105ad578063556d6e9f146105c357806358680d0b146105e35780635b41b908146105f957600080fd5b80634eac4835116102905780634eac4835146105435780634f12fe97146105635780634fb08c5e14610578578063524c39011461059857600080fd5b80634488ddf0146104fa5780634515cef3146105105780634903b0d11461052357600080fd5b80633046f97211610323578063392e53cd116102fd578063392e53cd1461047e57806339698415146104ad5780633c157e64146104c4578063405e28f8146104e457600080fd5b80633046f9721461043457806330c54085146104495780633883e1191461045e57600080fd5b8063226840fb1161035f578063226840fb146103dc57806325d2edf0146103f357806329357750146104095780632a4268961461041e57600080fd5b806306e9481c1461038657806314052288146103b05780632081066c146103c6575b600080fd5b34801561039257600080fd5b5061039d6201518081565b6040519081526020015b60405180910390f35b3480156103bc57600080fd5b5061039d60155481565b3480156103d257600080fd5b5061039d60145481565b3480156103e857600080fd5b506103f1610989565b005b3480156103ff57600080fd5b5061039d6159d881565b34801561041557600080fd5b5061039d600381565b34801561042a57600080fd5b5061039d60195481565b34801561044057600080fd5b506103f16109c1565b34801561045557600080fd5b506103f16109fe565b34801561046a57600080fd5b5061039d61047936600461455c565b610b56565b34801561048a57600080fd5b50601a5461049d90610100900460ff1681565b60405190151581526020016103a7565b3480156104b957600080fd5b5061039d620f424081565b3480156104d057600080fd5b506103f16104df366004614594565b610d1d565b3480156104f057600080fd5b5061039d60165481565b34801561050657600080fd5b5061039d60105481565b6103f161051e3660046145b6565b610f5c565b34801561052f57600080fd5b5061039d61053e3660046145e1565b61164d565b34801561054f57600080fd5b506103f161055e366004614611565b611664565b34801561056f57600080fd5b506103f1611b09565b34801561058457600080fd5b5061039d610593366004614594565b611c2e565b3480156105a457600080fd5b506103f1611c44565b3480156105b957600080fd5b5061039d60125481565b3480156105cf57600080fd5b5061039d6105de3660046146b1565b611d7e565b3480156105ef57600080fd5b5061039d60175481565b6103f16106073660046146dd565b611ec8565b34801561061857600080fd5b506103f1610627366004614594565b61230c565b34801561063857600080fd5b5061039d6106473660046145e1565b612467565b34801561065857600080fd5b5061039d601281565b34801561066d57600080fd5b506103f1612477565b34801561068257600080fd5b5061039d6106913660046145e1565b61248b565b3480156106a257600080fd5b5061039d6106b13660046146b1565b61249b565b3480156106c257600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103a7565b3480156106f457600080fd5b5061039d6108fc81565b34801561070a57600080fd5b50601a5461049d9060ff1681565b34801561072457600080fd5b506103f16107333660046145b6565b612579565b34801561074457600080fd5b506103f16107533660046145e1565b612b9d565b34801561076457600080fd5b506106d07f000000000000000000000000000000000000000000000000000000000000000081565b34801561079857600080fd5b5061039d670de0b6b3a764000081565b3480156107b457600080fd5b5061039d600a81565b3480156107c957600080fd5b5061039d60135481565b3480156107df57600080fd5b5061039d612c41565b3480156107f457600080fd5b5061039d64012a05f20081565b34801561080d57600080fd5b506106d061081c3660046145e1565b612cfd565b34801561082d57600080fd5b506103f1612d1d565b34801561084257600080fd5b5061039d6402540be40081565b34801561085b57600080fd5b5061039d600e5481565b34801561087157600080fd5b5061039d6108803660046145e1565b612d7e565b34801561089157600080fd5b506103f1612e7a565b3480156108a657600080fd5b5061039d60185481565b3480156108bc57600080fd5b5061039d6203f48081565b3480156108d357600080fd5b506103f16108e236600461470f565b612f0b565b3480156108f357600080fd5b5061039d624f1a0081565b34801561090a57600080fd5b506103f16109193660046146b1565b61317e565b34801561092a57600080fd5b506103f161093936600461473c565b613351565b34801561094a57600080fd5b5061039d6133de565b34801561095f57600080fd5b506011546106d0906001600160a01b031681565b34801561097f57600080fd5b5061039d600f5481565b6109916133ed565b600060168190556040517f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a19190a1565b6109c96133ed565b601a805460ff191690556040517f061284ffa2814ace135f62907c78a7cff0f070efe7e6a0a42740ea1da2c8bdc890600090a1565b610a066133ed565b60005b6003811015610b5357600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088360038110610a3c57610a3c614757565b01546001600160a01b03161415610a7357600b8260038110610a6057610a60614757565b0154610a6c9047614783565b9050610b13565b600b8260038110610a8657610a86614757565b015460088360038110610a9b57610a9b614757565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b06919061479a565b610b109190614783565b90505b8015610b4057610b4060088360038110610b2f57610b2f614757565b01546001600160a01b031682613447565b5080610b4b816147b3565b915050610a09565b50565b604080516060810191829052600091829190600b9060039082845b815481526020019060010190808311610b7157505050505090506000610b9561348a565b90506000610ba3838361352b565b905060005b6003811015610c49578515610bf957868160038110610bc957610bc9614757565b6020020151848260038110610be057610be0614757565b60200201818151610bf191906147ce565b905250610c37565b868160038110610c0b57610c0b614757565b6020020151848260038110610c2257610c22614757565b60200201818151610c339190614783565b9052505b80610c41816147b3565b915050610ba8565b506000610c56848461352b565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd1919061479a565b905060008715610cec57610ce58484614783565b9050610cf9565b610cf68385614783565b90505b83610d0483836147e6565b610d0e9190614805565b96505050505050505b92915050565b610d256133ed565b62015180601454610d3691906147ce565b421015610d8a5760405162461bcd60e51b815260206004820152600f60248201527f646576203a20746f6f206561726c79000000000000000000000000000000000060448201526064015b60405180910390fd5b610d9762015180426147ce565b811015610de65760405162461bcd60e51b815260206004820152601660248201527f6465763a20696e73756666696369656e742074696d65000000000000000000006044820152606401610d81565b6000610df061348a565b9050600083118015610e045750620f424083105b610e765760405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e642060448201527f4d41585f410000000000000000000000000000000000000000000000000000006064820152608401610d81565b808310158015610e905750610e8c600a826147e6565b8311155b80610eaf57508083108015610eaf575080610eac600a856147e6565b10155b610efb5760405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f4100000000006044820152606401610d81565b60128190556013839055426014819055601583905560408051838152602081018690528082019290925260608201849052517fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c2549181900360800190a1505050565b610f64613546565b601a5460ff1615610fa05760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d81565b601154600160a01b900460ff16610ff7573415610ff75760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d81565b610fff614405565b600061100d60016003614783565b6110189060046147e6565b6003600e5461102791906147e6565b6110319190614805565b600f54909150600061104161348a565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bc919061479a565b6040805160608101918290529192506000918291600b9060039082845b8154815260200190600101908083116110d95750505050509050600083111561110957611106818561352b565b91505b600060405180606001604052808360006003811061112957611129614757565b602002015181526020018360016003811061114657611146614757565b602002015181526020018360026003811061116357611163614757565b60200201519052905060005b600381101561126a57846112095760008b826003811061119157611191614757565b6020020151116112095760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f6960448201527f6e730000000000000000000000000000000000000000000000000000000000006064820152608401610d81565b8a816003811061121b5761121b614757565b602002015183826003811061123257611232614757565b602002015161124191906147ce565b82826003811061125357611253614757565b602002015280611262816147b3565b91505061116f565b506000611277828761352b565b90508381116112c85760405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e2044300000000000006044820152606401610d81565b8085156114765760005b6003811015611464576000868683600381106112f0576112f0614757565b60200201516112ff90866147e6565b6113099190614805565b9050600085836003811061131f5761131f614757565b60200201518211156113535785836003811061133d5761133d614757565b602002015161134c9083614783565b9050611378565b8186846003811061136657611366614757565b60200201516113759190614783565b90505b6402540be400611388828e6147e6565b6113929190614805565b8d84600381106113a4576113a4614757565b60200201526402540be4008b8e85600381106113c2576113c2614757565b60200201516113d191906147e6565b6113db9190614805565b8684600381106113ed576113ed614757565b60200201516113fc9190614783565b600b846003811061140f5761140f614757565b01558c836003811061142357611423614757565b602002015186846003811061143a5761143a614757565b6020020181815161144b9190614783565b90525082915061145c9050816147b3565b9150506112d2565b5061146f838861352b565b9050611485565b611483600b846003614423565b505b6000866114935750816114b5565b8561149e8184614783565b6114a890896147e6565b6114b29190614805565b90505b8b8110156115055760405162461bcd60e51b815260206004820152601460248201527f536c697070616765207363726577656420796f750000000000000000000000006044820152606401610d81565b60005b600381101561156d5760008e826003811061152557611525614757565b6020020151905060006008836003811061154157611541614757565b01546001600160a01b0316905061155881836135a0565b50508080611565906147b3565b915050611508565b506011546040517f40c10f19000000000000000000000000000000000000000000000000000000008152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b1580156115d357600080fd5b505af11580156115e7573d6000803e3d6000fd5b503392507f423f6495a08fc652425cf4ed0d1f9e37e571d9b9529b1c1c23cce780b2e7df0d91508f90508d8661161d868d6147ce565b60405161162d949392919061484a565b60405180910390a2505050505050505050505061164960018055565b5050565b600b816003811061165d57600080fd5b0154905081565b601a54610100900460ff16156116bc5760405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a6564006044820152606401610d81565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146117345760405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f72790000000000000000006044820152606401610d81565b620f42408511156117875760405162461bcd60e51b815260206004820152601260248201527f5f412065786365656473206d6178696d756d00000000000000000000000000006044820152606401610d81565b64012a05f2008411156117dc5760405162461bcd60e51b815260206004820152601460248201527f5f6665652065786365656473206d6178696d756d0000000000000000000000006044820152606401610d81565b6402540be4008311156118315760405162461bcd60e51b815260206004820152601a60248201527f5f61646d696e5f6665652065786365656473206d6178696d756d0000000000006044820152606401610d81565b601a805461ff00191661010017905560005b6003811015611a9d57600087826003811061186057611860614757565b60200201516001600160a01b031614156118bc5760405162461bcd60e51b815260206004820152600c60248201527f5a45524f204164647265737300000000000000000000000000000000000000006044820152606401610d81565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8883600381106118e5576118e5614757565b60200201516001600160a01b0316141561192f5750601180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17905560126119ad565b87826003811061194157611941614757565b60200201516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a79190614878565b60ff1690505b6012811115611a235760405162461bcd60e51b8152602060048201526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f7420657863656560448201527f64203138000000000000000000000000000000000000000000000000000000006064820152608401610d81565b611a2e816012614783565b611a3990600a61497f565b60028360038110611a4c57611a4c614757565b015560028260038110611a6157611a61614757565b0154611a7590670de0b6b3a76400006147e6565b60058360038110611a8857611a88614757565b01555080611a95816147b3565b915050611843565b50611aab600887600361445d565b5060128590556013859055600e849055600f839055611acd624f1a00426147ce565b6019556011805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055611b0182613351565b505050505050565b611b116133ed565b601654421015611b635760405162461bcd60e51b815260206004820152601660248201527f6465763a20696e73756666696369656e742074696d65000000000000000000006044820152606401610d81565b601654611bd85760405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201527f74206265203000000000000000000000000000000000000000000000000000006064820152608401610d81565b6000601655601754600e819055601854600f8190556040517fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d192611c2492908252602082015260400190565b60405180910390a1565b600080611c3b8484613621565b50949350505050565b611c4c6133ed565b60005b6003811015611d525773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088260038110611c8057611c80614757565b01546001600160a01b03161415611cac5747600b8260038110611ca557611ca5614757565b0155611d40565b60088160038110611cbf57611cbf614757565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2a919061479a565b600b8260038110611d3d57611d3d614757565b01555b80611d4a816147b3565b915050611c4f565b506040517f2c7203581ca666b8c5094c11c03f0b19b3750234a9d281bcbc88a260bcb006de90600090a1565b60408051606081019182905260009182919060059060039082845b815481526020019060010190808311611d9957505050505090506000611dbd613923565b90506000670de0b6b3a7640000838860038110611ddc57611ddc614757565b6020020151611deb90876147e6565b611df59190614805565b828860038110611e0757611e07614757565b6020020151611e1691906147ce565b90506000611e26888884866139dd565b90506000848860038110611e3c57611e3c614757565b6020020151670de0b6b3a7640000600184878c60038110611e5f57611e5f614757565b6020020151611e6e9190614783565b611e789190614783565b611e8291906147e6565b611e8c9190614805565b905060006402540be40082600e54611ea491906147e6565b611eae9190614805565b9050611eba8183614783565b9a9950505050505050505050565b611ed0613546565b601a5460ff1615611f0c5760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d81565b601154600160a01b900460ff16611f63573415611f635760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d81565b604080516060810191829052600091600b9060039082845b815481526020019060010190808311611f7b57505050505090506000611fa082613be7565b90506000670de0b6b3a764000060058860038110611fc057611fc0614757565b0154611fcc90876147e6565b611fd69190614805565b828860038110611fe857611fe8614757565b6020020151611ff791906147ce565b90506000612007888884866139dd565b90506000600182858a6003811061202057612020614757565b602002015161202f9190614783565b6120399190614783565b905060006402540be400600e548361205191906147e6565b61205b9190614805565b90506005896003811061207057612070614757565b0154670de0b6b3a76400006120858385614783565b61208f91906147e6565b6120999190614805565b9150868210156121115760405162461bcd60e51b815260206004820152602e60248201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201527f207468616e2065787065637465640000000000000000000000000000000000006064820152608401610d81565b60006402540be400600f548361212791906147e6565b6121319190614805565b905060058a6003811061214657612146614757565b015461215a670de0b6b3a7640000836147e6565b6121649190614805565b905088878c6003811061217957612179614757565b602002015161218891906147ce565b600b8c6003811061219b5761219b614757565b01558083888c600381106121b1576121b1614757565b60200201516121c09190614783565b6121ca9190614783565b600b8b600381106121dd576121dd614757565b0155600060088c600381106121f4576121f4614757565b01546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81141561226957348a146122645760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d81565b61227e565b61227e6001600160a01b03821633308d613ca5565b600060088c6003811061229357612293614757565b01546001600160a01b031690506122aa8186613447565b604080518e8152602081018d90529081018d90526060810186905233907fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989060800160405180910390a250505050505050505061230660018055565b50505050565b6123146133ed565b601654156123645760405162461bcd60e51b815260206004820181905260248201527f61646d696e5f616374696f6e735f646561646c696e65206d75737420626520306044820152606401610d81565b64012a05f2008211156123b95760405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d00000000000000006044820152606401610d81565b6402540be40081111561240e5760405162461bcd60e51b815260206004820152601e60248201527f6465763a2061646d696e206665652065786365656473206d6178696d756d00006044820152606401610d81565b61241b6203f480426147ce565b60168190556017839055601882905560408051848152602081018490527f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe0910160405180910390a25050565b6005816003811061165d57600080fd5b61247f6133ed565b6124896000613d56565b565b6002816003811061165d57600080fd5b6000806124a6613923565b6040805160608101918290529192506000919060029060039082845b8154815260200190600101908083116124c2575050505050905060008187600381106124f0576124f0614757565b60200201516124ff90866147e6565b83886003811061251157612511614757565b602002015161252091906147ce565b90506000612530888884876139dd565b9050600083886003811061254657612546614757565b6020020151600183878b6003811061256057612560614757565b602002015161256f9190614783565b611e829190614783565b612581613546565b601a5460ff16156125bd5760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d81565b601154604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015612607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262b919061479a565b90506000811161267d5760405162461bcd60e51b815260206004820152601660248201527f6465763a207a65726f20746f74616c20737570706c79000000000000000000006044820152606401610d81565b600061268b60016003614783565b6126969060046147e6565b6003600e546126a591906147e6565b6126af9190614805565b600f5490915060006126bf61348a565b60408051606081019182905291925060009190600b9060039082845b8154815260200190600101908083116126db5750505050509050600060405180606001604052808360006003811061271557612715614757565b602002015181526020018360016003811061273257612732614757565b602002015181526020018360026003811061274f5761274f614757565b6020020151905290506000612764838561352b565b905060005b60038110156127c15789816003811061278457612784614757565b602002015183826003811061279b5761279b614757565b602002018181516127ac9190614783565b905250806127b9816147b3565b915050612769565b5060006127ce838661352b565b90506127d8614405565b60005b600381101561296d576000848783600381106127f9576127f9614757565b602002015161280890866147e6565b6128129190614805565b9050600086836003811061282857612828614757565b602002015182111561285c5786836003811061284657612846614757565b60200201516128559083614783565b9050612881565b8187846003811061286f5761286f614757565b602002015161287e9190614783565b90505b6402540be400612891828d6147e6565b61289b9190614805565b8484600381106128ad576128ad614757565b60200201526402540be4008a8585600381106128cb576128cb614757565b60200201516128da91906147e6565b6128e49190614805565b8784600381106128f6576128f6614757565b60200201516129059190614783565b600b846003811061291857612918614757565b015583836003811061292c5761292c614757565b602002015187846003811061294357612943614757565b602002018181516129549190614783565b9052508291506129659050816147b3565b9150506127db565b50600061297a858861352b565b90506000848b61298a8483614783565b61299491906147e6565b61299e9190614805565b905060008111612a165760405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201527f6e203000000000000000000000000000000000000000000000000000000000006064820152608401610d81565b612a216001826147ce565b90508b811115612a735760405162461bcd60e51b815260206004820152601460248201527f536c697070616765207363726577656420796f750000000000000000000000006044820152606401610d81565b60115460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612abf57600080fd5b505af1158015612ad3573d6000803e3d6000fd5b5050505060005b6003811015612b515760008e8260038110612af757612af7614757565b60200201511115612b3f57612b3f60088260038110612b1857612b18614757565b01546001600160a01b03168f8360038110612b3557612b35614757565b6020020151613447565b80612b49816147b3565b915050612ada565b50612b5c818c614783565b9a50336001600160a01b03167f173599dbf9c6ca6f7c3b590df07ae98a45d74ff54065505141e7de6c46a624c28e85878f60405161162d949392919061484a565b612ba56133ed565b6108fc8110158015612bb957506159d88111155b612c055760405162461bcd60e51b815260206004820152600b60248201527f496c6c6567616c206761730000000000000000000000000000000000000000006044820152606401610d81565b60108190556040518181527f320c5e7159406866d39a81979ca1c22276b644dfcfd52ee1f335ee467ad0ec67906020015b60405180910390a150565b600080612c5c612c4f613923565b612c5761348a565b613db3565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd7919061479a565b905080612cec670de0b6b3a7640000846147e6565b612cf69190614805565b9250505090565b60088160038110612d0d57600080fd5b01546001600160a01b0316905081565b612d256133ed565b6000612d2f61348a565b6012819055601381905542601481905560158190556040519192507f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193891612c3691848252602082015260400190565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088360038110612da857612da8614757565b01546001600160a01b03161415612dd857600b8260038110612dcc57612dcc614757565b0154610d179047614783565b600b8260038110612deb57612deb614757565b015460088360038110612e0057612e00614757565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612e47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6b919061479a565b610d179190614783565b919050565b612e826133ed565b4260195411612ed35760405162461bcd60e51b815260206004820152601160248201527f457863656564656420646561646c696e650000000000000000000000000000006044820152606401610d81565b601a805460ff191660011790556040517fbe26733c2bf6ff3ea5ba8cfe744422bd49052ff9ed5685c9e81e6f9321dbaddd90600090a1565b612f13613546565b601154604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015612f5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f81919061479a565b9050612f8b614405565b612f93614405565b60005b60038110156130c55760008487600b8460038110612fb657612fb6614757565b0154612fc291906147e6565b612fcc9190614805565b9050858260038110612fe057612fe0614757565b602002015181101561305a5760405162461bcd60e51b815260206004820152603060248201527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201527f6e73207468616e206578706563746564000000000000000000000000000000006064820152608401610d81565b80600b836003811061306e5761306e614757565b01600082825461307e9190614783565b9091555081905084836003811061309757613097614757565b60200201526130b260088360038110610b2f57610b2f614757565b50806130bd816147b3565b915050612f96565b5060115460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561311257600080fd5b505af1158015613126573d6000803e3d6000fd5b503392507fa49d4cf02656aebf8c771f5a8585638a2a15ee6c97cf7205d4208ed7c1df252d91508490508361315b8988614783565b60405161316a9392919061498b565b60405180910390a250505061164960018055565b613186613546565b601a5460ff16156131c25760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d81565b6000806131cf8585613621565b91509150828210156132235760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f76656400000000000000006044820152606401610d81565b6402540be400600f548261323791906147e6565b6132419190614805565b61324b90836147ce565b600b856003811061325e5761325e614757565b01600082825461326e9190614783565b909155505060115460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156132bf57600080fd5b505af11580156132d3573d6000803e3d6000fd5b505050506132fe600885600381106132ed576132ed614757565b01546001600160a01b031683613447565b604080518581526020810187905290810183905233907f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a09060600160405180910390a2505061334c60018055565b505050565b6133596133ed565b6001600160a01b0381166133d55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610d81565b610b5381613d56565b60006133e861348a565b905090565b6000546001600160a01b031633146124895760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d81565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415613476576116493382613f49565b6116496001600160a01b0383163383613ff0565b6015546013546000919042821115610d1757601254601454818311156134ef576134b48185614783565b6134be8242614783565b6134c88486614783565b6134d291906147e6565b6134dc9190614805565b6134e690836147ce565b94505050505090565b6134f98185614783565b6135038242614783565b61350d8585614783565b61351791906147e6565b6135219190614805565b6134e69083614783565b600061353f61353984613be7565b83613db3565b9392505050565b600260015414156135995760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d81565b6002600155565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561360c573481146116495760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d81565b6116496001600160a01b038316333084613ca5565b600080600061362e61348a565b9050600061363e60016003614783565b6136499060046147e6565b6003600e5461365891906147e6565b6136629190614805565b6040805160608101918290529192506000919060029060039082845b81548152602001906001019080831161367e57505050505090506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156136ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613711919061479a565b9050600061371d613923565b9050600061372b8287613db3565b905060008361373a838d6147e6565b6137449190614805565b61374e9083614783565b905082600061375f898d8486614039565b90506000878d6003811061377557613775614757565b602002015182878f6003811061378d5761378d614757565b602002015161379c9190614783565b6137a69190614805565b905060005b60038110156138a25760008e8214156137fd578387878a85600381106137d3576137d3614757565b60200201516137e291906147e6565b6137ec9190614805565b6137f69190614783565b905061384e565b868689846003811061381157613811614757565b602002015161382091906147e6565b61382a9190614805565b88836003811061383c5761383c614757565b602002015161384b9190614783565b90505b6402540be40061385e828d6147e6565b6138689190614805565b85836003811061387a5761387a614757565b6020020181815161388b9190614783565b90525081905061389a816147b3565b9150506137ab565b5060006138b18b8f8688614039565b848f600381106138c3576138c3614757565b60200201516138d29190614783565b9050888e600381106138e6576138e6614757565b60200201516138f6600183614783565b6139009190614805565b90508061390d8184614783565b9c509c5050505050505050505050509250929050565b61392b614405565b6040805160608101918290529060059060039082845b815481526020019060010190808311613941575050505050905060005b60038110156139d957670de0b6b3a7640000600b826003811061398357613983614757565b015483836003811061399757613997614757565b60200201516139a691906147e6565b6139b09190614805565b8282600381106139c2576139c2614757565b6020020152806139d1816147b3565b91505061395e565b5090565b60008385141580156139ef5750600385105b80156139fb5750600384105b613a475760405162461bcd60e51b815260206004820152601160248201527f496c6c6567616c20706172616d657465720000000000000000000000000000006044820152606401610d81565b6000613a5161348a565b90506000613a5f8483613db3565b905080600080613a706003866147e6565b90506000805b6003811015613af9578b811415613a8f57899150613ab9565b8a8114613ab457888160038110613aa857613aa8614757565b60200201519150613ab9565b613ae7565b613ac382856147ce565b9350613ad06003836147e6565b613ada87876147e6565b613ae49190614805565b94505b80613af1816147b3565b915050613a76565b50613b056003836147e6565b613b0f86866147e6565b613b199190614805565b93506000613b278387614805565b613b3190856147ce565b9050600086815b60ff811015613bd3578192508884836002613b5391906147e6565b613b5d91906147ce565b613b679190614783565b88613b7284806147e6565b613b7c91906147ce565b613b869190614805565b915082821115613bab576001613b9c8484614783565b11613ba657613bd3565b613bc1565b6001613bb78385614783565b11613bc157613bd3565b80613bcb816147b3565b915050613b38565b50985050505050505050505b949350505050565b613bef614405565b6040805160608101918290529060059060039082845b815481526020019060010190808311613c05575050505050905060005b6003811015613c9f57670de0b6b3a7640000838260038110613c4657613c46614757565b6020020151838360038110613c5d57613c5d614757565b6020020151613c6c91906147e6565b613c769190614805565b828260038110613c8857613c88614757565b602002015280613c97816147b3565b915050613c22565b50919050565b6040516001600160a01b03808516602483015283166044820152606481018290526123069085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526141fd565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060005b6003811015613df757848160038110613dd457613dd4614757565b6020020151613de390836147ce565b915080613def816147b3565b915050613db9565b5080613e07576000915050610d17565b60008181613e166003876147e6565b905060005b60ff811015613f3d578260005b6003811015613e7c5760038a8260038110613e4557613e45614757565b6020020151613e5491906147e6565b613e5e86846147e6565b613e689190614805565b915080613e74816147b3565b915050613e28565b508394508060036001613e8f91906147ce565b613e9991906147e6565b84613ea5600186614783565b613eaf91906147e6565b613eb991906147ce565b84613ec56003846147e6565b613ecf89876147e6565b613ed991906147ce565b613ee391906147e6565b613eed9190614805565b935084841115613f13576001613f038686614783565b11613f0e5750613f3d565b613f2a565b6001613f1f8587614783565b11613f2a5750613f3d565b5080613f35816147b3565b915050613e1b565b50909695505050505050565b6000826001600160a01b031660105483604051600060405180830381858888f193505050503d8060008114613f9a576040519150601f19603f3d011682016040523d82523d6000602084013e613f9f565b606091505b505090508061334c5760405162461bcd60e51b815260206004820152601360248201527f424e42207472616e73666572206661696c6564000000000000000000000000006044820152606401610d81565b6040516001600160a01b03831660248201526044810182905261334c9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401613cf2565b60006003841061408b5760405162461bcd60e51b815260206004820152601460248201527f6465763a20692061626f7665204e5f434f494e530000000000000000000000006044820152606401610d81565b8160008061409a6003896147e6565b90506000805b6003811015614113578881146140ce578781600381106140c2576140c2614757565b602002015191506140d3565b614101565b6140dd82856147ce565b93506140ea6003836147e6565b6140f488876147e6565b6140fe9190614805565b94505b8061410b816147b3565b9150506140a0565b5061411f6003836147e6565b61412987866147e6565b6141339190614805565b935060006141418388614805565b61414b90856147ce565b9050600087815b60ff8110156141ed57819250898483600261416d91906147e6565b61417791906147ce565b6141819190614783565b8861418c84806147e6565b61419691906147ce565b6141a09190614805565b9150828211156141c55760016141b68484614783565b116141c0576141ed565b6141db565b60016141d18385614783565b116141db576141ed565b806141e5816147b3565b915050614152565b509b9a5050505050505050505050565b6000614252826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166142e59092919063ffffffff16565b905080516000148061427357508080602001905181019061427391906149b4565b61334c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610d81565b6060613bdf848460008585600080866001600160a01b0316858760405161430c91906149fd565b60006040518083038185875af1925050503d8060008114614349576040519150601f19603f3d011682016040523d82523d6000602084013e61434e565b606091505b509150915061435f8783838761436a565b979650505050505050565b606083156143d65782516143cf576001600160a01b0385163b6143cf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d81565b5081613bdf565b613bdf83838151156143eb5781518083602001fd5b8060405162461bcd60e51b8152600401610d819190614a19565b60405180606001604052806003906020820280368337509192915050565b8260038101928215614451579160200282015b82811115614451578251825591602001919060010190614436565b506139d99291506144b2565b8260038101928215614451579160200282015b82811115614451578251825473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116178255602090920191600190910190614470565b5b808211156139d957600081556001016144b3565b6040516060810167ffffffffffffffff811182821017156144f857634e487b7160e01b600052604160045260246000fd5b60405290565b600082601f83011261450f57600080fd5b6145176144c7565b80606084018581111561452957600080fd5b845b8181101561454357803584526020938401930161452b565b509095945050505050565b8015158114610b5357600080fd5b6000806080838503121561456f57600080fd5b61457984846144fe565b915060608301356145898161454e565b809150509250929050565b600080604083850312156145a757600080fd5b50508035926020909101359150565b600080608083850312156145c957600080fd5b6145d384846144fe565b946060939093013593505050565b6000602082840312156145f357600080fd5b5035919050565b80356001600160a01b0381168114612e7557600080fd5b600080600080600080610100878903121561462b57600080fd5b87601f88011261463a57600080fd5b6146426144c7565b80606089018a81111561465457600080fd5b895b8181101561467557614667816145fa565b845260209384019301614656565b50909750359550506080870135935060a0870135925061469760c088016145fa565b91506146a560e088016145fa565b90509295509295509295565b6000806000606084860312156146c657600080fd5b505081359360208301359350604090920135919050565b600080600080608085870312156146f357600080fd5b5050823594602084013594506040840135936060013592509050565b6000806080838503121561472257600080fd5b8235915061473384602085016144fe565b90509250929050565b60006020828403121561474e57600080fd5b61353f826145fa565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156147955761479561476d565b500390565b6000602082840312156147ac57600080fd5b5051919050565b60006000198214156147c7576147c761476d565b5060010190565b600082198211156147e1576147e161476d565b500190565b60008160001904831182151516156148005761480061476d565b500290565b60008261482257634e487b7160e01b600052601260045260246000fd5b500490565b8060005b600381101561230657815184526020938401939091019060010161482b565b61010081016148598287614827565b6148666060830186614827565b60c082019390935260e0015292915050565b60006020828403121561488a57600080fd5b815160ff8116811461353f57600080fd5b600181815b808511156148d65781600019048211156148bc576148bc61476d565b808516156148c957918102915b93841c93908002906148a0565b509250929050565b6000826148ed57506001610d17565b816148fa57506000610d17565b8160018114614910576002811461491a57614936565b6001915050610d17565b60ff84111561492b5761492b61476d565b50506001821b610d17565b5060208310610133831016604e8410600b8410161715614959575081810a610d17565b614963838361489b565b80600019048211156149775761497761476d565b029392505050565b600061353f83836148de565b60e081016149998286614827565b6149a66060830185614827565b8260c0830152949350505050565b6000602082840312156149c657600080fd5b815161353f8161454e565b60005b838110156149ec5781810151838201526020016149d4565b838111156123065750506000910152565b60008251614a0f8184602087016149d1565b9190910192915050565b6020815260008251806020840152614a388160408501602087016149d1565b601f01601f1916919091016040019291505056fea26469706673582212204d1c566c01c094b685090f0324cf63f08d9a27d2f54f0fb564253fe4d5edd33d64736f6c634300080a0033a26469706673582212205148cff4711472e7006d4385db86c15918fe5ac748f60531cac6f509ab02de4764736f6c634300080a0033
Deployed ByteCode
0x608060405234801561001057600080fd5b50600436106100675760003560e01c8063715018a611610050578063715018a6146100b25780638da5cb5b146100bc578063f2fde38b146100cd57600080fd5b8063293577501461006c5780634cedbfc714610087575b600080fd5b610074600381565b6040519081526020015b60405180910390f35b61009a610095366004610594565b6100e0565b6040516001600160a01b03909116815260200161007e565b6100ba6102fa565b005b6000546001600160a01b031661009a565b6100ba6100db366004610616565b61030e565b60006100ea61039e565b6001600160a01b0389161580159061010a57506001600160a01b03881615155b80156101285750876001600160a01b0316896001600160a01b031614155b6101795760405162461bcd60e51b815260206004820152600d60248201527f496c6c6567616c20746f6b656e0000000000000000000000000000000000000060448201526064015b60405180910390fd5b60008060006101898c8c8c6103f8565b92509250925060006040518060600160405280856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b03168152602001836001600160a01b03166001600160a01b031681525090506000604051806020016101f69061056b565b601f1982820381018352601f9091011660408190526bffffffffffffffffffffffff19606088811b8216602084015287811b8216603484015286811b8216604884015233901b16605c82015242607082015246609082015290915060009060b0016040516020818303038152906040528051906020012090506000818351602085016000f59050806001600160a01b0316634eac4835858f8f8f8f8f6040518763ffffffff1660e01b81526004016102b396959493929190610638565b600060405180830381600087803b1580156102cd57600080fd5b505af11580156102e1573d6000803e3d6000fd5b5092995050505050505050505098975050505050505050565b61030261039e565b61030c6000610503565b565b61031661039e565b6001600160a01b0381166103925760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610170565b61039b81610503565b50565b6000546001600160a01b0316331461030c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610170565b6000806000846001600160a01b0316866001600160a01b0316141580156104315750836001600160a01b0316866001600160a01b031614155b801561044f5750836001600160a01b0316856001600160a01b031614155b61049b5760405162461bcd60e51b815260206004820152601360248201527f4944454e544943414c5f414444524553534553000000000000000000000000006044820152606401610170565b6000856001600160a01b0316876001600160a01b031611156104bd5750939493845b846001600160a01b0316866001600160a01b031611156104f65750929392836001600160a01b0380871690881611156104f65750939493845b5094959394509192915050565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b614b26806106a283390190565b80356001600160a01b038116811461058f57600080fd5b919050565b600080600080600080600080610100898b0312156105b157600080fd5b6105ba89610578565b97506105c860208a01610578565b96506105d660408a01610578565b9550606089013594506080890135935060a089013592506105f960c08a01610578565b915061060760e08a01610578565b90509295985092959890939650565b60006020828403121561062857600080fd5b61063182610578565b9392505050565b6101008101818860005b600381101561066a5781516001600160a01b0316835260209283019290910190600101610642565b5050506060820196909652608081019490945260a08401929092526001600160a01b0390811660c08401521660e09091015291905056fe60a0604052610fbd6010553480156200001757600080fd5b50620000233362000031565b600180553360805262000081565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b608051614a82620000a46000396000818161076a01526116c70152614a826000f3fe6080604052600436106103815760003560e01c80637dafa364116101d1578063ca8ca15411610102578063ecb586a5116100a0578063f3de03621161006f578063f3de036214610836578063f446c1d01461093e578063fc0c546a14610953578063fee3f7f91461097357600080fd5b8063ecb586a5146108c7578063edfb7801146108e7578063f1dc3cc9146108fe578063f2fde38b1461091e57600080fd5b8063e2e7d264116100dc578063e2e7d26414610865578063e369885314610885578063e38244621461089a578063e5d9e903146108b057600080fd5b8063ca8ca15414610821578063d73792a914610836578063ddca3f431461084f57600080fd5b8063a6b0a7181161016f578063b4b577ad11610149578063b4b577ad146107bd578063bb7b8b80146107d3578063bc063e1a146107e8578063c66106571461080157600080fd5b8063a6b0a71814610758578063aaf5eb681461078c578063ab5ac061146107a857600080fd5b80639a1d6ed3116101ab5780639a1d6ed3146106e85780639c868ac0146106fe5780639fdaea0c14610718578063a139c3701461073857600080fd5b80637dafa3641461067657806385f11d1e146106965780638da5cb5b146106b657600080fd5b80634488ddf0116102b65780635409491a116102545780635b5a1467116102235780635b5a14671461060c57806362203d741461062c5780636d4366b71461064c578063715018a61461066157600080fd5b80635409491a146105ad578063556d6e9f146105c357806358680d0b146105e35780635b41b908146105f957600080fd5b80634eac4835116102905780634eac4835146105435780634f12fe97146105635780634fb08c5e14610578578063524c39011461059857600080fd5b80634488ddf0146104fa5780634515cef3146105105780634903b0d11461052357600080fd5b80633046f97211610323578063392e53cd116102fd578063392e53cd1461047e57806339698415146104ad5780633c157e64146104c4578063405e28f8146104e457600080fd5b80633046f9721461043457806330c54085146104495780633883e1191461045e57600080fd5b8063226840fb1161035f578063226840fb146103dc57806325d2edf0146103f357806329357750146104095780632a4268961461041e57600080fd5b806306e9481c1461038657806314052288146103b05780632081066c146103c6575b600080fd5b34801561039257600080fd5b5061039d6201518081565b6040519081526020015b60405180910390f35b3480156103bc57600080fd5b5061039d60155481565b3480156103d257600080fd5b5061039d60145481565b3480156103e857600080fd5b506103f1610989565b005b3480156103ff57600080fd5b5061039d6159d881565b34801561041557600080fd5b5061039d600381565b34801561042a57600080fd5b5061039d60195481565b34801561044057600080fd5b506103f16109c1565b34801561045557600080fd5b506103f16109fe565b34801561046a57600080fd5b5061039d61047936600461455c565b610b56565b34801561048a57600080fd5b50601a5461049d90610100900460ff1681565b60405190151581526020016103a7565b3480156104b957600080fd5b5061039d620f424081565b3480156104d057600080fd5b506103f16104df366004614594565b610d1d565b3480156104f057600080fd5b5061039d60165481565b34801561050657600080fd5b5061039d60105481565b6103f161051e3660046145b6565b610f5c565b34801561052f57600080fd5b5061039d61053e3660046145e1565b61164d565b34801561054f57600080fd5b506103f161055e366004614611565b611664565b34801561056f57600080fd5b506103f1611b09565b34801561058457600080fd5b5061039d610593366004614594565b611c2e565b3480156105a457600080fd5b506103f1611c44565b3480156105b957600080fd5b5061039d60125481565b3480156105cf57600080fd5b5061039d6105de3660046146b1565b611d7e565b3480156105ef57600080fd5b5061039d60175481565b6103f16106073660046146dd565b611ec8565b34801561061857600080fd5b506103f1610627366004614594565b61230c565b34801561063857600080fd5b5061039d6106473660046145e1565b612467565b34801561065857600080fd5b5061039d601281565b34801561066d57600080fd5b506103f1612477565b34801561068257600080fd5b5061039d6106913660046145e1565b61248b565b3480156106a257600080fd5b5061039d6106b13660046146b1565b61249b565b3480156106c257600080fd5b506000546001600160a01b03165b6040516001600160a01b0390911681526020016103a7565b3480156106f457600080fd5b5061039d6108fc81565b34801561070a57600080fd5b50601a5461049d9060ff1681565b34801561072457600080fd5b506103f16107333660046145b6565b612579565b34801561074457600080fd5b506103f16107533660046145e1565b612b9d565b34801561076457600080fd5b506106d07f000000000000000000000000000000000000000000000000000000000000000081565b34801561079857600080fd5b5061039d670de0b6b3a764000081565b3480156107b457600080fd5b5061039d600a81565b3480156107c957600080fd5b5061039d60135481565b3480156107df57600080fd5b5061039d612c41565b3480156107f457600080fd5b5061039d64012a05f20081565b34801561080d57600080fd5b506106d061081c3660046145e1565b612cfd565b34801561082d57600080fd5b506103f1612d1d565b34801561084257600080fd5b5061039d6402540be40081565b34801561085b57600080fd5b5061039d600e5481565b34801561087157600080fd5b5061039d6108803660046145e1565b612d7e565b34801561089157600080fd5b506103f1612e7a565b3480156108a657600080fd5b5061039d60185481565b3480156108bc57600080fd5b5061039d6203f48081565b3480156108d357600080fd5b506103f16108e236600461470f565b612f0b565b3480156108f357600080fd5b5061039d624f1a0081565b34801561090a57600080fd5b506103f16109193660046146b1565b61317e565b34801561092a57600080fd5b506103f161093936600461473c565b613351565b34801561094a57600080fd5b5061039d6133de565b34801561095f57600080fd5b506011546106d0906001600160a01b031681565b34801561097f57600080fd5b5061039d600f5481565b6109916133ed565b600060168190556040517f1b4883af197c705114490f8d84f9ce30bef6a6199f7b7b649e845577cf0769a19190a1565b6109c96133ed565b601a805460ff191690556040517f061284ffa2814ace135f62907c78a7cff0f070efe7e6a0a42740ea1da2c8bdc890600090a1565b610a066133ed565b60005b6003811015610b5357600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088360038110610a3c57610a3c614757565b01546001600160a01b03161415610a7357600b8260038110610a6057610a60614757565b0154610a6c9047614783565b9050610b13565b600b8260038110610a8657610a86614757565b015460088360038110610a9b57610a9b614757565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015610ae2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b06919061479a565b610b109190614783565b90505b8015610b4057610b4060088360038110610b2f57610b2f614757565b01546001600160a01b031682613447565b5080610b4b816147b3565b915050610a09565b50565b604080516060810191829052600091829190600b9060039082845b815481526020019060010190808311610b7157505050505090506000610b9561348a565b90506000610ba3838361352b565b905060005b6003811015610c49578515610bf957868160038110610bc957610bc9614757565b6020020151848260038110610be057610be0614757565b60200201818151610bf191906147ce565b905250610c37565b868160038110610c0b57610c0b614757565b6020020151848260038110610c2257610c22614757565b60200201818151610c339190614783565b9052505b80610c41816147b3565b915050610ba8565b506000610c56848461352b565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cad573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cd1919061479a565b905060008715610cec57610ce58484614783565b9050610cf9565b610cf68385614783565b90505b83610d0483836147e6565b610d0e9190614805565b96505050505050505b92915050565b610d256133ed565b62015180601454610d3691906147ce565b421015610d8a5760405162461bcd60e51b815260206004820152600f60248201527f646576203a20746f6f206561726c79000000000000000000000000000000000060448201526064015b60405180910390fd5b610d9762015180426147ce565b811015610de65760405162461bcd60e51b815260206004820152601660248201527f6465763a20696e73756666696369656e742074696d65000000000000000000006044820152606401610d81565b6000610df061348a565b9050600083118015610e045750620f424083105b610e765760405162461bcd60e51b815260206004820152602560248201527f5f6675747572655f41206d757374206265206265747765656e203020616e642060448201527f4d41585f410000000000000000000000000000000000000000000000000000006064820152608401610d81565b808310158015610e905750610e8c600a826147e6565b8311155b80610eaf57508083108015610eaf575080610eac600a856147e6565b10155b610efb5760405162461bcd60e51b815260206004820152601b60248201527f496c6c6567616c20706172616d65746572205f6675747572655f4100000000006044820152606401610d81565b60128190556013839055426014819055601583905560408051838152602081018690528082019290925260608201849052517fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c2549181900360800190a1505050565b610f64613546565b601a5460ff1615610fa05760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d81565b601154600160a01b900460ff16610ff7573415610ff75760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d81565b610fff614405565b600061100d60016003614783565b6110189060046147e6565b6003600e5461102791906147e6565b6110319190614805565b600f54909150600061104161348a565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611098573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110bc919061479a565b6040805160608101918290529192506000918291600b9060039082845b8154815260200190600101908083116110d95750505050509050600083111561110957611106818561352b565b91505b600060405180606001604052808360006003811061112957611129614757565b602002015181526020018360016003811061114657611146614757565b602002015181526020018360026003811061116357611163614757565b60200201519052905060005b600381101561126a57846112095760008b826003811061119157611191614757565b6020020151116112095760405162461bcd60e51b815260206004820152602260248201527f496e697469616c206465706f73697420726571756972657320616c6c20636f6960448201527f6e730000000000000000000000000000000000000000000000000000000000006064820152608401610d81565b8a816003811061121b5761121b614757565b602002015183826003811061123257611232614757565b602002015161124191906147ce565b82826003811061125357611253614757565b602002015280611262816147b3565b91505061116f565b506000611277828761352b565b90508381116112c85760405162461bcd60e51b815260206004820152601a60248201527f4431206d7573742062652067726561746572207468616e2044300000000000006044820152606401610d81565b8085156114765760005b6003811015611464576000868683600381106112f0576112f0614757565b60200201516112ff90866147e6565b6113099190614805565b9050600085836003811061131f5761131f614757565b60200201518211156113535785836003811061133d5761133d614757565b602002015161134c9083614783565b9050611378565b8186846003811061136657611366614757565b60200201516113759190614783565b90505b6402540be400611388828e6147e6565b6113929190614805565b8d84600381106113a4576113a4614757565b60200201526402540be4008b8e85600381106113c2576113c2614757565b60200201516113d191906147e6565b6113db9190614805565b8684600381106113ed576113ed614757565b60200201516113fc9190614783565b600b846003811061140f5761140f614757565b01558c836003811061142357611423614757565b602002015186846003811061143a5761143a614757565b6020020181815161144b9190614783565b90525082915061145c9050816147b3565b9150506112d2565b5061146f838861352b565b9050611485565b611483600b846003614423565b505b6000866114935750816114b5565b8561149e8184614783565b6114a890896147e6565b6114b29190614805565b90505b8b8110156115055760405162461bcd60e51b815260206004820152601460248201527f536c697070616765207363726577656420796f750000000000000000000000006044820152606401610d81565b60005b600381101561156d5760008e826003811061152557611525614757565b6020020151905060006008836003811061154157611541614757565b01546001600160a01b0316905061155881836135a0565b50508080611565906147b3565b915050611508565b506011546040517f40c10f19000000000000000000000000000000000000000000000000000000008152336004820152602481018390526001600160a01b03909116906340c10f1990604401600060405180830381600087803b1580156115d357600080fd5b505af11580156115e7573d6000803e3d6000fd5b503392507f423f6495a08fc652425cf4ed0d1f9e37e571d9b9529b1c1c23cce780b2e7df0d91508f90508d8661161d868d6147ce565b60405161162d949392919061484a565b60405180910390a2505050505050505050505061164960018055565b5050565b600b816003811061165d57600080fd5b0154905081565b601a54610100900460ff16156116bc5760405162461bcd60e51b815260206004820152601f60248201527f4f7065726174696f6e733a20416c726561647920696e697469616c697a6564006044820152606401610d81565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146117345760405162461bcd60e51b815260206004820152601760248201527f4f7065726174696f6e733a204e6f7420666163746f72790000000000000000006044820152606401610d81565b620f42408511156117875760405162461bcd60e51b815260206004820152601260248201527f5f412065786365656473206d6178696d756d00000000000000000000000000006044820152606401610d81565b64012a05f2008411156117dc5760405162461bcd60e51b815260206004820152601460248201527f5f6665652065786365656473206d6178696d756d0000000000000000000000006044820152606401610d81565b6402540be4008311156118315760405162461bcd60e51b815260206004820152601a60248201527f5f61646d696e5f6665652065786365656473206d6178696d756d0000000000006044820152606401610d81565b601a805461ff00191661010017905560005b6003811015611a9d57600087826003811061186057611860614757565b60200201516001600160a01b031614156118bc5760405162461bcd60e51b815260206004820152600c60248201527f5a45524f204164647265737300000000000000000000000000000000000000006044820152606401610d81565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee8883600381106118e5576118e5614757565b60200201516001600160a01b0316141561192f5750601180547fffffffffffffffffffffff00ffffffffffffffffffffffffffffffffffffffff16600160a01b17905560126119ad565b87826003811061194157611941614757565b60200201516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015611983573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a79190614878565b60ff1690505b6012811115611a235760405162461bcd60e51b8152602060048201526024808201527f546865206d6178696d756d20646563696d616c2063616e6e6f7420657863656560448201527f64203138000000000000000000000000000000000000000000000000000000006064820152608401610d81565b611a2e816012614783565b611a3990600a61497f565b60028360038110611a4c57611a4c614757565b015560028260038110611a6157611a61614757565b0154611a7590670de0b6b3a76400006147e6565b60058360038110611a8857611a88614757565b01555080611a95816147b3565b915050611843565b50611aab600887600361445d565b5060128590556013859055600e849055600f839055611acd624f1a00426147ce565b6019556011805473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b038316179055611b0182613351565b505050505050565b611b116133ed565b601654421015611b635760405162461bcd60e51b815260206004820152601660248201527f6465763a20696e73756666696369656e742074696d65000000000000000000006044820152606401610d81565b601654611bd85760405162461bcd60e51b815260206004820152602660248201527f61646d696e5f616374696f6e735f646561646c696e652073686f756c64206e6f60448201527f74206265203000000000000000000000000000000000000000000000000000006064820152608401610d81565b6000601655601754600e819055601854600f8190556040517fbe12859b636aed607d5230b2cc2711f68d70e51060e6cca1f575ef5d2fcc95d192611c2492908252602082015260400190565b60405180910390a1565b600080611c3b8484613621565b50949350505050565b611c4c6133ed565b60005b6003811015611d525773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088260038110611c8057611c80614757565b01546001600160a01b03161415611cac5747600b8260038110611ca557611ca5614757565b0155611d40565b60088160038110611cbf57611cbf614757565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015611d06573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d2a919061479a565b600b8260038110611d3d57611d3d614757565b01555b80611d4a816147b3565b915050611c4f565b506040517f2c7203581ca666b8c5094c11c03f0b19b3750234a9d281bcbc88a260bcb006de90600090a1565b60408051606081019182905260009182919060059060039082845b815481526020019060010190808311611d9957505050505090506000611dbd613923565b90506000670de0b6b3a7640000838860038110611ddc57611ddc614757565b6020020151611deb90876147e6565b611df59190614805565b828860038110611e0757611e07614757565b6020020151611e1691906147ce565b90506000611e26888884866139dd565b90506000848860038110611e3c57611e3c614757565b6020020151670de0b6b3a7640000600184878c60038110611e5f57611e5f614757565b6020020151611e6e9190614783565b611e789190614783565b611e8291906147e6565b611e8c9190614805565b905060006402540be40082600e54611ea491906147e6565b611eae9190614805565b9050611eba8183614783565b9a9950505050505050505050565b611ed0613546565b601a5460ff1615611f0c5760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d81565b601154600160a01b900460ff16611f63573415611f635760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d81565b604080516060810191829052600091600b9060039082845b815481526020019060010190808311611f7b57505050505090506000611fa082613be7565b90506000670de0b6b3a764000060058860038110611fc057611fc0614757565b0154611fcc90876147e6565b611fd69190614805565b828860038110611fe857611fe8614757565b6020020151611ff791906147ce565b90506000612007888884866139dd565b90506000600182858a6003811061202057612020614757565b602002015161202f9190614783565b6120399190614783565b905060006402540be400600e548361205191906147e6565b61205b9190614805565b90506005896003811061207057612070614757565b0154670de0b6b3a76400006120858385614783565b61208f91906147e6565b6120999190614805565b9150868210156121115760405162461bcd60e51b815260206004820152602e60248201527f45786368616e676520726573756c74656420696e20666577657220636f696e7360448201527f207468616e2065787065637465640000000000000000000000000000000000006064820152608401610d81565b60006402540be400600f548361212791906147e6565b6121319190614805565b905060058a6003811061214657612146614757565b015461215a670de0b6b3a7640000836147e6565b6121649190614805565b905088878c6003811061217957612179614757565b602002015161218891906147ce565b600b8c6003811061219b5761219b614757565b01558083888c600381106121b1576121b1614757565b60200201516121c09190614783565b6121ca9190614783565b600b8b600381106121dd576121dd614757565b0155600060088c600381106121f4576121f4614757565b01546001600160a01b0316905073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee81141561226957348a146122645760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d81565b61227e565b61227e6001600160a01b03821633308d613ca5565b600060088c6003811061229357612293614757565b01546001600160a01b031690506122aa8186613447565b604080518e8152602081018d90529081018d90526060810186905233907fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc989060800160405180910390a250505050505050505061230660018055565b50505050565b6123146133ed565b601654156123645760405162461bcd60e51b815260206004820181905260248201527f61646d696e5f616374696f6e735f646561646c696e65206d75737420626520306044820152606401610d81565b64012a05f2008211156123b95760405162461bcd60e51b815260206004820152601860248201527f6465763a206665652065786365656473206d6178696d756d00000000000000006044820152606401610d81565b6402540be40081111561240e5760405162461bcd60e51b815260206004820152601e60248201527f6465763a2061646d696e206665652065786365656473206d6178696d756d00006044820152606401610d81565b61241b6203f480426147ce565b60168190556017839055601882905560408051848152602081018490527f351fc5da2fbf480f2225debf3664a4bc90fa9923743aad58b4603f648e931fe0910160405180910390a25050565b6005816003811061165d57600080fd5b61247f6133ed565b6124896000613d56565b565b6002816003811061165d57600080fd5b6000806124a6613923565b6040805160608101918290529192506000919060029060039082845b8154815260200190600101908083116124c2575050505050905060008187600381106124f0576124f0614757565b60200201516124ff90866147e6565b83886003811061251157612511614757565b602002015161252091906147ce565b90506000612530888884876139dd565b9050600083886003811061254657612546614757565b6020020151600183878b6003811061256057612560614757565b602002015161256f9190614783565b611e829190614783565b612581613546565b601a5460ff16156125bd5760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d81565b601154604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015612607573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061262b919061479a565b90506000811161267d5760405162461bcd60e51b815260206004820152601660248201527f6465763a207a65726f20746f74616c20737570706c79000000000000000000006044820152606401610d81565b600061268b60016003614783565b6126969060046147e6565b6003600e546126a591906147e6565b6126af9190614805565b600f5490915060006126bf61348a565b60408051606081019182905291925060009190600b9060039082845b8154815260200190600101908083116126db5750505050509050600060405180606001604052808360006003811061271557612715614757565b602002015181526020018360016003811061273257612732614757565b602002015181526020018360026003811061274f5761274f614757565b6020020151905290506000612764838561352b565b905060005b60038110156127c15789816003811061278457612784614757565b602002015183826003811061279b5761279b614757565b602002018181516127ac9190614783565b905250806127b9816147b3565b915050612769565b5060006127ce838661352b565b90506127d8614405565b60005b600381101561296d576000848783600381106127f9576127f9614757565b602002015161280890866147e6565b6128129190614805565b9050600086836003811061282857612828614757565b602002015182111561285c5786836003811061284657612846614757565b60200201516128559083614783565b9050612881565b8187846003811061286f5761286f614757565b602002015161287e9190614783565b90505b6402540be400612891828d6147e6565b61289b9190614805565b8484600381106128ad576128ad614757565b60200201526402540be4008a8585600381106128cb576128cb614757565b60200201516128da91906147e6565b6128e49190614805565b8784600381106128f6576128f6614757565b60200201516129059190614783565b600b846003811061291857612918614757565b015583836003811061292c5761292c614757565b602002015187846003811061294357612943614757565b602002018181516129549190614783565b9052508291506129659050816147b3565b9150506127db565b50600061297a858861352b565b90506000848b61298a8483614783565b61299491906147e6565b61299e9190614805565b905060008111612a165760405162461bcd60e51b815260206004820152602360248201527f746f6b656e5f616d6f756e74206d75737420626520677265617465722074686160448201527f6e203000000000000000000000000000000000000000000000000000000000006064820152608401610d81565b612a216001826147ce565b90508b811115612a735760405162461bcd60e51b815260206004820152601460248201527f536c697070616765207363726577656420796f750000000000000000000000006044820152606401610d81565b60115460405163079cc67960e41b8152336004820152602481018390526001600160a01b03909116906379cc679090604401600060405180830381600087803b158015612abf57600080fd5b505af1158015612ad3573d6000803e3d6000fd5b5050505060005b6003811015612b515760008e8260038110612af757612af7614757565b60200201511115612b3f57612b3f60088260038110612b1857612b18614757565b01546001600160a01b03168f8360038110612b3557612b35614757565b6020020151613447565b80612b49816147b3565b915050612ada565b50612b5c818c614783565b9a50336001600160a01b03167f173599dbf9c6ca6f7c3b590df07ae98a45d74ff54065505141e7de6c46a624c28e85878f60405161162d949392919061484a565b612ba56133ed565b6108fc8110158015612bb957506159d88111155b612c055760405162461bcd60e51b815260206004820152600b60248201527f496c6c6567616c206761730000000000000000000000000000000000000000006044820152606401610d81565b60108190556040518181527f320c5e7159406866d39a81979ca1c22276b644dfcfd52ee1f335ee467ad0ec67906020015b60405180910390a150565b600080612c5c612c4f613923565b612c5761348a565b613db3565b90506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015612cb3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cd7919061479a565b905080612cec670de0b6b3a7640000846147e6565b612cf69190614805565b9250505090565b60088160038110612d0d57600080fd5b01546001600160a01b0316905081565b612d256133ed565b6000612d2f61348a565b6012819055601381905542601481905560158190556040519192507f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193891612c3691848252602082015260400190565b600073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60088360038110612da857612da8614757565b01546001600160a01b03161415612dd857600b8260038110612dcc57612dcc614757565b0154610d179047614783565b600b8260038110612deb57612deb614757565b015460088360038110612e0057612e00614757565b01546040516370a0823160e01b81523060048201526001600160a01b03909116906370a0823190602401602060405180830381865afa158015612e47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6b919061479a565b610d179190614783565b919050565b612e826133ed565b4260195411612ed35760405162461bcd60e51b815260206004820152601160248201527f457863656564656420646561646c696e650000000000000000000000000000006044820152606401610d81565b601a805460ff191660011790556040517fbe26733c2bf6ff3ea5ba8cfe744422bd49052ff9ed5685c9e81e6f9321dbaddd90600090a1565b612f13613546565b601154604080516318160ddd60e01b815290516000926001600160a01b0316916318160ddd9160048083019260209291908290030181865afa158015612f5d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f81919061479a565b9050612f8b614405565b612f93614405565b60005b60038110156130c55760008487600b8460038110612fb657612fb6614757565b0154612fc291906147e6565b612fcc9190614805565b9050858260038110612fe057612fe0614757565b602002015181101561305a5760405162461bcd60e51b815260206004820152603060248201527f5769746864726177616c20726573756c74656420696e20666577657220636f6960448201527f6e73207468616e206578706563746564000000000000000000000000000000006064820152608401610d81565b80600b836003811061306e5761306e614757565b01600082825461307e9190614783565b9091555081905084836003811061309757613097614757565b60200201526130b260088360038110610b2f57610b2f614757565b50806130bd816147b3565b915050612f96565b5060115460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b15801561311257600080fd5b505af1158015613126573d6000803e3d6000fd5b503392507fa49d4cf02656aebf8c771f5a8585638a2a15ee6c97cf7205d4208ed7c1df252d91508490508361315b8988614783565b60405161316a9392919061498b565b60405180910390a250505061164960018055565b613186613546565b601a5460ff16156131c25760405162461bcd60e51b815260206004820152600660248201526512da5b1b195960d21b6044820152606401610d81565b6000806131cf8585613621565b91509150828210156132235760405162461bcd60e51b815260206004820152601860248201527f4e6f7420656e6f75676820636f696e732072656d6f76656400000000000000006044820152606401610d81565b6402540be400600f548261323791906147e6565b6132419190614805565b61324b90836147ce565b600b856003811061325e5761325e614757565b01600082825461326e9190614783565b909155505060115460405163079cc67960e41b8152336004820152602481018790526001600160a01b03909116906379cc679090604401600060405180830381600087803b1580156132bf57600080fd5b505af11580156132d3573d6000803e3d6000fd5b505050506132fe600885600381106132ed576132ed614757565b01546001600160a01b031683613447565b604080518581526020810187905290810183905233907f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a09060600160405180910390a2505061334c60018055565b505050565b6133596133ed565b6001600160a01b0381166133d55760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610d81565b610b5381613d56565b60006133e861348a565b905090565b6000546001600160a01b031633146124895760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610d81565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee1415613476576116493382613f49565b6116496001600160a01b0383163383613ff0565b6015546013546000919042821115610d1757601254601454818311156134ef576134b48185614783565b6134be8242614783565b6134c88486614783565b6134d291906147e6565b6134dc9190614805565b6134e690836147ce565b94505050505090565b6134f98185614783565b6135038242614783565b61350d8585614783565b61351791906147e6565b6135219190614805565b6134e69083614783565b600061353f61353984613be7565b83613db3565b9392505050565b600260015414156135995760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610d81565b6002600155565b6001600160a01b03821673eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee141561360c573481146116495760405162461bcd60e51b8152602060048201526015602482015274496e636f6e73697374656e74207175616e7469747960581b6044820152606401610d81565b6116496001600160a01b038316333084613ca5565b600080600061362e61348a565b9050600061363e60016003614783565b6136499060046147e6565b6003600e5461365891906147e6565b6136629190614805565b6040805160608101918290529192506000919060029060039082845b81548152602001906001019080831161367e57505050505090506000601160009054906101000a90046001600160a01b03166001600160a01b03166318160ddd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156136ed573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613711919061479a565b9050600061371d613923565b9050600061372b8287613db3565b905060008361373a838d6147e6565b6137449190614805565b61374e9083614783565b905082600061375f898d8486614039565b90506000878d6003811061377557613775614757565b602002015182878f6003811061378d5761378d614757565b602002015161379c9190614783565b6137a69190614805565b905060005b60038110156138a25760008e8214156137fd578387878a85600381106137d3576137d3614757565b60200201516137e291906147e6565b6137ec9190614805565b6137f69190614783565b905061384e565b868689846003811061381157613811614757565b602002015161382091906147e6565b61382a9190614805565b88836003811061383c5761383c614757565b602002015161384b9190614783565b90505b6402540be40061385e828d6147e6565b6138689190614805565b85836003811061387a5761387a614757565b6020020181815161388b9190614783565b90525081905061389a816147b3565b9150506137ab565b5060006138b18b8f8688614039565b848f600381106138c3576138c3614757565b60200201516138d29190614783565b9050888e600381106138e6576138e6614757565b60200201516138f6600183614783565b6139009190614805565b90508061390d8184614783565b9c509c5050505050505050505050509250929050565b61392b614405565b6040805160608101918290529060059060039082845b815481526020019060010190808311613941575050505050905060005b60038110156139d957670de0b6b3a7640000600b826003811061398357613983614757565b015483836003811061399757613997614757565b60200201516139a691906147e6565b6139b09190614805565b8282600381106139c2576139c2614757565b6020020152806139d1816147b3565b91505061395e565b5090565b60008385141580156139ef5750600385105b80156139fb5750600384105b613a475760405162461bcd60e51b815260206004820152601160248201527f496c6c6567616c20706172616d657465720000000000000000000000000000006044820152606401610d81565b6000613a5161348a565b90506000613a5f8483613db3565b905080600080613a706003866147e6565b90506000805b6003811015613af9578b811415613a8f57899150613ab9565b8a8114613ab457888160038110613aa857613aa8614757565b60200201519150613ab9565b613ae7565b613ac382856147ce565b9350613ad06003836147e6565b613ada87876147e6565b613ae49190614805565b94505b80613af1816147b3565b915050613a76565b50613b056003836147e6565b613b0f86866147e6565b613b199190614805565b93506000613b278387614805565b613b3190856147ce565b9050600086815b60ff811015613bd3578192508884836002613b5391906147e6565b613b5d91906147ce565b613b679190614783565b88613b7284806147e6565b613b7c91906147ce565b613b869190614805565b915082821115613bab576001613b9c8484614783565b11613ba657613bd3565b613bc1565b6001613bb78385614783565b11613bc157613bd3565b80613bcb816147b3565b915050613b38565b50985050505050505050505b949350505050565b613bef614405565b6040805160608101918290529060059060039082845b815481526020019060010190808311613c05575050505050905060005b6003811015613c9f57670de0b6b3a7640000838260038110613c4657613c46614757565b6020020151838360038110613c5d57613c5d614757565b6020020151613c6c91906147e6565b613c769190614805565b828260038110613c8857613c88614757565b602002015280613c97816147b3565b915050613c22565b50919050565b6040516001600160a01b03808516602483015283166044820152606481018290526123069085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526141fd565b600080546001600160a01b0383811673ffffffffffffffffffffffffffffffffffffffff19831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b60008060005b6003811015613df757848160038110613dd457613dd4614757565b6020020151613de390836147ce565b915080613def816147b3565b915050613db9565b5080613e07576000915050610d17565b60008181613e166003876147e6565b905060005b60ff811015613f3d578260005b6003811015613e7c5760038a8260038110613e4557613e45614757565b6020020151613e5491906147e6565b613e5e86846147e6565b613e689190614805565b915080613e74816147b3565b915050613e28565b508394508060036001613e8f91906147ce565b613e9991906147e6565b84613ea5600186614783565b613eaf91906147e6565b613eb991906147ce565b84613ec56003846147e6565b613ecf89876147e6565b613ed991906147ce565b613ee391906147e6565b613eed9190614805565b935084841115613f13576001613f038686614783565b11613f0e5750613f3d565b613f2a565b6001613f1f8587614783565b11613f2a5750613f3d565b5080613f35816147b3565b915050613e1b565b50909695505050505050565b6000826001600160a01b031660105483604051600060405180830381858888f193505050503d8060008114613f9a576040519150601f19603f3d011682016040523d82523d6000602084013e613f9f565b606091505b505090508061334c5760405162461bcd60e51b815260206004820152601360248201527f424e42207472616e73666572206661696c6564000000000000000000000000006044820152606401610d81565b6040516001600160a01b03831660248201526044810182905261334c9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401613cf2565b60006003841061408b5760405162461bcd60e51b815260206004820152601460248201527f6465763a20692061626f7665204e5f434f494e530000000000000000000000006044820152606401610d81565b8160008061409a6003896147e6565b90506000805b6003811015614113578881146140ce578781600381106140c2576140c2614757565b602002015191506140d3565b614101565b6140dd82856147ce565b93506140ea6003836147e6565b6140f488876147e6565b6140fe9190614805565b94505b8061410b816147b3565b9150506140a0565b5061411f6003836147e6565b61412987866147e6565b6141339190614805565b935060006141418388614805565b61414b90856147ce565b9050600087815b60ff8110156141ed57819250898483600261416d91906147e6565b61417791906147ce565b6141819190614783565b8861418c84806147e6565b61419691906147ce565b6141a09190614805565b9150828211156141c55760016141b68484614783565b116141c0576141ed565b6141db565b60016141d18385614783565b116141db576141ed565b806141e5816147b3565b915050614152565b509b9a5050505050505050505050565b6000614252826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166142e59092919063ffffffff16565b905080516000148061427357508080602001905181019061427391906149b4565b61334c5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610d81565b6060613bdf848460008585600080866001600160a01b0316858760405161430c91906149fd565b60006040518083038185875af1925050503d8060008114614349576040519150601f19603f3d011682016040523d82523d6000602084013e61434e565b606091505b509150915061435f8783838761436a565b979650505050505050565b606083156143d65782516143cf576001600160a01b0385163b6143cf5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610d81565b5081613bdf565b613bdf83838151156143eb5781518083602001fd5b8060405162461bcd60e51b8152600401610d819190614a19565b60405180606001604052806003906020820280368337509192915050565b8260038101928215614451579160200282015b82811115614451578251825591602001919060010190614436565b506139d99291506144b2565b8260038101928215614451579160200282015b82811115614451578251825473ffffffffffffffffffffffffffffffffffffffff19166001600160a01b03909116178255602090920191600190910190614470565b5b808211156139d957600081556001016144b3565b6040516060810167ffffffffffffffff811182821017156144f857634e487b7160e01b600052604160045260246000fd5b60405290565b600082601f83011261450f57600080fd5b6145176144c7565b80606084018581111561452957600080fd5b845b8181101561454357803584526020938401930161452b565b509095945050505050565b8015158114610b5357600080fd5b6000806080838503121561456f57600080fd5b61457984846144fe565b915060608301356145898161454e565b809150509250929050565b600080604083850312156145a757600080fd5b50508035926020909101359150565b600080608083850312156145c957600080fd5b6145d384846144fe565b946060939093013593505050565b6000602082840312156145f357600080fd5b5035919050565b80356001600160a01b0381168114612e7557600080fd5b600080600080600080610100878903121561462b57600080fd5b87601f88011261463a57600080fd5b6146426144c7565b80606089018a81111561465457600080fd5b895b8181101561467557614667816145fa565b845260209384019301614656565b50909750359550506080870135935060a0870135925061469760c088016145fa565b91506146a560e088016145fa565b90509295509295509295565b6000806000606084860312156146c657600080fd5b505081359360208301359350604090920135919050565b600080600080608085870312156146f357600080fd5b5050823594602084013594506040840135936060013592509050565b6000806080838503121561472257600080fd5b8235915061473384602085016144fe565b90509250929050565b60006020828403121561474e57600080fd5b61353f826145fa565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b6000828210156147955761479561476d565b500390565b6000602082840312156147ac57600080fd5b5051919050565b60006000198214156147c7576147c761476d565b5060010190565b600082198211156147e1576147e161476d565b500190565b60008160001904831182151516156148005761480061476d565b500290565b60008261482257634e487b7160e01b600052601260045260246000fd5b500490565b8060005b600381101561230657815184526020938401939091019060010161482b565b61010081016148598287614827565b6148666060830186614827565b60c082019390935260e0015292915050565b60006020828403121561488a57600080fd5b815160ff8116811461353f57600080fd5b600181815b808511156148d65781600019048211156148bc576148bc61476d565b808516156148c957918102915b93841c93908002906148a0565b509250929050565b6000826148ed57506001610d17565b816148fa57506000610d17565b8160018114614910576002811461491a57614936565b6001915050610d17565b60ff84111561492b5761492b61476d565b50506001821b610d17565b5060208310610133831016604e8410600b8410161715614959575081810a610d17565b614963838361489b565b80600019048211156149775761497761476d565b029392505050565b600061353f83836148de565b60e081016149998286614827565b6149a66060830185614827565b8260c0830152949350505050565b6000602082840312156149c657600080fd5b815161353f8161454e565b60005b838110156149ec5781810151838201526020016149d4565b838111156123065750506000910152565b60008251614a0f8184602087016149d1565b9190910192915050565b6020815260008251806020840152614a388160408501602087016149d1565b601f01601f1916919091016040019291505056fea26469706673582212204d1c566c01c094b685090f0324cf63f08d9a27d2f54f0fb564253fe4d5edd33d64736f6c634300080a0033a26469706673582212205148cff4711472e7006d4385db86c15918fe5ac748f60531cac6f509ab02de4764736f6c634300080a0033