More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 12 from a total of 12 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw Fees By... | 61065581 | 239 days ago | IN | 0 POL | 0.00184843 | ||||
Withdraw All To ... | 61065522 | 239 days ago | IN | 0 POL | 0.07035884 | ||||
Withdraw To ETH | 61065108 | 239 days ago | IN | 0 POL | 0.08680344 | ||||
Deposit | 61065057 | 239 days ago | IN | 2 POL | 0.09989762 | ||||
Withdraw All To ... | 61065007 | 239 days ago | IN | 0 POL | 0.07906857 | ||||
Withdraw | 61064945 | 239 days ago | IN | 0 POL | 0.00090377 | ||||
Withdraw To ETH | 61064926 | 239 days ago | IN | 0 POL | 0.00089422 | ||||
Deposit | 61064868 | 239 days ago | IN | 1 POL | 0.09829229 | ||||
Set Whitelist | 61064833 | 239 days ago | IN | 0 POL | 0.00276555 | ||||
Set Whitelist | 61061602 | 239 days ago | IN | 0 POL | 0.00207149 | ||||
Bulk Add Tokens | 61059890 | 239 days ago | IN | 0 POL | 0.03628851 | ||||
Bulk Add Tokens | 61059810 | 239 days ago | IN | 0 POL | 0.00148141 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
61065581 | 239 days ago | 0.03 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.164934 POL | ||||
61065057 | 239 days ago | 0.165132 POL | ||||
61065057 | 239 days ago | 0.165132 POL | ||||
61065057 | 239 days ago | 0.165132 POL | ||||
61065057 | 239 days ago | 0.165132 POL | ||||
61065057 | 239 days ago | 0.165132 POL | ||||
61065057 | 239 days ago | 0.165132 POL | ||||
61065057 | 239 days ago | 0.165132 POL | ||||
61065057 | 239 days ago | 0.165132 POL |
Loading...
Loading
Contract Name:
PYGGportfolioRebalancer
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; import "@openzeppelin/contracts/utils/Pausable.sol"; import "./interface/IUniswapV2Router02.sol"; import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; import "./interface/IUniswapV3Quoter.sol"; import "./interface/IWETH.sol"; import { TokenInfo } from "./Structs.sol"; import "./SwapOperationManager.sol"; import "./WhiteListManager.sol"; contract PYGGportfolioRebalancer is Ownable, Pausable, ERC20, SwapOperationManager, WhiteListManager { TokenInfo[] private portfolio; mapping(address => uint256) public ethDepositedFailed; uint256 private depositFee; // Fee in basis points (e.g., 100 = 1%) uint256 private withdrawalFee; // Fee in basis points (e.g., 100 = 1%) uint256 private totalFeesToETH; uint256 private totalFeesToWETH; bool public initialedTokens = false; bytes32 private constant VERSION_V2 = keccak256(abi.encodePacked("v2")); bytes32 private constant VERSION_V3 = keccak256(abi.encodePacked("v3")); // event Deposited(address indexed user, uint256 amount, uint256 shares, string version); // event Withdrawn(address indexed user, uint256 amount, uint256 shares); // event Rebalanced(uint256 timestamp); // event Whitelisted(address indexed user, bool isWhitelisted); // event SwapFailed(address indexed user, IERC20 token, uint256 amount, string version); // event SlippageToleranceChanged(uint256 newSlippageTolerance); event AddToken(address _tokens, uint256 targetPercentage, string verision, uint24 feeTier); constructor(address _uniswapV2Router, address _uniswapV3Router, address _uniswapV3Quoter) Ownable(msg.sender) ERC20("PYGGETH", "PETH") SwapOperationManager(_uniswapV2Router, _uniswapV3Router, _uniswapV3Quoter) WhiteListManager() { withdrawalFee = 100; depositFee = 100; } function pause() external onlyOwner { _pause(); emit Paused(msg.sender); } function unpause() external onlyOwner() { _unpause(); emit Unpaused(msg.sender); } function withdrawAllToETH() external onlyOwner { uint256 totalETH = 0; uint256 totalWETH = 0; for (uint256 i = 0; i < portfolio.length; i++) { TokenInfo storage tokenInfo = portfolio[i]; uint256 tokenBalance = tokenInfo.token.balanceOf(address(this)); try this.swapTokenForETH(tokenInfo.token, tokenBalance, tokenInfo.version, tokenInfo.feeTier) returns (uint256 ethReceived) { if (keccak256(abi.encodePacked(tokenInfo.version)) == VERSION_V2) { totalETH += ethReceived; } else if(keccak256(abi.encodePacked(tokenInfo.version)) == VERSION_V3){ totalWETH += ethReceived; } } catch {} } } function withdrawWholeAllInKind() external onlyOwner { for (uint256 i = 0; i < portfolio.length; i++) { TokenInfo storage tokenInfo = portfolio[i]; uint256 tokenBalance = tokenInfo.token.balanceOf(address(this)); tokenInfo.token.transfer(msg.sender, tokenBalance); } } function setFees(uint256 _depositFee, uint256 _withdrawalFee) external onlyOwner { require(_depositFee <= 10000, "!dfee"); require(_withdrawalFee <= 10000, "!wfee"); depositFee = _depositFee; withdrawalFee = _withdrawalFee; } function withdrawFeesByOwner(address _receiverFeeAddress) external onlyOwner { if(totalFeesToETH > 0){ (bool success, ) = _receiverFeeAddress.call{value: totalFeesToETH}(""); require(success, "FAILEDETH"); totalFeesToETH = 0; } if(totalFeesToWETH > 0){ address WETH9 = getWETHaddress(); IWETH(WETH9).transfer(_receiverFeeAddress, totalFeesToWETH); totalFeesToWETH = 0; } } function bulkAddTokens( address[] calldata _tokens, uint256[] calldata _targetPercentages, string[] calldata _versions, uint24[] calldata _feeTiers ) external onlyOwner { require(!initialedTokens, "the contract has initialized"); require( _tokens.length == _targetPercentages.length && _tokens.length == _versions.length && _tokens.length == _feeTiers.length, "!Misslengths" ); uint256 totalPercentage = 0; for (uint256 i = 0; i < _tokens.length; i++) { require(_targetPercentages[i] <= 10000, "!percentage"); totalPercentage += _targetPercentages[i]; portfolio.push(TokenInfo({ token: IERC20(_tokens[i]), targetPercentage: _targetPercentages[i], version: _versions[i], feeTier: _feeTiers[i] })); emit AddToken(_tokens[i], _targetPercentages[i], _versions[i], _feeTiers[i]); } require(totalPercentage == 10000, "total percentage should be 10000"); initialedTokens = true; } function updateToken( address _token, uint256 _targetPercentage, string memory _version, uint24 _feeTier ) external onlyOwner { require(_targetPercentage <= 10000, "!P>10000"); bool tokenFound = false; for (uint256 i = 0; i < portfolio.length; i++) { if (address(portfolio[i].token) == _token) { portfolio[i].targetPercentage = _targetPercentage; portfolio[i].version = _version; portfolio[i].feeTier = _feeTier; tokenFound = true; break; } } require(tokenFound, "!token"); } function deposit() external payable onlyWhitelisted whenNotPaused { require(msg.value > 0, "AMG"); uint256 fee = (msg.value * depositFee) / 10000; uint256 amountAfterFee = msg.value - fee; totalFeesToETH += fee; require(amountAfterFee > 0, "Amount after fee must be greater than zero"); _mint(msg.sender, amountAfterFee); // emit Deposited(msg.sender, amountAfterFee, amountAfterFee, "N/A"); // Swap ETH to portfolio tokens for (uint256 i = 0; i < portfolio.length; i++) { TokenInfo storage tokenInfo = portfolio[i]; uint256 calEthAmount = (amountAfterFee * tokenInfo.targetPercentage) / 10000; require(calEthAmount <= amountAfterFee, "calETH<=amountfee"); // this.swapETHForToken{value: calEthAmount}(tokenInfo.token, calEthAmount, tokenInfo.version, tokenInfo.feeTier); try this.swapETHForToken{value: calEthAmount}(tokenInfo.token, calEthAmount, tokenInfo.version, tokenInfo.feeTier) {} catch { ethDepositedFailed[msg.sender] += calEthAmount; failedSwaps.push(FailedSwap(msg.sender, tokenInfo.token, calEthAmount, tokenInfo.version, tokenInfo.feeTier)); userFailedSwaps[msg.sender]++; // emit SwapFailed(msg.sender, tokenInfo.token, calEthAmount, tokenInfo.version); } // Adjust amountAfterFee to reflect the used ETH } } function withdrawToETH(uint256 tokenAmount) external whenNotPaused { require(tokenAmount > 0, ">0"); require(this.balanceOf(msg.sender) >= tokenAmount, "!Insufficient"); uint256 percentage = (tokenAmount * 10000) / totalSupply(); address WETH9 = uniswapV2Router.WETH(); uint256 totalETH = 0; uint256 totalWETH = 0; for (uint256 i = 0; i < portfolio.length; i++) { TokenInfo storage tokenInfo = portfolio[i]; uint256 tokenAmountToWithdraw = (tokenInfo.token.balanceOf(address(this)) * percentage) / 10000; // if(tokenAmountToWithdraw > 0){ try this.swapTokenForETH(tokenInfo.token, tokenAmountToWithdraw, tokenInfo.version, tokenInfo.feeTier) returns (uint256 ethReceived ) { if(keccak256(abi.encodePacked(tokenInfo.version)) == keccak256(abi.encodePacked("v3"))){ totalWETH+= ethReceived; } else { totalETH += ethReceived; } } catch {} // } else { // continue; // } } _burn(msg.sender, tokenAmount); if(totalWETH > 0){ uint256 feeWETH = (totalWETH * withdrawalFee) / 10000; uint256 amountAfterFeeWETH = totalWETH - feeWETH; totalFeesToWETH += feeWETH; IWETH(WETH9).transfer(msg.sender, amountAfterFeeWETH); } if(totalETH > 0){ uint256 feeETH = (totalETH * withdrawalFee) / 10000; uint256 amountAfterFee = totalETH - feeETH; totalFeesToETH += feeETH; uint256 failedETHsUser = ethDepositedFailed[msg.sender]; uint256 totalTransferAmount = failedETHsUser + amountAfterFee; (bool success, ) = msg.sender.call{value: totalTransferAmount}(""); require(success, "ETH transfer failed"); } // emit Withdrawn(msg.sender, totalETH, percentage); } function withdraw(uint256 tokenAmount) external whenNotPaused { require(tokenAmount > 0, ">0"); require(this.balanceOf(msg.sender) >= tokenAmount, "Insufficient"); uint256 userShare = (tokenAmount * 10000) / totalSupply(); for (uint256 i = 0; i < portfolio.length; i++) { TokenInfo storage tokenInfo = portfolio[i]; uint256 tokenAmountToWithdraw = (tokenInfo.token.balanceOf(address(this)) * userShare) / 10000; // if(tokenAmountToWithdraw > 0){ uint256 fee = (tokenAmountToWithdraw * withdrawalFee) / 10000; uint256 amountAfterFee = tokenAmountToWithdraw - fee; tokenInfo.token.transfer(msg.sender, amountAfterFee); try this.swapTokenForETH(tokenInfo.token, fee, tokenInfo.version, tokenInfo.feeTier) returns (uint256 ethReceived) { if(keccak256(abi.encodePacked(tokenInfo.version)) == VERSION_V3){ totalFeesToWETH += ethReceived; } else { totalFeesToETH += ethReceived; } } catch {} // } else { // continue; // } } _burn(msg.sender, tokenAmount); uint256 failedETHsUser = (ethDepositedFailed[msg.sender] * userShare) / 10000; uint256 totalTransferAmount = failedETHsUser; if(totalTransferAmount > 0){ (bool success, ) = msg.sender.call{value: totalTransferAmount}(""); require(success, "TR"); } // emit Withdrawn(msg.sender, userShare, userShare); } function getPortfolioValue(uint256[] memory _tokenPrices) public view returns (uint256) { require(_tokenPrices.length == portfolio.length, "!priceslength"); uint256 totalValue = 0; for (uint256 i = 0; i < portfolio.length; i++) { TokenInfo storage tokenInfo = portfolio[i]; uint256 tokenBalance = tokenInfo.token.balanceOf(address(this)); uint256 tokenPrice = _tokenPrices[i]; totalValue += tokenBalance * tokenPrice; } return totalValue; } function getAllTokens() external view returns (TokenInfo[] memory) { return portfolio; } // function needsRebalance(uint256[] memory _tokenPrices) external view returns (bool) { // require(_tokenPrices.length == portfolio.length, "!PL"); // uint256 totalValue = getPortfolioValue(_tokenPrices); // require(totalValue > 0, "TV>0"); // for (uint256 i = 0; i < portfolio.length; i++) { // TokenInfo storage tokenInfo = portfolio[i]; // uint256 currentPrice = _tokenPrices[i] * tokenInfo.token.balanceOf(address(this)); // require(currentPrice > 0, "CP>0"); // uint256 shareTokenOfPortfolio = (currentPrice * 10000) / totalValue; // if (shareTokenOfPortfolio > tokenInfo.targetPercentage) { // return true; // } else if (shareTokenOfPortfolio < tokenInfo.targetPercentage) { // return true; // } // } // function rebalance(uint256[] memory _tokenPrices) // external // onlyOwner whenNotPaused // { // uint256 totalValue = getPortfolioValue(_tokenPrices); // require(totalValue > 0, "Total value must be greater than zero"); // for (uint256 i = 0; i < portfolio.length; i++) { // TokenInfo storage tokenInfo = portfolio[i]; // uint256 currentValue = _tokenPrices[i] * tokenInfo.token.balanceOf(address(this)); // uint256 targetValue = (totalValue * tokenInfo.targetPercentage) / 10000; // if (currentValue > targetValue) { // uint256 amountToSell = (currentValue - targetValue) / _tokenPrices[i]; // sellTokens(tokenInfo.token, amountToSell, tokenInfo.version, tokenInfo.feeTier); // } else if (currentValue < targetValue) { // uint256 amountTobuy = (targetValue - currentValue) / _tokenPrices[i]; // buyTokens(tokenInfo.token, amountTobuy, tokenInfo.version, tokenInfo.feeTier); // } // } // } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../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. * * The initial owner is set to the address provided by the deployer. 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; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @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 { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _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); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ 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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Pausable.sol) pragma solidity ^0.8.20; import {Context} from "../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 { bool private _paused; /** * @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); /** * @dev The operation failed because the contract is paused. */ error EnforcedPause(); /** * @dev The operation failed because the contract is not paused. */ error ExpectedPause(); /** * @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 { if (paused()) { revert EnforcedPause(); } } /** * @dev Throws if the contract is not paused. */ function _requirePaused() internal view virtual { if (!paused()) { revert ExpectedPause(); } } /** * @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()); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Callback for IUniswapV3PoolActions#swap /// @notice Any contract that calls IUniswapV3PoolActions#swap must implement this interface interface IUniswapV3SwapCallback { /// @notice Called to `msg.sender` after executing a swap via IUniswapV3Pool#swap. /// @dev In the implementation you must pay the pool tokens owed for the swap. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// amount0Delta and amount1Delta can both be 0 if no tokens were swapped. /// @param amount0Delta The amount of token0 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token0 to the pool. /// @param amount1Delta The amount of token1 that was sent (negative) or must be received (positive) by the pool by /// the end of the swap. If positive, the callback must send that amount of token1 to the pool. /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#swap call function uniswapV3SwapCallback( int256 amount0Delta, int256 amount1Delta, bytes calldata data ) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import '@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3SwapCallback.sol'; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface ISwapRouter is IUniswapV3SwapCallback { struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @param params The parameters necessary for the swap, encoded as `ExactInputSingleParams` in calldata /// @return amountOut The amount of the received token function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); struct ExactInputParams { bytes path; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; } /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata /// @return amountOut The amount of the received token function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut); struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @param params The parameters necessary for the swap, encoded as `ExactOutputSingleParams` in calldata /// @return amountIn The amount of the input token function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountIn); struct ExactOutputParams { bytes path; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; } /// @notice Swaps as little as possible of one token for `amountOut` of another along the specified path (reversed) /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactOutputParams` in calldata /// @return amountIn The amount of the input token function exactOutput(ExactOutputParams calldata params) external payable returns (uint256 amountIn); }
pragma solidity >=0.6.2; interface IUniswapV2Router01 { function factory() external pure returns (address); function WETH() external pure 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); }
pragma solidity >=0.6.2; import './IUniswapV2Router01.sol'; interface IUniswapV2Router02 is IUniswapV2Router01 { 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; }
pragma solidity ^0.8.0; interface IUniswapV3Quoter { function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut); function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.0; import '@openzeppelin/contracts/token/ERC20/IERC20.sol'; /// @title Interface for WETH9 interface IWETH is IERC20 { /// @notice Deposit ether to get wrapped ether function deposit() external payable; /// @notice Withdraw wrapped ether to get ether function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; struct TokenInfo { IERC20 token; uint256 targetPercentage; string version; uint24 feeTier; } struct FailedSwap { address user; IERC20 token; uint256 amount; string version; uint24 feeTier; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "./interface/IUniswapV2Router02.sol"; import "@uniswap/v3-periphery/contracts/interfaces/ISwapRouter.sol"; import "./interface/IUniswapV3Quoter.sol"; import { FailedSwap } from "./Structs.sol"; import "./interface/IWETH.sol"; abstract contract SwapOperationManager { IUniswapV2Router02 public uniswapV2Router; ISwapRouter public uniswapV3Router; IUniswapV3Quoter public uniswapV3Quoter; FailedSwap[] public failedSwaps; uint256 public slippageTolerance; uint256 public profitToETH; uint256 public profitToWETH; mapping(address => uint256) public userFailedSwaps; bytes32 private constant VERSION_V2 = keccak256(abi.encodePacked("v2")); bytes32 private constant VERSION_V3 = keccak256(abi.encodePacked("v3")); constructor(address _uniswapV2Router, address _uniswapV3Router, address _uniswapV3Quoter) { uniswapV2Router = IUniswapV2Router02(_uniswapV2Router); uniswapV3Router = ISwapRouter(_uniswapV3Router); uniswapV3Quoter = IUniswapV3Quoter(_uniswapV3Quoter); slippageTolerance = 1000; } function retryFailedSwaps(address user) external { for (uint256 i = 0; i < failedSwaps.length; i++) { if (failedSwaps[i].user == user) { FailedSwap memory failedSwap = failedSwaps[i]; if(keccak256(abi.encodePacked(failedSwap.version)) == VERSION_V3){ IWETH(uniswapV2Router.WETH()).deposit{value: failedSwap.amount}(); try this.swapETHForToken(failedSwap.token, failedSwap.amount, failedSwap.version, failedSwap.feeTier) { removeFailedSwap(i); userFailedSwaps[user]--; } catch { failedSwaps.push(FailedSwap(msg.sender, failedSwap.token, failedSwap.amount, failedSwap.version, failedSwap.feeTier)); userFailedSwaps[msg.sender]++; // emit SwapFailed(msg.sender, failedSwap.token, failedSwap.amount, failedSwap.version); } } else if (keccak256(abi.encodePacked(failedSwap.version)) == VERSION_V2) { try this.swapETHForToken{value: failedSwap.amount}(failedSwap.token, failedSwap.amount, failedSwap.version, failedSwap.feeTier) { removeFailedSwap(i); userFailedSwaps[user]--; } catch { failedSwaps.push(FailedSwap(msg.sender, failedSwap.token, failedSwap.amount, failedSwap.version, failedSwap.feeTier)); userFailedSwaps[msg.sender]++; // emit SwapFailed(msg.sender, failedSwap.token, failedSwap.amount, failedSwap.version); } } } } } function getFailedSwaps(address user) external view returns (FailedSwap[] memory) { FailedSwap[] memory userFailedSwapsArray = new FailedSwap[](userFailedSwaps[user]); uint256 counter = 0; for (uint256 i = 0; i < failedSwaps.length; i++) { if (failedSwaps[i].user == user) { userFailedSwapsArray[counter] = failedSwaps[i]; counter++; } } return userFailedSwapsArray; } function removeFailedSwap(uint256 index) internal { require(index < failedSwaps.length, "!index"); failedSwaps[index] = failedSwaps[failedSwaps.length - 1]; failedSwaps.pop(); } function swapTokenForETH(IERC20 _token, uint256 _amountIn, string memory version, uint24 feeTier) external returns (uint256) { if (keccak256(abi.encodePacked(version)) == VERSION_V2) { address[] memory path = new address[](2); path[0] = address(_token); path[1] = uniswapV2Router.WETH(); uint256[] memory expectedAmounts = uniswapV2Router.getAmountsOut(_amountIn, path); uint256 amountOutMinimum = (expectedAmounts[1] * (10000 - slippageTolerance)) / 10000; return swapTokenForETHV2(_token, _amountIn, amountOutMinimum, address(this)); } else if (keccak256(abi.encodePacked(version)) == VERSION_V3) { bytes memory path = abi.encodePacked(address(_token), feeTier, uniswapV2Router.WETH()); uint256 expectedAmountOut = uniswapV3Quoter.quoteExactInput(path, _amountIn); // Calculate the minimum amount of ETH to receive, considering slippage tolerance uint256 amountOutMinimum = (expectedAmountOut * (10000 - slippageTolerance)) / 10000; return swapTokenForETHV3(_token, _amountIn, feeTier, amountOutMinimum, address(this)); } else { revert("!UV"); } } function swapETHForToken(IERC20 _token, uint256 _ethAmount, string memory version, uint24 feeTier) public payable { // Calculate the minimum amount of tokens to receive, considering slippage tolerance if (keccak256(abi.encodePacked(version)) == VERSION_V2) { address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = address(_token); uint256[] memory expectedAmounts = uniswapV2Router.getAmountsOut(_ethAmount, path); uint256 amountOutMinimum = (expectedAmounts[1] * (10000 - slippageTolerance)) / 10000; swapETHForTokenV2(_token, _ethAmount, amountOutMinimum); } else if (keccak256(abi.encodePacked(version)) == VERSION_V3) { bytes memory path = abi.encodePacked(uniswapV2Router.WETH(), feeTier, address(_token)); uint256 expectedAmountOut = uniswapV3Quoter.quoteExactInput(path, _ethAmount); uint256 amountOutMinimum = (expectedAmountOut * (10000 - slippageTolerance)) / 10000; swapETHForTokenV3(_token, _ethAmount, feeTier, amountOutMinimum); } else { revert("!UV"); } } function swapTokenForETHV2(IERC20 _token, uint256 _amountIn, uint256 amountOutMinimum, address receiver) internal returns (uint256) { address[] memory path = new address[](2); path[0] = address(_token); path[1] = uniswapV2Router.WETH(); _token.approve(address(uniswapV2Router), _amountIn); uint256[] memory amounts = uniswapV2Router.swapExactTokensForETH( _amountIn, amountOutMinimum, // minimum amount of ETH to receive path, receiver, block.timestamp ); return amounts[1]; } function swapETHForTokenV2(IERC20 _token, uint256 _ethAmount, uint256 amountOutMinimum) internal returns (uint256[] memory amounts) { address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = address(_token); amounts = uniswapV2Router.swapExactETHForTokens{value: _ethAmount}( amountOutMinimum, // minimum amount of tokens to receive path, address(this), block.timestamp ); return amounts; } function swapTokenForETHV3(IERC20 _token, uint256 _amountIn, uint24 feeTier, uint256 amountOutMinimum, address receiver) internal returns (uint256) { ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({ tokenIn: address(_token), tokenOut: uniswapV2Router.WETH(), fee: feeTier, // Pool fee tier recipient: receiver, deadline: block.timestamp, amountIn: _amountIn, amountOutMinimum: amountOutMinimum, // minimum amount of ETH to receive sqrtPriceLimitX96: 0 }); _token.approve(address(uniswapV3Router), _amountIn); return uniswapV3Router.exactInputSingle(params); } function swapETHForTokenV3(IERC20 _token, uint256 _ethAmount, uint24 feeTier, uint256 amountOutMinimum) internal { ISwapRouter.ExactInputSingleParams memory params = ISwapRouter.ExactInputSingleParams({ tokenIn: uniswapV2Router.WETH(), tokenOut: address(_token), fee: feeTier, // Pool fee tier recipient: address(this), deadline: block.timestamp, amountIn: _ethAmount, amountOutMinimum: amountOutMinimum, // minimum amount of tokens to receive sqrtPriceLimitX96: 0 }); uniswapV3Router.exactInputSingle{value: _ethAmount}(params); } function sellTokens(IERC20 _token, uint256 _amount, string memory version, uint24 feeTier) internal returns(uint256 amountOut){ if (keccak256(abi.encodePacked(version)) == VERSION_V2) { address[] memory path = new address[](2); path[0] = address(_token); path[1] = uniswapV2Router.WETH(); uint256[] memory expectedAmounts = uniswapV2Router.getAmountsOut(_amount, path); uint256 amountOutMinimum = (expectedAmounts[1] * (10000 - slippageTolerance)) / 10000; amountOut = swapTokenForETHV2(_token, _amount, amountOutMinimum, address(this)); profitToETH += amountOut; } else if (keccak256(abi.encodePacked(version)) == VERSION_V3) { bytes memory pathV3 = abi.encodePacked(address(_token), feeTier, uniswapV2Router.WETH()); uint256 expectedAmountOut = uniswapV3Quoter.quoteExactInput(pathV3, _amount); uint256 amountOutMinimum = (expectedAmountOut * (10000 - slippageTolerance)) / 10000; amountOut = swapTokenForETHV3(_token, _amount, feeTier, amountOutMinimum, address(this)); profitToWETH += amountOut; } else { revert("Invalid Uniswap version"); } } function buyTokens(IERC20 _token, uint256 _amountOut, string memory version, uint24 feeTier) internal { if (keccak256(abi.encodePacked(version)) == VERSION_V2) { address[] memory path = new address[](2); path[0] = uniswapV2Router.WETH(); path[1] = address(_token); uint256[] memory expectedAmountsIn = uniswapV2Router.getAmountsIn(_amountOut, path); uint256 ethToUse = (profitToETH > expectedAmountsIn[0]) ? expectedAmountsIn[0] : profitToETH; require(ethToUse > 0, "eth to use is zero"); uint256[] memory expectedAmountsOut = uniswapV2Router.getAmountsOut(ethToUse, path); uint256 amountOutMinimum = (expectedAmountsOut[1] * (10000 - slippageTolerance)) / 10000; swapETHForTokenV2(_token, ethToUse, amountOutMinimum); } else if (keccak256(abi.encodePacked(version)) == VERSION_V3) { bytes memory pathV3 = abi.encodePacked(uniswapV2Router.WETH(), feeTier, address(_token)); uint256 expectedAmountIn = uniswapV3Quoter.quoteExactOutput(pathV3, _amountOut); uint256 ethToUse = (profitToWETH > expectedAmountIn) ? expectedAmountIn : profitToWETH; require(ethToUse > 0, "eth to use is zero"); uint256 expectedAmountOut = uniswapV3Quoter.quoteExactInput(pathV3, ethToUse); uint256 amountOutMinimum = (expectedAmountOut * (10000 - slippageTolerance)) / 10000; swapETHForTokenV3(_token, ethToUse, feeTier, amountOutMinimum); } else { revert("Invalid Uniswap version"); } } function setSlippageTolerance(uint256 _slippageTolerance) external { require(_slippageTolerance <= 10000, "!SLP"); slippageTolerance = _slippageTolerance; // emit SlippageToleranceChanged(_slippageTolerance); } function getWETHaddress() public view returns(address) { return uniswapV2Router.WETH(); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; abstract contract WhiteListManager { mapping(address => bool) public whitelist; address[] private whitelistedAddresses; address private owner; event Whitelisted(address indexed user, bool isWhitelisted); modifier onlyWhitelisted() { require(whitelist[msg.sender], "!WHT"); _; } constructor() { whitelist[msg.sender] = true; whitelistedAddresses.push(msg.sender); // Add the contract deployer to the whitelist owner = msg.sender; } function setWhitelist(address _user, bool _status) external { require(msg.sender == owner, "You are not owner"); if (_status && !whitelist[_user]) { // Add to whitelist and track address whitelist[_user] = true; whitelistedAddresses.push(_user); } else if (!_status && whitelist[_user]) { // Remove from whitelist but keep address in array (optional) whitelist[_user] = false; } emit Whitelisted(_user, _status); } function getWhitelistedUsers() external view returns (address[] memory) { uint256 count = 0; // Count the number of currently whitelisted users for (uint256 i = 0; i < whitelistedAddresses.length; i++) { if (whitelist[whitelistedAddresses[i]]) { count++; } } address[] memory activeWhitelisted = new address[](count); uint256 index = 0; // Populate the array with active whitelisted users for (uint256 i = 0; i < whitelistedAddresses.length; i++) { if (whitelist[whitelistedAddresses[i]]) { activeWhitelisted[index] = whitelistedAddresses[i]; index++; } } return activeWhitelisted; } }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_uniswapV2Router","type":"address"},{"internalType":"address","name":"_uniswapV3Router","type":"address"},{"internalType":"address","name":"_uniswapV3Quoter","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"allowance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientAllowance","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"},{"internalType":"uint256","name":"balance","type":"uint256"},{"internalType":"uint256","name":"needed","type":"uint256"}],"name":"ERC20InsufficientBalance","type":"error"},{"inputs":[{"internalType":"address","name":"approver","type":"address"}],"name":"ERC20InvalidApprover","type":"error"},{"inputs":[{"internalType":"address","name":"receiver","type":"address"}],"name":"ERC20InvalidReceiver","type":"error"},{"inputs":[{"internalType":"address","name":"sender","type":"address"}],"name":"ERC20InvalidSender","type":"error"},{"inputs":[{"internalType":"address","name":"spender","type":"address"}],"name":"ERC20InvalidSpender","type":"error"},{"inputs":[],"name":"EnforcedPause","type":"error"},{"inputs":[],"name":"ExpectedPause","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"_tokens","type":"address"},{"indexed":false,"internalType":"uint256","name":"targetPercentage","type":"uint256"},{"indexed":false,"internalType":"string","name":"verision","type":"string"},{"indexed":false,"internalType":"uint24","name":"feeTier","type":"uint24"}],"name":"AddToken","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Paused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"value","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"account","type":"address"}],"name":"Unpaused","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"bool","name":"isWhitelisted","type":"bool"}],"name":"Whitelisted","type":"event"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_tokens","type":"address[]"},{"internalType":"uint256[]","name":"_targetPercentages","type":"uint256[]"},{"internalType":"string[]","name":"_versions","type":"string[]"},{"internalType":"uint24[]","name":"_feeTiers","type":"uint24[]"}],"name":"bulkAddTokens","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"deposit","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"ethDepositedFailed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"failedSwaps","outputs":[{"internalType":"address","name":"user","type":"address"},{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint24","name":"feeTier","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllTokens","outputs":[{"components":[{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"targetPercentage","type":"uint256"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint24","name":"feeTier","type":"uint24"}],"internalType":"struct TokenInfo[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"getFailedSwaps","outputs":[{"components":[{"internalType":"address","name":"user","type":"address"},{"internalType":"contract IERC20","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint24","name":"feeTier","type":"uint24"}],"internalType":"struct FailedSwap[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_tokenPrices","type":"uint256[]"}],"name":"getPortfolioValue","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWETHaddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getWhitelistedUsers","outputs":[{"internalType":"address[]","name":"","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"initialedTokens","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"profitToETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"profitToWETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"retryFailedSwaps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_depositFee","type":"uint256"},{"internalType":"uint256","name":"_withdrawalFee","type":"uint256"}],"name":"setFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_slippageTolerance","type":"uint256"}],"name":"setSlippageTolerance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"setWhitelist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"slippageTolerance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_ethAmount","type":"uint256"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint24","name":"feeTier","type":"uint24"}],"name":"swapETHForToken","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20","name":"_token","type":"address"},{"internalType":"uint256","name":"_amountIn","type":"uint256"},{"internalType":"string","name":"version","type":"string"},{"internalType":"uint24","name":"feeTier","type":"uint24"}],"name":"swapTokenForETH","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"uniswapV2Router","outputs":[{"internalType":"contract IUniswapV2Router02","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV3Quoter","outputs":[{"internalType":"contract IUniswapV3Quoter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"uniswapV3Router","outputs":[{"internalType":"contract ISwapRouter","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"unpause","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_targetPercentage","type":"uint256"},{"internalType":"string","name":"_version","type":"string"},{"internalType":"uint24","name":"_feeTier","type":"uint24"}],"name":"updateToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userFailedSwaps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"whitelist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawAllToETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_receiverFeeAddress","type":"address"}],"name":"withdrawFeesByOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenAmount","type":"uint256"}],"name":"withdrawToETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"withdrawWholeAllInKind","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040526017805460ff191690553480156200001b57600080fd5b5060405162005774380380620057748339810160408190526200003e91620001fd565b60408051808201825260078152660a0b28e8e8aa8960cb1b602080830191909152825180840190935260048352630a08aa8960e31b908301528491849184913380620000a457604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b620000af8162000190565b506000805460ff60a01b191690556004620000cb8382620002ec565b506005620000da8282620002ec565b5050600680546001600160a01b03199081166001600160a01b0396871617909155600780548216948616949094179093555060088054831691909316179091556103e8600a55336000818152600e60205260408120805460ff19166001908117909155600f805491820181559091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020180548316821790556010805490921617905550506064601481905560135550620003b8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620001f857600080fd5b919050565b6000806000606084860312156200021357600080fd5b6200021e84620001e0565b92506200022e60208501620001e0565b91506200023e60408501620001e0565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200027257607f821691505b6020821081036200029357634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002e757600081815260208120601f850160051c81016020861015620002c25750805b601f850160051c820191505b81811015620002e357828155600101620002ce565b5050505b505050565b81516001600160401b0381111562000308576200030862000247565b62000320816200031984546200025d565b8462000299565b602080601f8311600181146200035857600084156200033f5750858301515b600019600386901b1c1916600185901b178555620002e3565b600085815260208120601f198616915b82811015620003895788860151825594840194600190910190840162000368565b5085821015620003a85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6153ac80620003c86000396000f3fe6080604052600436106102725760003560e01c806360d274511161014f5780639b19251a116100c1578063d0e30db01161007a578063d0e30db01461077e578063dd62ed3e14610786578063df0e0768146107cc578063e7ae65ab146107e1578063f2fde38b14610801578063fa3b56491461082157600080fd5b80639b19251a146106ab578063a38e9e66146106db578063a738c7df146106fb578063a9059cbb1461071b578063c38cd0b51461073b578063d03153aa1461076857600080fd5b80638456cb59116101135780638456cb591461060a57806386bc55db1461061f57806386c14663146106355780638da5cb5b1461064b57806391ebe50f1461066957806395d89b411461069657600080fd5b806360d2745114610570578063611d126a1461059057806370a08231146105a5578063715018a6146105db57806381a06b73146105f057600080fd5b8063313ce567116101e85780633f4ba83a116101ac5780633f4ba83a146104ba5780634d20d0f8146104cf57806350bfc449146104ef57806353d6fd59146105115780635643a5a7146105315780635c975abb1461055157600080fd5b8063313ce5671461040d57806336a43f2b14610429578063378a653c1461045657806339c0f5d2146104875780633d7526f71461049a57600080fd5b806318160ddd1161023a57806318160ddd1461034c57806323b872dd1461036b5780632a5c792a1461038b5780632c76d7a6146103ad5780632c9351a1146103cd5780632e1a7d4d146103ed57600080fd5b806306fdde0314610277578063095ea7b3146102a25780630b78f9c0146102d2578063117da1ee146102f45780631694505e14610314575b600080fd5b34801561028357600080fd5b5061028c610836565b60405161029991906145f8565b60405180910390f35b3480156102ae57600080fd5b506102c26102bd366004614627565b6108c8565b6040519015158152602001610299565b3480156102de57600080fd5b506102f26102ed366004614653565b6108e2565b005b34801561030057600080fd5b506102f261030f366004614675565b61096e565b34801561032057600080fd5b50600654610334906001600160a01b031681565b6040516001600160a01b039091168152602001610299565b34801561035857600080fd5b506003545b604051908152602001610299565b34801561037757600080fd5b506102c261038636600461468e565b6109ae565b34801561039757600080fd5b506103a06109d2565b60405161029991906146cf565b3480156103b957600080fd5b50600754610334906001600160a01b031681565b3480156103d957600080fd5b506102f26103e8366004614675565b610af5565b3480156103f957600080fd5b506102f2610408366004614675565b611007565b34801561041957600080fd5b5060405160128152602001610299565b34801561043557600080fd5b5061035d61044436600461476b565b600d6020526000908152604090205481565b34801561046257600080fd5b50610476610471366004614675565b611446565b604051610299959493929190614788565b6102f261049536600461489f565b611525565b3480156104a657600080fd5b506102f26104b536600461476b565b6118fd565b3480156104c657600080fd5b506102f2611f9e565b3480156104db57600080fd5b50600854610334906001600160a01b031681565b3480156104fb57600080fd5b50610504611fe4565b604051610299919061494c565b34801561051d57600080fd5b506102f261052c36600461496d565b612175565b34801561053d57600080fd5b5061035d61054c3660046149c9565b6122ed565b34801561055d57600080fd5b50600054600160a01b900460ff166102c2565b34801561057c57600080fd5b506102f261058b366004614a9e565b612427565b34801561059c57600080fd5b506102f261280a565b3480156105b157600080fd5b5061035d6105c036600461476b565b6001600160a01b031660009081526001602052604090205490565b3480156105e757600080fd5b506102f261293f565b3480156105fc57600080fd5b506017546102c29060ff1681565b34801561061657600080fd5b506102f2612953565b34801561062b57600080fd5b5061035d600b5481565b34801561064157600080fd5b5061035d600c5481565b34801561065757600080fd5b506000546001600160a01b0316610334565b34801561067557600080fd5b5061068961068436600461476b565b612993565b6040516102999190614b61565b3480156106a257600080fd5b5061028c612bac565b3480156106b757600080fd5b506102c26106c636600461476b565b600e6020526000908152604090205460ff1681565b3480156106e757600080fd5b506102f26106f636600461489f565b612bbb565b34801561070757600080fd5b506102f261071636600461476b565b612d38565b34801561072757600080fd5b506102c2610736366004614627565b612e73565b34801561074757600080fd5b5061035d61075636600461476b565b60126020526000908152604090205481565b34801561077457600080fd5b5061035d600a5481565b6102f2612e81565b34801561079257600080fd5b5061035d6107a1366004614bfe565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3480156107d857600080fd5b50610334613277565b3480156107ed57600080fd5b5061035d6107fc36600461489f565b6132ea565b34801561080d57600080fd5b506102f261081c36600461476b565b613695565b34801561082d57600080fd5b506102f26136d0565b60606004805461084590614c2c565b80601f016020809104026020016040519081016040528092919081815260200182805461087190614c2c565b80156108be5780601f10610893576101008083540402835291602001916108be565b820191906000526020600020905b8154815290600101906020018083116108a157829003601f168201915b5050505050905090565b6000336108d68185856138df565b60019150505b92915050565b6108ea6138ec565b6127108211156109295760405162461bcd60e51b8152602060048201526005602482015264216466656560d81b60448201526064015b60405180910390fd5b6127108111156109635760405162461bcd60e51b8152602060048201526005602482015264217766656560d81b6044820152606401610920565b601391909155601455565b6127108111156109a95760405162461bcd60e51b815260040161092090602080825260049082015263021534c560e41b604082015260600190565b600a55565b6000336109bc858285613919565b6109c7858585613991565b506001949350505050565b60606011805480602002602001604051908101604052809291908181526020016000905b82821015610aec576000848152602090819020604080516080810182526004860290920180546001600160a01b0316835260018101549383019390935260028301805492939291840191610a4990614c2c565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7590614c2c565b8015610ac25780601f10610a9757610100808354040283529160200191610ac2565b820191906000526020600020905b815481529060010190602001808311610aa557829003601f168201915b50505091835250506003919091015462ffffff1660209182015290825260019290920191016109f6565b50505050905090565b610afd6139f0565b60008111610b325760405162461bcd60e51b815260206004820152600260248201526103e360f41b6044820152606401610920565b6040516370a0823160e01b8152336004820152819030906370a0823190602401602060405180830381865afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b939190614c66565b1015610bd15760405162461bcd60e51b815260206004820152600d60248201526c08525b9cdd59999a58da595b9d609a1b6044820152606401610920565b6000610bdc60035490565b610be883612710614c95565b610bf29190614cac565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190614cce565b905060008060005b601154811015610e3a57600060118281548110610c9457610c94614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506127109189916001600160a01b0316906370a0823190602401602060405180830381865afa158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d179190614c66565b610d219190614c95565b610d2b9190614cac565b8254600384015460405163e7ae65ab60e01b8152929350309263e7ae65ab92610d71926001600160a01b03909116918691600289019162ffffff90911690600401614d01565b6020604051808303816000875af1925050508015610dac575060408051601f3d908101601f19168201909252610da991810190614c66565b60015b15610e2557604051602001610dc090614dac565b6040516020818303038152906040528051906020012083600201604051602001610dea9190614dba565b6040516020818303038152906040528051906020012003610e1657610e0f8186614e30565b9450610e23565b610e208187614e30565b95505b505b50508080610e3290614e43565b915050610c75565b50610e453386613a1b565b8015610f0457600061271060145483610e5e9190614c95565b610e689190614cac565b90506000610e768284614e5c565b90508160166000828254610e8a9190614e30565b909155505060405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f009190614e6f565b5050505b811561100057600061271060145484610f1d9190614c95565b610f279190614cac565b90506000610f358285614e5c565b90508160156000828254610f499190614e30565b90915550503360009081526012602052604081205490610f698383614e30565b604051909150600090339083908381818185875af1925050503d8060008114610fae576040519150601f19603f3d011682016040523d82523d6000602084013e610fb3565b606091505b5050905080610ffa5760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610920565b50505050505b5050505050565b61100f6139f0565b600081116110445760405162461bcd60e51b815260206004820152600260248201526103e360f41b6044820152606401610920565b6040516370a0823160e01b8152336004820152819030906370a0823190602401602060405180830381865afa158015611081573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a59190614c66565b10156110e25760405162461bcd60e51b815260206004820152600c60248201526b125b9cdd59999a58da595b9d60a21b6044820152606401610920565b60006110ed60035490565b6110f983612710614c95565b6111039190614cac565b905060005b6011548110156113865760006011828154811061112757611127614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506127109186916001600160a01b0316906370a0823190602401602060405180830381865afa158015611186573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111aa9190614c66565b6111b49190614c95565b6111be9190614cac565b90506000612710601454836111d39190614c95565b6111dd9190614cac565b905060006111eb8284614e5c565b845460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af115801561123c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112609190614e6f565b508354600385015460405163e7ae65ab60e01b8152309263e7ae65ab926112a4926001600160a01b0390921691879160028b019162ffffff90911690600401614d01565b6020604051808303816000875af19250505080156112df575060408051601f3d908101601f191682019092526112dc91810190614c66565b60015b1561136f576040516020016112f390614dac565b604051602081830303815290604052805190602001208560020160405160200161131d9190614dba565b604051602081830303815290604052805190602001200361135557806016600082825461134a9190614e30565b9091555061136d9050565b80601560008282546113679190614e30565b90915550505b505b50505050808061137e90614e43565b915050611108565b506113913383613a1b565b33600090815260126020526040812054612710906113b0908490614c95565b6113ba9190614cac565b905080801561144057604051600090339083908381818185875af1925050503d8060008114611405576040519150601f19603f3d011682016040523d82523d6000602084013e61140a565b606091505b50509050806110005760405162461bcd60e51b81526020600482015260026024820152612a2960f11b6044820152606401610920565b50505050565b6009818154811061145657600080fd5b600091825260209091206005909102018054600182015460028301546003840180546001600160a01b03948516965092909316939092909161149790614c2c565b80601f01602080910402602001604051908101604052809291908181526020018280546114c390614c2c565b80156115105780601f106114e557610100808354040283529160200191611510565b820191906000526020600020905b8154815290600101906020018083116114f357829003601f168201915b5050506004909301549192505062ffffff1685565b604051613b1960f11b6020820152602201604051602081830303815290604052805190602001208260405160200161155d9190614e8c565b6040516020818303038152906040528051906020012003611732576040805160028082526060820183526000926020830190803683375050600654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa1580156115e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116069190614cce565b8160008151811061161957611619614ceb565b60200260200101906001600160a01b031690816001600160a01b031681525050848160018151811061164d5761164d614ceb565b6001600160a01b03928316602091820292909201015260065460405163d06ca61f60e01b8152600092919091169063d06ca61f906116919088908690600401614ea8565b600060405180830381865afa1580156116ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116d69190810190614ec1565b90506000612710600a546127106116ed9190614e5c565b8360018151811061170057611700614ceb565b60200260200101516117129190614c95565b61171c9190614cac565b9050611729878783613a51565b50505050611440565b60405160200161174190614dac565b60405160208183030381529060405280519060200120826040516020016117689190614e8c565b60405160208183030381529060405280519060200120036118cf57600654604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa1580156117cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f19190614cce565b828660405160200161180593929190614f46565b60408051601f198184030181529082905260085463cdca175360e01b83529092506000916001600160a01b039091169063cdca17539061184b9085908990600401614f81565b6020604051808303816000875af115801561186a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188e9190614c66565b90506000612710600a546127106118a59190614e5c565b6118af9084614c95565b6118b99190614cac565b90506118c787878684613bbf565b505050611440565b60405162461bcd60e51b815260206004820152600360248201526210aaab60e91b6044820152606401610920565b60005b600954811015611f9a57816001600160a01b03166009828154811061192757611927614ceb565b60009182526020909120600590910201546001600160a01b031603611f885760006009828154811061195b5761195b614ceb565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b039081168452600182015416938301939093526002830154908201526003820180549192916060840191906119b590614c2c565b80601f01602080910402602001604051908101604052809291908181526020018280546119e190614c2c565b8015611a2e5780601f10611a0357610100808354040283529160200191611a2e565b820191906000526020600020905b815481529060010190602001808311611a1157829003601f168201915b50505091835250506004919091015462ffffff16602091820152604051919250611a589101614dac565b604051602081830303815290604052805190602001208160600151604051602001611a839190614e8c565b6040516020818303038152906040528051906020012003611d6c57600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b159190614cce565b6001600160a01b031663d0e30db082604001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015611b5357600080fd5b505af1158015611b67573d6000803e3d6000fd5b5050506020830151604080850151606086015160808701519251631ce07ae960e11b81523096506339c0f5d29550611ba3949390600401614fa3565b600060405180830381600087803b158015611bbd57600080fd5b505af1925050508015611bce575060015b611d3f576040805160a0810182523381526020838101516001600160a01b039081169183019182528484015193830193845260608086015190840190815260808087015162ffffff169085015260098054600181018255600091909152845160059091027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180549285166001600160a01b031993841617815594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0820180549190951692169190911790925593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b18201559251919290917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b290910190611cf89082615026565b50608091909101516004909101805462ffffff191662ffffff909216919091179055336000908152600d60205260408120805491611d3583614e43565b9190505550611f86565b611d4882613cf7565b6001600160a01b0383166000908152600d60205260408120805491611d35836150e5565b604051613b1960f11b6020820152602201604051602081830303815290604052805190602001208160600151604051602001611da89190614e8c565b6040516020818303038152906040528051906020012003611f86576040808201516020830151606084015160808501519351631ce07ae960e11b815230946339c0f5d29493611dfe939092859290600401614fa3565b6000604051808303818588803b158015611e1757600080fd5b505af193505050508015611e29575060015b611f53576040805160a0810182523381526020838101516001600160a01b039081169183019182528484015193830193845260608086015190840190815260808087015162ffffff169085015260098054600181018255600091909152845160059091027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180549285166001600160a01b031993841617815594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0820180549190951692169190911790925593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b18201559251919290917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b290910190611cf89082615026565b611f5c82613cf7565b6001600160a01b0383166000908152600d60205260408120805491611f80836150e5565b91905055505b505b80611f9281614e43565b915050611900565b5050565b611fa66138ec565b611fae613e58565b6040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b60606000805b600f5481101561205857600e6000600f838154811061200b5761200b614ceb565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff1615612046578161204281614e43565b9250505b8061205081614e43565b915050611fea565b506000816001600160401b03811115612073576120736147d2565b60405190808252806020026020018201604052801561209c578160200160208202803683370190505b5090506000805b600f5481101561216c57600e6000600f83815481106120c4576120c4614ceb565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff161561215a57600f818154811061210457612104614ceb565b9060005260206000200160009054906101000a90046001600160a01b031683838151811061213457612134614ceb565b6001600160a01b03909216602092830291909101909101528161215681614e43565b9250505b8061216481614e43565b9150506120a3565b50909392505050565b6010546001600160a01b031633146121c35760405162461bcd60e51b81526020600482015260116024820152702cb7ba9030b932903737ba1037bbb732b960791b6044820152606401610920565b8080156121e957506001600160a01b0382166000908152600e602052604090205460ff16155b15612258576001600160a01b0382166000818152600e60205260408120805460ff19166001908117909155600f805491820181559091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020180546001600160a01b03191690911790556122a4565b8015801561227e57506001600160a01b0382166000908152600e602052604090205460ff165b156122a4576001600160a01b0382166000908152600e60205260409020805460ff191690555b816001600160a01b03167fa54714518c5d275fdcd3d2a461e4858e4e8cb04fb93cd0bca9d6d34115f26440826040516122e1911515815260200190565b60405180910390a25050565b6011548151600091146123325760405162461bcd60e51b815260206004820152600d60248201526c042e0e4d2c6cae6d8cadccee8d609b1b6044820152606401610920565b6000805b6011548110156124205760006011828154811061235557612355614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa1580156123ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d29190614c66565b905060008684815181106123e8576123e8614ceb565b6020026020010151905080826123fe9190614c95565b6124089086614e30565b9450505050808061241890614e43565b915050612336565b5092915050565b61242f6138ec565b60175460ff16156124825760405162461bcd60e51b815260206004820152601c60248201527f74686520636f6e74726163742068617320696e697469616c697a6564000000006044820152606401610920565b868514801561249057508683145b801561249b57508681145b6124d65760405162461bcd60e51b815260206004820152600c60248201526b214d6973736c656e6774687360a01b6044820152606401610920565b6000805b888110156127a0576127108888838181106124f7576124f7614ceb565b90506020020135111561253a5760405162461bcd60e51b815260206004820152600b60248201526a2170657263656e7461676560a81b6044820152606401610920565b87878281811061254c5761254c614ceb565b905060200201358261255e9190614e30565b9150601160405180608001604052808c8c8581811061257f5761257f614ceb565b9050602002016020810190612594919061476b565b6001600160a01b031681526020018a8a858181106125b4576125b4614ceb565b9050602002013581526020018888858181106125d2576125d2614ceb565b90506020028101906125e491906150fc565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200186868581811061263057612630614ceb565b90506020020160208101906126459190615142565b62ffffff1690528154600180820184556000938452602093849020835160049093020180546001600160a01b0319166001600160a01b039093169290921782559282015192810192909255604081015190919060028201906126a79082615026565b50606091909101516003909101805462ffffff191662ffffff9092169190911790557fdae6f056932f00933cb66a91f6e0255f17770daa04db2d36869e28ffa46dca638a8a838181106126fc576126fc614ceb565b9050602002016020810190612711919061476b565b89898481811061272357612723614ceb565b9050602002013588888581811061273c5761273c614ceb565b905060200281019061274e91906150fc565b88888781811061276057612760614ceb565b90506020020160208101906127759190615142565b60405161278695949392919061515d565b60405180910390a18061279881614e43565b9150506124da565b5080612710146127f25760405162461bcd60e51b815260206004820181905260248201527f746f74616c2070657263656e746167652073686f756c642062652031303030306044820152606401610920565b50506017805460ff1916600117905550505050505050565b6128126138ec565b60005b60115481101561293c5760006011828154811061283457612834614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa15801561288d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b19190614c66565b825460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015612902573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129269190614e6f565b505050808061293490614e43565b915050612815565b50565b6129476138ec565b6129516000613ea8565b565b61295b6138ec565b612963613ef8565b6040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602001611fda565b6001600160a01b0381166000908152600d6020526040812054606091906001600160401b038111156129c7576129c76147d2565b604051908082528060200260200182016040528015612a1f57816020015b6040805160a08101825260008082526020808301829052928201819052606080830152608082015282526000199092019101816129e55790505b5090506000805b60095481101561216c57846001600160a01b031660098281548110612a4d57612a4d614ceb565b60009182526020909120600590910201546001600160a01b031603612b9a5760098181548110612a7f57612a7f614ceb565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b03908116845260018201541693830193909352600283015490820152600382018054919291606084019190612ad990614c2c565b80601f0160208091040260200160405190810160405280929190818152602001828054612b0590614c2c565b8015612b525780601f10612b2757610100808354040283529160200191612b52565b820191906000526020600020905b815481529060010190602001808311612b3557829003601f168201915b50505091835250506004919091015462ffffff166020909101528351849084908110612b8057612b80614ceb565b60200260200101819052508180612b9690614e43565b9250505b80612ba481614e43565b915050612a26565b60606005805461084590614c2c565b612bc36138ec565b612710831115612c005760405162461bcd60e51b8152602060048201526008602482015267021503e31303030360c41b6044820152606401610920565b6000805b601154811015612d0157856001600160a01b031660118281548110612c2b57612c2b614ceb565b60009182526020909120600490910201546001600160a01b031603612cef578460118281548110612c5e57612c5e614ceb565b9060005260206000209060040201600101819055508360118281548110612c8757612c87614ceb565b90600052602060002090600402016002019081612ca49190615026565b508260118281548110612cb957612cb9614ceb565b906000526020600020906004020160030160006101000a81548162ffffff021916908362ffffff16021790555060019150612d01565b80612cf981614e43565b915050612c04565b50806110005760405162461bcd60e51b815260206004820152600660248201526510ba37b5b2b760d11b6044820152606401610920565b612d406138ec565b60155415612ddd576015546040516000916001600160a01b038416918381818185875af1925050503d8060008114612d94576040519150601f19603f3d011682016040523d82523d6000602084013e612d99565b606091505b5050905080612dd65760405162461bcd60e51b815260206004820152600960248201526808c8292988a888aa8960bb1b6044820152606401610920565b5060006015555b6016541561293c576000612def613277565b60165460405163a9059cbb60e01b81526001600160a01b038581166004830152602482019290925291925082169063a9059cbb906044016020604051808303816000875af1158015612e45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e699190614e6f565b5050600060165550565b6000336108d6818585613991565b336000908152600e602052604090205460ff16612ec95760405162461bcd60e51b8152600401610920906020808252600490820152630855d21560e21b604082015260600190565b612ed16139f0565b60003411612f075760405162461bcd60e51b8152602060048201526003602482015262414d4760e81b6044820152606401610920565b600061271060135434612f1a9190614c95565b612f249190614cac565b90506000612f328234614e5c565b90508160156000828254612f469190614e30565b909155505080612fab5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e7420616674657220666565206d7573742062652067726561746572604482015269207468616e207a65726f60b01b6064820152608401610920565b612fb53382613f3b565b60005b60115481101561327257600060118281548110612fd757612fd7614ceb565b906000526020600020906004020190506000612710826001015485612ffc9190614c95565b6130069190614cac565b90508381111561304c5760405162461bcd60e51b815260206004820152601160248201527063616c4554483c3d616d6f756e7466656560781b6044820152606401610920565b81546003830154604051631ce07ae960e11b815230926339c0f5d292859261308d926001600160a01b031691849160028a019162ffffff1690600401614d01565b6000604051808303818588803b1580156130a657600080fd5b505af1935050505080156130b8575060015b61325d5733600090815260126020526040812080548392906130db908490614e30565b90915550506040805160a08101825233815283546001600160a01b0316602082015290810182905260028301805460099291606083019161311b90614c2c565b80601f016020809104026020016040519081016040528092919081815260200182805461314790614c2c565b80156131945780601f1061316957610100808354040283529160200191613194565b820191906000526020600020905b81548152906001019060200180831161317757829003601f168201915b505050918352505060038581015462ffffff16602092830152835460018082018655600095865294839020845160059092020180546001600160a01b03199081166001600160a01b0393841617825593850151958101805490941695909116949094179091556040820151600284015560608201519192919082019061321a9082615026565b50608091909101516004909101805462ffffff191662ffffff909216919091179055336000908152600d6020526040812080549161325783614e43565b91905055505b5050808061326a90614e43565b915050612fb8565b505050565b600654604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa1580156132c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132e59190614cce565b905090565b604051613b1960f11b602082015260009060220160405160208183030381529060405280519060200120836040516020016133259190614e8c565b60405160208183030381529060405280519060200120036134ec57604080516002808252606082018352600092602083019080368337019050509050858160008151811061337557613375614ceb565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156133ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f29190614cce565b8160018151811061340557613405614ceb565b6001600160a01b03928316602091820292909201015260065460405163d06ca61f60e01b8152600092919091169063d06ca61f906134499089908690600401614ea8565b600060405180830381865afa158015613466573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261348e9190810190614ec1565b90506000612710600a546127106134a59190614e5c565b836001815181106134b8576134b8614ceb565b60200260200101516134ca9190614c95565b6134d49190614cac565b90506134e288888330613f71565b935050505061368d565b6040516020016134fb90614dac565b60405160208183030381529060405280519060200120836040516020016135229190614e8c565b60405160208183030381529060405280519060200120036118cf5760008583600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015613594573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135b89190614cce565b6040516020016135ca93929190614f46565b60408051601f198184030181529082905260085463cdca175360e01b83529092506000916001600160a01b039091169063cdca1753906136109085908a90600401614f81565b6020604051808303816000875af115801561362f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136539190614c66565b90506000612710600a5461271061366a9190614e5c565b6136749084614c95565b61367e9190614cac565b90506134e28888878430614169565b949350505050565b61369d6138ec565b6001600160a01b0381166136c757604051631e4fbdf760e01b815260006004820152602401610920565b61293c81613ea8565b6136d86138ec565b60008060005b601154811015613272576000601182815481106136fd576136fd614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa158015613756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377a9190614c66565b8254600384015460405163e7ae65ab60e01b8152929350309263e7ae65ab926137c0926001600160a01b03909116918691600289019162ffffff90911690600401614d01565b6020604051808303816000875af19250505080156137fb575060408051601f3d908101601f191682019092526137f891810190614c66565b60015b156138ca57604051613b1960f11b6020820152602201604051602081830303815290604052805190602001208360020160405160200161383b9190614dba565b6040516020818303038152906040528051906020012003613867576138608187614e30565b95506138c8565b60405160200161387690614dac565b60405160208183030381529060405280519060200120836002016040516020016138a09190614dba565b60405160208183030381529060405280519060200120036138c8576138c58186614e30565b94505b505b505080806138d790614e43565b9150506136de565b6132728383836001614331565b6000546001600160a01b031633146129515760405163118cdaa760e01b8152336004820152602401610920565b6001600160a01b038381166000908152600260209081526040808320938616835292905220546000198114611440578181101561398257604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610920565b61144084848484036000614331565b6001600160a01b0383166139bb57604051634b637e8f60e11b815260006004820152602401610920565b6001600160a01b0382166139e55760405163ec442f0560e01b815260006004820152602401610920565b613272838383614406565b600054600160a01b900460ff16156129515760405163d93c066560e01b815260040160405180910390fd5b6001600160a01b038216613a4557604051634b637e8f60e11b815260006004820152602401610920565b611f9a82600083614406565b604080516002808252606080830184529260009291906020830190803683375050600654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa158015613abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ae39190614cce565b81600081518110613af657613af6614ceb565b60200260200101906001600160a01b031690816001600160a01b0316815250508481600181518110613b2a57613b2a614ceb565b6001600160a01b039283166020918202929092010152600654604051637ff36ab560e01b8152911690637ff36ab5908690613b6f9087908690309042906004016151b4565b60006040518083038185885af1158015613b8d573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052613bb69190810190614ec1565b95945050505050565b6040805161010081018083526006546315ab88c960e31b909152915160009282916001600160a01b039091169063ad5c464890610104808501916020918187030181865afa158015613c15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c399190614cce565b6001600160a01b039081168252878116602083015262ffffff861660408084019190915230606084015242608084015260a0830188905260c08301869052600060e090930192909252600754915163414bf38960e01b8152929350169063414bf389908690613cac9085906004016151e9565b60206040518083038185885af1158015613cca573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190613cef9190614c66565b505050505050565b6009548110613d315760405162461bcd60e51b8152602060048201526006602482015265042d2dcc8caf60d31b6044820152606401610920565b60098054613d4190600190614e5c565b81548110613d5157613d51614ceb565b906000526020600020906005020160098281548110613d7257613d72614ceb565b60009182526020909120825460059092020180546001600160a01b039283166001600160a01b031991821617825560018085015490830180549190941691161790915560028083015490820155600380820190613dd190840182615252565b506004918201549101805462ffffff191662ffffff9092169190911790556009805480613e0057613e00615324565b60008281526020812060056000199093019283020180546001600160a01b0319908116825560018201805490911690556002810182905590613e45600383018261455a565b50600401805462ffffff19169055905550565b613e60614530565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001611fda565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b613f006139f0565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613e903390565b6001600160a01b038216613f655760405163ec442f0560e01b815260006004820152602401610920565b611f9a60008383614406565b604080516002808252606082018352600092839291906020830190803683370190505090508581600081518110613faa57613faa614ceb565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015614003573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140279190614cce565b8160018151811061403a5761403a614ceb565b6001600160a01b03928316602091820292909201015260065460405163095ea7b360e01b81529082166004820152602481018790529087169063095ea7b3906044016020604051808303816000875af115801561409b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140bf9190614e6f565b506006546040516318cbafe560e01b81526000916001600160a01b0316906318cbafe5906140f9908990899087908a90429060040161533a565b6000604051808303816000875af1158015614118573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526141409190810190614ec1565b90508060018151811061415557614155614ceb565b602002602001015192505050949350505050565b600080604051806101000160405280886001600160a01b03168152602001600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141fe9190614cce565b6001600160a01b03908116825262ffffff88166020830152858116604080840191909152426060840152608083018a905260a08301889052600060c090930192909252600754915163095ea7b360e01b81529181166004830152602482018990529192509088169063095ea7b3906044016020604051808303816000875af115801561428e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142b29190614e6f565b5060075460405163414bf38960e01b81526001600160a01b039091169063414bf389906142e39084906004016151e9565b6020604051808303816000875af1158015614302573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143269190614c66565b979650505050505050565b6001600160a01b03841661435b5760405163e602df0560e01b815260006004820152602401610920565b6001600160a01b03831661438557604051634a1406b160e11b815260006004820152602401610920565b6001600160a01b038085166000908152600260209081526040808320938716835292905220829055801561144057826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516143f891815260200190565b60405180910390a350505050565b6001600160a01b0383166144315780600360008282546144269190614e30565b909155506144a39050565b6001600160a01b038316600090815260016020526040902054818110156144845760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610920565b6001600160a01b03841660009081526001602052604090209082900390555b6001600160a01b0382166144bf576003805482900390556144de565b6001600160a01b03821660009081526001602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161452391815260200190565b60405180910390a3505050565b600054600160a01b900460ff1661295157604051638dfc202b60e01b815260040160405180910390fd5b50805461456690614c2c565b6000825580601f10614576575050565b601f01602090049060005260206000209081019061293c91905b808211156145a45760008155600101614590565b5090565b60005b838110156145c35781810151838201526020016145ab565b50506000910152565b600081518084526145e48160208601602086016145a8565b601f01601f19169290920160200192915050565b60208152600061460b60208301846145cc565b9392505050565b6001600160a01b038116811461293c57600080fd5b6000806040838503121561463a57600080fd5b823561464581614612565b946020939093013593505050565b6000806040838503121561466657600080fd5b50508035926020909101359150565b60006020828403121561468757600080fd5b5035919050565b6000806000606084860312156146a357600080fd5b83356146ae81614612565b925060208401356146be81614612565b929592945050506040919091013590565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561475d57888303603f19018552815180516001600160a01b03168452878101518885015286810151608088860181905290614737828701826145cc565b60609384015162ffffff16969093019590955250948701949250908601906001016146f6565b509098975050505050505050565b60006020828403121561477d57600080fd5b813561460b81614612565b6001600160a01b038681168252851660208201526040810184905260a0606082018190526000906147bb908301856145cc565b905062ffffff831660808301529695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614810576148106147d2565b604052919050565b600082601f83011261482957600080fd5b81356001600160401b03811115614842576148426147d2565b614855601f8201601f19166020016147e8565b81815284602083860101111561486a57600080fd5b816020850160208301376000918101602001919091529392505050565b803562ffffff8116811461489a57600080fd5b919050565b600080600080608085870312156148b557600080fd5b84356148c081614612565b93506020850135925060408501356001600160401b038111156148e257600080fd5b6148ee87828801614818565b9250506148fd60608601614887565b905092959194509250565b600081518084526020808501945080840160005b838110156149415781516001600160a01b03168752958201959082019060010161491c565b509495945050505050565b60208152600061460b6020830184614908565b801515811461293c57600080fd5b6000806040838503121561498057600080fd5b823561498b81614612565b9150602083013561499b8161495f565b809150509250929050565b60006001600160401b038211156149bf576149bf6147d2565b5060051b60200190565b600060208083850312156149dc57600080fd5b82356001600160401b038111156149f257600080fd5b8301601f81018513614a0357600080fd5b8035614a16614a11826149a6565b6147e8565b81815260059190911b82018301908381019087831115614a3557600080fd5b928401925b8284101561432657833582529284019290840190614a3a565b60008083601f840112614a6557600080fd5b5081356001600160401b03811115614a7c57600080fd5b6020830191508360208260051b8501011115614a9757600080fd5b9250929050565b6000806000806000806000806080898b031215614aba57600080fd5b88356001600160401b0380821115614ad157600080fd5b614add8c838d01614a53565b909a50985060208b0135915080821115614af657600080fd5b614b028c838d01614a53565b909850965060408b0135915080821115614b1b57600080fd5b614b278c838d01614a53565b909650945060608b0135915080821115614b4057600080fd5b50614b4d8b828c01614a53565b999c989b5096995094979396929594505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561475d57888303603f19018552815180516001600160a01b039081168552888201511688850152868101518785015260608082015160a08287018190529190614bd7838801826145cc565b60809485015162ffffff169790940196909652505094870194925090860190600101614b88565b60008060408385031215614c1157600080fd5b8235614c1c81614612565b9150602083013561499b81614612565b600181811c90821680614c4057607f821691505b602082108103614c6057634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215614c7857600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176108dc576108dc614c7f565b600082614cc957634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614ce057600080fd5b815161460b81614612565b634e487b7160e01b600052603260045260246000fd5b60018060a01b03851681526000602085818401526080604084015260008554614d2981614c2c565b80608087015260a0600180841660008114614d4b5760018114614d6557614d93565b60ff1985168984015283151560051b890183019550614d93565b8a6000528660002060005b85811015614d8b5781548b8201860152908301908801614d70565b8a0184019650505b5050505062ffffff86166060860152509150613bb69050565b61763360f01b815260020190565b6000808354614dc881614c2c565b60018281168015614de05760018114614df557614e24565b60ff1984168752821515830287019450614e24565b8760005260208060002060005b85811015614e1b5781548a820152908401908201614e02565b50505082870194505b50929695505050505050565b808201808211156108dc576108dc614c7f565b600060018201614e5557614e55614c7f565b5060010190565b818103818111156108dc576108dc614c7f565b600060208284031215614e8157600080fd5b815161460b8161495f565b60008251614e9e8184602087016145a8565b9190910192915050565b82815260406020820152600061368d6040830184614908565b60006020808385031215614ed457600080fd5b82516001600160401b03811115614eea57600080fd5b8301601f81018513614efb57600080fd5b8051614f09614a11826149a6565b81815260059190911b82018301908381019087831115614f2857600080fd5b928401925b8284101561432657835182529284019290840190614f2d565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b604081526000614f9460408301856145cc565b90508260208301529392505050565b60018060a01b0385168152836020820152608060408201526000614fca60808301856145cc565b905062ffffff8316606083015295945050505050565b601f82111561327257600081815260208120601f850160051c810160208610156150075750805b601f850160051c820191505b81811015613cef57828155600101615013565b81516001600160401b0381111561503f5761503f6147d2565b6150538161504d8454614c2c565b84614fe0565b602080601f83116001811461508857600084156150705750858301515b600019600386901b1c1916600185901b178555613cef565b600085815260208120601f198616915b828110156150b757888601518255948401946001909101908401615098565b50858210156150d55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000816150f4576150f4614c7f565b506000190190565b6000808335601e1984360301811261511357600080fd5b8301803591506001600160401b0382111561512d57600080fd5b602001915036819003821315614a9757600080fd5b60006020828403121561515457600080fd5b61460b82614887565b6001600160a01b0386168152602081018590526080604082018190528101839052828460a0830137600060a08483010152600060a0601f19601f860116830101905062ffffff831660608301529695505050505050565b8481526080602082015260006151cd6080830186614908565b6001600160a01b03949094166040830152506060015292915050565b81516001600160a01b03908116825260208084015182169083015260408084015162ffffff16908301526060808401518216908301526080808401519083015260a0838101519083015260c0808401519083015260e09283015116918101919091526101000190565b81810361525d575050565b6152678254614c2c565b6001600160401b0381111561527e5761527e6147d2565b61528c8161504d8454614c2c565b6000601f8211600181146152c057600083156152a85750848201545b600019600385901b1c1916600184901b178455611000565b600085815260209020601f19841690600086815260209020845b838110156152fa57828601548255600195860195909101906020016152da565b50858310156150d55793015460001960f8600387901b161c19169092555050600190811b01905550565b634e487b7160e01b600052603160045260246000fd5b85815284602082015260a06040820152600061535960a0830186614908565b6001600160a01b039490941660608301525060800152939250505056fea2646970667358221220d22f26dd627f4196299219bb1097289950d371608f24fcc0c88575ddf5c48ffb64736f6c63430008140033000000000000000000000000edf6066a2b290c185783862c7f4776a2c8077ad1000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000b27308f9f90d607463bb33ea1bebb41c27ce5ab6
Deployed Bytecode
0x6080604052600436106102725760003560e01c806360d274511161014f5780639b19251a116100c1578063d0e30db01161007a578063d0e30db01461077e578063dd62ed3e14610786578063df0e0768146107cc578063e7ae65ab146107e1578063f2fde38b14610801578063fa3b56491461082157600080fd5b80639b19251a146106ab578063a38e9e66146106db578063a738c7df146106fb578063a9059cbb1461071b578063c38cd0b51461073b578063d03153aa1461076857600080fd5b80638456cb59116101135780638456cb591461060a57806386bc55db1461061f57806386c14663146106355780638da5cb5b1461064b57806391ebe50f1461066957806395d89b411461069657600080fd5b806360d2745114610570578063611d126a1461059057806370a08231146105a5578063715018a6146105db57806381a06b73146105f057600080fd5b8063313ce567116101e85780633f4ba83a116101ac5780633f4ba83a146104ba5780634d20d0f8146104cf57806350bfc449146104ef57806353d6fd59146105115780635643a5a7146105315780635c975abb1461055157600080fd5b8063313ce5671461040d57806336a43f2b14610429578063378a653c1461045657806339c0f5d2146104875780633d7526f71461049a57600080fd5b806318160ddd1161023a57806318160ddd1461034c57806323b872dd1461036b5780632a5c792a1461038b5780632c76d7a6146103ad5780632c9351a1146103cd5780632e1a7d4d146103ed57600080fd5b806306fdde0314610277578063095ea7b3146102a25780630b78f9c0146102d2578063117da1ee146102f45780631694505e14610314575b600080fd5b34801561028357600080fd5b5061028c610836565b60405161029991906145f8565b60405180910390f35b3480156102ae57600080fd5b506102c26102bd366004614627565b6108c8565b6040519015158152602001610299565b3480156102de57600080fd5b506102f26102ed366004614653565b6108e2565b005b34801561030057600080fd5b506102f261030f366004614675565b61096e565b34801561032057600080fd5b50600654610334906001600160a01b031681565b6040516001600160a01b039091168152602001610299565b34801561035857600080fd5b506003545b604051908152602001610299565b34801561037757600080fd5b506102c261038636600461468e565b6109ae565b34801561039757600080fd5b506103a06109d2565b60405161029991906146cf565b3480156103b957600080fd5b50600754610334906001600160a01b031681565b3480156103d957600080fd5b506102f26103e8366004614675565b610af5565b3480156103f957600080fd5b506102f2610408366004614675565b611007565b34801561041957600080fd5b5060405160128152602001610299565b34801561043557600080fd5b5061035d61044436600461476b565b600d6020526000908152604090205481565b34801561046257600080fd5b50610476610471366004614675565b611446565b604051610299959493929190614788565b6102f261049536600461489f565b611525565b3480156104a657600080fd5b506102f26104b536600461476b565b6118fd565b3480156104c657600080fd5b506102f2611f9e565b3480156104db57600080fd5b50600854610334906001600160a01b031681565b3480156104fb57600080fd5b50610504611fe4565b604051610299919061494c565b34801561051d57600080fd5b506102f261052c36600461496d565b612175565b34801561053d57600080fd5b5061035d61054c3660046149c9565b6122ed565b34801561055d57600080fd5b50600054600160a01b900460ff166102c2565b34801561057c57600080fd5b506102f261058b366004614a9e565b612427565b34801561059c57600080fd5b506102f261280a565b3480156105b157600080fd5b5061035d6105c036600461476b565b6001600160a01b031660009081526001602052604090205490565b3480156105e757600080fd5b506102f261293f565b3480156105fc57600080fd5b506017546102c29060ff1681565b34801561061657600080fd5b506102f2612953565b34801561062b57600080fd5b5061035d600b5481565b34801561064157600080fd5b5061035d600c5481565b34801561065757600080fd5b506000546001600160a01b0316610334565b34801561067557600080fd5b5061068961068436600461476b565b612993565b6040516102999190614b61565b3480156106a257600080fd5b5061028c612bac565b3480156106b757600080fd5b506102c26106c636600461476b565b600e6020526000908152604090205460ff1681565b3480156106e757600080fd5b506102f26106f636600461489f565b612bbb565b34801561070757600080fd5b506102f261071636600461476b565b612d38565b34801561072757600080fd5b506102c2610736366004614627565b612e73565b34801561074757600080fd5b5061035d61075636600461476b565b60126020526000908152604090205481565b34801561077457600080fd5b5061035d600a5481565b6102f2612e81565b34801561079257600080fd5b5061035d6107a1366004614bfe565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3480156107d857600080fd5b50610334613277565b3480156107ed57600080fd5b5061035d6107fc36600461489f565b6132ea565b34801561080d57600080fd5b506102f261081c36600461476b565b613695565b34801561082d57600080fd5b506102f26136d0565b60606004805461084590614c2c565b80601f016020809104026020016040519081016040528092919081815260200182805461087190614c2c565b80156108be5780601f10610893576101008083540402835291602001916108be565b820191906000526020600020905b8154815290600101906020018083116108a157829003601f168201915b5050505050905090565b6000336108d68185856138df565b60019150505b92915050565b6108ea6138ec565b6127108211156109295760405162461bcd60e51b8152602060048201526005602482015264216466656560d81b60448201526064015b60405180910390fd5b6127108111156109635760405162461bcd60e51b8152602060048201526005602482015264217766656560d81b6044820152606401610920565b601391909155601455565b6127108111156109a95760405162461bcd60e51b815260040161092090602080825260049082015263021534c560e41b604082015260600190565b600a55565b6000336109bc858285613919565b6109c7858585613991565b506001949350505050565b60606011805480602002602001604051908101604052809291908181526020016000905b82821015610aec576000848152602090819020604080516080810182526004860290920180546001600160a01b0316835260018101549383019390935260028301805492939291840191610a4990614c2c565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7590614c2c565b8015610ac25780601f10610a9757610100808354040283529160200191610ac2565b820191906000526020600020905b815481529060010190602001808311610aa557829003601f168201915b50505091835250506003919091015462ffffff1660209182015290825260019290920191016109f6565b50505050905090565b610afd6139f0565b60008111610b325760405162461bcd60e51b815260206004820152600260248201526103e360f41b6044820152606401610920565b6040516370a0823160e01b8152336004820152819030906370a0823190602401602060405180830381865afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b939190614c66565b1015610bd15760405162461bcd60e51b815260206004820152600d60248201526c08525b9cdd59999a58da595b9d609a1b6044820152606401610920565b6000610bdc60035490565b610be883612710614c95565b610bf29190614cac565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190614cce565b905060008060005b601154811015610e3a57600060118281548110610c9457610c94614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506127109189916001600160a01b0316906370a0823190602401602060405180830381865afa158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d179190614c66565b610d219190614c95565b610d2b9190614cac565b8254600384015460405163e7ae65ab60e01b8152929350309263e7ae65ab92610d71926001600160a01b03909116918691600289019162ffffff90911690600401614d01565b6020604051808303816000875af1925050508015610dac575060408051601f3d908101601f19168201909252610da991810190614c66565b60015b15610e2557604051602001610dc090614dac565b6040516020818303038152906040528051906020012083600201604051602001610dea9190614dba565b6040516020818303038152906040528051906020012003610e1657610e0f8186614e30565b9450610e23565b610e208187614e30565b95505b505b50508080610e3290614e43565b915050610c75565b50610e453386613a1b565b8015610f0457600061271060145483610e5e9190614c95565b610e689190614cac565b90506000610e768284614e5c565b90508160166000828254610e8a9190614e30565b909155505060405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610edc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f009190614e6f565b5050505b811561100057600061271060145484610f1d9190614c95565b610f279190614cac565b90506000610f358285614e5c565b90508160156000828254610f499190614e30565b90915550503360009081526012602052604081205490610f698383614e30565b604051909150600090339083908381818185875af1925050503d8060008114610fae576040519150601f19603f3d011682016040523d82523d6000602084013e610fb3565b606091505b5050905080610ffa5760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610920565b50505050505b5050505050565b61100f6139f0565b600081116110445760405162461bcd60e51b815260206004820152600260248201526103e360f41b6044820152606401610920565b6040516370a0823160e01b8152336004820152819030906370a0823190602401602060405180830381865afa158015611081573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a59190614c66565b10156110e25760405162461bcd60e51b815260206004820152600c60248201526b125b9cdd59999a58da595b9d60a21b6044820152606401610920565b60006110ed60035490565b6110f983612710614c95565b6111039190614cac565b905060005b6011548110156113865760006011828154811061112757611127614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506127109186916001600160a01b0316906370a0823190602401602060405180830381865afa158015611186573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111aa9190614c66565b6111b49190614c95565b6111be9190614cac565b90506000612710601454836111d39190614c95565b6111dd9190614cac565b905060006111eb8284614e5c565b845460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af115801561123c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112609190614e6f565b508354600385015460405163e7ae65ab60e01b8152309263e7ae65ab926112a4926001600160a01b0390921691879160028b019162ffffff90911690600401614d01565b6020604051808303816000875af19250505080156112df575060408051601f3d908101601f191682019092526112dc91810190614c66565b60015b1561136f576040516020016112f390614dac565b604051602081830303815290604052805190602001208560020160405160200161131d9190614dba565b604051602081830303815290604052805190602001200361135557806016600082825461134a9190614e30565b9091555061136d9050565b80601560008282546113679190614e30565b90915550505b505b50505050808061137e90614e43565b915050611108565b506113913383613a1b565b33600090815260126020526040812054612710906113b0908490614c95565b6113ba9190614cac565b905080801561144057604051600090339083908381818185875af1925050503d8060008114611405576040519150601f19603f3d011682016040523d82523d6000602084013e61140a565b606091505b50509050806110005760405162461bcd60e51b81526020600482015260026024820152612a2960f11b6044820152606401610920565b50505050565b6009818154811061145657600080fd5b600091825260209091206005909102018054600182015460028301546003840180546001600160a01b03948516965092909316939092909161149790614c2c565b80601f01602080910402602001604051908101604052809291908181526020018280546114c390614c2c565b80156115105780601f106114e557610100808354040283529160200191611510565b820191906000526020600020905b8154815290600101906020018083116114f357829003601f168201915b5050506004909301549192505062ffffff1685565b604051613b1960f11b6020820152602201604051602081830303815290604052805190602001208260405160200161155d9190614e8c565b6040516020818303038152906040528051906020012003611732576040805160028082526060820183526000926020830190803683375050600654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa1580156115e2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116069190614cce565b8160008151811061161957611619614ceb565b60200260200101906001600160a01b031690816001600160a01b031681525050848160018151811061164d5761164d614ceb565b6001600160a01b03928316602091820292909201015260065460405163d06ca61f60e01b8152600092919091169063d06ca61f906116919088908690600401614ea8565b600060405180830381865afa1580156116ae573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116d69190810190614ec1565b90506000612710600a546127106116ed9190614e5c565b8360018151811061170057611700614ceb565b60200260200101516117129190614c95565b61171c9190614cac565b9050611729878783613a51565b50505050611440565b60405160200161174190614dac565b60405160208183030381529060405280519060200120826040516020016117689190614e8c565b60405160208183030381529060405280519060200120036118cf57600654604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa1580156117cd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f19190614cce565b828660405160200161180593929190614f46565b60408051601f198184030181529082905260085463cdca175360e01b83529092506000916001600160a01b039091169063cdca17539061184b9085908990600401614f81565b6020604051808303816000875af115801561186a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061188e9190614c66565b90506000612710600a546127106118a59190614e5c565b6118af9084614c95565b6118b99190614cac565b90506118c787878684613bbf565b505050611440565b60405162461bcd60e51b815260206004820152600360248201526210aaab60e91b6044820152606401610920565b60005b600954811015611f9a57816001600160a01b03166009828154811061192757611927614ceb565b60009182526020909120600590910201546001600160a01b031603611f885760006009828154811061195b5761195b614ceb565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b039081168452600182015416938301939093526002830154908201526003820180549192916060840191906119b590614c2c565b80601f01602080910402602001604051908101604052809291908181526020018280546119e190614c2c565b8015611a2e5780601f10611a0357610100808354040283529160200191611a2e565b820191906000526020600020905b815481529060010190602001808311611a1157829003601f168201915b50505091835250506004919091015462ffffff16602091820152604051919250611a589101614dac565b604051602081830303815290604052805190602001208160600151604051602001611a839190614e8c565b6040516020818303038152906040528051906020012003611d6c57600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611af1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b159190614cce565b6001600160a01b031663d0e30db082604001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015611b5357600080fd5b505af1158015611b67573d6000803e3d6000fd5b5050506020830151604080850151606086015160808701519251631ce07ae960e11b81523096506339c0f5d29550611ba3949390600401614fa3565b600060405180830381600087803b158015611bbd57600080fd5b505af1925050508015611bce575060015b611d3f576040805160a0810182523381526020838101516001600160a01b039081169183019182528484015193830193845260608086015190840190815260808087015162ffffff169085015260098054600181018255600091909152845160059091027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180549285166001600160a01b031993841617815594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0820180549190951692169190911790925593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b18201559251919290917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b290910190611cf89082615026565b50608091909101516004909101805462ffffff191662ffffff909216919091179055336000908152600d60205260408120805491611d3583614e43565b9190505550611f86565b611d4882613cf7565b6001600160a01b0383166000908152600d60205260408120805491611d35836150e5565b604051613b1960f11b6020820152602201604051602081830303815290604052805190602001208160600151604051602001611da89190614e8c565b6040516020818303038152906040528051906020012003611f86576040808201516020830151606084015160808501519351631ce07ae960e11b815230946339c0f5d29493611dfe939092859290600401614fa3565b6000604051808303818588803b158015611e1757600080fd5b505af193505050508015611e29575060015b611f53576040805160a0810182523381526020838101516001600160a01b039081169183019182528484015193830193845260608086015190840190815260808087015162ffffff169085015260098054600181018255600091909152845160059091027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180549285166001600160a01b031993841617815594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0820180549190951692169190911790925593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b18201559251919290917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b290910190611cf89082615026565b611f5c82613cf7565b6001600160a01b0383166000908152600d60205260408120805491611f80836150e5565b91905055505b505b80611f9281614e43565b915050611900565b5050565b611fa66138ec565b611fae613e58565b6040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b60606000805b600f5481101561205857600e6000600f838154811061200b5761200b614ceb565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff1615612046578161204281614e43565b9250505b8061205081614e43565b915050611fea565b506000816001600160401b03811115612073576120736147d2565b60405190808252806020026020018201604052801561209c578160200160208202803683370190505b5090506000805b600f5481101561216c57600e6000600f83815481106120c4576120c4614ceb565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff161561215a57600f818154811061210457612104614ceb565b9060005260206000200160009054906101000a90046001600160a01b031683838151811061213457612134614ceb565b6001600160a01b03909216602092830291909101909101528161215681614e43565b9250505b8061216481614e43565b9150506120a3565b50909392505050565b6010546001600160a01b031633146121c35760405162461bcd60e51b81526020600482015260116024820152702cb7ba9030b932903737ba1037bbb732b960791b6044820152606401610920565b8080156121e957506001600160a01b0382166000908152600e602052604090205460ff16155b15612258576001600160a01b0382166000818152600e60205260408120805460ff19166001908117909155600f805491820181559091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020180546001600160a01b03191690911790556122a4565b8015801561227e57506001600160a01b0382166000908152600e602052604090205460ff165b156122a4576001600160a01b0382166000908152600e60205260409020805460ff191690555b816001600160a01b03167fa54714518c5d275fdcd3d2a461e4858e4e8cb04fb93cd0bca9d6d34115f26440826040516122e1911515815260200190565b60405180910390a25050565b6011548151600091146123325760405162461bcd60e51b815260206004820152600d60248201526c042e0e4d2c6cae6d8cadccee8d609b1b6044820152606401610920565b6000805b6011548110156124205760006011828154811061235557612355614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa1580156123ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d29190614c66565b905060008684815181106123e8576123e8614ceb565b6020026020010151905080826123fe9190614c95565b6124089086614e30565b9450505050808061241890614e43565b915050612336565b5092915050565b61242f6138ec565b60175460ff16156124825760405162461bcd60e51b815260206004820152601c60248201527f74686520636f6e74726163742068617320696e697469616c697a6564000000006044820152606401610920565b868514801561249057508683145b801561249b57508681145b6124d65760405162461bcd60e51b815260206004820152600c60248201526b214d6973736c656e6774687360a01b6044820152606401610920565b6000805b888110156127a0576127108888838181106124f7576124f7614ceb565b90506020020135111561253a5760405162461bcd60e51b815260206004820152600b60248201526a2170657263656e7461676560a81b6044820152606401610920565b87878281811061254c5761254c614ceb565b905060200201358261255e9190614e30565b9150601160405180608001604052808c8c8581811061257f5761257f614ceb565b9050602002016020810190612594919061476b565b6001600160a01b031681526020018a8a858181106125b4576125b4614ceb565b9050602002013581526020018888858181106125d2576125d2614ceb565b90506020028101906125e491906150fc565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200186868581811061263057612630614ceb565b90506020020160208101906126459190615142565b62ffffff1690528154600180820184556000938452602093849020835160049093020180546001600160a01b0319166001600160a01b039093169290921782559282015192810192909255604081015190919060028201906126a79082615026565b50606091909101516003909101805462ffffff191662ffffff9092169190911790557fdae6f056932f00933cb66a91f6e0255f17770daa04db2d36869e28ffa46dca638a8a838181106126fc576126fc614ceb565b9050602002016020810190612711919061476b565b89898481811061272357612723614ceb565b9050602002013588888581811061273c5761273c614ceb565b905060200281019061274e91906150fc565b88888781811061276057612760614ceb565b90506020020160208101906127759190615142565b60405161278695949392919061515d565b60405180910390a18061279881614e43565b9150506124da565b5080612710146127f25760405162461bcd60e51b815260206004820181905260248201527f746f74616c2070657263656e746167652073686f756c642062652031303030306044820152606401610920565b50506017805460ff1916600117905550505050505050565b6128126138ec565b60005b60115481101561293c5760006011828154811061283457612834614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa15801561288d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b19190614c66565b825460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015612902573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129269190614e6f565b505050808061293490614e43565b915050612815565b50565b6129476138ec565b6129516000613ea8565b565b61295b6138ec565b612963613ef8565b6040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602001611fda565b6001600160a01b0381166000908152600d6020526040812054606091906001600160401b038111156129c7576129c76147d2565b604051908082528060200260200182016040528015612a1f57816020015b6040805160a08101825260008082526020808301829052928201819052606080830152608082015282526000199092019101816129e55790505b5090506000805b60095481101561216c57846001600160a01b031660098281548110612a4d57612a4d614ceb565b60009182526020909120600590910201546001600160a01b031603612b9a5760098181548110612a7f57612a7f614ceb565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b03908116845260018201541693830193909352600283015490820152600382018054919291606084019190612ad990614c2c565b80601f0160208091040260200160405190810160405280929190818152602001828054612b0590614c2c565b8015612b525780601f10612b2757610100808354040283529160200191612b52565b820191906000526020600020905b815481529060010190602001808311612b3557829003601f168201915b50505091835250506004919091015462ffffff166020909101528351849084908110612b8057612b80614ceb565b60200260200101819052508180612b9690614e43565b9250505b80612ba481614e43565b915050612a26565b60606005805461084590614c2c565b612bc36138ec565b612710831115612c005760405162461bcd60e51b8152602060048201526008602482015267021503e31303030360c41b6044820152606401610920565b6000805b601154811015612d0157856001600160a01b031660118281548110612c2b57612c2b614ceb565b60009182526020909120600490910201546001600160a01b031603612cef578460118281548110612c5e57612c5e614ceb565b9060005260206000209060040201600101819055508360118281548110612c8757612c87614ceb565b90600052602060002090600402016002019081612ca49190615026565b508260118281548110612cb957612cb9614ceb565b906000526020600020906004020160030160006101000a81548162ffffff021916908362ffffff16021790555060019150612d01565b80612cf981614e43565b915050612c04565b50806110005760405162461bcd60e51b815260206004820152600660248201526510ba37b5b2b760d11b6044820152606401610920565b612d406138ec565b60155415612ddd576015546040516000916001600160a01b038416918381818185875af1925050503d8060008114612d94576040519150601f19603f3d011682016040523d82523d6000602084013e612d99565b606091505b5050905080612dd65760405162461bcd60e51b815260206004820152600960248201526808c8292988a888aa8960bb1b6044820152606401610920565b5060006015555b6016541561293c576000612def613277565b60165460405163a9059cbb60e01b81526001600160a01b038581166004830152602482019290925291925082169063a9059cbb906044016020604051808303816000875af1158015612e45573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e699190614e6f565b5050600060165550565b6000336108d6818585613991565b336000908152600e602052604090205460ff16612ec95760405162461bcd60e51b8152600401610920906020808252600490820152630855d21560e21b604082015260600190565b612ed16139f0565b60003411612f075760405162461bcd60e51b8152602060048201526003602482015262414d4760e81b6044820152606401610920565b600061271060135434612f1a9190614c95565b612f249190614cac565b90506000612f328234614e5c565b90508160156000828254612f469190614e30565b909155505080612fab5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e7420616674657220666565206d7573742062652067726561746572604482015269207468616e207a65726f60b01b6064820152608401610920565b612fb53382613f3b565b60005b60115481101561327257600060118281548110612fd757612fd7614ceb565b906000526020600020906004020190506000612710826001015485612ffc9190614c95565b6130069190614cac565b90508381111561304c5760405162461bcd60e51b815260206004820152601160248201527063616c4554483c3d616d6f756e7466656560781b6044820152606401610920565b81546003830154604051631ce07ae960e11b815230926339c0f5d292859261308d926001600160a01b031691849160028a019162ffffff1690600401614d01565b6000604051808303818588803b1580156130a657600080fd5b505af1935050505080156130b8575060015b61325d5733600090815260126020526040812080548392906130db908490614e30565b90915550506040805160a08101825233815283546001600160a01b0316602082015290810182905260028301805460099291606083019161311b90614c2c565b80601f016020809104026020016040519081016040528092919081815260200182805461314790614c2c565b80156131945780601f1061316957610100808354040283529160200191613194565b820191906000526020600020905b81548152906001019060200180831161317757829003601f168201915b505050918352505060038581015462ffffff16602092830152835460018082018655600095865294839020845160059092020180546001600160a01b03199081166001600160a01b0393841617825593850151958101805490941695909116949094179091556040820151600284015560608201519192919082019061321a9082615026565b50608091909101516004909101805462ffffff191662ffffff909216919091179055336000908152600d6020526040812080549161325783614e43565b91905055505b5050808061326a90614e43565b915050612fb8565b505050565b600654604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa1580156132c1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906132e59190614cce565b905090565b604051613b1960f11b602082015260009060220160405160208183030381529060405280519060200120836040516020016133259190614e8c565b60405160208183030381529060405280519060200120036134ec57604080516002808252606082018352600092602083019080368337019050509050858160008151811061337557613375614ceb565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa1580156133ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133f29190614cce565b8160018151811061340557613405614ceb565b6001600160a01b03928316602091820292909201015260065460405163d06ca61f60e01b8152600092919091169063d06ca61f906134499089908690600401614ea8565b600060405180830381865afa158015613466573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261348e9190810190614ec1565b90506000612710600a546127106134a59190614e5c565b836001815181106134b8576134b8614ceb565b60200260200101516134ca9190614c95565b6134d49190614cac565b90506134e288888330613f71565b935050505061368d565b6040516020016134fb90614dac565b60405160208183030381529060405280519060200120836040516020016135229190614e8c565b60405160208183030381529060405280519060200120036118cf5760008583600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015613594573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906135b89190614cce565b6040516020016135ca93929190614f46565b60408051601f198184030181529082905260085463cdca175360e01b83529092506000916001600160a01b039091169063cdca1753906136109085908a90600401614f81565b6020604051808303816000875af115801561362f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136539190614c66565b90506000612710600a5461271061366a9190614e5c565b6136749084614c95565b61367e9190614cac565b90506134e28888878430614169565b949350505050565b61369d6138ec565b6001600160a01b0381166136c757604051631e4fbdf760e01b815260006004820152602401610920565b61293c81613ea8565b6136d86138ec565b60008060005b601154811015613272576000601182815481106136fd576136fd614ceb565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa158015613756573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377a9190614c66565b8254600384015460405163e7ae65ab60e01b8152929350309263e7ae65ab926137c0926001600160a01b03909116918691600289019162ffffff90911690600401614d01565b6020604051808303816000875af19250505080156137fb575060408051601f3d908101601f191682019092526137f891810190614c66565b60015b156138ca57604051613b1960f11b6020820152602201604051602081830303815290604052805190602001208360020160405160200161383b9190614dba565b6040516020818303038152906040528051906020012003613867576138608187614e30565b95506138c8565b60405160200161387690614dac565b60405160208183030381529060405280519060200120836002016040516020016138a09190614dba565b60405160208183030381529060405280519060200120036138c8576138c58186614e30565b94505b505b505080806138d790614e43565b9150506136de565b6132728383836001614331565b6000546001600160a01b031633146129515760405163118cdaa760e01b8152336004820152602401610920565b6001600160a01b038381166000908152600260209081526040808320938616835292905220546000198114611440578181101561398257604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610920565b61144084848484036000614331565b6001600160a01b0383166139bb57604051634b637e8f60e11b815260006004820152602401610920565b6001600160a01b0382166139e55760405163ec442f0560e01b815260006004820152602401610920565b613272838383614406565b600054600160a01b900460ff16156129515760405163d93c066560e01b815260040160405180910390fd5b6001600160a01b038216613a4557604051634b637e8f60e11b815260006004820152602401610920565b611f9a82600083614406565b604080516002808252606080830184529260009291906020830190803683375050600654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa158015613abf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613ae39190614cce565b81600081518110613af657613af6614ceb565b60200260200101906001600160a01b031690816001600160a01b0316815250508481600181518110613b2a57613b2a614ceb565b6001600160a01b039283166020918202929092010152600654604051637ff36ab560e01b8152911690637ff36ab5908690613b6f9087908690309042906004016151b4565b60006040518083038185885af1158015613b8d573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f19168201604052613bb69190810190614ec1565b95945050505050565b6040805161010081018083526006546315ab88c960e31b909152915160009282916001600160a01b039091169063ad5c464890610104808501916020918187030181865afa158015613c15573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c399190614cce565b6001600160a01b039081168252878116602083015262ffffff861660408084019190915230606084015242608084015260a0830188905260c08301869052600060e090930192909252600754915163414bf38960e01b8152929350169063414bf389908690613cac9085906004016151e9565b60206040518083038185885af1158015613cca573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190613cef9190614c66565b505050505050565b6009548110613d315760405162461bcd60e51b8152602060048201526006602482015265042d2dcc8caf60d31b6044820152606401610920565b60098054613d4190600190614e5c565b81548110613d5157613d51614ceb565b906000526020600020906005020160098281548110613d7257613d72614ceb565b60009182526020909120825460059092020180546001600160a01b039283166001600160a01b031991821617825560018085015490830180549190941691161790915560028083015490820155600380820190613dd190840182615252565b506004918201549101805462ffffff191662ffffff9092169190911790556009805480613e0057613e00615324565b60008281526020812060056000199093019283020180546001600160a01b0319908116825560018201805490911690556002810182905590613e45600383018261455a565b50600401805462ffffff19169055905550565b613e60614530565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001611fda565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b613f006139f0565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613e903390565b6001600160a01b038216613f655760405163ec442f0560e01b815260006004820152602401610920565b611f9a60008383614406565b604080516002808252606082018352600092839291906020830190803683370190505090508581600081518110613faa57613faa614ceb565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015614003573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140279190614cce565b8160018151811061403a5761403a614ceb565b6001600160a01b03928316602091820292909201015260065460405163095ea7b360e01b81529082166004820152602481018790529087169063095ea7b3906044016020604051808303816000875af115801561409b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140bf9190614e6f565b506006546040516318cbafe560e01b81526000916001600160a01b0316906318cbafe5906140f9908990899087908a90429060040161533a565b6000604051808303816000875af1158015614118573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526141409190810190614ec1565b90508060018151811061415557614155614ceb565b602002602001015192505050949350505050565b600080604051806101000160405280886001600160a01b03168152602001600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141fe9190614cce565b6001600160a01b03908116825262ffffff88166020830152858116604080840191909152426060840152608083018a905260a08301889052600060c090930192909252600754915163095ea7b360e01b81529181166004830152602482018990529192509088169063095ea7b3906044016020604051808303816000875af115801561428e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906142b29190614e6f565b5060075460405163414bf38960e01b81526001600160a01b039091169063414bf389906142e39084906004016151e9565b6020604051808303816000875af1158015614302573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143269190614c66565b979650505050505050565b6001600160a01b03841661435b5760405163e602df0560e01b815260006004820152602401610920565b6001600160a01b03831661438557604051634a1406b160e11b815260006004820152602401610920565b6001600160a01b038085166000908152600260209081526040808320938716835292905220829055801561144057826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925846040516143f891815260200190565b60405180910390a350505050565b6001600160a01b0383166144315780600360008282546144269190614e30565b909155506144a39050565b6001600160a01b038316600090815260016020526040902054818110156144845760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610920565b6001600160a01b03841660009081526001602052604090209082900390555b6001600160a01b0382166144bf576003805482900390556144de565b6001600160a01b03821660009081526001602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161452391815260200190565b60405180910390a3505050565b600054600160a01b900460ff1661295157604051638dfc202b60e01b815260040160405180910390fd5b50805461456690614c2c565b6000825580601f10614576575050565b601f01602090049060005260206000209081019061293c91905b808211156145a45760008155600101614590565b5090565b60005b838110156145c35781810151838201526020016145ab565b50506000910152565b600081518084526145e48160208601602086016145a8565b601f01601f19169290920160200192915050565b60208152600061460b60208301846145cc565b9392505050565b6001600160a01b038116811461293c57600080fd5b6000806040838503121561463a57600080fd5b823561464581614612565b946020939093013593505050565b6000806040838503121561466657600080fd5b50508035926020909101359150565b60006020828403121561468757600080fd5b5035919050565b6000806000606084860312156146a357600080fd5b83356146ae81614612565b925060208401356146be81614612565b929592945050506040919091013590565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561475d57888303603f19018552815180516001600160a01b03168452878101518885015286810151608088860181905290614737828701826145cc565b60609384015162ffffff16969093019590955250948701949250908601906001016146f6565b509098975050505050505050565b60006020828403121561477d57600080fd5b813561460b81614612565b6001600160a01b038681168252851660208201526040810184905260a0606082018190526000906147bb908301856145cc565b905062ffffff831660808301529695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614810576148106147d2565b604052919050565b600082601f83011261482957600080fd5b81356001600160401b03811115614842576148426147d2565b614855601f8201601f19166020016147e8565b81815284602083860101111561486a57600080fd5b816020850160208301376000918101602001919091529392505050565b803562ffffff8116811461489a57600080fd5b919050565b600080600080608085870312156148b557600080fd5b84356148c081614612565b93506020850135925060408501356001600160401b038111156148e257600080fd5b6148ee87828801614818565b9250506148fd60608601614887565b905092959194509250565b600081518084526020808501945080840160005b838110156149415781516001600160a01b03168752958201959082019060010161491c565b509495945050505050565b60208152600061460b6020830184614908565b801515811461293c57600080fd5b6000806040838503121561498057600080fd5b823561498b81614612565b9150602083013561499b8161495f565b809150509250929050565b60006001600160401b038211156149bf576149bf6147d2565b5060051b60200190565b600060208083850312156149dc57600080fd5b82356001600160401b038111156149f257600080fd5b8301601f81018513614a0357600080fd5b8035614a16614a11826149a6565b6147e8565b81815260059190911b82018301908381019087831115614a3557600080fd5b928401925b8284101561432657833582529284019290840190614a3a565b60008083601f840112614a6557600080fd5b5081356001600160401b03811115614a7c57600080fd5b6020830191508360208260051b8501011115614a9757600080fd5b9250929050565b6000806000806000806000806080898b031215614aba57600080fd5b88356001600160401b0380821115614ad157600080fd5b614add8c838d01614a53565b909a50985060208b0135915080821115614af657600080fd5b614b028c838d01614a53565b909850965060408b0135915080821115614b1b57600080fd5b614b278c838d01614a53565b909650945060608b0135915080821115614b4057600080fd5b50614b4d8b828c01614a53565b999c989b5096995094979396929594505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561475d57888303603f19018552815180516001600160a01b039081168552888201511688850152868101518785015260608082015160a08287018190529190614bd7838801826145cc565b60809485015162ffffff169790940196909652505094870194925090860190600101614b88565b60008060408385031215614c1157600080fd5b8235614c1c81614612565b9150602083013561499b81614612565b600181811c90821680614c4057607f821691505b602082108103614c6057634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215614c7857600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176108dc576108dc614c7f565b600082614cc957634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614ce057600080fd5b815161460b81614612565b634e487b7160e01b600052603260045260246000fd5b60018060a01b03851681526000602085818401526080604084015260008554614d2981614c2c565b80608087015260a0600180841660008114614d4b5760018114614d6557614d93565b60ff1985168984015283151560051b890183019550614d93565b8a6000528660002060005b85811015614d8b5781548b8201860152908301908801614d70565b8a0184019650505b5050505062ffffff86166060860152509150613bb69050565b61763360f01b815260020190565b6000808354614dc881614c2c565b60018281168015614de05760018114614df557614e24565b60ff1984168752821515830287019450614e24565b8760005260208060002060005b85811015614e1b5781548a820152908401908201614e02565b50505082870194505b50929695505050505050565b808201808211156108dc576108dc614c7f565b600060018201614e5557614e55614c7f565b5060010190565b818103818111156108dc576108dc614c7f565b600060208284031215614e8157600080fd5b815161460b8161495f565b60008251614e9e8184602087016145a8565b9190910192915050565b82815260406020820152600061368d6040830184614908565b60006020808385031215614ed457600080fd5b82516001600160401b03811115614eea57600080fd5b8301601f81018513614efb57600080fd5b8051614f09614a11826149a6565b81815260059190911b82018301908381019087831115614f2857600080fd5b928401925b8284101561432657835182529284019290840190614f2d565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b604081526000614f9460408301856145cc565b90508260208301529392505050565b60018060a01b0385168152836020820152608060408201526000614fca60808301856145cc565b905062ffffff8316606083015295945050505050565b601f82111561327257600081815260208120601f850160051c810160208610156150075750805b601f850160051c820191505b81811015613cef57828155600101615013565b81516001600160401b0381111561503f5761503f6147d2565b6150538161504d8454614c2c565b84614fe0565b602080601f83116001811461508857600084156150705750858301515b600019600386901b1c1916600185901b178555613cef565b600085815260208120601f198616915b828110156150b757888601518255948401946001909101908401615098565b50858210156150d55787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000816150f4576150f4614c7f565b506000190190565b6000808335601e1984360301811261511357600080fd5b8301803591506001600160401b0382111561512d57600080fd5b602001915036819003821315614a9757600080fd5b60006020828403121561515457600080fd5b61460b82614887565b6001600160a01b0386168152602081018590526080604082018190528101839052828460a0830137600060a08483010152600060a0601f19601f860116830101905062ffffff831660608301529695505050505050565b8481526080602082015260006151cd6080830186614908565b6001600160a01b03949094166040830152506060015292915050565b81516001600160a01b03908116825260208084015182169083015260408084015162ffffff16908301526060808401518216908301526080808401519083015260a0838101519083015260c0808401519083015260e09283015116918101919091526101000190565b81810361525d575050565b6152678254614c2c565b6001600160401b0381111561527e5761527e6147d2565b61528c8161504d8454614c2c565b6000601f8211600181146152c057600083156152a85750848201545b600019600385901b1c1916600184901b178455611000565b600085815260209020601f19841690600086815260209020845b838110156152fa57828601548255600195860195909101906020016152da565b50858310156150d55793015460001960f8600387901b161c19169092555050600190811b01905550565b634e487b7160e01b600052603160045260246000fd5b85815284602082015260a06040820152600061535960a0830186614908565b6001600160a01b039490941660608301525060800152939250505056fea2646970667358221220d22f26dd627f4196299219bb1097289950d371608f24fcc0c88575ddf5c48ffb64736f6c63430008140033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000edf6066a2b290c185783862c7f4776a2c8077ad1000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000b27308f9f90d607463bb33ea1bebb41c27ce5ab6
-----Decoded View---------------
Arg [0] : _uniswapV2Router (address): 0xedf6066a2b290C185783862C7F4776A2C8077AD1
Arg [1] : _uniswapV3Router (address): 0xE592427A0AEce92De3Edee1F18E0157C05861564
Arg [2] : _uniswapV3Quoter (address): 0xb27308f9F90D607463bb33eA1BeBb41C27CE5AB6
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000edf6066a2b290c185783862c7f4776a2c8077ad1
Arg [1] : 000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564
Arg [2] : 000000000000000000000000b27308f9f90d607463bb33ea1bebb41c27ce5ab6
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 34 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
POL | 100.00% | $0.217669 | 2.286 | $0.4975 |
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.