Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- NineInchSpotLimit
- Optimization enabled
- true
- Compiler version
- v0.8.19+commit.7dd6d404
- Optimization runs
- 999999
- EVM Version
- default
- Verified at
- 2023-10-19T20:24:15.144685Z
Constructor Arguments
0x000000000000000000000000d2161e7ab1bbe96eedf0c015e29b6edee8663b2e000000000000000000000000c73896721b68ce58dde039ef79e37fff164fd355
Arg [0] (address) : 0xd2161e7ab1bbe96eedf0c015e29b6edee8663b2e
Arg [1] (address) : 0xc73896721b68ce58dde039ef79e37fff164fd355
contracts/swap/NineInchSpotLimitPLS.sol
// SPDX-License-Identifier: GPLv3
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "@openzeppelin/contracts/utils/math/SafeCast.sol";
import "@openzeppelin/contracts/utils/structs/EnumerableSet.sol";
import "@openzeppelin/contracts/security/ReentrancyGuard.sol";
import "@openzeppelin/contracts/security/Pausable.sol";
import "./interfaces/INineInchRouter02.sol";
/**
* @title NineInchSpotLimit
* @notice It allows to create programmed swaps at a certain price, each order costs credits that, depending on the credits, increase the time of the open order.
* The accepted token to buy credits is 9inch the amount of 9inch is used to fund the keeper and execute the order
*/
contract NineInchSpotLimit is ReentrancyGuard, Pausable, Ownable {
//---------- Libraries ----------//
using SafeMath for uint256;
using SafeCast for uint256;
using SafeERC20 for IERC20;
using EnumerableSet for EnumerableSet.Bytes32Set;
//---------- Contracts ----------//
INineInchRouter02 public creditRouter; // 9inch Router contract.
IERC20 private creditToken; //
//---------- Variables ----------//
uint256 public creditPrice; // Price of credit in creditToken.
uint256 public creditTime; // Time per credit to keep an open order.
bool public returnCredit; // Allow or not to return 1 credit when canceling.
address public keeper; // Address of the admin who can performKeep.
//---------- Storage -----------//
struct Order {
uint256 targetPrice;
uint256 amountIn;
address[] path;
address user;
uint16 slippage;
uint256 deadline;
}
mapping(bytes32 => Order) private orderBook; // Mapping from orderId to order.
EnumerableSet.Bytes32Set private orderIndex; // Mapping of ids of orders.
mapping(address => uint256) public credits; // Mapping of credits balances.
//---------- Events -----------//
event OrderCreated(
bytes32 indexed orderId,
uint256 currentPrice,
uint256 targetPrice,
uint256 amountIn,
address tokenIn,
address tokenOut,
address indexed user,
uint16 slippage,
uint256 deadline
);
event OrderCancelled(bytes32 indexed orderId);
event OrderExpired(bytes32 indexed orderId);
event OrderFilled(bytes32 indexed orderId, uint256 executionPrice);
event OrderFailed(bytes32 indexed orderId);
event BoughtCredit(address indexed wallet, uint256 amount);
event TransferCredit(
address indexed from,
address indexed to,
uint256 amount
);
//---------- Constructor ----------//
constructor(address router, address _keeper) {
creditRouter = INineInchRouter02(router);
keeper = _keeper; // 0xC73896721b68ce58DDe039ef79E37FFf164FD355; pulse node admin
creditPrice = 0.20 ether; // creditToken
creditTime = 7 days;
returnCredit = true;
}
//---------- Modifiers ----------//
/**
* @dev Reverts if the caller is not a admin.
*/
modifier onlyKeeper() {
require(_msgSender() == keeper, "Only Node Admin");
_;
}
//----------- Internal Functions -----------//
/**
* @dev Convert two address in address array.
* @param tokenA First address.
* @param tokenB Last address.
* @return address[] path.
*/
function _getPath(
address tokenA,
address tokenB
) private pure returns (address[] memory) {
address[] memory path = new address[](2);
path[0] = tokenA;
path[1] = tokenB;
return path;
}
/**
* @dev Register an order and index it.
* @param orderId Order Identity.
* @param price Price at which the order is executed.
* @param amountIn Amount to swap.
* @param path Path to be performed by the swap.
* @param user Address of the order maker.
* @param slippage Swap tolerance percentage.
* @param deadline Expiration date if the order is not executed.
*/
function _createOrder(
bytes32 orderId,
uint256 price,
uint256 amountIn,
address[] calldata path,
address user,
uint16 slippage,
uint256 deadline
) private {
Order memory newOrder = Order(
price,
amountIn,
path,
user,
slippage,
deadline
);
orderIndex.add(orderId);
orderBook[orderId] = newOrder;
}
/**
* @dev Cancel a existent order.
* @param orderId Order Identity.
*/
function _deleteOrder(bytes32 orderId) private {
orderIndex.remove(orderId);
delete orderBook[orderId];
}
/**
* @dev Return funds if the order execution fails.
* @param amount Amount to return.
* @param token Address of the asset.
* @param user Address of the order maker.
*/
function _forceFail(uint256 amount, address token, address user) private {
//Interactions
if (token == address(creditRouter.WETH())) {
(bool success, ) = payable(user).call{value: amount}("");
require(success, "Transfer failed");
} else {
IERC20 _token = IERC20(token);
_token.safeTransfer(user, amount);
}
}
/**
* @dev Perform a swap once the target price is reached.
* @param orderId Order Identity.
* @param amountIn Amount to swap.
* @param path Path to be performed by the swap.
* @param user Address of the order maker.
* @param amountOutMin Minimum amount of tokens accepted to not revert.
*/
function _performSwap(
bytes32 orderId,
uint256 amountIn,
address[] memory path,
address user,
uint256 amountOutMin
) private {
address WETH = creditRouter.WETH();
address tokenIn = path[0];
address tokenOut = path[path.length - 1];
if (tokenIn == WETH) {
try
creditRouter.swapExactETHForTokens{value: amountIn}(
amountOutMin,
path,
user,
block.timestamp.add(300)
)
returns (uint256[] memory amounts) {
emit OrderFilled(orderId, amounts[path.length - 1]);
} catch {
_forceFail(amountIn, tokenIn, user);
emit OrderFailed(orderId);
}
} else if (tokenOut == WETH) {
try
creditRouter.swapExactTokensForETH(
amountIn,
amountOutMin,
path,
payable(user),
block.timestamp.add(300)
)
returns (uint256[] memory amounts) {
emit OrderFilled(orderId, amounts[path.length - 1]);
} catch {
_forceFail(amountIn, tokenIn, user);
emit OrderFailed(orderId);
}
} else {
try
creditRouter.swapExactTokensForTokens(
amountIn,
amountOutMin,
path,
user,
block.timestamp.add(300)
)
returns (uint256[] memory amounts) {
emit OrderFilled(orderId, amounts[path.length - 1]);
} catch {
_forceFail(amountIn, tokenIn, user);
emit OrderFailed(orderId);
}
}
}
/**
* @dev Calculate the amount of digits in a number.
* @param number Number to check.
* @return uint256 amount of difits.
*/
function _numDigits(uint256 number) private pure returns (uint256) {
uint256 digits = 0;
while (number != 0) {
number /= 10;
digits++;
}
return digits;
}
/**
* @dev Calculate the number of pages in proportion to 100 orders per page.
* @return book_ amount of pages.
* @return digitpage_ difits of pages.
*/
function _getPagination()
private
view
returns (uint256 book_, uint256 digitpage_)
{
uint256 _book = orderIndex.length().div(100);
uint256 remainder = _book.mul(100);
_book = remainder < orderIndex.length() ? _book.add(1) : _book;
return (_book, _numDigits(_book));
}
//----------- External Functions -----------//
/**
* @notice Show the number of total open orders.
* @return The number of orders.
*/
function totalOrders() external view returns (uint256) {
return orderIndex.length();
}
/**
* @notice Show the order in the searched index.
* @param index Index number for query.
* @return The id of the order.
*/
function getOrderAt(uint256 index) external view returns (bytes32) {
return orderIndex.at(index);
}
/**
* @notice Show data of the order.
* @param orderId ID for query.
* @return The data of the order.
*/
function getOrder(bytes32 orderId) external view returns (Order memory) {
require(orderIndex.contains(orderId), "Query for nonexistent order");
return orderBook[orderId];
}
/**
* @notice Show the amounts out of path.
* @param amountIn Amount to query.
* @param path Path to query.
* @return If exist and the amount out.
*/
function getPrice(
uint256 amountIn,
address[] memory path
) public view returns (bool, uint256) {
try creditRouter.getAmountsOut(amountIn, path) returns (
uint256[] memory result
) {
return (true, result[path.length - 1]);
} catch {
return (false, 0);
}
}
/** @notice Show the amount of creditToken needed to buy a credit.
* @return The amount of creditToken.
*/
function creditPriceInEth(
uint256 numCredits
) public view returns (uint256) {
// calculate required amount of eth for buy required nineInchAmount
uint256 nineInchAmount = creditPrice.mul(numCredits);
uint256 ethAmount = creditRouter.getAmountsIn(
nineInchAmount,
_getPath(address(creditRouter.WETH()), address(creditToken))
)[0];
return ethAmount;
}
/**
* @notice Show the start and end index for the keeper query, these indexes change according to the block number.
* This function is implemented so that keepers can read all open orders and not have a reduced limit.
* @return start index to check.
* @return end index to check.
*/
function getBatch() public view returns (uint256 start, uint256 end) {
if (orderIndex.length() != 0) {
(uint256 pages, uint256 batchDigits) = _getPagination();
uint256 blockTens = block.number.div(10);
uint256 underBlock = blockTens.div(10 ** batchDigits);
uint256 overBlock = underBlock.mul(10 ** batchDigits);
uint256 result = blockTens.sub(overBlock);
result = result == 0 ? 1 : result;
while (result > pages) {
result -= pages;
}
uint256 start_ = result.sub(1).mul(100);
uint256 end_ = result.mul(100) > orderIndex.length()
? orderIndex.length()
: result.mul(100);
return (start_, end_);
}
return (0, 0);
}
/**
* @notice Create new order.
* @param targetPrice_ Price at which the order is executed.
* @param amountIn_ Amount to swap.
* @param path_ Path to be performed by the swap.
* @param slippage_ Swap tolerance percentage.
* @param credits_ Amount of credits to use.
*/
function createOrder(
uint256 targetPrice_,
uint256 amountIn_,
address[] calldata path_,
uint16 slippage_,
uint256 credits_
) external payable whenNotPaused nonReentrant {
//Checks
require(slippage_ <= 10000, "Slippage out of bound");
require(amountIn_ != 0, "Zero amount in");
require(targetPrice_ > 0 && credits_ > 0, "Zero price");
require(path_.length >= 2, "Invalid path");
uint256 targetPrice = targetPrice_;
uint256 amountIn = amountIn_;
uint256 _credits = credits_;
address[] calldata path = path_;
address tokenIn = path[0];
address tokenOut = path[path_.length - 1];
uint16 slippage = slippage_;
address user = _msgSender();
require(
tokenIn != address(0x0) &&
tokenOut != address(0x0) &&
tokenIn != tokenOut,
"Invalid tokens"
);
// buy credits if user has not enough
if (credits[_msgSender()] < _credits) {
uint256 requiredCredits = _credits.sub(credits[_msgSender()]);
uint256 requiredEthAmount = creditPriceInEth(requiredCredits);
if (tokenIn == address(creditRouter.WETH())) {
require(
msg.value >= amountIn + requiredEthAmount,
"Insufficient eth value for swap and buy credits"
);
}
creditRouter.swapExactETHForTokens{value: requiredEthAmount}(
creditPrice.mul(requiredCredits),
_getPath(address(creditRouter.WETH()), address(creditToken)),
address(this),
block.timestamp.add(300)
);
creditToken.transfer(keeper, creditPrice.mul(requiredCredits));
unchecked {
credits[_msgSender()] += requiredCredits;
}
} else {
if (tokenIn == address(creditRouter.WETH())) {
require(
msg.value == amountIn,
"Insufficient eth value for swap"
);
}
}
(bool success, uint256 price) = getPrice(amountIn, path);
require(success && price < targetPrice, "Invalid target price");
uint256[3] memory prices;
prices[0] = price;
prices[1] = targetPrice;
prices[2] = amountIn;
bytes32 orderId = keccak256(
abi.encodePacked(
prices[0],
prices[1],
prices[2],
tokenIn,
tokenOut,
user,
slippage,
block.number
)
);
require(!orderIndex.contains(orderId), "Order id mistake");
unchecked {
credits[_msgSender()] -= _credits;
}
//Effects
uint256 deadline = block.timestamp.add(creditTime.mul(_credits));
_createOrder(
orderId,
prices[1],
prices[2],
path,
user,
slippage,
deadline
);
//Interactions
IERC20 token = IERC20(tokenIn);
if (token.allowance(address(this), address(creditRouter)) == 0) {
token.approve(address(creditRouter), ~uint256(0));
}
if (tokenIn != address(creditRouter.WETH())) {
token.transferFrom(user, address(this), prices[2]);
}
emit OrderCreated(
orderId,
prices[0],
prices[1],
prices[2],
tokenIn,
tokenOut,
user,
slippage,
deadline
);
}
/**
* @notice Cancel a existent order.
* @param orderId Order identity.
*/
function cancelOrder(bytes32 orderId) external nonReentrant {
//Checks
require(orderIndex.contains(orderId), "Order does not exist");
Order memory order = orderBook[orderId];
require(order.user == _msgSender(), "Invalid access");
address tokenIn = order.path[0];
//Effects
_deleteOrder(orderId);
//Interactions
if (tokenIn == address(creditRouter.WETH())) {
(bool success, ) = payable(order.user).call{value: order.amountIn}(
""
);
require(success, "Transfer failed");
} else {
IERC20 token = IERC20(tokenIn);
token.transfer(order.user, order.amountIn);
}
if (returnCredit) {
credits[order.user] += 1;
}
emit OrderCancelled(orderId);
}
/**
* @notice Check if any order need to be execute.
* @param checkData default data of keeper.
* @return If need to be execute and the order id.
*/
function checkUpkeep(
bytes calldata checkData
) external view returns (bool, bytes memory) {
(uint256 start, uint256 end) = getBatch();
for (uint256 i = start; i < end; i++) {
bytes32 orderId = orderIndex.at(i);
Order memory order = orderBook[orderId];
(bool success, uint256 price) = getPrice(
order.amountIn,
order.path
);
if (
(success == true && price >= order.targetPrice) ||
order.deadline <= block.timestamp
) {
return (true, abi.encodePacked(orderId));
}
}
return (false, checkData);
}
/**
* @notice Execute an order, only keepers can do this execution.
* @param performData order id to execute.
*/
function performUpkeep(
bytes calldata performData
) external nonReentrant onlyKeeper {
bytes32 orderId = abi.decode(performData, (bytes32));
require(orderIndex.contains(orderId), "Order does not exist");
Order memory order = orderBook[orderId];
address tokenIn = order.path[0];
if (order.deadline <= block.timestamp) {
//Effects
_deleteOrder(orderId);
//Interactions
if (tokenIn == address(creditRouter.WETH())) {
(bool transfered, ) = payable(order.user).call{
value: order.amountIn
}("");
require(transfered, "Transfer failed");
} else {
IERC20 token = IERC20(tokenIn);
token.transfer(order.user, order.amountIn);
}
emit OrderExpired(orderId);
} else {
//Checks
(bool success, uint256 price) = getPrice(
order.amountIn,
order.path
);
require(
success == true && price >= order.targetPrice,
"Target not reached"
);
uint256 amountOutMin = price.mul(10000 - order.slippage).div(10000);
//Effects
_deleteOrder(orderId);
//Interactions
_performSwap(
orderId,
order.amountIn,
order.path,
order.user,
amountOutMin
);
}
}
/**
* @notice Cancel a existent order by the contract owner.
* @param orderId_ Order identity.
*/
function forceCancelOrder(bytes32 orderId_) external onlyOwner {
//Checks
require(orderIndex.contains(orderId_), "Order does not exist");
Order memory order = orderBook[orderId_];
address tokenIn = order.path[0];
//Effects
_deleteOrder(orderId_);
//Interactions
if (tokenIn == address(creditRouter.WETH())) {
(bool success, ) = payable(order.user).call{value: order.amountIn}(
""
);
require(success, "Transfer failed");
} else {
IERC20 token = IERC20(tokenIn);
token.transfer(order.user, order.amountIn);
}
credits[order.user] += 1;
emit OrderCancelled(orderId_);
}
/**
* @notice Set if a credit is returned when canceling the order.
* @param return_ Determines whether or not to return.
*/
function setReturnCredit(bool return_) external onlyOwner {
returnCredit = return_;
}
/**
* @notice Set the time that extends an order per consumed credit.
* @param newTimeCredit_ The time in timestamp that extends an order.
*/
function setTimeCredit(uint256 newTimeCredit_) external onlyOwner {
require(newTimeCredit_ > 0, "Invalid time");
creditTime = newTimeCredit_;
}
/**
* @notice Set the creditToken credit price.
* @param _creditPrice creditToken credit price.
*/
function setCreditPrice(uint256 _creditPrice) external onlyOwner {
require(_creditPrice != 0, "Zero fee");
creditPrice = _creditPrice;
}
function updateRouter(address _router) external onlyOwner {
creditRouter = INineInchRouter02(_router);
}
function updateToken(address _token) external onlyOwner {
creditToken = IERC20(_token);
}
function updateKeeper(address _keeper) external onlyOwner {
keeper = _keeper;
}
/**
* @notice Functions for pause and unpause the contract.
*/
function pause() external onlyOwner {
_pause();
}
function unpause() external onlyOwner {
_unpause();
}
}
@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/Pausable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.7.0) (security/Pausable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which allows children to implement an emergency stop
* mechanism that can be triggered by an authorized account.
*
* This module is used through inheritance. It will make available the
* modifiers `whenNotPaused` and `whenPaused`, which can be applied to
* the functions of your contract. Note that they will not be pausable by
* simply including this module, only once the modifiers are put in place.
*/
abstract contract Pausable is Context {
/**
* @dev Emitted when the pause is triggered by `account`.
*/
event Paused(address account);
/**
* @dev Emitted when the pause is lifted by `account`.
*/
event Unpaused(address account);
bool private _paused;
/**
* @dev Initializes the contract in unpaused state.
*/
constructor() {
_paused = false;
}
/**
* @dev Modifier to make a function callable only when the contract is not paused.
*
* Requirements:
*
* - The contract must not be paused.
*/
modifier whenNotPaused() {
_requireNotPaused();
_;
}
/**
* @dev Modifier to make a function callable only when the contract is paused.
*
* Requirements:
*
* - The contract must be paused.
*/
modifier whenPaused() {
_requirePaused();
_;
}
/**
* @dev Returns true if the contract is paused, and false otherwise.
*/
function paused() public view virtual returns (bool) {
return _paused;
}
/**
* @dev Throws if the contract is paused.
*/
function _requireNotPaused() internal view virtual {
require(!paused(), "Pausable: paused");
}
/**
* @dev Throws if the contract is not paused.
*/
function _requirePaused() internal view virtual {
require(paused(), "Pausable: not paused");
}
/**
* @dev Triggers stopped state.
*
* Requirements:
*
* - The contract must not be paused.
*/
function _pause() internal virtual whenNotPaused {
_paused = true;
emit Paused(_msgSender());
}
/**
* @dev Returns to normal state.
*
* Requirements:
*
* - The contract must be paused.
*/
function _unpause() internal virtual whenPaused {
_paused = false;
emit Unpaused(_msgSender());
}
}
@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.0) (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.
*/
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].
*/
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.0) (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. Compatible with tokens that require the approval to be set to
* 0 before setting it to a non-zero value.
*/
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 v4.4.1 (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;
}
}
@openzeppelin/contracts/utils/math/SafeCast.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol)
// This file was procedurally generated from scripts/generate/templates/SafeCast.js.
pragma solidity ^0.8.0;
/**
* @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow
* checks.
*
* Downcasting from uint256/int256 in Solidity does not revert on overflow. This can
* easily result in undesired exploitation or bugs, since developers usually
* assume that overflows raise errors. `SafeCast` restores this intuition by
* reverting the transaction when such an operation overflows.
*
* Using this library instead of the unchecked operations eliminates an entire
* class of bugs, so it's recommended to use it always.
*
* Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing
* all math on `uint256` and `int256` and then downcasting.
*/
library SafeCast {
/**
* @dev Returns the downcasted uint248 from uint256, reverting on
* overflow (when the input is greater than largest uint248).
*
* Counterpart to Solidity's `uint248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toUint248(uint256 value) internal pure returns (uint248) {
require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits");
return uint248(value);
}
/**
* @dev Returns the downcasted uint240 from uint256, reverting on
* overflow (when the input is greater than largest uint240).
*
* Counterpart to Solidity's `uint240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toUint240(uint256 value) internal pure returns (uint240) {
require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits");
return uint240(value);
}
/**
* @dev Returns the downcasted uint232 from uint256, reverting on
* overflow (when the input is greater than largest uint232).
*
* Counterpart to Solidity's `uint232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toUint232(uint256 value) internal pure returns (uint232) {
require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits");
return uint232(value);
}
/**
* @dev Returns the downcasted uint224 from uint256, reverting on
* overflow (when the input is greater than largest uint224).
*
* Counterpart to Solidity's `uint224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.2._
*/
function toUint224(uint256 value) internal pure returns (uint224) {
require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits");
return uint224(value);
}
/**
* @dev Returns the downcasted uint216 from uint256, reverting on
* overflow (when the input is greater than largest uint216).
*
* Counterpart to Solidity's `uint216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toUint216(uint256 value) internal pure returns (uint216) {
require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits");
return uint216(value);
}
/**
* @dev Returns the downcasted uint208 from uint256, reverting on
* overflow (when the input is greater than largest uint208).
*
* Counterpart to Solidity's `uint208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toUint208(uint256 value) internal pure returns (uint208) {
require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits");
return uint208(value);
}
/**
* @dev Returns the downcasted uint200 from uint256, reverting on
* overflow (when the input is greater than largest uint200).
*
* Counterpart to Solidity's `uint200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toUint200(uint256 value) internal pure returns (uint200) {
require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits");
return uint200(value);
}
/**
* @dev Returns the downcasted uint192 from uint256, reverting on
* overflow (when the input is greater than largest uint192).
*
* Counterpart to Solidity's `uint192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toUint192(uint256 value) internal pure returns (uint192) {
require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits");
return uint192(value);
}
/**
* @dev Returns the downcasted uint184 from uint256, reverting on
* overflow (when the input is greater than largest uint184).
*
* Counterpart to Solidity's `uint184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toUint184(uint256 value) internal pure returns (uint184) {
require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits");
return uint184(value);
}
/**
* @dev Returns the downcasted uint176 from uint256, reverting on
* overflow (when the input is greater than largest uint176).
*
* Counterpart to Solidity's `uint176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toUint176(uint256 value) internal pure returns (uint176) {
require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits");
return uint176(value);
}
/**
* @dev Returns the downcasted uint168 from uint256, reverting on
* overflow (when the input is greater than largest uint168).
*
* Counterpart to Solidity's `uint168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toUint168(uint256 value) internal pure returns (uint168) {
require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits");
return uint168(value);
}
/**
* @dev Returns the downcasted uint160 from uint256, reverting on
* overflow (when the input is greater than largest uint160).
*
* Counterpart to Solidity's `uint160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toUint160(uint256 value) internal pure returns (uint160) {
require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits");
return uint160(value);
}
/**
* @dev Returns the downcasted uint152 from uint256, reverting on
* overflow (when the input is greater than largest uint152).
*
* Counterpart to Solidity's `uint152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toUint152(uint256 value) internal pure returns (uint152) {
require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits");
return uint152(value);
}
/**
* @dev Returns the downcasted uint144 from uint256, reverting on
* overflow (when the input is greater than largest uint144).
*
* Counterpart to Solidity's `uint144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toUint144(uint256 value) internal pure returns (uint144) {
require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits");
return uint144(value);
}
/**
* @dev Returns the downcasted uint136 from uint256, reverting on
* overflow (when the input is greater than largest uint136).
*
* Counterpart to Solidity's `uint136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toUint136(uint256 value) internal pure returns (uint136) {
require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits");
return uint136(value);
}
/**
* @dev Returns the downcasted uint128 from uint256, reverting on
* overflow (when the input is greater than largest uint128).
*
* Counterpart to Solidity's `uint128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v2.5._
*/
function toUint128(uint256 value) internal pure returns (uint128) {
require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits");
return uint128(value);
}
/**
* @dev Returns the downcasted uint120 from uint256, reverting on
* overflow (when the input is greater than largest uint120).
*
* Counterpart to Solidity's `uint120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toUint120(uint256 value) internal pure returns (uint120) {
require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits");
return uint120(value);
}
/**
* @dev Returns the downcasted uint112 from uint256, reverting on
* overflow (when the input is greater than largest uint112).
*
* Counterpart to Solidity's `uint112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toUint112(uint256 value) internal pure returns (uint112) {
require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits");
return uint112(value);
}
/**
* @dev Returns the downcasted uint104 from uint256, reverting on
* overflow (when the input is greater than largest uint104).
*
* Counterpart to Solidity's `uint104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toUint104(uint256 value) internal pure returns (uint104) {
require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits");
return uint104(value);
}
/**
* @dev Returns the downcasted uint96 from uint256, reverting on
* overflow (when the input is greater than largest uint96).
*
* Counterpart to Solidity's `uint96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.2._
*/
function toUint96(uint256 value) internal pure returns (uint96) {
require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits");
return uint96(value);
}
/**
* @dev Returns the downcasted uint88 from uint256, reverting on
* overflow (when the input is greater than largest uint88).
*
* Counterpart to Solidity's `uint88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toUint88(uint256 value) internal pure returns (uint88) {
require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits");
return uint88(value);
}
/**
* @dev Returns the downcasted uint80 from uint256, reverting on
* overflow (when the input is greater than largest uint80).
*
* Counterpart to Solidity's `uint80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toUint80(uint256 value) internal pure returns (uint80) {
require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits");
return uint80(value);
}
/**
* @dev Returns the downcasted uint72 from uint256, reverting on
* overflow (when the input is greater than largest uint72).
*
* Counterpart to Solidity's `uint72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toUint72(uint256 value) internal pure returns (uint72) {
require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits");
return uint72(value);
}
/**
* @dev Returns the downcasted uint64 from uint256, reverting on
* overflow (when the input is greater than largest uint64).
*
* Counterpart to Solidity's `uint64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v2.5._
*/
function toUint64(uint256 value) internal pure returns (uint64) {
require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits");
return uint64(value);
}
/**
* @dev Returns the downcasted uint56 from uint256, reverting on
* overflow (when the input is greater than largest uint56).
*
* Counterpart to Solidity's `uint56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toUint56(uint256 value) internal pure returns (uint56) {
require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits");
return uint56(value);
}
/**
* @dev Returns the downcasted uint48 from uint256, reverting on
* overflow (when the input is greater than largest uint48).
*
* Counterpart to Solidity's `uint48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toUint48(uint256 value) internal pure returns (uint48) {
require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits");
return uint48(value);
}
/**
* @dev Returns the downcasted uint40 from uint256, reverting on
* overflow (when the input is greater than largest uint40).
*
* Counterpart to Solidity's `uint40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toUint40(uint256 value) internal pure returns (uint40) {
require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits");
return uint40(value);
}
/**
* @dev Returns the downcasted uint32 from uint256, reverting on
* overflow (when the input is greater than largest uint32).
*
* Counterpart to Solidity's `uint32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v2.5._
*/
function toUint32(uint256 value) internal pure returns (uint32) {
require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits");
return uint32(value);
}
/**
* @dev Returns the downcasted uint24 from uint256, reverting on
* overflow (when the input is greater than largest uint24).
*
* Counterpart to Solidity's `uint24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toUint24(uint256 value) internal pure returns (uint24) {
require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits");
return uint24(value);
}
/**
* @dev Returns the downcasted uint16 from uint256, reverting on
* overflow (when the input is greater than largest uint16).
*
* Counterpart to Solidity's `uint16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v2.5._
*/
function toUint16(uint256 value) internal pure returns (uint16) {
require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits");
return uint16(value);
}
/**
* @dev Returns the downcasted uint8 from uint256, reverting on
* overflow (when the input is greater than largest uint8).
*
* Counterpart to Solidity's `uint8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v2.5._
*/
function toUint8(uint256 value) internal pure returns (uint8) {
require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits");
return uint8(value);
}
/**
* @dev Converts a signed int256 into an unsigned uint256.
*
* Requirements:
*
* - input must be greater than or equal to 0.
*
* _Available since v3.0._
*/
function toUint256(int256 value) internal pure returns (uint256) {
require(value >= 0, "SafeCast: value must be positive");
return uint256(value);
}
/**
* @dev Returns the downcasted int248 from int256, reverting on
* overflow (when the input is less than smallest int248 or
* greater than largest int248).
*
* Counterpart to Solidity's `int248` operator.
*
* Requirements:
*
* - input must fit into 248 bits
*
* _Available since v4.7._
*/
function toInt248(int256 value) internal pure returns (int248 downcasted) {
downcasted = int248(value);
require(downcasted == value, "SafeCast: value doesn't fit in 248 bits");
}
/**
* @dev Returns the downcasted int240 from int256, reverting on
* overflow (when the input is less than smallest int240 or
* greater than largest int240).
*
* Counterpart to Solidity's `int240` operator.
*
* Requirements:
*
* - input must fit into 240 bits
*
* _Available since v4.7._
*/
function toInt240(int256 value) internal pure returns (int240 downcasted) {
downcasted = int240(value);
require(downcasted == value, "SafeCast: value doesn't fit in 240 bits");
}
/**
* @dev Returns the downcasted int232 from int256, reverting on
* overflow (when the input is less than smallest int232 or
* greater than largest int232).
*
* Counterpart to Solidity's `int232` operator.
*
* Requirements:
*
* - input must fit into 232 bits
*
* _Available since v4.7._
*/
function toInt232(int256 value) internal pure returns (int232 downcasted) {
downcasted = int232(value);
require(downcasted == value, "SafeCast: value doesn't fit in 232 bits");
}
/**
* @dev Returns the downcasted int224 from int256, reverting on
* overflow (when the input is less than smallest int224 or
* greater than largest int224).
*
* Counterpart to Solidity's `int224` operator.
*
* Requirements:
*
* - input must fit into 224 bits
*
* _Available since v4.7._
*/
function toInt224(int256 value) internal pure returns (int224 downcasted) {
downcasted = int224(value);
require(downcasted == value, "SafeCast: value doesn't fit in 224 bits");
}
/**
* @dev Returns the downcasted int216 from int256, reverting on
* overflow (when the input is less than smallest int216 or
* greater than largest int216).
*
* Counterpart to Solidity's `int216` operator.
*
* Requirements:
*
* - input must fit into 216 bits
*
* _Available since v4.7._
*/
function toInt216(int256 value) internal pure returns (int216 downcasted) {
downcasted = int216(value);
require(downcasted == value, "SafeCast: value doesn't fit in 216 bits");
}
/**
* @dev Returns the downcasted int208 from int256, reverting on
* overflow (when the input is less than smallest int208 or
* greater than largest int208).
*
* Counterpart to Solidity's `int208` operator.
*
* Requirements:
*
* - input must fit into 208 bits
*
* _Available since v4.7._
*/
function toInt208(int256 value) internal pure returns (int208 downcasted) {
downcasted = int208(value);
require(downcasted == value, "SafeCast: value doesn't fit in 208 bits");
}
/**
* @dev Returns the downcasted int200 from int256, reverting on
* overflow (when the input is less than smallest int200 or
* greater than largest int200).
*
* Counterpart to Solidity's `int200` operator.
*
* Requirements:
*
* - input must fit into 200 bits
*
* _Available since v4.7._
*/
function toInt200(int256 value) internal pure returns (int200 downcasted) {
downcasted = int200(value);
require(downcasted == value, "SafeCast: value doesn't fit in 200 bits");
}
/**
* @dev Returns the downcasted int192 from int256, reverting on
* overflow (when the input is less than smallest int192 or
* greater than largest int192).
*
* Counterpart to Solidity's `int192` operator.
*
* Requirements:
*
* - input must fit into 192 bits
*
* _Available since v4.7._
*/
function toInt192(int256 value) internal pure returns (int192 downcasted) {
downcasted = int192(value);
require(downcasted == value, "SafeCast: value doesn't fit in 192 bits");
}
/**
* @dev Returns the downcasted int184 from int256, reverting on
* overflow (when the input is less than smallest int184 or
* greater than largest int184).
*
* Counterpart to Solidity's `int184` operator.
*
* Requirements:
*
* - input must fit into 184 bits
*
* _Available since v4.7._
*/
function toInt184(int256 value) internal pure returns (int184 downcasted) {
downcasted = int184(value);
require(downcasted == value, "SafeCast: value doesn't fit in 184 bits");
}
/**
* @dev Returns the downcasted int176 from int256, reverting on
* overflow (when the input is less than smallest int176 or
* greater than largest int176).
*
* Counterpart to Solidity's `int176` operator.
*
* Requirements:
*
* - input must fit into 176 bits
*
* _Available since v4.7._
*/
function toInt176(int256 value) internal pure returns (int176 downcasted) {
downcasted = int176(value);
require(downcasted == value, "SafeCast: value doesn't fit in 176 bits");
}
/**
* @dev Returns the downcasted int168 from int256, reverting on
* overflow (when the input is less than smallest int168 or
* greater than largest int168).
*
* Counterpart to Solidity's `int168` operator.
*
* Requirements:
*
* - input must fit into 168 bits
*
* _Available since v4.7._
*/
function toInt168(int256 value) internal pure returns (int168 downcasted) {
downcasted = int168(value);
require(downcasted == value, "SafeCast: value doesn't fit in 168 bits");
}
/**
* @dev Returns the downcasted int160 from int256, reverting on
* overflow (when the input is less than smallest int160 or
* greater than largest int160).
*
* Counterpart to Solidity's `int160` operator.
*
* Requirements:
*
* - input must fit into 160 bits
*
* _Available since v4.7._
*/
function toInt160(int256 value) internal pure returns (int160 downcasted) {
downcasted = int160(value);
require(downcasted == value, "SafeCast: value doesn't fit in 160 bits");
}
/**
* @dev Returns the downcasted int152 from int256, reverting on
* overflow (when the input is less than smallest int152 or
* greater than largest int152).
*
* Counterpart to Solidity's `int152` operator.
*
* Requirements:
*
* - input must fit into 152 bits
*
* _Available since v4.7._
*/
function toInt152(int256 value) internal pure returns (int152 downcasted) {
downcasted = int152(value);
require(downcasted == value, "SafeCast: value doesn't fit in 152 bits");
}
/**
* @dev Returns the downcasted int144 from int256, reverting on
* overflow (when the input is less than smallest int144 or
* greater than largest int144).
*
* Counterpart to Solidity's `int144` operator.
*
* Requirements:
*
* - input must fit into 144 bits
*
* _Available since v4.7._
*/
function toInt144(int256 value) internal pure returns (int144 downcasted) {
downcasted = int144(value);
require(downcasted == value, "SafeCast: value doesn't fit in 144 bits");
}
/**
* @dev Returns the downcasted int136 from int256, reverting on
* overflow (when the input is less than smallest int136 or
* greater than largest int136).
*
* Counterpart to Solidity's `int136` operator.
*
* Requirements:
*
* - input must fit into 136 bits
*
* _Available since v4.7._
*/
function toInt136(int256 value) internal pure returns (int136 downcasted) {
downcasted = int136(value);
require(downcasted == value, "SafeCast: value doesn't fit in 136 bits");
}
/**
* @dev Returns the downcasted int128 from int256, reverting on
* overflow (when the input is less than smallest int128 or
* greater than largest int128).
*
* Counterpart to Solidity's `int128` operator.
*
* Requirements:
*
* - input must fit into 128 bits
*
* _Available since v3.1._
*/
function toInt128(int256 value) internal pure returns (int128 downcasted) {
downcasted = int128(value);
require(downcasted == value, "SafeCast: value doesn't fit in 128 bits");
}
/**
* @dev Returns the downcasted int120 from int256, reverting on
* overflow (when the input is less than smallest int120 or
* greater than largest int120).
*
* Counterpart to Solidity's `int120` operator.
*
* Requirements:
*
* - input must fit into 120 bits
*
* _Available since v4.7._
*/
function toInt120(int256 value) internal pure returns (int120 downcasted) {
downcasted = int120(value);
require(downcasted == value, "SafeCast: value doesn't fit in 120 bits");
}
/**
* @dev Returns the downcasted int112 from int256, reverting on
* overflow (when the input is less than smallest int112 or
* greater than largest int112).
*
* Counterpart to Solidity's `int112` operator.
*
* Requirements:
*
* - input must fit into 112 bits
*
* _Available since v4.7._
*/
function toInt112(int256 value) internal pure returns (int112 downcasted) {
downcasted = int112(value);
require(downcasted == value, "SafeCast: value doesn't fit in 112 bits");
}
/**
* @dev Returns the downcasted int104 from int256, reverting on
* overflow (when the input is less than smallest int104 or
* greater than largest int104).
*
* Counterpart to Solidity's `int104` operator.
*
* Requirements:
*
* - input must fit into 104 bits
*
* _Available since v4.7._
*/
function toInt104(int256 value) internal pure returns (int104 downcasted) {
downcasted = int104(value);
require(downcasted == value, "SafeCast: value doesn't fit in 104 bits");
}
/**
* @dev Returns the downcasted int96 from int256, reverting on
* overflow (when the input is less than smallest int96 or
* greater than largest int96).
*
* Counterpart to Solidity's `int96` operator.
*
* Requirements:
*
* - input must fit into 96 bits
*
* _Available since v4.7._
*/
function toInt96(int256 value) internal pure returns (int96 downcasted) {
downcasted = int96(value);
require(downcasted == value, "SafeCast: value doesn't fit in 96 bits");
}
/**
* @dev Returns the downcasted int88 from int256, reverting on
* overflow (when the input is less than smallest int88 or
* greater than largest int88).
*
* Counterpart to Solidity's `int88` operator.
*
* Requirements:
*
* - input must fit into 88 bits
*
* _Available since v4.7._
*/
function toInt88(int256 value) internal pure returns (int88 downcasted) {
downcasted = int88(value);
require(downcasted == value, "SafeCast: value doesn't fit in 88 bits");
}
/**
* @dev Returns the downcasted int80 from int256, reverting on
* overflow (when the input is less than smallest int80 or
* greater than largest int80).
*
* Counterpart to Solidity's `int80` operator.
*
* Requirements:
*
* - input must fit into 80 bits
*
* _Available since v4.7._
*/
function toInt80(int256 value) internal pure returns (int80 downcasted) {
downcasted = int80(value);
require(downcasted == value, "SafeCast: value doesn't fit in 80 bits");
}
/**
* @dev Returns the downcasted int72 from int256, reverting on
* overflow (when the input is less than smallest int72 or
* greater than largest int72).
*
* Counterpart to Solidity's `int72` operator.
*
* Requirements:
*
* - input must fit into 72 bits
*
* _Available since v4.7._
*/
function toInt72(int256 value) internal pure returns (int72 downcasted) {
downcasted = int72(value);
require(downcasted == value, "SafeCast: value doesn't fit in 72 bits");
}
/**
* @dev Returns the downcasted int64 from int256, reverting on
* overflow (when the input is less than smallest int64 or
* greater than largest int64).
*
* Counterpart to Solidity's `int64` operator.
*
* Requirements:
*
* - input must fit into 64 bits
*
* _Available since v3.1._
*/
function toInt64(int256 value) internal pure returns (int64 downcasted) {
downcasted = int64(value);
require(downcasted == value, "SafeCast: value doesn't fit in 64 bits");
}
/**
* @dev Returns the downcasted int56 from int256, reverting on
* overflow (when the input is less than smallest int56 or
* greater than largest int56).
*
* Counterpart to Solidity's `int56` operator.
*
* Requirements:
*
* - input must fit into 56 bits
*
* _Available since v4.7._
*/
function toInt56(int256 value) internal pure returns (int56 downcasted) {
downcasted = int56(value);
require(downcasted == value, "SafeCast: value doesn't fit in 56 bits");
}
/**
* @dev Returns the downcasted int48 from int256, reverting on
* overflow (when the input is less than smallest int48 or
* greater than largest int48).
*
* Counterpart to Solidity's `int48` operator.
*
* Requirements:
*
* - input must fit into 48 bits
*
* _Available since v4.7._
*/
function toInt48(int256 value) internal pure returns (int48 downcasted) {
downcasted = int48(value);
require(downcasted == value, "SafeCast: value doesn't fit in 48 bits");
}
/**
* @dev Returns the downcasted int40 from int256, reverting on
* overflow (when the input is less than smallest int40 or
* greater than largest int40).
*
* Counterpart to Solidity's `int40` operator.
*
* Requirements:
*
* - input must fit into 40 bits
*
* _Available since v4.7._
*/
function toInt40(int256 value) internal pure returns (int40 downcasted) {
downcasted = int40(value);
require(downcasted == value, "SafeCast: value doesn't fit in 40 bits");
}
/**
* @dev Returns the downcasted int32 from int256, reverting on
* overflow (when the input is less than smallest int32 or
* greater than largest int32).
*
* Counterpart to Solidity's `int32` operator.
*
* Requirements:
*
* - input must fit into 32 bits
*
* _Available since v3.1._
*/
function toInt32(int256 value) internal pure returns (int32 downcasted) {
downcasted = int32(value);
require(downcasted == value, "SafeCast: value doesn't fit in 32 bits");
}
/**
* @dev Returns the downcasted int24 from int256, reverting on
* overflow (when the input is less than smallest int24 or
* greater than largest int24).
*
* Counterpart to Solidity's `int24` operator.
*
* Requirements:
*
* - input must fit into 24 bits
*
* _Available since v4.7._
*/
function toInt24(int256 value) internal pure returns (int24 downcasted) {
downcasted = int24(value);
require(downcasted == value, "SafeCast: value doesn't fit in 24 bits");
}
/**
* @dev Returns the downcasted int16 from int256, reverting on
* overflow (when the input is less than smallest int16 or
* greater than largest int16).
*
* Counterpart to Solidity's `int16` operator.
*
* Requirements:
*
* - input must fit into 16 bits
*
* _Available since v3.1._
*/
function toInt16(int256 value) internal pure returns (int16 downcasted) {
downcasted = int16(value);
require(downcasted == value, "SafeCast: value doesn't fit in 16 bits");
}
/**
* @dev Returns the downcasted int8 from int256, reverting on
* overflow (when the input is less than smallest int8 or
* greater than largest int8).
*
* Counterpart to Solidity's `int8` operator.
*
* Requirements:
*
* - input must fit into 8 bits
*
* _Available since v3.1._
*/
function toInt8(int256 value) internal pure returns (int8 downcasted) {
downcasted = int8(value);
require(downcasted == value, "SafeCast: value doesn't fit in 8 bits");
}
/**
* @dev Converts an unsigned uint256 into a signed int256.
*
* Requirements:
*
* - input must be less than or equal to maxInt256.
*
* _Available since v3.0._
*/
function toInt256(uint256 value) internal pure returns (int256) {
// Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive
require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256");
return int256(value);
}
}
@openzeppelin/contracts/utils/math/SafeMath.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/math/SafeMath.sol)
pragma solidity ^0.8.0;
// CAUTION
// This version of SafeMath should only be used with Solidity 0.8 or later,
// because it relies on the compiler's built in overflow checks.
/**
* @dev Wrappers over Solidity's arithmetic operations.
*
* NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler
* now has built in overflow checking.
*/
library SafeMath {
/**
* @dev Returns the addition of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
uint256 c = a + b;
if (c < a) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the subtraction of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b > a) return (false, 0);
return (true, a - b);
}
}
/**
* @dev Returns the multiplication of two unsigned integers, with an overflow flag.
*
* _Available since v3.4._
*/
function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
// Gas optimization: this is cheaper than requiring 'a' not being zero, but the
// benefit is lost if 'b' is also tested.
// See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522
if (a == 0) return (true, 0);
uint256 c = a * b;
if (c / a != b) return (false, 0);
return (true, c);
}
}
/**
* @dev Returns the division of two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a / b);
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag.
*
* _Available since v3.4._
*/
function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) {
unchecked {
if (b == 0) return (false, 0);
return (true, a % b);
}
}
/**
* @dev Returns the addition of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `+` operator.
*
* Requirements:
*
* - Addition cannot overflow.
*/
function add(uint256 a, uint256 b) internal pure returns (uint256) {
return a + b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting on
* overflow (when the result is negative).
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
return a - b;
}
/**
* @dev Returns the multiplication of two unsigned integers, reverting on
* overflow.
*
* Counterpart to Solidity's `*` operator.
*
* Requirements:
*
* - Multiplication cannot overflow.
*/
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
return a * b;
}
/**
* @dev Returns the integer division of two unsigned integers, reverting on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator.
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b) internal pure returns (uint256) {
return a / b;
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting when dividing by zero.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b) internal pure returns (uint256) {
return a % b;
}
/**
* @dev Returns the subtraction of two unsigned integers, reverting with custom message on
* overflow (when the result is negative).
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {trySub}.
*
* Counterpart to Solidity's `-` operator.
*
* Requirements:
*
* - Subtraction cannot overflow.
*/
function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b <= a, errorMessage);
return a - b;
}
}
/**
* @dev Returns the integer division of two unsigned integers, reverting with custom message on
* division by zero. The result is rounded towards zero.
*
* Counterpart to Solidity's `/` operator. Note: this function uses a
* `revert` opcode (which leaves remaining gas untouched) while Solidity
* uses an invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a / b;
}
}
/**
* @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),
* reverting with custom message when dividing by zero.
*
* CAUTION: This function is deprecated because it requires allocating memory for the error
* message unnecessarily. For custom revert reasons use {tryMod}.
*
* Counterpart to Solidity's `%` operator. This function uses a `revert`
* opcode (which leaves remaining gas untouched) while Solidity uses an
* invalid opcode to revert (consuming all remaining gas).
*
* Requirements:
*
* - The divisor cannot be zero.
*/
function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {
unchecked {
require(b > 0, errorMessage);
return a % b;
}
}
}
@openzeppelin/contracts/utils/structs/EnumerableSet.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/structs/EnumerableSet.sol)
// This file was procedurally generated from scripts/generate/templates/EnumerableSet.js.
pragma solidity ^0.8.0;
/**
* @dev Library for managing
* https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive
* types.
*
* Sets have the following properties:
*
* - Elements are added, removed, and checked for existence in constant time
* (O(1)).
* - Elements are enumerated in O(n). No guarantees are made on the ordering.
*
* ```solidity
* contract Example {
* // Add the library methods
* using EnumerableSet for EnumerableSet.AddressSet;
*
* // Declare a set state variable
* EnumerableSet.AddressSet private mySet;
* }
* ```
*
* As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`)
* and `uint256` (`UintSet`) are supported.
*
* [WARNING]
* ====
* Trying to delete such a structure from storage will likely result in data corruption, rendering the structure
* unusable.
* See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info.
*
* In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an
* array of EnumerableSet.
* ====
*/
library EnumerableSet {
// To implement this library for multiple types with as little code
// repetition as possible, we write it in terms of a generic Set type with
// bytes32 values.
// The Set implementation uses private functions, and user-facing
// implementations (such as AddressSet) are just wrappers around the
// underlying Set.
// This means that we can only create new EnumerableSets for types that fit
// in bytes32.
struct Set {
// Storage of set values
bytes32[] _values;
// Position of the value in the `values` array, plus 1 because index 0
// means a value is not in the set.
mapping(bytes32 => uint256) _indexes;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function _add(Set storage set, bytes32 value) private returns (bool) {
if (!_contains(set, value)) {
set._values.push(value);
// The value is stored at length-1, but we add 1 to all indexes
// and use 0 as a sentinel value
set._indexes[value] = set._values.length;
return true;
} else {
return false;
}
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function _remove(Set storage set, bytes32 value) private returns (bool) {
// We read and store the value's index to prevent multiple reads from the same storage slot
uint256 valueIndex = set._indexes[value];
if (valueIndex != 0) {
// Equivalent to contains(set, value)
// To delete an element from the _values array in O(1), we swap the element to delete with the last one in
// the array, and then remove the last element (sometimes called as 'swap and pop').
// This modifies the order of the array, as noted in {at}.
uint256 toDeleteIndex = valueIndex - 1;
uint256 lastIndex = set._values.length - 1;
if (lastIndex != toDeleteIndex) {
bytes32 lastValue = set._values[lastIndex];
// Move the last value to the index where the value to delete is
set._values[toDeleteIndex] = lastValue;
// Update the index for the moved value
set._indexes[lastValue] = valueIndex; // Replace lastValue's index to valueIndex
}
// Delete the slot where the moved value was stored
set._values.pop();
// Delete the index for the deleted slot
delete set._indexes[value];
return true;
} else {
return false;
}
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function _contains(Set storage set, bytes32 value) private view returns (bool) {
return set._indexes[value] != 0;
}
/**
* @dev Returns the number of values on the set. O(1).
*/
function _length(Set storage set) private view returns (uint256) {
return set._values.length;
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function _at(Set storage set, uint256 index) private view returns (bytes32) {
return set._values[index];
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function _values(Set storage set) private view returns (bytes32[] memory) {
return set._values;
}
// Bytes32Set
struct Bytes32Set {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _add(set._inner, value);
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) {
return _remove(set._inner, value);
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) {
return _contains(set._inner, value);
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(Bytes32Set storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) {
return _at(set._inner, index);
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(Bytes32Set storage set) internal view returns (bytes32[] memory) {
bytes32[] memory store = _values(set._inner);
bytes32[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// AddressSet
struct AddressSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(AddressSet storage set, address value) internal returns (bool) {
return _add(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(AddressSet storage set, address value) internal returns (bool) {
return _remove(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(AddressSet storage set, address value) internal view returns (bool) {
return _contains(set._inner, bytes32(uint256(uint160(value))));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(AddressSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(AddressSet storage set, uint256 index) internal view returns (address) {
return address(uint160(uint256(_at(set._inner, index))));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(AddressSet storage set) internal view returns (address[] memory) {
bytes32[] memory store = _values(set._inner);
address[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
// UintSet
struct UintSet {
Set _inner;
}
/**
* @dev Add a value to a set. O(1).
*
* Returns true if the value was added to the set, that is if it was not
* already present.
*/
function add(UintSet storage set, uint256 value) internal returns (bool) {
return _add(set._inner, bytes32(value));
}
/**
* @dev Removes a value from a set. O(1).
*
* Returns true if the value was removed from the set, that is if it was
* present.
*/
function remove(UintSet storage set, uint256 value) internal returns (bool) {
return _remove(set._inner, bytes32(value));
}
/**
* @dev Returns true if the value is in the set. O(1).
*/
function contains(UintSet storage set, uint256 value) internal view returns (bool) {
return _contains(set._inner, bytes32(value));
}
/**
* @dev Returns the number of values in the set. O(1).
*/
function length(UintSet storage set) internal view returns (uint256) {
return _length(set._inner);
}
/**
* @dev Returns the value stored at position `index` in the set. O(1).
*
* Note that there are no guarantees on the ordering of values inside the
* array, and it may change when more values are added or removed.
*
* Requirements:
*
* - `index` must be strictly less than {length}.
*/
function at(UintSet storage set, uint256 index) internal view returns (uint256) {
return uint256(_at(set._inner, index));
}
/**
* @dev Return the entire set in an array
*
* WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed
* to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that
* this function has an unbounded cost, and using it as part of a state-changing function may render the function
* uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block.
*/
function values(UintSet storage set) internal view returns (uint256[] memory) {
bytes32[] memory store = _values(set._inner);
uint256[] memory result;
/// @solidity memory-safe-assembly
assembly {
result := store
}
return result;
}
}
contracts/swap/interfaces/INineInchRouter01.sol
// SPDX-License-Identifier: GPLv3
pragma solidity 0.8.19;
interface INineInchRouter01 {
function factory() external view returns (address);
function WETH() external view returns (address);
function addLiquidity(
address tokenA,
address tokenB,
uint amountADesired,
uint amountBDesired,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB, uint liquidity);
function addLiquidityETH(
address token,
uint amountTokenDesired,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
)
external
payable
returns (uint amountToken, uint amountETH, uint liquidity);
function removeLiquidity(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline
) external returns (uint amountA, uint amountB);
function removeLiquidityETH(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountToken, uint amountETH);
function removeLiquidityWithPermit(
address tokenA,
address tokenB,
uint liquidity,
uint amountAMin,
uint amountBMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountA, uint amountB);
function removeLiquidityETHWithPermit(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountToken, uint amountETH);
function swapExactTokensForTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapTokensForExactTokens(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactETHForTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable returns (uint[] memory amounts);
function swapTokensForExactETH(
uint amountOut,
uint amountInMax,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapExactTokensForETH(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external returns (uint[] memory amounts);
function swapETHForExactTokens(
uint amountOut,
address[] calldata path,
address to,
uint deadline
) external payable returns (uint[] memory amounts);
function quote(
uint amountA,
uint reserveA,
uint reserveB
) external pure returns (uint amountB);
function getAmountOut(
uint amountIn,
uint reserveIn,
uint reserveOut
) external pure returns (uint amountOut);
function getAmountIn(
uint amountOut,
uint reserveIn,
uint reserveOut
) external pure returns (uint amountIn);
function getAmountsOut(
uint amountIn,
address[] calldata path
) external view returns (uint[] memory amounts);
function getAmountsIn(
uint amountOut,
address[] calldata path
) external view returns (uint[] memory amounts);
}
contracts/swap/interfaces/INineInchRouter02.sol
// SPDX-License-Identifier: GPLv3
pragma solidity 0.8.19;
import "./INineInchRouter01.sol";
interface INineInchRouter02 is INineInchRouter01 {
function removeLiquidityETHSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline
) external returns (uint amountETH);
function removeLiquidityETHWithPermitSupportingFeeOnTransferTokens(
address token,
uint liquidity,
uint amountTokenMin,
uint amountETHMin,
address to,
uint deadline,
bool approveMax,
uint8 v,
bytes32 r,
bytes32 s
) external returns (uint amountETH);
function swapExactTokensForTokensSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
function swapExactETHForTokensSupportingFeeOnTransferTokens(
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external payable;
function swapExactTokensForETHSupportingFeeOnTransferTokens(
uint amountIn,
uint amountOutMin,
address[] calldata path,
address to,
uint deadline
) external;
}
Compiler Settings
{"outputSelection":{"*":{"*":["abi","evm.bytecode","evm.deployedBytecode","evm.methodIdentifiers"]}},"optimizer":{"runs":999999,"enabled":true},"libraries":{}}
Contract ABI
[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"router","internalType":"address"},{"type":"address","name":"_keeper","internalType":"address"}]},{"type":"event","name":"BoughtCredit","inputs":[{"type":"address","name":"wallet","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OrderCancelled","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"OrderCreated","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true},{"type":"uint256","name":"currentPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"targetPrice","internalType":"uint256","indexed":false},{"type":"uint256","name":"amountIn","internalType":"uint256","indexed":false},{"type":"address","name":"tokenIn","internalType":"address","indexed":false},{"type":"address","name":"tokenOut","internalType":"address","indexed":false},{"type":"address","name":"user","internalType":"address","indexed":true},{"type":"uint16","name":"slippage","internalType":"uint16","indexed":false},{"type":"uint256","name":"deadline","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OrderExpired","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"OrderFailed","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true}],"anonymous":false},{"type":"event","name":"OrderFilled","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32","indexed":true},{"type":"uint256","name":"executionPrice","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"event","name":"Paused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"event","name":"TransferCredit","inputs":[{"type":"address","name":"from","internalType":"address","indexed":true},{"type":"address","name":"to","internalType":"address","indexed":true},{"type":"uint256","name":"amount","internalType":"uint256","indexed":false}],"anonymous":false},{"type":"event","name":"Unpaused","inputs":[{"type":"address","name":"account","internalType":"address","indexed":false}],"anonymous":false},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"cancelOrder","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"},{"type":"bytes","name":"","internalType":"bytes"}],"name":"checkUpkeep","inputs":[{"type":"bytes","name":"checkData","internalType":"bytes"}]},{"type":"function","stateMutability":"payable","outputs":[],"name":"createOrder","inputs":[{"type":"uint256","name":"targetPrice_","internalType":"uint256"},{"type":"uint256","name":"amountIn_","internalType":"uint256"},{"type":"address[]","name":"path_","internalType":"address[]"},{"type":"uint16","name":"slippage_","internalType":"uint16"},{"type":"uint256","name":"credits_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"creditPrice","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"creditPriceInEth","inputs":[{"type":"uint256","name":"numCredits","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract INineInchRouter02"}],"name":"creditRouter","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"creditTime","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"credits","inputs":[{"type":"address","name":"","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"forceCancelOrder","inputs":[{"type":"bytes32","name":"orderId_","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"start","internalType":"uint256"},{"type":"uint256","name":"end","internalType":"uint256"}],"name":"getBatch","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct NineInchSpotLimit.Order","components":[{"type":"uint256","name":"targetPrice","internalType":"uint256"},{"type":"uint256","name":"amountIn","internalType":"uint256"},{"type":"address[]","name":"path","internalType":"address[]"},{"type":"address","name":"user","internalType":"address"},{"type":"uint16","name":"slippage","internalType":"uint16"},{"type":"uint256","name":"deadline","internalType":"uint256"}]}],"name":"getOrder","inputs":[{"type":"bytes32","name":"orderId","internalType":"bytes32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bytes32","name":"","internalType":"bytes32"}],"name":"getOrderAt","inputs":[{"type":"uint256","name":"index","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"},{"type":"uint256","name":"","internalType":"uint256"}],"name":"getPrice","inputs":[{"type":"uint256","name":"amountIn","internalType":"uint256"},{"type":"address[]","name":"path","internalType":"address[]"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"keeper","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"pause","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"paused","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"performUpkeep","inputs":[{"type":"bytes","name":"performData","internalType":"bytes"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"","internalType":"bool"}],"name":"returnCredit","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setCreditPrice","inputs":[{"type":"uint256","name":"_creditPrice","internalType":"uint256"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setReturnCredit","inputs":[{"type":"bool","name":"return_","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setTimeCredit","inputs":[{"type":"uint256","name":"newTimeCredit_","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"totalOrders","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"unpause","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateKeeper","inputs":[{"type":"address","name":"_keeper","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateRouter","inputs":[{"type":"address","name":"_router","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"updateToken","inputs":[{"type":"address","name":"_token","internalType":"address"}]}]
Contract Creation Code
0x60806040523480156200001157600080fd5b50604051620049b3380380620049b3833981016040819052620000349162000120565b60016000819055805460ff191690556200004e33620000a9565b600280546001600160a01b0319166001600160a01b03938416179055600680546702c68af0bb14000060045562093a806005556001600160a81b031916610100929093169190910260ff191691909117600117905562000158565b600180546001600160a01b03838116610100818102610100600160a81b031985161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b80516001600160a01b03811681146200011b57600080fd5b919050565b600080604083850312156200013457600080fd5b6200013f8362000103565b91506200014f6020840162000103565b90509250929050565b61484b80620001686000396000f3fe6080604052600436106101c25760003560e01c80638da5cb5b116100f7578063c851cc3211610095578063ec57dd5911610064578063ec57dd591461053d578063f2fde38b1461055d578063fab6d6d01461057d578063fe5ff4681461059d57600080fd5b8063c851cc32146104cd578063ca6358cd146104ed578063cb59e5c014610503578063d7a9a3781461051d57600080fd5b8063aced1661116100d1578063aced166114610452578063ad17a0b314610484578063adfd4354146104a4578063ae182dcd146104ba57600080fd5b80638da5cb5b146103e257806395048d4614610412578063977902171461043257600080fd5b80635e6cd6fb1161016457806373a423d01161013e57806373a423d01461036d5780637489ec231461038d5780637ad3def2146103ad5780638456cb59146103cd57600080fd5b80635e6cd6fb146102d85780636e04ff0d1461032a578063715018a61461035857600080fd5b80633f4ba83a116101a05780633f4ba83a146102505780634585e33b146102675780635778472a146102875780635c975abb146102b457600080fd5b80630c0fa81a146101c75780631d834409146102035780633b1fee6c14610226575b600080fd5b3480156101d357600080fd5b506101e76101e2366004614015565b6105ca565b6040805192151583526020830191909152015b60405180910390f35b34801561020f57600080fd5b506102186106c8565b6040519081526020016101fa565b34801561023257600080fd5b5061023b6106d9565b604080519283526020830191909152016101fa565b34801561025c57600080fd5b506102656107df565b005b34801561027357600080fd5b506102656102823660046140c0565b6107f1565b34801561029357600080fd5b506102a76102a2366004614132565b610da1565b6040516101fa919061414b565b3480156102c057600080fd5b5060015460ff165b60405190151581526020016101fa565b3480156102e457600080fd5b506002546103059073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101fa565b34801561033657600080fd5b5061034a6103453660046140c0565b610f4a565b6040516101fa929190614278565b34801561036457600080fd5b5061026561114d565b34801561037957600080fd5b50610218610388366004614132565b61115f565b34801561039957600080fd5b506102656103a8366004614132565b611172565b3480156103b957600080fd5b506102656103c8366004614293565b611658565b3480156103d957600080fd5b506102656116a7565b3480156103ee57600080fd5b50600154610100900473ffffffffffffffffffffffffffffffffffffffff16610305565b34801561041e57600080fd5b5061026561042d366004614132565b6116b7565b34801561043e57600080fd5b5061026561044d366004614293565b611af0565b34801561045e57600080fd5b5060065461030590610100900473ffffffffffffffffffffffffffffffffffffffff1681565b34801561049057600080fd5b5061026561049f366004614132565b611b44565b3480156104b057600080fd5b5061021860055481565b6102656104c83660046142c7565b611bbb565b3480156104d957600080fd5b506102656104e8366004614293565b6129b3565b3480156104f957600080fd5b5061021860045481565b34801561050f57600080fd5b506006546102c89060ff1681565b34801561052957600080fd5b50610218610538366004614132565b612a02565b34801561054957600080fd5b50610265610558366004614377565b612b44565b34801561056957600080fd5b50610265610578366004614293565b612b7d565b34801561058957600080fd5b50610265610598366004614132565b612c31565b3480156105a957600080fd5b506102186105b8366004614293565b600a6020526000908152604090205481565b6002546040517fd06ca61f000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff9091169063d06ca61f9061062790879087906004016143e5565b600060405180830381865afa92505050801561068357506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261068091908101906143fe565b60015b610692575060009050806106c1565b600181600186516106a391906144b3565b815181106106b3576106b36144c6565b602002602001015192509250505b9250929050565b60006106d46008612ca8565b905090565b6000806106e66008612ca8565b156107d6576000806106f6612cb2565b9092509050600061070843600a612d0e565b9050600061072161071a84600a614615565b8390612d0e565b9050600061073a61073385600a614615565b8390612d21565b905060006107488483612d2d565b905080156107565780610759565b60015b90505b858111156107755761076e86826144b3565b905061075c565b600061078d6064610787846001612d2d565b90612d21565b9050600061079b6008612ca8565b6107a6846064612d21565b116107bb576107b6836064612d21565b6107c5565b6107c56008612ca8565b919a91995090975050505050505050565b50600091829150565b6107e7612d39565b6107ef612dc0565b565b6107f9612e3d565b600654610100900473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461089a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4f6e6c79204e6f64652041646d696e000000000000000000000000000000000060448201526064015b60405180910390fd5b60006108a882840184614132565b90506108b5600882612eb0565b61091b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4f7264657220646f6573206e6f742065786973740000000000000000000000006044820152606401610891565b6000818152600760209081526040808320815160c081018352815481526001820154818501526002820180548451818702810187018652818152929593948601938301828280156109a257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610977575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff8116602083015274010000000000000000000000000000000000000000900461ffff1660408083019190915260049092015460609091015281015180519192506000918290610a1557610a156144c6565b60200260200101519050428260a0015111610ca757610a3383612ec8565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac49190614621565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610bce576000826060015173ffffffffffffffffffffffffffffffffffffffff16836020015160405160006040518083038185875af1925050503d8060008114610b58576040519150601f19603f3d011682016040523d82523d6000602084013e610b5d565b606091505b5050905080610bc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610891565b50610c77565b606082015160208301516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810191909152829182169063a9059cbb906044016020604051808303816000875af1158015610c50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c74919061463e565b50505b60405183907f2e775cae5028266ebbe90e46ca5ce1b333eb3c28eef104c52203add626c1ada890600090a2610d90565b600080610cbc846020015185604001516105ca565b90925090506001821515148015610cd4575083518110155b610d3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f546172676574206e6f74207265616368656400000000000000000000000000006044820152606401610891565b6000610d68612710610d628760800151612710610d57919061465b565b859061ffff16612d21565b90612d0e565b9050610d7386612ec8565b610d8c8686602001518760400151886060015185612f30565b5050505b505050610d9d6001600055565b5050565b610df46040518060c00160405280600081526020016000815260200160608152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600061ffff168152602001600081525090565b610dff600883612eb0565b610e65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e74206f7264657200000000006044820152606401610891565b600082815260076020908152604091829020825160c0810184528154815260018201548184015260028201805485518186028101860187528181529295939493860193830182828015610eee57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610ec3575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff8116602083015274010000000000000000000000000000000000000000900461ffff16604082015260049091015460609091015292915050565b60006060600080610f596106d9565b9092509050815b81811015611102576000610f75600883613396565b90506000600760008381526020019081526020016000206040518060c001604052908160008201548152602001600182015481526020016002820180548060200260200160405190810160405280929190818152602001828054801561101157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610fe6575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff81166020808401919091527401000000000000000000000000000000000000000090910461ffff1660408084019190915260049093015460609092019190915282015190820151919250600091829161108b916105ca565b909250905060018215151480156110a3575082518110155b806110b25750428360a0015111155b156110eb576001846040516020016110cc91815260200190565b60405160208183030381529060405298509850505050505050506106c1565b5050505080806110fa90614676565b915050610f60565b506000868681818080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250959c929b50919950505050505050505050565b611155612d39565b6107ef60006133a2565b600061116c600883613396565b92915050565b61117a612e3d565b611185600882612eb0565b6111eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4f7264657220646f6573206e6f742065786973740000000000000000000000006044820152606401610891565b6000818152600760209081526040808320815160c0810183528154815260018201548185015260028201805484518187028101870186528181529295939486019383018282801561127257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611247575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff8116602083015274010000000000000000000000000000000000000000900461ffff16604082015260049091015460609091015290503373ffffffffffffffffffffffffffffffffffffffff16816060015173ffffffffffffffffffffffffffffffffffffffff1614611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c6964206163636573730000000000000000000000000000000000006044820152606401610891565b6000816040015160008151811061137c5761137c6144c6565b6020026020010151905061138f83612ec8565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114209190614621565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361152a576000826060015173ffffffffffffffffffffffffffffffffffffffff16836020015160405160006040518083038185875af1925050503d80600081146114b4576040519150601f19603f3d011682016040523d82523d6000602084013e6114b9565b606091505b5050905080611524576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610891565b506115d3565b606082015160208301516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810191909152829182169063a9059cbb906044016020604051808303816000875af11580156115ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d0919061463e565b50505b60065460ff161561161e57606082015173ffffffffffffffffffffffffffffffffffffffff166000908152600a602052604081208054600192906116189084906146ae565b90915550505b60405183907f5152abf959f6564662358c2e52b702259b78bac5ee7842a0f01937e670efcc7d90600090a250506116556001600055565b50565b611660612d39565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6116af612d39565b6107ef613420565b6116bf612d39565b6116ca600882612eb0565b611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4f7264657220646f6573206e6f742065786973740000000000000000000000006044820152606401610891565b6000818152600760209081526040808320815160c081018352815481526001820154818501526002820180548451818702810187018652818152929593948601938301828280156117b757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161178c575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff8116602083015274010000000000000000000000000000000000000000900461ffff166040808301919091526004909201546060909101528101518051919250600091829061182a5761182a6144c6565b6020026020010151905061183d83612ec8565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ce9190614621565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036119d8576000826060015173ffffffffffffffffffffffffffffffffffffffff16836020015160405160006040518083038185875af1925050503d8060008114611962576040519150601f19603f3d011682016040523d82523d6000602084013e611967565b606091505b50509050806119d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610891565b50611a81565b606082015160208301516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810191909152829182169063a9059cbb906044016020604051808303816000875af1158015611a5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7e919061463e565b50505b606082015173ffffffffffffffffffffffffffffffffffffffff166000908152600a60205260408120805460019290611abb9084906146ae565b909155505060405183907f5152abf959f6564662358c2e52b702259b78bac5ee7842a0f01937e670efcc7d90600090a2505050565b611af8612d39565b6006805473ffffffffffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b611b4c612d39565b80600003611bb6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600860248201527f5a65726f206665650000000000000000000000000000000000000000000000006044820152606401610891565b600455565b611bc3613479565b611bcb612e3d565b6127108261ffff161115611c3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f536c697070616765206f7574206f6620626f756e6400000000000000000000006044820152606401610891565b84600003611ca5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5a65726f20616d6f756e7420696e0000000000000000000000000000000000006044820152606401610891565b600086118015611cb55750600081115b611d1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5a65726f207072696365000000000000000000000000000000000000000000006044820152606401610891565b6002831015611d86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f496e76616c6964207061746800000000000000000000000000000000000000006044820152606401610891565b8585828686600082828281611d9d57611d9d6144c6565b9050602002016020810190611db29190614293565b905060008383611dc360018d6144b3565b818110611dd257611dd26144c6565b9050602002016020810190611de79190614293565b9050883373ffffffffffffffffffffffffffffffffffffffff841615801590611e25575073ffffffffffffffffffffffffffffffffffffffff831615155b8015611e5d57508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b611ec3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420746f6b656e730000000000000000000000000000000000006044820152606401610891565b336000908152600a60205260409020548711156122c057336000908152600a6020526040812054611ef5908990612d2d565b90506000611f0282612a02565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f959190614621565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff160361206057611fd1818b6146ae565b341015612060576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f496e73756666696369656e74206574682076616c756520666f7220737761702060448201527f616e6420627579206372656469747300000000000000000000000000000000006064820152608401610891565b60025460045473ffffffffffffffffffffffffffffffffffffffff90911690637ff36ab59083906120919086612d21565b600254604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516121449273ffffffffffffffffffffffffffffffffffffffff169163ad5c46489160048083019260209291908290030181865afa158015612102573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121269190614621565b60035473ffffffffffffffffffffffffffffffffffffffff166134e6565b306121514261012c61359a565b6040518663ffffffff1660e01b815260040161217094939291906146c1565b60006040518083038185885af115801561218e573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526121d591908101906143fe565b5060035460065460045473ffffffffffffffffffffffffffffffffffffffff9283169263a9059cbb926101009004169061220f9086612d21565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af115801561227f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a3919061463e565b5050336000908152600a60205260409020805490910190556123ec565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561232d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123519190614621565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036123ec578734146123ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f496e73756666696369656e74206574682076616c756520666f722073776170006044820152606401610891565b60008061242c8a8989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506105ca92505050565b9150915081801561243c57508a81105b6124a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c6964207461726765742070726963650000000000000000000000006044820152606401610891565b6124aa613e76565b81815260208082018d905260408083018d9052805191820184905281018d905260608082018d905288811b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116608084015288821b811660948401529086901b1660a882015260f086901b7fffff0000000000000000000000000000000000000000000000000000000000001660bc8201524360be82015260009060de01604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120905061258d600882612eb0565b156125f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f72646572206964206d697374616b65000000000000000000000000000000006044820152606401610891565b336000908152600a6020526040812080548d900390556005546126229061261b908e612d21565b429061359a565b905061264282846001602002015185600260200201518e8e8b8d886135a6565b6002546040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91821660248201528a9182169063dd62ed3e90604401602060405180830381865afa1580156126b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126dd9190614703565b6000036127a2576002546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529082169063095ea7b3906044016020604051808303816000875af115801561277c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a0919061463e565b505b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561280f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128339190614621565b73ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff161461290d5760408085015190517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301523060248301526044820192909252908216906323b872dd906064016020604051808303816000875af11580156128e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290b919061463e565b505b835160208086015160408088015181519485529284019190915282015273ffffffffffffffffffffffffffffffffffffffff8b811660608301528a8116608083015261ffff8a1660a083015260c0820184905288169084907f99657a932d9c70d2828b20283c6695ec3f56fab0cba81f52b3e59c7cb67b49ac9060e00160405180910390a35050505050505050505050505050506129ab6001600055565b505050505050565b6129bb612d39565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600080612a1a83600454612d2190919063ffffffff16565b600254604080517fad5c4648000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff90921691631f00ca74918591612a9e91859163ad5c4648916004808201926020929091908290030181865afa158015612102573d6000803e3d6000fd5b6040518363ffffffff1660e01b8152600401612abb9291906143e5565b600060405180830381865afa158015612ad8573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612b1e91908101906143fe565b600081518110612b3057612b306144c6565b602002602001015190508092505050919050565b612b4c612d39565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b612b85612d39565b73ffffffffffffffffffffffffffffffffffffffff8116612c28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610891565b611655816133a2565b612c39612d39565b60008111612ca3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f496e76616c69642074696d6500000000000000000000000000000000000000006044820152606401610891565b600555565b600061116c825490565b6000806000612cc66064610d626008612ca8565b90506000612cd5826064612d21565b9050612ce16008612ca8565b8110612ced5781612cf8565b612cf882600161359a565b915081612d04836136f1565b9350935050509091565b6000612d1a828461471c565b9392505050565b6000612d1a8284614757565b6000612d1a82846144b3565b60015473ffffffffffffffffffffffffffffffffffffffff6101009091041633146107ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610891565b612dc861371a565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b600260005403612ea9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610891565b6002600055565b60008181526001830160205260408120541515612d1a565b612ed3600882613786565b5060008181526007602052604081208181556001810182905590612efa6002830182613e94565b506003810180547fffffffffffffffffffff00000000000000000000000000000000000000000000169055600060049091015550565b600254604080517fad5c4648000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163ad5c46489160048083019260209291908290030181865afa158015612fa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc49190614621565b9050600084600081518110612fdb57612fdb6144c6565b6020026020010151905060008560018751612ff691906144b3565b81518110613006576130066144c6565b602002602001015190508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036131935760025473ffffffffffffffffffffffffffffffffffffffff16637ff36ab5888689896130714261012c61359a565b6040518663ffffffff1660e01b815260040161309094939291906146c1565b60006040518083038185885af1935050505080156130ee57506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526130eb91908101906143fe565b60015b61312d576130fd878387613792565b60405188907fe1bf2a28c083b93b502e4140fe14e357c3d973a7ec3d8517b6022a70bfd3562690600090a261338c565b887ffec331350fce78ba658e082a71da20ac9f8d798a99b3c79681c8440cbfe77e078260018a5161315e91906144b3565b8151811061316e5761316e6144c6565b602002602001015160405161318591815260200190565b60405180910390a25061338c565b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361326f5760025473ffffffffffffffffffffffffffffffffffffffff166318cbafe5888689896131f44261012c61359a565b6040518663ffffffff1660e01b815260040161321495949392919061476e565b6000604051808303816000875af19250505080156130ee57506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526130eb91908101906143fe565b60025473ffffffffffffffffffffffffffffffffffffffff166338ed17398886898961329d4261012c61359a565b6040518663ffffffff1660e01b81526004016132bd95949392919061476e565b6000604051808303816000875af192505050801561331b57506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261331891908101906143fe565b60015b61332a576130fd878387613792565b887ffec331350fce78ba658e082a71da20ac9f8d798a99b3c79681c8440cbfe77e078260018a5161335b91906144b3565b8151811061336b5761336b6144c6565b602002602001015160405161338291815260200190565b60405180910390a2505b5050505050505050565b6000612d1a838361394c565b6001805473ffffffffffffffffffffffffffffffffffffffff8381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff85161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b613428613479565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833612e13565b60015460ff16156107ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610891565b60408051600280825260608083018452926000929190602083019080368337019050509050838160008151811061351f5761351f6144c6565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061356d5761356d6144c6565b73ffffffffffffffffffffffffffffffffffffffff90921660209283029190910190910152905092915050565b6000612d1a82846146ae565b60006040518060c0016040528089815260200188815260200187878080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525073ffffffffffffffffffffffffffffffffffffffff8616602082015261ffff85166040820152606001839052905061362e60088a613976565b5060008981526007602090815260409182902083518155818401516001820155918301518051849392613668926002850192910190613eb2565b506060820151600382018054608085015161ffff1674010000000000000000000000000000000000000000027fffffffffffffffffffff0000000000000000000000000000000000000000000090911673ffffffffffffffffffffffffffffffffffffffff9093169290921791909117905560a090910151600490910155505050505050505050565b6000805b821561116c57613706600a8461471c565b92508061371281614676565b9150506136f5565b60015460ff166107ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610891565b6000612d1a8383613982565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138239190614621565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036139255760008173ffffffffffffffffffffffffffffffffffffffff168460405160006040518083038185875af1925050503d80600081146138af576040519150601f19603f3d011682016040523d82523d6000602084013e6138b4565b606091505b505090508061391f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610891565b50505050565b8161391f73ffffffffffffffffffffffffffffffffffffffff82168386613a7c565b505050565b6000826000018281548110613963576139636144c6565b9060005260206000200154905092915050565b6000612d1a8383613b09565b60008181526001830160205260408120548015613a6b5760006139a66001836144b3565b85549091506000906139ba906001906144b3565b9050818114613a1f5760008660000182815481106139da576139da6144c6565b90600052602060002001549050808760000184815481106139fd576139fd6144c6565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613a3057613a306147b7565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061116c565b600091505061116c565b5092915050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052613947908490613b58565b6000818152600183016020526040812054613b505750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561116c565b50600061116c565b6000613bba826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613c679092919063ffffffff16565b9050805160001480613bdb575080806020019051810190613bdb919061463e565b613947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610891565b6060613c768484600085613c7e565b949350505050565b606082471015613d10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610891565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613d3991906147e6565b60006040518083038185875af1925050503d8060008114613d76576040519150601f19603f3d011682016040523d82523d6000602084013e613d7b565b606091505b5091509150613d8c87838387613d97565b979650505050505050565b60608315613e2d578251600003613e265773ffffffffffffffffffffffffffffffffffffffff85163b613e26576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610891565b5081613c76565b613c768383815115613e425781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108919190614802565b60405180606001604052806003906020820280368337509192915050565b50805460008255906000526020600020908101906116559190613f3c565b828054828255906000526020600020908101928215613f2c579160200282015b82811115613f2c57825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190613ed2565b50613f38929150613f3c565b5090565b5b80821115613f385760008155600101613f3d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613fc757613fc7613f51565b604052919050565b600067ffffffffffffffff821115613fe957613fe9613f51565b5060051b60200190565b73ffffffffffffffffffffffffffffffffffffffff8116811461165557600080fd5b6000806040838503121561402857600080fd5b8235915060208084013567ffffffffffffffff81111561404757600080fd5b8401601f8101861361405857600080fd5b803561406b61406682613fcf565b613f80565b81815260059190911b8201830190838101908883111561408a57600080fd5b928401925b828410156140b15783356140a281613ff3565b8252928401929084019061408f565b80955050505050509250929050565b600080602083850312156140d357600080fd5b823567ffffffffffffffff808211156140eb57600080fd5b818501915085601f8301126140ff57600080fd5b81358181111561410e57600080fd5b86602082850101111561412057600080fd5b60209290920196919550909350505050565b60006020828403121561414457600080fd5b5035919050565b6000602080835260e08301845182850152818501516040850152604085015160c06060860152818151808452610100870191508483019350600092505b808310156141be57835173ffffffffffffffffffffffffffffffffffffffff168252928401926001929092019190840190614188565b50606087015173ffffffffffffffffffffffffffffffffffffffff811660808801529350608087015161ffff811660a0880152935060a087015160c08701528094505050505092915050565b60005b8381101561422557818101518382015260200161420d565b50506000910152565b6000815180845261424681602086016020860161420a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8215158152604060208201526000613c76604083018461422e565b6000602082840312156142a557600080fd5b8135612d1a81613ff3565b803561ffff811681146142c257600080fd5b919050565b60008060008060008060a087890312156142e057600080fd5b8635955060208701359450604087013567ffffffffffffffff8082111561430657600080fd5b818901915089601f83011261431a57600080fd5b81358181111561432957600080fd5b8a60208260051b850101111561433e57600080fd5b602083019650809550505050614356606088016142b0565b9150608087013590509295509295509295565b801515811461165557600080fd5b60006020828403121561438957600080fd5b8135612d1a81614369565b600081518084526020808501945080840160005b838110156143da57815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016143a8565b509495945050505050565b828152604060208201526000613c766040830184614394565b6000602080838503121561441157600080fd5b825167ffffffffffffffff81111561442857600080fd5b8301601f8101851361443957600080fd5b805161444761406682613fcf565b81815260059190911b8201830190838101908783111561446657600080fd5b928401925b82841015613d8c5783518252928401929084019061446b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561116c5761116c614484565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600181815b8085111561454e57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561453457614534614484565b8085161561454157918102915b93841c93908002906144fa565b509250929050565b6000826145655750600161116c565b816145725750600061116c565b81600181146145885760028114614592576145ae565b600191505061116c565b60ff8411156145a3576145a3614484565b50506001821b61116c565b5060208310610133831016604e8410600b84101617156145d1575081810a61116c565b6145db83836144f5565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561460d5761460d614484565b029392505050565b6000612d1a8383614556565b60006020828403121561463357600080fd5b8151612d1a81613ff3565b60006020828403121561465057600080fd5b8151612d1a81614369565b61ffff828116828216039080821115613a7557613a75614484565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036146a7576146a7614484565b5060010190565b8082018082111561116c5761116c614484565b8481526080602082015260006146da6080830186614394565b73ffffffffffffffffffffffffffffffffffffffff949094166040830152506060015292915050565b60006020828403121561471557600080fd5b5051919050565b600082614752577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b808202811582820484141761116c5761116c614484565b85815284602082015260a06040820152600061478d60a0830186614394565b73ffffffffffffffffffffffffffffffffffffffff94909416606083015250608001529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082516147f881846020870161420a565b9190910192915050565b602081526000612d1a602083018461422e56fea26469706673582212207e01e35889c480700067dcd3f8f69b5da783793b636ff20ebdbe78b38389cc4b64736f6c63430008130033000000000000000000000000d2161e7ab1bbe96eedf0c015e29b6edee8663b2e000000000000000000000000c73896721b68ce58dde039ef79e37fff164fd355
Deployed ByteCode
0x6080604052600436106101c25760003560e01c80638da5cb5b116100f7578063c851cc3211610095578063ec57dd5911610064578063ec57dd591461053d578063f2fde38b1461055d578063fab6d6d01461057d578063fe5ff4681461059d57600080fd5b8063c851cc32146104cd578063ca6358cd146104ed578063cb59e5c014610503578063d7a9a3781461051d57600080fd5b8063aced1661116100d1578063aced166114610452578063ad17a0b314610484578063adfd4354146104a4578063ae182dcd146104ba57600080fd5b80638da5cb5b146103e257806395048d4614610412578063977902171461043257600080fd5b80635e6cd6fb1161016457806373a423d01161013e57806373a423d01461036d5780637489ec231461038d5780637ad3def2146103ad5780638456cb59146103cd57600080fd5b80635e6cd6fb146102d85780636e04ff0d1461032a578063715018a61461035857600080fd5b80633f4ba83a116101a05780633f4ba83a146102505780634585e33b146102675780635778472a146102875780635c975abb146102b457600080fd5b80630c0fa81a146101c75780631d834409146102035780633b1fee6c14610226575b600080fd5b3480156101d357600080fd5b506101e76101e2366004614015565b6105ca565b6040805192151583526020830191909152015b60405180910390f35b34801561020f57600080fd5b506102186106c8565b6040519081526020016101fa565b34801561023257600080fd5b5061023b6106d9565b604080519283526020830191909152016101fa565b34801561025c57600080fd5b506102656107df565b005b34801561027357600080fd5b506102656102823660046140c0565b6107f1565b34801561029357600080fd5b506102a76102a2366004614132565b610da1565b6040516101fa919061414b565b3480156102c057600080fd5b5060015460ff165b60405190151581526020016101fa565b3480156102e457600080fd5b506002546103059073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101fa565b34801561033657600080fd5b5061034a6103453660046140c0565b610f4a565b6040516101fa929190614278565b34801561036457600080fd5b5061026561114d565b34801561037957600080fd5b50610218610388366004614132565b61115f565b34801561039957600080fd5b506102656103a8366004614132565b611172565b3480156103b957600080fd5b506102656103c8366004614293565b611658565b3480156103d957600080fd5b506102656116a7565b3480156103ee57600080fd5b50600154610100900473ffffffffffffffffffffffffffffffffffffffff16610305565b34801561041e57600080fd5b5061026561042d366004614132565b6116b7565b34801561043e57600080fd5b5061026561044d366004614293565b611af0565b34801561045e57600080fd5b5060065461030590610100900473ffffffffffffffffffffffffffffffffffffffff1681565b34801561049057600080fd5b5061026561049f366004614132565b611b44565b3480156104b057600080fd5b5061021860055481565b6102656104c83660046142c7565b611bbb565b3480156104d957600080fd5b506102656104e8366004614293565b6129b3565b3480156104f957600080fd5b5061021860045481565b34801561050f57600080fd5b506006546102c89060ff1681565b34801561052957600080fd5b50610218610538366004614132565b612a02565b34801561054957600080fd5b50610265610558366004614377565b612b44565b34801561056957600080fd5b50610265610578366004614293565b612b7d565b34801561058957600080fd5b50610265610598366004614132565b612c31565b3480156105a957600080fd5b506102186105b8366004614293565b600a6020526000908152604090205481565b6002546040517fd06ca61f000000000000000000000000000000000000000000000000000000008152600091829173ffffffffffffffffffffffffffffffffffffffff9091169063d06ca61f9061062790879087906004016143e5565b600060405180830381865afa92505050801561068357506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261068091908101906143fe565b60015b610692575060009050806106c1565b600181600186516106a391906144b3565b815181106106b3576106b36144c6565b602002602001015192509250505b9250929050565b60006106d46008612ca8565b905090565b6000806106e66008612ca8565b156107d6576000806106f6612cb2565b9092509050600061070843600a612d0e565b9050600061072161071a84600a614615565b8390612d0e565b9050600061073a61073385600a614615565b8390612d21565b905060006107488483612d2d565b905080156107565780610759565b60015b90505b858111156107755761076e86826144b3565b905061075c565b600061078d6064610787846001612d2d565b90612d21565b9050600061079b6008612ca8565b6107a6846064612d21565b116107bb576107b6836064612d21565b6107c5565b6107c56008612ca8565b919a91995090975050505050505050565b50600091829150565b6107e7612d39565b6107ef612dc0565b565b6107f9612e3d565b600654610100900473ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161461089a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f4f6e6c79204e6f64652041646d696e000000000000000000000000000000000060448201526064015b60405180910390fd5b60006108a882840184614132565b90506108b5600882612eb0565b61091b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4f7264657220646f6573206e6f742065786973740000000000000000000000006044820152606401610891565b6000818152600760209081526040808320815160c081018352815481526001820154818501526002820180548451818702810187018652818152929593948601938301828280156109a257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610977575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff8116602083015274010000000000000000000000000000000000000000900461ffff1660408083019190915260049092015460609091015281015180519192506000918290610a1557610a156144c6565b60200260200101519050428260a0015111610ca757610a3383612ec8565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610aa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ac49190614621565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1603610bce576000826060015173ffffffffffffffffffffffffffffffffffffffff16836020015160405160006040518083038185875af1925050503d8060008114610b58576040519150601f19603f3d011682016040523d82523d6000602084013e610b5d565b606091505b5050905080610bc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610891565b50610c77565b606082015160208301516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810191909152829182169063a9059cbb906044016020604051808303816000875af1158015610c50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c74919061463e565b50505b60405183907f2e775cae5028266ebbe90e46ca5ce1b333eb3c28eef104c52203add626c1ada890600090a2610d90565b600080610cbc846020015185604001516105ca565b90925090506001821515148015610cd4575083518110155b610d3a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601260248201527f546172676574206e6f74207265616368656400000000000000000000000000006044820152606401610891565b6000610d68612710610d628760800151612710610d57919061465b565b859061ffff16612d21565b90612d0e565b9050610d7386612ec8565b610d8c8686602001518760400151886060015185612f30565b5050505b505050610d9d6001600055565b5050565b610df46040518060c00160405280600081526020016000815260200160608152602001600073ffffffffffffffffffffffffffffffffffffffff168152602001600061ffff168152602001600081525090565b610dff600883612eb0565b610e65576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601b60248201527f517565727920666f72206e6f6e6578697374656e74206f7264657200000000006044820152606401610891565b600082815260076020908152604091829020825160c0810184528154815260018201548184015260028201805485518186028101860187528181529295939493860193830182828015610eee57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610ec3575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff8116602083015274010000000000000000000000000000000000000000900461ffff16604082015260049091015460609091015292915050565b60006060600080610f596106d9565b9092509050815b81811015611102576000610f75600883613396565b90506000600760008381526020019081526020016000206040518060c001604052908160008201548152602001600182015481526020016002820180548060200260200160405190810160405280929190818152602001828054801561101157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610fe6575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff81166020808401919091527401000000000000000000000000000000000000000090910461ffff1660408084019190915260049093015460609092019190915282015190820151919250600091829161108b916105ca565b909250905060018215151480156110a3575082518110155b806110b25750428360a0015111155b156110eb576001846040516020016110cc91815260200190565b60405160208183030381529060405298509850505050505050506106c1565b5050505080806110fa90614676565b915050610f60565b506000868681818080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250959c929b50919950505050505050505050565b611155612d39565b6107ef60006133a2565b600061116c600883613396565b92915050565b61117a612e3d565b611185600882612eb0565b6111eb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4f7264657220646f6573206e6f742065786973740000000000000000000000006044820152606401610891565b6000818152600760209081526040808320815160c0810183528154815260018201548185015260028201805484518187028101870186528181529295939486019383018282801561127257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311611247575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff8116602083015274010000000000000000000000000000000000000000900461ffff16604082015260049091015460609091015290503373ffffffffffffffffffffffffffffffffffffffff16816060015173ffffffffffffffffffffffffffffffffffffffff1614611363576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c6964206163636573730000000000000000000000000000000000006044820152606401610891565b6000816040015160008151811061137c5761137c6144c6565b6020026020010151905061138f83612ec8565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113fc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906114209190614621565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361152a576000826060015173ffffffffffffffffffffffffffffffffffffffff16836020015160405160006040518083038185875af1925050503d80600081146114b4576040519150601f19603f3d011682016040523d82523d6000602084013e6114b9565b606091505b5050905080611524576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610891565b506115d3565b606082015160208301516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810191909152829182169063a9059cbb906044016020604051808303816000875af11580156115ac573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906115d0919061463e565b50505b60065460ff161561161e57606082015173ffffffffffffffffffffffffffffffffffffffff166000908152600a602052604081208054600192906116189084906146ae565b90915550505b60405183907f5152abf959f6564662358c2e52b702259b78bac5ee7842a0f01937e670efcc7d90600090a250506116556001600055565b50565b611660612d39565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6116af612d39565b6107ef613420565b6116bf612d39565b6116ca600882612eb0565b611730576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f4f7264657220646f6573206e6f742065786973740000000000000000000000006044820152606401610891565b6000818152600760209081526040808320815160c081018352815481526001820154818501526002820180548451818702810187018652818152929593948601938301828280156117b757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff16815260019091019060200180831161178c575b5050509183525050600382015473ffffffffffffffffffffffffffffffffffffffff8116602083015274010000000000000000000000000000000000000000900461ffff166040808301919091526004909201546060909101528101518051919250600091829061182a5761182a6144c6565b6020026020010151905061183d83612ec8565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156118aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118ce9190614621565b73ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16036119d8576000826060015173ffffffffffffffffffffffffffffffffffffffff16836020015160405160006040518083038185875af1925050503d8060008114611962576040519150601f19603f3d011682016040523d82523d6000602084013e611967565b606091505b50509050806119d2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610891565b50611a81565b606082015160208301516040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201526024810191909152829182169063a9059cbb906044016020604051808303816000875af1158015611a5a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a7e919061463e565b50505b606082015173ffffffffffffffffffffffffffffffffffffffff166000908152600a60205260408120805460019290611abb9084906146ae565b909155505060405183907f5152abf959f6564662358c2e52b702259b78bac5ee7842a0f01937e670efcc7d90600090a2505050565b611af8612d39565b6006805473ffffffffffffffffffffffffffffffffffffffff909216610100027fffffffffffffffffffffff0000000000000000000000000000000000000000ff909216919091179055565b611b4c612d39565b80600003611bb6576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600860248201527f5a65726f206665650000000000000000000000000000000000000000000000006044820152606401610891565b600455565b611bc3613479565b611bcb612e3d565b6127108261ffff161115611c3b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601560248201527f536c697070616765206f7574206f6620626f756e6400000000000000000000006044820152606401610891565b84600003611ca5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f5a65726f20616d6f756e7420696e0000000000000000000000000000000000006044820152606401610891565b600086118015611cb55750600081115b611d1b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600a60248201527f5a65726f207072696365000000000000000000000000000000000000000000006044820152606401610891565b6002831015611d86576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f496e76616c6964207061746800000000000000000000000000000000000000006044820152606401610891565b8585828686600082828281611d9d57611d9d6144c6565b9050602002016020810190611db29190614293565b905060008383611dc360018d6144b3565b818110611dd257611dd26144c6565b9050602002016020810190611de79190614293565b9050883373ffffffffffffffffffffffffffffffffffffffff841615801590611e25575073ffffffffffffffffffffffffffffffffffffffff831615155b8015611e5d57508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff1614155b611ec3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f496e76616c696420746f6b656e730000000000000000000000000000000000006044820152606401610891565b336000908152600a60205260409020548711156122c057336000908152600a6020526040812054611ef5908990612d2d565b90506000611f0282612a02565b9050600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611f71573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f959190614621565b73ffffffffffffffffffffffffffffffffffffffff168673ffffffffffffffffffffffffffffffffffffffff160361206057611fd1818b6146ae565b341015612060576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602f60248201527f496e73756666696369656e74206574682076616c756520666f7220737761702060448201527f616e6420627579206372656469747300000000000000000000000000000000006064820152608401610891565b60025460045473ffffffffffffffffffffffffffffffffffffffff90911690637ff36ab59083906120919086612d21565b600254604080517fad5c464800000000000000000000000000000000000000000000000000000000815290516121449273ffffffffffffffffffffffffffffffffffffffff169163ad5c46489160048083019260209291908290030181865afa158015612102573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121269190614621565b60035473ffffffffffffffffffffffffffffffffffffffff166134e6565b306121514261012c61359a565b6040518663ffffffff1660e01b815260040161217094939291906146c1565b60006040518083038185885af115801561218e573d6000803e3d6000fd5b50505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526121d591908101906143fe565b5060035460065460045473ffffffffffffffffffffffffffffffffffffffff9283169263a9059cbb926101009004169061220f9086612d21565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b16815273ffffffffffffffffffffffffffffffffffffffff909216600483015260248201526044016020604051808303816000875af115801561227f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906122a3919061463e565b5050336000908152600a60205260409020805490910190556123ec565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561232d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123519190614621565b73ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff16036123ec578734146123ec576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f496e73756666696369656e74206574682076616c756520666f722073776170006044820152606401610891565b60008061242c8a8989808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152506105ca92505050565b9150915081801561243c57508a81105b6124a2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f496e76616c6964207461726765742070726963650000000000000000000000006044820152606401610891565b6124aa613e76565b81815260208082018d905260408083018d9052805191820184905281018d905260608082018d905288811b7fffffffffffffffffffffffffffffffffffffffff000000000000000000000000908116608084015288821b811660948401529086901b1660a882015260f086901b7fffff0000000000000000000000000000000000000000000000000000000000001660bc8201524360be82015260009060de01604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190528051602090910120905061258d600882612eb0565b156125f4576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f4f72646572206964206d697374616b65000000000000000000000000000000006044820152606401610891565b336000908152600a6020526040812080548d900390556005546126229061261b908e612d21565b429061359a565b905061264282846001602002015185600260200201518e8e8b8d886135a6565b6002546040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91821660248201528a9182169063dd62ed3e90604401602060405180830381865afa1580156126b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126dd9190614703565b6000036127a2576002546040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff91821660048201527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60248201529082169063095ea7b3906044016020604051808303816000875af115801561277c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127a0919061463e565b505b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561280f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128339190614621565b73ffffffffffffffffffffffffffffffffffffffff168a73ffffffffffffffffffffffffffffffffffffffff161461290d5760408085015190517f23b872dd00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff89811660048301523060248301526044820192909252908216906323b872dd906064016020604051808303816000875af11580156128e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061290b919061463e565b505b835160208086015160408088015181519485529284019190915282015273ffffffffffffffffffffffffffffffffffffffff8b811660608301528a8116608083015261ffff8a1660a083015260c0820184905288169084907f99657a932d9c70d2828b20283c6695ec3f56fab0cba81f52b3e59c7cb67b49ac9060e00160405180910390a35050505050505050505050505050506129ab6001600055565b505050505050565b6129bb612d39565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b600080612a1a83600454612d2190919063ffffffff16565b600254604080517fad5c4648000000000000000000000000000000000000000000000000000000008152905192935060009273ffffffffffffffffffffffffffffffffffffffff90921691631f00ca74918591612a9e91859163ad5c4648916004808201926020929091908290030181865afa158015612102573d6000803e3d6000fd5b6040518363ffffffff1660e01b8152600401612abb9291906143e5565b600060405180830381865afa158015612ad8573d6000803e3d6000fd5b505050506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0168201604052612b1e91908101906143fe565b600081518110612b3057612b306144c6565b602002602001015190508092505050919050565b612b4c612d39565b600680547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b612b85612d39565b73ffffffffffffffffffffffffffffffffffffffff8116612c28576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610891565b611655816133a2565b612c39612d39565b60008111612ca3576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600c60248201527f496e76616c69642074696d6500000000000000000000000000000000000000006044820152606401610891565b600555565b600061116c825490565b6000806000612cc66064610d626008612ca8565b90506000612cd5826064612d21565b9050612ce16008612ca8565b8110612ced5781612cf8565b612cf882600161359a565b915081612d04836136f1565b9350935050509091565b6000612d1a828461471c565b9392505050565b6000612d1a8284614757565b6000612d1a82846144b3565b60015473ffffffffffffffffffffffffffffffffffffffff6101009091041633146107ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610891565b612dc861371a565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390a1565b600260005403612ea9576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610891565b6002600055565b60008181526001830160205260408120541515612d1a565b612ed3600882613786565b5060008181526007602052604081208181556001810182905590612efa6002830182613e94565b506003810180547fffffffffffffffffffff00000000000000000000000000000000000000000000169055600060049091015550565b600254604080517fad5c4648000000000000000000000000000000000000000000000000000000008152905160009273ffffffffffffffffffffffffffffffffffffffff169163ad5c46489160048083019260209291908290030181865afa158015612fa0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612fc49190614621565b9050600084600081518110612fdb57612fdb6144c6565b6020026020010151905060008560018751612ff691906144b3565b81518110613006576130066144c6565b602002602001015190508273ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036131935760025473ffffffffffffffffffffffffffffffffffffffff16637ff36ab5888689896130714261012c61359a565b6040518663ffffffff1660e01b815260040161309094939291906146c1565b60006040518083038185885af1935050505080156130ee57506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526130eb91908101906143fe565b60015b61312d576130fd878387613792565b60405188907fe1bf2a28c083b93b502e4140fe14e357c3d973a7ec3d8517b6022a70bfd3562690600090a261338c565b887ffec331350fce78ba658e082a71da20ac9f8d798a99b3c79681c8440cbfe77e078260018a5161315e91906144b3565b8151811061316e5761316e6144c6565b602002602001015160405161318591815260200190565b60405180910390a25061338c565b8273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff160361326f5760025473ffffffffffffffffffffffffffffffffffffffff166318cbafe5888689896131f44261012c61359a565b6040518663ffffffff1660e01b815260040161321495949392919061476e565b6000604051808303816000875af19250505080156130ee57506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe01682016040526130eb91908101906143fe565b60025473ffffffffffffffffffffffffffffffffffffffff166338ed17398886898961329d4261012c61359a565b6040518663ffffffff1660e01b81526004016132bd95949392919061476e565b6000604051808303816000875af192505050801561331b57506040513d6000823e601f3d9081017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016820160405261331891908101906143fe565b60015b61332a576130fd878387613792565b887ffec331350fce78ba658e082a71da20ac9f8d798a99b3c79681c8440cbfe77e078260018a5161335b91906144b3565b8151811061336b5761336b6144c6565b602002602001015160405161338291815260200190565b60405180910390a2505b5050505050505050565b6000612d1a838361394c565b6001805473ffffffffffffffffffffffffffffffffffffffff8381166101008181027fffffffffffffffffffffff0000000000000000000000000000000000000000ff85161790945560405193909204169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b613428613479565b600180547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016811790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25833612e13565b60015460ff16156107ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601060248201527f5061757361626c653a20706175736564000000000000000000000000000000006044820152606401610891565b60408051600280825260608083018452926000929190602083019080368337019050509050838160008151811061351f5761351f6144c6565b602002602001019073ffffffffffffffffffffffffffffffffffffffff16908173ffffffffffffffffffffffffffffffffffffffff1681525050828160018151811061356d5761356d6144c6565b73ffffffffffffffffffffffffffffffffffffffff90921660209283029190910190910152905092915050565b6000612d1a82846146ae565b60006040518060c0016040528089815260200188815260200187878080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525050509082525073ffffffffffffffffffffffffffffffffffffffff8616602082015261ffff85166040820152606001839052905061362e60088a613976565b5060008981526007602090815260409182902083518155818401516001820155918301518051849392613668926002850192910190613eb2565b506060820151600382018054608085015161ffff1674010000000000000000000000000000000000000000027fffffffffffffffffffff0000000000000000000000000000000000000000000090911673ffffffffffffffffffffffffffffffffffffffff9093169290921791909117905560a090910151600490910155505050505050505050565b6000805b821561116c57613706600a8461471c565b92508061371281614676565b9150506136f5565b60015460ff166107ef576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f5061757361626c653a206e6f74207061757365640000000000000000000000006044820152606401610891565b6000612d1a8383613982565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156137ff573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906138239190614621565b73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16036139255760008173ffffffffffffffffffffffffffffffffffffffff168460405160006040518083038185875af1925050503d80600081146138af576040519150601f19603f3d011682016040523d82523d6000602084013e6138b4565b606091505b505090508061391f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600f60248201527f5472616e73666572206661696c656400000000000000000000000000000000006044820152606401610891565b50505050565b8161391f73ffffffffffffffffffffffffffffffffffffffff82168386613a7c565b505050565b6000826000018281548110613963576139636144c6565b9060005260206000200154905092915050565b6000612d1a8383613b09565b60008181526001830160205260408120548015613a6b5760006139a66001836144b3565b85549091506000906139ba906001906144b3565b9050818114613a1f5760008660000182815481106139da576139da6144c6565b90600052602060002001549050808760000184815481106139fd576139fd6144c6565b6000918252602080832090910192909255918252600188019052604090208390555b8554869080613a3057613a306147b7565b60019003818190600052602060002001600090559055856001016000868152602001908152602001600020600090556001935050505061116c565b600091505061116c565b5092915050565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052613947908490613b58565b6000818152600183016020526040812054613b505750815460018181018455600084815260208082209093018490558454848252828601909352604090209190915561116c565b50600061116c565b6000613bba826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16613c679092919063ffffffff16565b9050805160001480613bdb575080806020019051810190613bdb919061463e565b613947576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610891565b6060613c768484600085613c7e565b949350505050565b606082471015613d10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610891565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051613d3991906147e6565b60006040518083038185875af1925050503d8060008114613d76576040519150601f19603f3d011682016040523d82523d6000602084013e613d7b565b606091505b5091509150613d8c87838387613d97565b979650505050505050565b60608315613e2d578251600003613e265773ffffffffffffffffffffffffffffffffffffffff85163b613e26576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610891565b5081613c76565b613c768383815115613e425781518083602001fd5b806040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016108919190614802565b60405180606001604052806003906020820280368337509192915050565b50805460008255906000526020600020908101906116559190613f3c565b828054828255906000526020600020908101928215613f2c579160200282015b82811115613f2c57825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff909116178255602090920191600190910190613ed2565b50613f38929150613f3c565b5090565b5b80821115613f385760008155600101613f3d565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff81118282101715613fc757613fc7613f51565b604052919050565b600067ffffffffffffffff821115613fe957613fe9613f51565b5060051b60200190565b73ffffffffffffffffffffffffffffffffffffffff8116811461165557600080fd5b6000806040838503121561402857600080fd5b8235915060208084013567ffffffffffffffff81111561404757600080fd5b8401601f8101861361405857600080fd5b803561406b61406682613fcf565b613f80565b81815260059190911b8201830190838101908883111561408a57600080fd5b928401925b828410156140b15783356140a281613ff3565b8252928401929084019061408f565b80955050505050509250929050565b600080602083850312156140d357600080fd5b823567ffffffffffffffff808211156140eb57600080fd5b818501915085601f8301126140ff57600080fd5b81358181111561410e57600080fd5b86602082850101111561412057600080fd5b60209290920196919550909350505050565b60006020828403121561414457600080fd5b5035919050565b6000602080835260e08301845182850152818501516040850152604085015160c06060860152818151808452610100870191508483019350600092505b808310156141be57835173ffffffffffffffffffffffffffffffffffffffff168252928401926001929092019190840190614188565b50606087015173ffffffffffffffffffffffffffffffffffffffff811660808801529350608087015161ffff811660a0880152935060a087015160c08701528094505050505092915050565b60005b8381101561422557818101518382015260200161420d565b50506000910152565b6000815180845261424681602086016020860161420a565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b8215158152604060208201526000613c76604083018461422e565b6000602082840312156142a557600080fd5b8135612d1a81613ff3565b803561ffff811681146142c257600080fd5b919050565b60008060008060008060a087890312156142e057600080fd5b8635955060208701359450604087013567ffffffffffffffff8082111561430657600080fd5b818901915089601f83011261431a57600080fd5b81358181111561432957600080fd5b8a60208260051b850101111561433e57600080fd5b602083019650809550505050614356606088016142b0565b9150608087013590509295509295509295565b801515811461165557600080fd5b60006020828403121561438957600080fd5b8135612d1a81614369565b600081518084526020808501945080840160005b838110156143da57815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016143a8565b509495945050505050565b828152604060208201526000613c766040830184614394565b6000602080838503121561441157600080fd5b825167ffffffffffffffff81111561442857600080fd5b8301601f8101851361443957600080fd5b805161444761406682613fcf565b81815260059190911b8201830190838101908783111561446657600080fd5b928401925b82841015613d8c5783518252928401929084019061446b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b8181038181111561116c5761116c614484565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600181815b8085111561454e57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561453457614534614484565b8085161561454157918102915b93841c93908002906144fa565b509250929050565b6000826145655750600161116c565b816145725750600061116c565b81600181146145885760028114614592576145ae565b600191505061116c565b60ff8411156145a3576145a3614484565b50506001821b61116c565b5060208310610133831016604e8410600b84101617156145d1575081810a61116c565b6145db83836144f5565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0482111561460d5761460d614484565b029392505050565b6000612d1a8383614556565b60006020828403121561463357600080fd5b8151612d1a81613ff3565b60006020828403121561465057600080fd5b8151612d1a81614369565b61ffff828116828216039080821115613a7557613a75614484565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036146a7576146a7614484565b5060010190565b8082018082111561116c5761116c614484565b8481526080602082015260006146da6080830186614394565b73ffffffffffffffffffffffffffffffffffffffff949094166040830152506060015292915050565b60006020828403121561471557600080fd5b5051919050565b600082614752577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b808202811582820484141761116c5761116c614484565b85815284602082015260a06040820152600061478d60a0830186614394565b73ffffffffffffffffffffffffffffffffffffffff94909416606083015250608001529392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603160045260246000fd5b600082516147f881846020870161420a565b9190910192915050565b602081526000612d1a602083018461422e56fea26469706673582212207e01e35889c480700067dcd3f8f69b5da783793b636ff20ebdbe78b38389cc4b64736f6c63430008130033