More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 16 from a total of 16 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 61112721 | 238 days ago | IN | 0 POL | 0.06220413 | ||||
Withdraw To ETH | 61112270 | 238 days ago | IN | 0 POL | 0.00080733 | ||||
Withdraw To ETH | 61112216 | 238 days ago | IN | 0 POL | 0.00080733 | ||||
Withdraw | 61112200 | 238 days ago | IN | 0 POL | 0.06220017 | ||||
Withdraw | 61112161 | 238 days ago | IN | 0 POL | 0.00080835 | ||||
Withdraw | 61112143 | 238 days ago | IN | 0 POL | 0.06214341 | ||||
Withdraw | 61110926 | 238 days ago | IN | 0 POL | 0.06594375 | ||||
Deposit | 61110906 | 238 days ago | IN | 0.001 POL | 0.0762699 | ||||
Withdraw Fees By... | 61110840 | 238 days ago | IN | 0 POL | 0.00100086 | ||||
Withdraw All To ... | 61110808 | 238 days ago | IN | 0 POL | 0.06238664 | ||||
Withdraw All To ... | 61110764 | 238 days ago | IN | 0 POL | 0.00085797 | ||||
Withdraw To ETH | 61104724 | 238 days ago | IN | 0 POL | 0.00371152 | ||||
Deposit | 61098912 | 238 days ago | IN | 0.1 POL | 0.08096071 | ||||
Set Whitelist | 61098874 | 238 days ago | IN | 0 POL | 0.00230905 | ||||
Set Whitelist | 61098785 | 238 days ago | IN | 0 POL | 0.00239715 | ||||
Bulk Add Tokens | 61098134 | 238 days ago | IN | 0 POL | 0.04497036 |
Latest 25 internal transactions (View All)
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008246 POL | ||||
61110906 | 238 days ago | 0.00008256 POL | ||||
61110906 | 238 days ago | 0.00008256 POL | ||||
61110906 | 238 days ago | 0.00008256 POL | ||||
61110906 | 238 days ago | 0.00008256 POL | ||||
61110906 | 238 days ago | 0.00008256 POL | ||||
61110906 | 238 days ago | 0.00008256 POL | ||||
61110906 | 238 days ago | 0.00008256 POL | ||||
61110906 | 238 days ago | 0.00008256 POL | ||||
61110840 | 238 days ago | 0.001 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, address(owner())) 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; try this.swapTokenForETH(tokenInfo.token, tokenAmountToWithdraw, tokenInfo.version, tokenInfo.feeTier, address(this)) returns (uint256 ethReceived ) { if(keccak256(abi.encodePacked(tokenInfo.version)) == keccak256(abi.encodePacked("v3"))){ totalWETH+= ethReceived; } else { totalETH += ethReceived; } } catch {} } _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; 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, address(this)) returns (uint256 ethReceived) { if(keccak256(abi.encodePacked(tokenInfo.version)) == VERSION_V3){ totalFeesToWETH += ethReceived; } else { totalFeesToETH += ethReceived; } } catch {} } _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, address _receiver) 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, _receiver); } 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, _receiver); } else { revert("!UV"); } } function swapETHForToken(IERC20 _token, uint256 _ethAmount, string memory version, uint24 feeTier) external 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"},{"internalType":"address","name":"_receiver","type":"address"}],"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
60806040526017805460ff191690553480156200001b57600080fd5b506040516200584a3803806200584a8339810160408190526200003e91620001fd565b60408051808201825260078152660a0b28e8e8aa8960cb1b602080830191909152825180840190935260048352630a08aa8960e31b908301528491849184913380620000a457604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b620000af8162000190565b506000805460ff60a01b191690556004620000cb8382620002ec565b506005620000da8282620002ec565b5050600680546001600160a01b03199081166001600160a01b0396871617909155600780548216948616949094179093555060088054831691909316179091556103e8600a55336000818152600e60205260408120805460ff19166001908117909155600f805491820181559091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020180548316821790556010805490921617905550506064601481905560135550620003b8565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620001f857600080fd5b919050565b6000806000606084860312156200021357600080fd5b6200021e84620001e0565b92506200022e60208501620001e0565b91506200023e60408501620001e0565b90509250925092565b634e487b7160e01b600052604160045260246000fd5b600181811c908216806200027257607f821691505b6020821081036200029357634e487b7160e01b600052602260045260246000fd5b50919050565b601f821115620002e757600081815260208120601f850160051c81016020861015620002c25750805b601f850160051c820191505b81811015620002e357828155600101620002ce565b5050505b505050565b81516001600160401b0381111562000308576200030862000247565b62000320816200031984546200025d565b8462000299565b602080601f8311600181146200035857600084156200033f5750858301515b600019600386901b1c1916600185901b178555620002e3565b600085815260208120601f198616915b82811015620003895788860151825594840194600190910190840162000368565b5085821015620003a85787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b61548280620003c86000396000f3fe6080604052600436106102725760003560e01c806360d274511161014f5780639b19251a116100c1578063d03153aa1161007a578063d03153aa14610788578063d0e30db01461079e578063dd62ed3e146107a6578063df0e0768146107ec578063f2fde38b14610801578063fa3b56491461082157600080fd5b80639b19251a146106ab578063a38e9e66146106db578063a738c7df146106fb578063a9059cbb1461071b578063a9492aeb1461073b578063c38cd0b51461075b57600080fd5b80638456cb59116101135780638456cb591461060a57806386bc55db1461061f57806386c14663146106355780638da5cb5b1461064b57806391ebe50f1461066957806395d89b411461069657600080fd5b806360d2745114610570578063611d126a1461059057806370a08231146105a5578063715018a6146105db57806381a06b73146105f057600080fd5b8063313ce567116101e85780633f4ba83a116101ac5780633f4ba83a146104ba5780634d20d0f8146104cf57806350bfc449146104ef57806353d6fd59146105115780635643a5a7146105315780635c975abb1461055157600080fd5b8063313ce5671461040d57806336a43f2b14610429578063378a653c1461045657806339c0f5d2146104875780633d7526f71461049a57600080fd5b806318160ddd1161023a57806318160ddd1461034c57806323b872dd1461036b5780632a5c792a1461038b5780632c76d7a6146103ad5780632c9351a1146103cd5780632e1a7d4d146103ed57600080fd5b806306fdde0314610277578063095ea7b3146102a25780630b78f9c0146102d2578063117da1ee146102f45780631694505e14610314575b600080fd5b34801561028357600080fd5b5061028c610836565b6040516102999190614608565b60405180910390f35b3480156102ae57600080fd5b506102c26102bd366004614637565b6108c8565b6040519015158152602001610299565b3480156102de57600080fd5b506102f26102ed366004614663565b6108e2565b005b34801561030057600080fd5b506102f261030f366004614685565b61096e565b34801561032057600080fd5b50600654610334906001600160a01b031681565b6040516001600160a01b039091168152602001610299565b34801561035857600080fd5b506003545b604051908152602001610299565b34801561037757600080fd5b506102c261038636600461469e565b6109ae565b34801561039757600080fd5b506103a06109d2565b60405161029991906146df565b3480156103b957600080fd5b50600754610334906001600160a01b031681565b3480156103d957600080fd5b506102f26103e8366004614685565b610af5565b3480156103f957600080fd5b506102f2610408366004614685565b611009565b34801561041957600080fd5b5060405160128152602001610299565b34801561043557600080fd5b5061035d61044436600461477b565b600d6020526000908152604090205481565b34801561046257600080fd5b50610476610471366004614685565b61144a565b604051610299959493929190614798565b6102f26104953660046148af565b611529565b3480156104a657600080fd5b506102f26104b536600461477b565b611901565b3480156104c657600080fd5b506102f2611fa2565b3480156104db57600080fd5b50600854610334906001600160a01b031681565b3480156104fb57600080fd5b50610504611fe8565b604051610299919061495c565b34801561051d57600080fd5b506102f261052c36600461497d565b612179565b34801561053d57600080fd5b5061035d61054c3660046149d9565b6122f1565b34801561055d57600080fd5b50600054600160a01b900460ff166102c2565b34801561057c57600080fd5b506102f261058b366004614aae565b61242b565b34801561059c57600080fd5b506102f261280e565b3480156105b157600080fd5b5061035d6105c036600461477b565b6001600160a01b031660009081526001602052604090205490565b3480156105e757600080fd5b506102f2612943565b3480156105fc57600080fd5b506017546102c29060ff1681565b34801561061657600080fd5b506102f2612957565b34801561062b57600080fd5b5061035d600b5481565b34801561064157600080fd5b5061035d600c5481565b34801561065757600080fd5b506000546001600160a01b0316610334565b34801561067557600080fd5b5061068961068436600461477b565b612997565b6040516102999190614b71565b3480156106a257600080fd5b5061028c612bb0565b3480156106b757600080fd5b506102c26106c636600461477b565b600e6020526000908152604090205460ff1681565b3480156106e757600080fd5b506102f26106f63660046148af565b612bbf565b34801561070757600080fd5b506102f261071636600461477b565b612d3c565b34801561072757600080fd5b506102c2610736366004614637565b612e77565b34801561074757600080fd5b5061035d610756366004614c0e565b612e85565b34801561076757600080fd5b5061035d61077636600461477b565b60126020526000908152604090205481565b34801561079457600080fd5b5061035d600a5481565b6102f2613231565b3480156107b257600080fd5b5061035d6107c1366004614c8c565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3480156107f857600080fd5b50610334613627565b34801561080d57600080fd5b506102f261081c36600461477b565b61369a565b34801561082d57600080fd5b506102f26136d5565b60606004805461084590614cba565b80601f016020809104026020016040519081016040528092919081815260200182805461087190614cba565b80156108be5780601f10610893576101008083540402835291602001916108be565b820191906000526020600020905b8154815290600101906020018083116108a157829003601f168201915b5050505050905090565b6000336108d68185856138f8565b60019150505b92915050565b6108ea613905565b6127108211156109295760405162461bcd60e51b8152602060048201526005602482015264216466656560d81b60448201526064015b60405180910390fd5b6127108111156109635760405162461bcd60e51b8152602060048201526005602482015264217766656560d81b6044820152606401610920565b601391909155601455565b6127108111156109a95760405162461bcd60e51b815260040161092090602080825260049082015263021534c560e41b604082015260600190565b600a55565b6000336109bc858285613932565b6109c78585856139aa565b506001949350505050565b60606011805480602002602001604051908101604052809291908181526020016000905b82821015610aec576000848152602090819020604080516080810182526004860290920180546001600160a01b0316835260018101549383019390935260028301805492939291840191610a4990614cba565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7590614cba565b8015610ac25780601f10610a9757610100808354040283529160200191610ac2565b820191906000526020600020905b815481529060010190602001808311610aa557829003601f168201915b50505091835250506003919091015462ffffff1660209182015290825260019290920191016109f6565b50505050905090565b610afd613a09565b60008111610b325760405162461bcd60e51b815260206004820152600260248201526103e360f41b6044820152606401610920565b6040516370a0823160e01b8152336004820152819030906370a0823190602401602060405180830381865afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b939190614cf4565b1015610bd15760405162461bcd60e51b815260206004820152600d60248201526c08525b9cdd59999a58da595b9d609a1b6044820152606401610920565b6000610bdc60035490565b610be883612710614d23565b610bf29190614d3a565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190614d5c565b905060008060005b601154811015610e3c57600060118281548110610c9457610c94614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506127109189916001600160a01b0316906370a0823190602401602060405180830381865afa158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d179190614cf4565b610d219190614d23565b610d2b9190614d3a565b8254600384015460405163a9492aeb60e01b8152929350309263a9492aeb92610d73926001600160a01b03909116918691600289019162ffffff909116908790600401614e0c565b6020604051808303816000875af1925050508015610dae575060408051601f3d908101601f19168201909252610dab91810190614cf4565b60015b15610e2757604051602001610dc290614e53565b6040516020818303038152906040528051906020012083600201604051602001610dec9190614e61565b6040516020818303038152906040528051906020012003610e1857610e118186614ed7565b9450610e25565b610e228187614ed7565b95505b505b50508080610e3490614eea565b915050610c75565b50610e473386613a34565b8015610f0657600061271060145483610e609190614d23565b610e6a9190614d3a565b90506000610e788284614f03565b90508160166000828254610e8c9190614ed7565b909155505060405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f029190614f16565b5050505b811561100257600061271060145484610f1f9190614d23565b610f299190614d3a565b90506000610f378285614f03565b90508160156000828254610f4b9190614ed7565b90915550503360009081526012602052604081205490610f6b8383614ed7565b604051909150600090339083908381818185875af1925050503d8060008114610fb0576040519150601f19603f3d011682016040523d82523d6000602084013e610fb5565b606091505b5050905080610ffc5760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610920565b50505050505b5050505050565b611011613a09565b600081116110465760405162461bcd60e51b815260206004820152600260248201526103e360f41b6044820152606401610920565b6040516370a0823160e01b8152336004820152819030906370a0823190602401602060405180830381865afa158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a79190614cf4565b10156110e45760405162461bcd60e51b815260206004820152600c60248201526b125b9cdd59999a58da595b9d60a21b6044820152606401610920565b60006110ef60035490565b6110fb83612710614d23565b6111059190614d3a565b905060005b60115481101561138a5760006011828154811061112957611129614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506127109186916001600160a01b0316906370a0823190602401602060405180830381865afa158015611188573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ac9190614cf4565b6111b69190614d23565b6111c09190614d3a565b90506000612710601454836111d59190614d23565b6111df9190614d3a565b905060006111ed8284614f03565b845460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af115801561123e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112629190614f16565b508354600385015460405163a9492aeb60e01b8152309263a9492aeb926112a8926001600160a01b0390921691879160028b019162ffffff909116908790600401614e0c565b6020604051808303816000875af19250505080156112e3575060408051601f3d908101601f191682019092526112e091810190614cf4565b60015b15611373576040516020016112f790614e53565b60405160208183030381529060405280519060200120856002016040516020016113219190614e61565b604051602081830303815290604052805190602001200361135957806016600082825461134e9190614ed7565b909155506113719050565b806015600082825461136b9190614ed7565b90915550505b505b50505050808061138290614eea565b91505061110a565b506113953383613a34565b33600090815260126020526040812054612710906113b4908490614d23565b6113be9190614d3a565b905080801561144457604051600090339083908381818185875af1925050503d8060008114611409576040519150601f19603f3d011682016040523d82523d6000602084013e61140e565b606091505b50509050806110025760405162461bcd60e51b81526020600482015260026024820152612a2960f11b6044820152606401610920565b50505050565b6009818154811061145a57600080fd5b600091825260209091206005909102018054600182015460028301546003840180546001600160a01b03948516965092909316939092909161149b90614cba565b80601f01602080910402602001604051908101604052809291908181526020018280546114c790614cba565b80156115145780601f106114e957610100808354040283529160200191611514565b820191906000526020600020905b8154815290600101906020018083116114f757829003601f168201915b5050506004909301549192505062ffffff1685565b604051613b1960f11b602082015260220160405160208183030381529060405280519060200120826040516020016115619190614f33565b6040516020818303038152906040528051906020012003611736576040805160028082526060820183526000926020830190803683375050600654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa1580156115e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160a9190614d5c565b8160008151811061161d5761161d614d79565b60200260200101906001600160a01b031690816001600160a01b031681525050848160018151811061165157611651614d79565b6001600160a01b03928316602091820292909201015260065460405163d06ca61f60e01b8152600092919091169063d06ca61f906116959088908690600401614f4f565b600060405180830381865afa1580156116b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116da9190810190614f70565b90506000612710600a546127106116f19190614f03565b8360018151811061170457611704614d79565b60200260200101516117169190614d23565b6117209190614d3a565b905061172d878783613a6a565b50505050611444565b60405160200161174590614e53565b604051602081830303815290604052805190602001208260405160200161176c9190614f33565b60405160208183030381529060405280519060200120036118d357600654604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa1580156117d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f59190614d5c565b828660405160200161180993929190614ff5565b60408051601f198184030181529082905260085463cdca175360e01b83529092506000916001600160a01b039091169063cdca17539061184f9085908990600401615030565b6020604051808303816000875af115801561186e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118929190614cf4565b90506000612710600a546127106118a99190614f03565b6118b39084614d23565b6118bd9190614d3a565b90506118cb87878684613bcf565b505050611444565b60405162461bcd60e51b815260206004820152600360248201526210aaab60e91b6044820152606401610920565b60005b600954811015611f9e57816001600160a01b03166009828154811061192b5761192b614d79565b60009182526020909120600590910201546001600160a01b031603611f8c5760006009828154811061195f5761195f614d79565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b039081168452600182015416938301939093526002830154908201526003820180549192916060840191906119b990614cba565b80601f01602080910402602001604051908101604052809291908181526020018280546119e590614cba565b8015611a325780601f10611a0757610100808354040283529160200191611a32565b820191906000526020600020905b815481529060010190602001808311611a1557829003601f168201915b50505091835250506004919091015462ffffff16602091820152604051919250611a5c9101614e53565b604051602081830303815290604052805190602001208160600151604051602001611a879190614f33565b6040516020818303038152906040528051906020012003611d7057600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b199190614d5c565b6001600160a01b031663d0e30db082604001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015611b5757600080fd5b505af1158015611b6b573d6000803e3d6000fd5b5050506020830151604080850151606086015160808701519251631ce07ae960e11b81523096506339c0f5d29550611ba7949390600401615052565b600060405180830381600087803b158015611bc157600080fd5b505af1925050508015611bd2575060015b611d43576040805160a0810182523381526020838101516001600160a01b039081169183019182528484015193830193845260608086015190840190815260808087015162ffffff169085015260098054600181018255600091909152845160059091027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180549285166001600160a01b031993841617815594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0820180549190951692169190911790925593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b18201559251919290917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b290910190611cfc90826150d5565b50608091909101516004909101805462ffffff191662ffffff909216919091179055336000908152600d60205260408120805491611d3983614eea565b9190505550611f8a565b611d4c82613d07565b6001600160a01b0383166000908152600d60205260408120805491611d3983615194565b604051613b1960f11b6020820152602201604051602081830303815290604052805190602001208160600151604051602001611dac9190614f33565b6040516020818303038152906040528051906020012003611f8a576040808201516020830151606084015160808501519351631ce07ae960e11b815230946339c0f5d29493611e02939092859290600401615052565b6000604051808303818588803b158015611e1b57600080fd5b505af193505050508015611e2d575060015b611f57576040805160a0810182523381526020838101516001600160a01b039081169183019182528484015193830193845260608086015190840190815260808087015162ffffff169085015260098054600181018255600091909152845160059091027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180549285166001600160a01b031993841617815594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0820180549190951692169190911790925593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b18201559251919290917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b290910190611cfc90826150d5565b611f6082613d07565b6001600160a01b0383166000908152600d60205260408120805491611f8483615194565b91905055505b505b80611f9681614eea565b915050611904565b5050565b611faa613905565b611fb2613e68565b6040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b60606000805b600f5481101561205c57600e6000600f838154811061200f5761200f614d79565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff161561204a578161204681614eea565b9250505b8061205481614eea565b915050611fee565b506000816001600160401b03811115612077576120776147e2565b6040519080825280602002602001820160405280156120a0578160200160208202803683370190505b5090506000805b600f5481101561217057600e6000600f83815481106120c8576120c8614d79565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff161561215e57600f818154811061210857612108614d79565b9060005260206000200160009054906101000a90046001600160a01b031683838151811061213857612138614d79565b6001600160a01b03909216602092830291909101909101528161215a81614eea565b9250505b8061216881614eea565b9150506120a7565b50909392505050565b6010546001600160a01b031633146121c75760405162461bcd60e51b81526020600482015260116024820152702cb7ba9030b932903737ba1037bbb732b960791b6044820152606401610920565b8080156121ed57506001600160a01b0382166000908152600e602052604090205460ff16155b1561225c576001600160a01b0382166000818152600e60205260408120805460ff19166001908117909155600f805491820181559091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020180546001600160a01b03191690911790556122a8565b8015801561228257506001600160a01b0382166000908152600e602052604090205460ff165b156122a8576001600160a01b0382166000908152600e60205260409020805460ff191690555b816001600160a01b03167fa54714518c5d275fdcd3d2a461e4858e4e8cb04fb93cd0bca9d6d34115f26440826040516122e5911515815260200190565b60405180910390a25050565b6011548151600091146123365760405162461bcd60e51b815260206004820152600d60248201526c042e0e4d2c6cae6d8cadccee8d609b1b6044820152606401610920565b6000805b6011548110156124245760006011828154811061235957612359614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa1580156123b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d69190614cf4565b905060008684815181106123ec576123ec614d79565b6020026020010151905080826124029190614d23565b61240c9086614ed7565b9450505050808061241c90614eea565b91505061233a565b5092915050565b612433613905565b60175460ff16156124865760405162461bcd60e51b815260206004820152601c60248201527f74686520636f6e74726163742068617320696e697469616c697a6564000000006044820152606401610920565b868514801561249457508683145b801561249f57508681145b6124da5760405162461bcd60e51b815260206004820152600c60248201526b214d6973736c656e6774687360a01b6044820152606401610920565b6000805b888110156127a4576127108888838181106124fb576124fb614d79565b90506020020135111561253e5760405162461bcd60e51b815260206004820152600b60248201526a2170657263656e7461676560a81b6044820152606401610920565b87878281811061255057612550614d79565b90506020020135826125629190614ed7565b9150601160405180608001604052808c8c8581811061258357612583614d79565b9050602002016020810190612598919061477b565b6001600160a01b031681526020018a8a858181106125b8576125b8614d79565b9050602002013581526020018888858181106125d6576125d6614d79565b90506020028101906125e891906151ab565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200186868581811061263457612634614d79565b905060200201602081019061264991906151f1565b62ffffff1690528154600180820184556000938452602093849020835160049093020180546001600160a01b0319166001600160a01b039093169290921782559282015192810192909255604081015190919060028201906126ab90826150d5565b50606091909101516003909101805462ffffff191662ffffff9092169190911790557fdae6f056932f00933cb66a91f6e0255f17770daa04db2d36869e28ffa46dca638a8a8381811061270057612700614d79565b9050602002016020810190612715919061477b565b89898481811061272757612727614d79565b9050602002013588888581811061274057612740614d79565b905060200281019061275291906151ab565b88888781811061276457612764614d79565b905060200201602081019061277991906151f1565b60405161278a95949392919061520c565b60405180910390a18061279c81614eea565b9150506124de565b5080612710146127f65760405162461bcd60e51b815260206004820181905260248201527f746f74616c2070657263656e746167652073686f756c642062652031303030306044820152606401610920565b50506017805460ff1916600117905550505050505050565b612816613905565b60005b6011548110156129405760006011828154811061283857612838614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa158015612891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b59190614cf4565b825460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015612906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292a9190614f16565b505050808061293890614eea565b915050612819565b50565b61294b613905565b6129556000613eb8565b565b61295f613905565b612967613f08565b6040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602001611fde565b6001600160a01b0381166000908152600d6020526040812054606091906001600160401b038111156129cb576129cb6147e2565b604051908082528060200260200182016040528015612a2357816020015b6040805160a08101825260008082526020808301829052928201819052606080830152608082015282526000199092019101816129e95790505b5090506000805b60095481101561217057846001600160a01b031660098281548110612a5157612a51614d79565b60009182526020909120600590910201546001600160a01b031603612b9e5760098181548110612a8357612a83614d79565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b03908116845260018201541693830193909352600283015490820152600382018054919291606084019190612add90614cba565b80601f0160208091040260200160405190810160405280929190818152602001828054612b0990614cba565b8015612b565780601f10612b2b57610100808354040283529160200191612b56565b820191906000526020600020905b815481529060010190602001808311612b3957829003601f168201915b50505091835250506004919091015462ffffff166020909101528351849084908110612b8457612b84614d79565b60200260200101819052508180612b9a90614eea565b9250505b80612ba881614eea565b915050612a2a565b60606005805461084590614cba565b612bc7613905565b612710831115612c045760405162461bcd60e51b8152602060048201526008602482015267021503e31303030360c41b6044820152606401610920565b6000805b601154811015612d0557856001600160a01b031660118281548110612c2f57612c2f614d79565b60009182526020909120600490910201546001600160a01b031603612cf3578460118281548110612c6257612c62614d79565b9060005260206000209060040201600101819055508360118281548110612c8b57612c8b614d79565b90600052602060002090600402016002019081612ca891906150d5565b508260118281548110612cbd57612cbd614d79565b906000526020600020906004020160030160006101000a81548162ffffff021916908362ffffff16021790555060019150612d05565b80612cfd81614eea565b915050612c08565b50806110025760405162461bcd60e51b815260206004820152600660248201526510ba37b5b2b760d11b6044820152606401610920565b612d44613905565b60155415612de1576015546040516000916001600160a01b038416918381818185875af1925050503d8060008114612d98576040519150601f19603f3d011682016040523d82523d6000602084013e612d9d565b606091505b5050905080612dda5760405162461bcd60e51b815260206004820152600960248201526808c8292988a888aa8960bb1b6044820152606401610920565b5060006015555b60165415612940576000612df3613627565b60165460405163a9059cbb60e01b81526001600160a01b038581166004830152602482019290925291925082169063a9059cbb906044016020604051808303816000875af1158015612e49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6d9190614f16565b5050600060165550565b6000336108d68185856139aa565b604051613b1960f11b60208201526000906022016040516020818303038152906040528051906020012084604051602001612ec09190614f33565b6040516020818303038152906040528051906020012003613087576040805160028082526060820183526000926020830190803683370190505090508681600081518110612f1057612f10614d79565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015612f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8d9190614d5c565b81600181518110612fa057612fa0614d79565b6001600160a01b03928316602091820292909201015260065460405163d06ca61f60e01b8152600092919091169063d06ca61f90612fe4908a908690600401614f4f565b600060405180830381865afa158015613001573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526130299190810190614f70565b90506000612710600a546127106130409190614f03565b8360018151811061305357613053614d79565b60200260200101516130659190614d23565b61306f9190614d3a565b905061307d89898388613f4b565b9350505050613228565b60405160200161309690614e53565b60405160208183030381529060405280519060200120846040516020016130bd9190614f33565b60405160208183030381529060405280519060200120036118d35760008684600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561312f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131539190614d5c565b60405160200161316593929190614ff5565b60408051601f198184030181529082905260085463cdca175360e01b83529092506000916001600160a01b039091169063cdca1753906131ab9085908b90600401615030565b6020604051808303816000875af11580156131ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131ee9190614cf4565b90506000612710600a546127106132059190614f03565b61320f9084614d23565b6132199190614d3a565b905061307d8989888489614143565b95945050505050565b336000908152600e602052604090205460ff166132795760405162461bcd60e51b8152600401610920906020808252600490820152630855d21560e21b604082015260600190565b613281613a09565b600034116132b75760405162461bcd60e51b8152602060048201526003602482015262414d4760e81b6044820152606401610920565b6000612710601354346132ca9190614d23565b6132d49190614d3a565b905060006132e28234614f03565b905081601560008282546132f69190614ed7565b90915550508061335b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e7420616674657220666565206d7573742062652067726561746572604482015269207468616e207a65726f60b01b6064820152608401610920565b613365338261430b565b60005b6011548110156136225760006011828154811061338757613387614d79565b9060005260206000209060040201905060006127108260010154856133ac9190614d23565b6133b69190614d3a565b9050838111156133fc5760405162461bcd60e51b815260206004820152601160248201527063616c4554483c3d616d6f756e7466656560781b6044820152606401610920565b81546003830154604051631ce07ae960e11b815230926339c0f5d292859261343d926001600160a01b031691849160028a019162ffffff1690600401615263565b6000604051808303818588803b15801561345657600080fd5b505af193505050508015613468575060015b61360d57336000908152601260205260408120805483929061348b908490614ed7565b90915550506040805160a08101825233815283546001600160a01b031660208201529081018290526002830180546009929160608301916134cb90614cba565b80601f01602080910402602001604051908101604052809291908181526020018280546134f790614cba565b80156135445780601f1061351957610100808354040283529160200191613544565b820191906000526020600020905b81548152906001019060200180831161352757829003601f168201915b505050918352505060038581015462ffffff16602092830152835460018082018655600095865294839020845160059092020180546001600160a01b03199081166001600160a01b039384161782559385015195810180549094169590911694909417909155604082015160028401556060820151919291908201906135ca90826150d5565b50608091909101516004909101805462ffffff191662ffffff909216919091179055336000908152600d6020526040812080549161360783614eea565b91905055505b5050808061361a90614eea565b915050613368565b505050565b600654604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa158015613671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136959190614d5c565b905090565b6136a2613905565b6001600160a01b0381166136cc57604051631e4fbdf760e01b815260006004820152602401610920565b61294081613eb8565b6136dd613905565b60008060005b6011548110156136225760006011828154811061370257613702614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa15801561375b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377f9190614cf4565b82546003840154919250309163a9492aeb916001600160a01b0316908490600287019062ffffff166137b96000546001600160a01b031690565b6040518663ffffffff1660e01b81526004016137d9959493929190614e0c565b6020604051808303816000875af1925050508015613814575060408051601f3d908101601f1916820190925261381191810190614cf4565b60015b156138e357604051613b1960f11b602082015260220160405160208183030381529060405280519060200120836002016040516020016138549190614e61565b6040516020818303038152906040528051906020012003613880576138798187614ed7565b95506138e1565b60405160200161388f90614e53565b60405160208183030381529060405280519060200120836002016040516020016138b99190614e61565b60405160208183030381529060405280519060200120036138e1576138de8186614ed7565b94505b505b505080806138f090614eea565b9150506136e3565b6136228383836001614341565b6000546001600160a01b031633146129555760405163118cdaa760e01b8152336004820152602401610920565b6001600160a01b038381166000908152600260209081526040808320938616835292905220546000198114611444578181101561399b57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610920565b61144484848484036000614341565b6001600160a01b0383166139d457604051634b637e8f60e11b815260006004820152602401610920565b6001600160a01b0382166139fe5760405163ec442f0560e01b815260006004820152602401610920565b613622838383614416565b600054600160a01b900460ff16156129555760405163d93c066560e01b815260040160405180910390fd5b6001600160a01b038216613a5e57604051634b637e8f60e11b815260006004820152602401610920565b611f9e82600083614416565b604080516002808252606080830184529260009291906020830190803683375050600654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa158015613ad8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613afc9190614d5c565b81600081518110613b0f57613b0f614d79565b60200260200101906001600160a01b031690816001600160a01b0316815250508481600181518110613b4357613b43614d79565b6001600160a01b039283166020918202929092010152600654604051637ff36ab560e01b8152911690637ff36ab5908690613b8890879086903090429060040161528a565b60006040518083038185885af1158015613ba6573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526132289190810190614f70565b6040805161010081018083526006546315ab88c960e31b909152915160009282916001600160a01b039091169063ad5c464890610104808501916020918187030181865afa158015613c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c499190614d5c565b6001600160a01b039081168252878116602083015262ffffff861660408084019190915230606084015242608084015260a0830188905260c08301869052600060e090930192909252600754915163414bf38960e01b8152929350169063414bf389908690613cbc9085906004016152bf565b60206040518083038185885af1158015613cda573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190613cff9190614cf4565b505050505050565b6009548110613d415760405162461bcd60e51b8152602060048201526006602482015265042d2dcc8caf60d31b6044820152606401610920565b60098054613d5190600190614f03565b81548110613d6157613d61614d79565b906000526020600020906005020160098281548110613d8257613d82614d79565b60009182526020909120825460059092020180546001600160a01b039283166001600160a01b031991821617825560018085015490830180549190941691161790915560028083015490820155600380820190613de190840182615328565b506004918201549101805462ffffff191662ffffff9092169190911790556009805480613e1057613e106153fa565b60008281526020812060056000199093019283020180546001600160a01b0319908116825560018201805490911690556002810182905590613e55600383018261456a565b50600401805462ffffff19169055905550565b613e70614540565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001611fde565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b613f10613a09565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613ea03390565b604080516002808252606082018352600092839291906020830190803683370190505090508581600081518110613f8457613f84614d79565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015613fdd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140019190614d5c565b8160018151811061401457614014614d79565b6001600160a01b03928316602091820292909201015260065460405163095ea7b360e01b81529082166004820152602481018790529087169063095ea7b3906044016020604051808303816000875af1158015614075573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140999190614f16565b506006546040516318cbafe560e01b81526000916001600160a01b0316906318cbafe5906140d3908990899087908a904290600401615410565b6000604051808303816000875af11580156140f2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261411a9190810190614f70565b90508060018151811061412f5761412f614d79565b602002602001015192505050949350505050565b600080604051806101000160405280886001600160a01b03168152602001600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141d89190614d5c565b6001600160a01b03908116825262ffffff88166020830152858116604080840191909152426060840152608083018a905260a08301889052600060c090930192909252600754915163095ea7b360e01b81529181166004830152602482018990529192509088169063095ea7b3906044016020604051808303816000875af1158015614268573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061428c9190614f16565b5060075460405163414bf38960e01b81526001600160a01b039091169063414bf389906142bd9084906004016152bf565b6020604051808303816000875af11580156142dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143009190614cf4565b979650505050505050565b6001600160a01b0382166143355760405163ec442f0560e01b815260006004820152602401610920565b611f9e60008383614416565b6001600160a01b03841661436b5760405163e602df0560e01b815260006004820152602401610920565b6001600160a01b03831661439557604051634a1406b160e11b815260006004820152602401610920565b6001600160a01b038085166000908152600260209081526040808320938716835292905220829055801561144457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161440891815260200190565b60405180910390a350505050565b6001600160a01b0383166144415780600360008282546144369190614ed7565b909155506144b39050565b6001600160a01b038316600090815260016020526040902054818110156144945760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610920565b6001600160a01b03841660009081526001602052604090209082900390555b6001600160a01b0382166144cf576003805482900390556144ee565b6001600160a01b03821660009081526001602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161453391815260200190565b60405180910390a3505050565b600054600160a01b900460ff1661295557604051638dfc202b60e01b815260040160405180910390fd5b50805461457690614cba565b6000825580601f10614586575050565b601f01602090049060005260206000209081019061294091905b808211156145b457600081556001016145a0565b5090565b60005b838110156145d35781810151838201526020016145bb565b50506000910152565b600081518084526145f48160208601602086016145b8565b601f01601f19169290920160200192915050565b60208152600061461b60208301846145dc565b9392505050565b6001600160a01b038116811461294057600080fd5b6000806040838503121561464a57600080fd5b823561465581614622565b946020939093013593505050565b6000806040838503121561467657600080fd5b50508035926020909101359150565b60006020828403121561469757600080fd5b5035919050565b6000806000606084860312156146b357600080fd5b83356146be81614622565b925060208401356146ce81614622565b929592945050506040919091013590565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561476d57888303603f19018552815180516001600160a01b03168452878101518885015286810151608088860181905290614747828701826145dc565b60609384015162ffffff1696909301959095525094870194925090860190600101614706565b509098975050505050505050565b60006020828403121561478d57600080fd5b813561461b81614622565b6001600160a01b038681168252851660208201526040810184905260a0606082018190526000906147cb908301856145dc565b905062ffffff831660808301529695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614820576148206147e2565b604052919050565b600082601f83011261483957600080fd5b81356001600160401b03811115614852576148526147e2565b614865601f8201601f19166020016147f8565b81815284602083860101111561487a57600080fd5b816020850160208301376000918101602001919091529392505050565b803562ffffff811681146148aa57600080fd5b919050565b600080600080608085870312156148c557600080fd5b84356148d081614622565b93506020850135925060408501356001600160401b038111156148f257600080fd5b6148fe87828801614828565b92505061490d60608601614897565b905092959194509250565b600081518084526020808501945080840160005b838110156149515781516001600160a01b03168752958201959082019060010161492c565b509495945050505050565b60208152600061461b6020830184614918565b801515811461294057600080fd5b6000806040838503121561499057600080fd5b823561499b81614622565b915060208301356149ab8161496f565b809150509250929050565b60006001600160401b038211156149cf576149cf6147e2565b5060051b60200190565b600060208083850312156149ec57600080fd5b82356001600160401b03811115614a0257600080fd5b8301601f81018513614a1357600080fd5b8035614a26614a21826149b6565b6147f8565b81815260059190911b82018301908381019087831115614a4557600080fd5b928401925b8284101561430057833582529284019290840190614a4a565b60008083601f840112614a7557600080fd5b5081356001600160401b03811115614a8c57600080fd5b6020830191508360208260051b8501011115614aa757600080fd5b9250929050565b6000806000806000806000806080898b031215614aca57600080fd5b88356001600160401b0380821115614ae157600080fd5b614aed8c838d01614a63565b909a50985060208b0135915080821115614b0657600080fd5b614b128c838d01614a63565b909850965060408b0135915080821115614b2b57600080fd5b614b378c838d01614a63565b909650945060608b0135915080821115614b5057600080fd5b50614b5d8b828c01614a63565b999c989b5096995094979396929594505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561476d57888303603f19018552815180516001600160a01b039081168552888201511688850152868101518785015260608082015160a08287018190529190614be7838801826145dc565b60809485015162ffffff169790940196909652505094870194925090860190600101614b98565b600080600080600060a08688031215614c2657600080fd5b8535614c3181614622565b94506020860135935060408601356001600160401b03811115614c5357600080fd5b614c5f88828901614828565b935050614c6e60608701614897565b91506080860135614c7e81614622565b809150509295509295909350565b60008060408385031215614c9f57600080fd5b8235614caa81614622565b915060208301356149ab81614622565b600181811c90821680614cce57607f821691505b602082108103614cee57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215614d0657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176108dc576108dc614d0d565b600082614d5757634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614d6e57600080fd5b815161461b81614622565b634e487b7160e01b600052603260045260246000fd5b60008154614d9c81614cba565b808552602060018381168015614db95760018114614dd357614e01565b60ff1985168884015283151560051b880183019550614e01565b866000528260002060005b85811015614df95781548a8201860152908301908401614dde565b890184019650505b505050505092915050565b600060018060a01b03808816835286602084015260a06040840152614e3460a0840187614d8f565b62ffffff95909516606084015292909216608090910152509392505050565b61763360f01b815260020190565b6000808354614e6f81614cba565b60018281168015614e875760018114614e9c57614ecb565b60ff1984168752821515830287019450614ecb565b8760005260208060002060005b85811015614ec25781548a820152908401908201614ea9565b50505082870194505b50929695505050505050565b808201808211156108dc576108dc614d0d565b600060018201614efc57614efc614d0d565b5060010190565b818103818111156108dc576108dc614d0d565b600060208284031215614f2857600080fd5b815161461b8161496f565b60008251614f458184602087016145b8565b9190910192915050565b828152604060208201526000614f686040830184614918565b949350505050565b60006020808385031215614f8357600080fd5b82516001600160401b03811115614f9957600080fd5b8301601f81018513614faa57600080fd5b8051614fb8614a21826149b6565b81815260059190911b82018301908381019087831115614fd757600080fd5b928401925b8284101561430057835182529284019290840190614fdc565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b60408152600061504360408301856145dc565b90508260208301529392505050565b60018060a01b038516815283602082015260806040820152600061507960808301856145dc565b905062ffffff8316606083015295945050505050565b601f82111561362257600081815260208120601f850160051c810160208610156150b65750805b601f850160051c820191505b81811015613cff578281556001016150c2565b81516001600160401b038111156150ee576150ee6147e2565b615102816150fc8454614cba565b8461508f565b602080601f831160018114615137576000841561511f5750858301515b600019600386901b1c1916600185901b178555613cff565b600085815260208120601f198616915b8281101561516657888601518255948401946001909101908401615147565b50858210156151845787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000816151a3576151a3614d0d565b506000190190565b6000808335601e198436030181126151c257600080fd5b8301803591506001600160401b038211156151dc57600080fd5b602001915036819003821315614aa757600080fd5b60006020828403121561520357600080fd5b61461b82614897565b6001600160a01b0386168152602081018590526080604082018190528101839052828460a0830137600060a08483010152600060a0601f19601f860116830101905062ffffff831660608301529695505050505050565b60018060a01b03851681528360208201526080604082015260006150796080830185614d8f565b8481526080602082015260006152a36080830186614918565b6001600160a01b03949094166040830152506060015292915050565b81516001600160a01b03908116825260208084015182169083015260408084015162ffffff16908301526060808401518216908301526080808401519083015260a0838101519083015260c0808401519083015260e09283015116918101919091526101000190565b818103615333575050565b61533d8254614cba565b6001600160401b03811115615354576153546147e2565b615362816150fc8454614cba565b6000601f821160018114615396576000831561537e5750848201545b600019600385901b1c1916600184901b178455611002565b600085815260209020601f19841690600086815260209020845b838110156153d057828601548255600195860195909101906020016153b0565b50858310156151845793015460001960f8600387901b161c19169092555050600190811b01905550565b634e487b7160e01b600052603160045260246000fd5b85815284602082015260a06040820152600061542f60a0830186614918565b6001600160a01b039490941660608301525060800152939250505056fea264697066735822122030ae60c139bcc506e6ea26409406bd9e6da3b54246661c1d3e6b33ff119ee9c364736f6c63430008140033000000000000000000000000edf6066a2b290c185783862c7f4776a2c8077ad1000000000000000000000000e592427a0aece92de3edee1f18e0157c05861564000000000000000000000000b27308f9f90d607463bb33ea1bebb41c27ce5ab6
Deployed Bytecode
0x6080604052600436106102725760003560e01c806360d274511161014f5780639b19251a116100c1578063d03153aa1161007a578063d03153aa14610788578063d0e30db01461079e578063dd62ed3e146107a6578063df0e0768146107ec578063f2fde38b14610801578063fa3b56491461082157600080fd5b80639b19251a146106ab578063a38e9e66146106db578063a738c7df146106fb578063a9059cbb1461071b578063a9492aeb1461073b578063c38cd0b51461075b57600080fd5b80638456cb59116101135780638456cb591461060a57806386bc55db1461061f57806386c14663146106355780638da5cb5b1461064b57806391ebe50f1461066957806395d89b411461069657600080fd5b806360d2745114610570578063611d126a1461059057806370a08231146105a5578063715018a6146105db57806381a06b73146105f057600080fd5b8063313ce567116101e85780633f4ba83a116101ac5780633f4ba83a146104ba5780634d20d0f8146104cf57806350bfc449146104ef57806353d6fd59146105115780635643a5a7146105315780635c975abb1461055157600080fd5b8063313ce5671461040d57806336a43f2b14610429578063378a653c1461045657806339c0f5d2146104875780633d7526f71461049a57600080fd5b806318160ddd1161023a57806318160ddd1461034c57806323b872dd1461036b5780632a5c792a1461038b5780632c76d7a6146103ad5780632c9351a1146103cd5780632e1a7d4d146103ed57600080fd5b806306fdde0314610277578063095ea7b3146102a25780630b78f9c0146102d2578063117da1ee146102f45780631694505e14610314575b600080fd5b34801561028357600080fd5b5061028c610836565b6040516102999190614608565b60405180910390f35b3480156102ae57600080fd5b506102c26102bd366004614637565b6108c8565b6040519015158152602001610299565b3480156102de57600080fd5b506102f26102ed366004614663565b6108e2565b005b34801561030057600080fd5b506102f261030f366004614685565b61096e565b34801561032057600080fd5b50600654610334906001600160a01b031681565b6040516001600160a01b039091168152602001610299565b34801561035857600080fd5b506003545b604051908152602001610299565b34801561037757600080fd5b506102c261038636600461469e565b6109ae565b34801561039757600080fd5b506103a06109d2565b60405161029991906146df565b3480156103b957600080fd5b50600754610334906001600160a01b031681565b3480156103d957600080fd5b506102f26103e8366004614685565b610af5565b3480156103f957600080fd5b506102f2610408366004614685565b611009565b34801561041957600080fd5b5060405160128152602001610299565b34801561043557600080fd5b5061035d61044436600461477b565b600d6020526000908152604090205481565b34801561046257600080fd5b50610476610471366004614685565b61144a565b604051610299959493929190614798565b6102f26104953660046148af565b611529565b3480156104a657600080fd5b506102f26104b536600461477b565b611901565b3480156104c657600080fd5b506102f2611fa2565b3480156104db57600080fd5b50600854610334906001600160a01b031681565b3480156104fb57600080fd5b50610504611fe8565b604051610299919061495c565b34801561051d57600080fd5b506102f261052c36600461497d565b612179565b34801561053d57600080fd5b5061035d61054c3660046149d9565b6122f1565b34801561055d57600080fd5b50600054600160a01b900460ff166102c2565b34801561057c57600080fd5b506102f261058b366004614aae565b61242b565b34801561059c57600080fd5b506102f261280e565b3480156105b157600080fd5b5061035d6105c036600461477b565b6001600160a01b031660009081526001602052604090205490565b3480156105e757600080fd5b506102f2612943565b3480156105fc57600080fd5b506017546102c29060ff1681565b34801561061657600080fd5b506102f2612957565b34801561062b57600080fd5b5061035d600b5481565b34801561064157600080fd5b5061035d600c5481565b34801561065757600080fd5b506000546001600160a01b0316610334565b34801561067557600080fd5b5061068961068436600461477b565b612997565b6040516102999190614b71565b3480156106a257600080fd5b5061028c612bb0565b3480156106b757600080fd5b506102c26106c636600461477b565b600e6020526000908152604090205460ff1681565b3480156106e757600080fd5b506102f26106f63660046148af565b612bbf565b34801561070757600080fd5b506102f261071636600461477b565b612d3c565b34801561072757600080fd5b506102c2610736366004614637565b612e77565b34801561074757600080fd5b5061035d610756366004614c0e565b612e85565b34801561076757600080fd5b5061035d61077636600461477b565b60126020526000908152604090205481565b34801561079457600080fd5b5061035d600a5481565b6102f2613231565b3480156107b257600080fd5b5061035d6107c1366004614c8c565b6001600160a01b03918216600090815260026020908152604080832093909416825291909152205490565b3480156107f857600080fd5b50610334613627565b34801561080d57600080fd5b506102f261081c36600461477b565b61369a565b34801561082d57600080fd5b506102f26136d5565b60606004805461084590614cba565b80601f016020809104026020016040519081016040528092919081815260200182805461087190614cba565b80156108be5780601f10610893576101008083540402835291602001916108be565b820191906000526020600020905b8154815290600101906020018083116108a157829003601f168201915b5050505050905090565b6000336108d68185856138f8565b60019150505b92915050565b6108ea613905565b6127108211156109295760405162461bcd60e51b8152602060048201526005602482015264216466656560d81b60448201526064015b60405180910390fd5b6127108111156109635760405162461bcd60e51b8152602060048201526005602482015264217766656560d81b6044820152606401610920565b601391909155601455565b6127108111156109a95760405162461bcd60e51b815260040161092090602080825260049082015263021534c560e41b604082015260600190565b600a55565b6000336109bc858285613932565b6109c78585856139aa565b506001949350505050565b60606011805480602002602001604051908101604052809291908181526020016000905b82821015610aec576000848152602090819020604080516080810182526004860290920180546001600160a01b0316835260018101549383019390935260028301805492939291840191610a4990614cba565b80601f0160208091040260200160405190810160405280929190818152602001828054610a7590614cba565b8015610ac25780601f10610a9757610100808354040283529160200191610ac2565b820191906000526020600020905b815481529060010190602001808311610aa557829003601f168201915b50505091835250506003919091015462ffffff1660209182015290825260019290920191016109f6565b50505050905090565b610afd613a09565b60008111610b325760405162461bcd60e51b815260206004820152600260248201526103e360f41b6044820152606401610920565b6040516370a0823160e01b8152336004820152819030906370a0823190602401602060405180830381865afa158015610b6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b939190614cf4565b1015610bd15760405162461bcd60e51b815260206004820152600d60248201526c08525b9cdd59999a58da595b9d609a1b6044820152606401610920565b6000610bdc60035490565b610be883612710614d23565b610bf29190614d3a565b90506000600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c6d9190614d5c565b905060008060005b601154811015610e3c57600060118281548110610c9457610c94614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506127109189916001600160a01b0316906370a0823190602401602060405180830381865afa158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d179190614cf4565b610d219190614d23565b610d2b9190614d3a565b8254600384015460405163a9492aeb60e01b8152929350309263a9492aeb92610d73926001600160a01b03909116918691600289019162ffffff909116908790600401614e0c565b6020604051808303816000875af1925050508015610dae575060408051601f3d908101601f19168201909252610dab91810190614cf4565b60015b15610e2757604051602001610dc290614e53565b6040516020818303038152906040528051906020012083600201604051602001610dec9190614e61565b6040516020818303038152906040528051906020012003610e1857610e118186614ed7565b9450610e25565b610e228187614ed7565b95505b505b50508080610e3490614eea565b915050610c75565b50610e473386613a34565b8015610f0657600061271060145483610e609190614d23565b610e6a9190614d3a565b90506000610e788284614f03565b90508160166000828254610e8c9190614ed7565b909155505060405163a9059cbb60e01b8152336004820152602481018290526001600160a01b0386169063a9059cbb906044016020604051808303816000875af1158015610ede573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f029190614f16565b5050505b811561100257600061271060145484610f1f9190614d23565b610f299190614d3a565b90506000610f378285614f03565b90508160156000828254610f4b9190614ed7565b90915550503360009081526012602052604081205490610f6b8383614ed7565b604051909150600090339083908381818185875af1925050503d8060008114610fb0576040519150601f19603f3d011682016040523d82523d6000602084013e610fb5565b606091505b5050905080610ffc5760405162461bcd60e51b8152602060048201526013602482015272115512081d1c985b9cd9995c8819985a5b1959606a1b6044820152606401610920565b50505050505b5050505050565b611011613a09565b600081116110465760405162461bcd60e51b815260206004820152600260248201526103e360f41b6044820152606401610920565b6040516370a0823160e01b8152336004820152819030906370a0823190602401602060405180830381865afa158015611083573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110a79190614cf4565b10156110e45760405162461bcd60e51b815260206004820152600c60248201526b125b9cdd59999a58da595b9d60a21b6044820152606401610920565b60006110ef60035490565b6110fb83612710614d23565b6111059190614d3a565b905060005b60115481101561138a5760006011828154811061112957611129614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506127109186916001600160a01b0316906370a0823190602401602060405180830381865afa158015611188573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906111ac9190614cf4565b6111b69190614d23565b6111c09190614d3a565b90506000612710601454836111d59190614d23565b6111df9190614d3a565b905060006111ed8284614f03565b845460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af115801561123e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906112629190614f16565b508354600385015460405163a9492aeb60e01b8152309263a9492aeb926112a8926001600160a01b0390921691879160028b019162ffffff909116908790600401614e0c565b6020604051808303816000875af19250505080156112e3575060408051601f3d908101601f191682019092526112e091810190614cf4565b60015b15611373576040516020016112f790614e53565b60405160208183030381529060405280519060200120856002016040516020016113219190614e61565b604051602081830303815290604052805190602001200361135957806016600082825461134e9190614ed7565b909155506113719050565b806015600082825461136b9190614ed7565b90915550505b505b50505050808061138290614eea565b91505061110a565b506113953383613a34565b33600090815260126020526040812054612710906113b4908490614d23565b6113be9190614d3a565b905080801561144457604051600090339083908381818185875af1925050503d8060008114611409576040519150601f19603f3d011682016040523d82523d6000602084013e61140e565b606091505b50509050806110025760405162461bcd60e51b81526020600482015260026024820152612a2960f11b6044820152606401610920565b50505050565b6009818154811061145a57600080fd5b600091825260209091206005909102018054600182015460028301546003840180546001600160a01b03948516965092909316939092909161149b90614cba565b80601f01602080910402602001604051908101604052809291908181526020018280546114c790614cba565b80156115145780601f106114e957610100808354040283529160200191611514565b820191906000526020600020905b8154815290600101906020018083116114f757829003601f168201915b5050506004909301549192505062ffffff1685565b604051613b1960f11b602082015260220160405160208183030381529060405280519060200120826040516020016115619190614f33565b6040516020818303038152906040528051906020012003611736576040805160028082526060820183526000926020830190803683375050600654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa1580156115e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061160a9190614d5c565b8160008151811061161d5761161d614d79565b60200260200101906001600160a01b031690816001600160a01b031681525050848160018151811061165157611651614d79565b6001600160a01b03928316602091820292909201015260065460405163d06ca61f60e01b8152600092919091169063d06ca61f906116959088908690600401614f4f565b600060405180830381865afa1580156116b2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526116da9190810190614f70565b90506000612710600a546127106116f19190614f03565b8360018151811061170457611704614d79565b60200260200101516117169190614d23565b6117209190614d3a565b905061172d878783613a6a565b50505050611444565b60405160200161174590614e53565b604051602081830303815290604052805190602001208260405160200161176c9190614f33565b60405160208183030381529060405280519060200120036118d357600654604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa1580156117d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117f59190614d5c565b828660405160200161180993929190614ff5565b60408051601f198184030181529082905260085463cdca175360e01b83529092506000916001600160a01b039091169063cdca17539061184f9085908990600401615030565b6020604051808303816000875af115801561186e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118929190614cf4565b90506000612710600a546127106118a99190614f03565b6118b39084614d23565b6118bd9190614d3a565b90506118cb87878684613bcf565b505050611444565b60405162461bcd60e51b815260206004820152600360248201526210aaab60e91b6044820152606401610920565b60005b600954811015611f9e57816001600160a01b03166009828154811061192b5761192b614d79565b60009182526020909120600590910201546001600160a01b031603611f8c5760006009828154811061195f5761195f614d79565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b039081168452600182015416938301939093526002830154908201526003820180549192916060840191906119b990614cba565b80601f01602080910402602001604051908101604052809291908181526020018280546119e590614cba565b8015611a325780601f10611a0757610100808354040283529160200191611a32565b820191906000526020600020905b815481529060010190602001808311611a1557829003601f168201915b50505091835250506004919091015462ffffff16602091820152604051919250611a5c9101614e53565b604051602081830303815290604052805190602001208160600151604051602001611a879190614f33565b6040516020818303038152906040528051906020012003611d7057600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa158015611af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b199190614d5c565b6001600160a01b031663d0e30db082604001516040518263ffffffff1660e01b81526004016000604051808303818588803b158015611b5757600080fd5b505af1158015611b6b573d6000803e3d6000fd5b5050506020830151604080850151606086015160808701519251631ce07ae960e11b81523096506339c0f5d29550611ba7949390600401615052565b600060405180830381600087803b158015611bc157600080fd5b505af1925050508015611bd2575060015b611d43576040805160a0810182523381526020838101516001600160a01b039081169183019182528484015193830193845260608086015190840190815260808087015162ffffff169085015260098054600181018255600091909152845160059091027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180549285166001600160a01b031993841617815594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0820180549190951692169190911790925593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b18201559251919290917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b290910190611cfc90826150d5565b50608091909101516004909101805462ffffff191662ffffff909216919091179055336000908152600d60205260408120805491611d3983614eea565b9190505550611f8a565b611d4c82613d07565b6001600160a01b0383166000908152600d60205260408120805491611d3983615194565b604051613b1960f11b6020820152602201604051602081830303815290604052805190602001208160600151604051602001611dac9190614f33565b6040516020818303038152906040528051906020012003611f8a576040808201516020830151606084015160808501519351631ce07ae960e11b815230946339c0f5d29493611e02939092859290600401615052565b6000604051808303818588803b158015611e1b57600080fd5b505af193505050508015611e2d575060015b611f57576040805160a0810182523381526020838101516001600160a01b039081169183019182528484015193830193845260608086015190840190815260808087015162ffffff169085015260098054600181018255600091909152845160059091027f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7af810180549285166001600160a01b031993841617815594517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b0820180549190951692169190911790925593517f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b18201559251919290917f6e1540171b6c0c960b71a7020d9f60077f6af931a8bbf590da0223dacf75c7b290910190611cfc90826150d5565b611f6082613d07565b6001600160a01b0383166000908152600d60205260408120805491611f8483615194565b91905055505b505b80611f9681614eea565b915050611904565b5050565b611faa613905565b611fb2613e68565b6040513381527f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa906020015b60405180910390a1565b60606000805b600f5481101561205c57600e6000600f838154811061200f5761200f614d79565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff161561204a578161204681614eea565b9250505b8061205481614eea565b915050611fee565b506000816001600160401b03811115612077576120776147e2565b6040519080825280602002602001820160405280156120a0578160200160208202803683370190505b5090506000805b600f5481101561217057600e6000600f83815481106120c8576120c8614d79565b60009182526020808320909101546001600160a01b0316835282019290925260400190205460ff161561215e57600f818154811061210857612108614d79565b9060005260206000200160009054906101000a90046001600160a01b031683838151811061213857612138614d79565b6001600160a01b03909216602092830291909101909101528161215a81614eea565b9250505b8061216881614eea565b9150506120a7565b50909392505050565b6010546001600160a01b031633146121c75760405162461bcd60e51b81526020600482015260116024820152702cb7ba9030b932903737ba1037bbb732b960791b6044820152606401610920565b8080156121ed57506001600160a01b0382166000908152600e602052604090205460ff16155b1561225c576001600160a01b0382166000818152600e60205260408120805460ff19166001908117909155600f805491820181559091527f8d1108e10bcb7c27dddfc02ed9d693a074039d026cf4ea4240b40f7d581ac8020180546001600160a01b03191690911790556122a8565b8015801561228257506001600160a01b0382166000908152600e602052604090205460ff165b156122a8576001600160a01b0382166000908152600e60205260409020805460ff191690555b816001600160a01b03167fa54714518c5d275fdcd3d2a461e4858e4e8cb04fb93cd0bca9d6d34115f26440826040516122e5911515815260200190565b60405180910390a25050565b6011548151600091146123365760405162461bcd60e51b815260206004820152600d60248201526c042e0e4d2c6cae6d8cadccee8d609b1b6044820152606401610920565b6000805b6011548110156124245760006011828154811061235957612359614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa1580156123b2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d69190614cf4565b905060008684815181106123ec576123ec614d79565b6020026020010151905080826124029190614d23565b61240c9086614ed7565b9450505050808061241c90614eea565b91505061233a565b5092915050565b612433613905565b60175460ff16156124865760405162461bcd60e51b815260206004820152601c60248201527f74686520636f6e74726163742068617320696e697469616c697a6564000000006044820152606401610920565b868514801561249457508683145b801561249f57508681145b6124da5760405162461bcd60e51b815260206004820152600c60248201526b214d6973736c656e6774687360a01b6044820152606401610920565b6000805b888110156127a4576127108888838181106124fb576124fb614d79565b90506020020135111561253e5760405162461bcd60e51b815260206004820152600b60248201526a2170657263656e7461676560a81b6044820152606401610920565b87878281811061255057612550614d79565b90506020020135826125629190614ed7565b9150601160405180608001604052808c8c8581811061258357612583614d79565b9050602002016020810190612598919061477b565b6001600160a01b031681526020018a8a858181106125b8576125b8614d79565b9050602002013581526020018888858181106125d6576125d6614d79565b90506020028101906125e891906151ab565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200186868581811061263457612634614d79565b905060200201602081019061264991906151f1565b62ffffff1690528154600180820184556000938452602093849020835160049093020180546001600160a01b0319166001600160a01b039093169290921782559282015192810192909255604081015190919060028201906126ab90826150d5565b50606091909101516003909101805462ffffff191662ffffff9092169190911790557fdae6f056932f00933cb66a91f6e0255f17770daa04db2d36869e28ffa46dca638a8a8381811061270057612700614d79565b9050602002016020810190612715919061477b565b89898481811061272757612727614d79565b9050602002013588888581811061274057612740614d79565b905060200281019061275291906151ab565b88888781811061276457612764614d79565b905060200201602081019061277991906151f1565b60405161278a95949392919061520c565b60405180910390a18061279c81614eea565b9150506124de565b5080612710146127f65760405162461bcd60e51b815260206004820181905260248201527f746f74616c2070657263656e746167652073686f756c642062652031303030306044820152606401610920565b50506017805460ff1916600117905550505050505050565b612816613905565b60005b6011548110156129405760006011828154811061283857612838614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa158015612891573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128b59190614cf4565b825460405163a9059cbb60e01b8152336004820152602481018390529192506001600160a01b03169063a9059cbb906044016020604051808303816000875af1158015612906573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061292a9190614f16565b505050808061293890614eea565b915050612819565b50565b61294b613905565b6129556000613eb8565b565b61295f613905565b612967613f08565b6040513381527f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a25890602001611fde565b6001600160a01b0381166000908152600d6020526040812054606091906001600160401b038111156129cb576129cb6147e2565b604051908082528060200260200182016040528015612a2357816020015b6040805160a08101825260008082526020808301829052928201819052606080830152608082015282526000199092019101816129e95790505b5090506000805b60095481101561217057846001600160a01b031660098281548110612a5157612a51614d79565b60009182526020909120600590910201546001600160a01b031603612b9e5760098181548110612a8357612a83614d79565b60009182526020918290206040805160a081018252600590930290910180546001600160a01b03908116845260018201541693830193909352600283015490820152600382018054919291606084019190612add90614cba565b80601f0160208091040260200160405190810160405280929190818152602001828054612b0990614cba565b8015612b565780601f10612b2b57610100808354040283529160200191612b56565b820191906000526020600020905b815481529060010190602001808311612b3957829003601f168201915b50505091835250506004919091015462ffffff166020909101528351849084908110612b8457612b84614d79565b60200260200101819052508180612b9a90614eea565b9250505b80612ba881614eea565b915050612a2a565b60606005805461084590614cba565b612bc7613905565b612710831115612c045760405162461bcd60e51b8152602060048201526008602482015267021503e31303030360c41b6044820152606401610920565b6000805b601154811015612d0557856001600160a01b031660118281548110612c2f57612c2f614d79565b60009182526020909120600490910201546001600160a01b031603612cf3578460118281548110612c6257612c62614d79565b9060005260206000209060040201600101819055508360118281548110612c8b57612c8b614d79565b90600052602060002090600402016002019081612ca891906150d5565b508260118281548110612cbd57612cbd614d79565b906000526020600020906004020160030160006101000a81548162ffffff021916908362ffffff16021790555060019150612d05565b80612cfd81614eea565b915050612c08565b50806110025760405162461bcd60e51b815260206004820152600660248201526510ba37b5b2b760d11b6044820152606401610920565b612d44613905565b60155415612de1576015546040516000916001600160a01b038416918381818185875af1925050503d8060008114612d98576040519150601f19603f3d011682016040523d82523d6000602084013e612d9d565b606091505b5050905080612dda5760405162461bcd60e51b815260206004820152600960248201526808c8292988a888aa8960bb1b6044820152606401610920565b5060006015555b60165415612940576000612df3613627565b60165460405163a9059cbb60e01b81526001600160a01b038581166004830152602482019290925291925082169063a9059cbb906044016020604051808303816000875af1158015612e49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612e6d9190614f16565b5050600060165550565b6000336108d68185856139aa565b604051613b1960f11b60208201526000906022016040516020818303038152906040528051906020012084604051602001612ec09190614f33565b6040516020818303038152906040528051906020012003613087576040805160028082526060820183526000926020830190803683370190505090508681600081518110612f1057612f10614d79565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015612f69573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f8d9190614d5c565b81600181518110612fa057612fa0614d79565b6001600160a01b03928316602091820292909201015260065460405163d06ca61f60e01b8152600092919091169063d06ca61f90612fe4908a908690600401614f4f565b600060405180830381865afa158015613001573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526130299190810190614f70565b90506000612710600a546127106130409190614f03565b8360018151811061305357613053614d79565b60200260200101516130659190614d23565b61306f9190614d3a565b905061307d89898388613f4b565b9350505050613228565b60405160200161309690614e53565b60405160208183030381529060405280519060200120846040516020016130bd9190614f33565b60405160208183030381529060405280519060200120036118d35760008684600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa15801561312f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131539190614d5c565b60405160200161316593929190614ff5565b60408051601f198184030181529082905260085463cdca175360e01b83529092506000916001600160a01b039091169063cdca1753906131ab9085908b90600401615030565b6020604051808303816000875af11580156131ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906131ee9190614cf4565b90506000612710600a546127106132059190614f03565b61320f9084614d23565b6132199190614d3a565b905061307d8989888489614143565b95945050505050565b336000908152600e602052604090205460ff166132795760405162461bcd60e51b8152600401610920906020808252600490820152630855d21560e21b604082015260600190565b613281613a09565b600034116132b75760405162461bcd60e51b8152602060048201526003602482015262414d4760e81b6044820152606401610920565b6000612710601354346132ca9190614d23565b6132d49190614d3a565b905060006132e28234614f03565b905081601560008282546132f69190614ed7565b90915550508061335b5760405162461bcd60e51b815260206004820152602a60248201527f416d6f756e7420616674657220666565206d7573742062652067726561746572604482015269207468616e207a65726f60b01b6064820152608401610920565b613365338261430b565b60005b6011548110156136225760006011828154811061338757613387614d79565b9060005260206000209060040201905060006127108260010154856133ac9190614d23565b6133b69190614d3a565b9050838111156133fc5760405162461bcd60e51b815260206004820152601160248201527063616c4554483c3d616d6f756e7466656560781b6044820152606401610920565b81546003830154604051631ce07ae960e11b815230926339c0f5d292859261343d926001600160a01b031691849160028a019162ffffff1690600401615263565b6000604051808303818588803b15801561345657600080fd5b505af193505050508015613468575060015b61360d57336000908152601260205260408120805483929061348b908490614ed7565b90915550506040805160a08101825233815283546001600160a01b031660208201529081018290526002830180546009929160608301916134cb90614cba565b80601f01602080910402602001604051908101604052809291908181526020018280546134f790614cba565b80156135445780601f1061351957610100808354040283529160200191613544565b820191906000526020600020905b81548152906001019060200180831161352757829003601f168201915b505050918352505060038581015462ffffff16602092830152835460018082018655600095865294839020845160059092020180546001600160a01b03199081166001600160a01b039384161782559385015195810180549094169590911694909417909155604082015160028401556060820151919291908201906135ca90826150d5565b50608091909101516004909101805462ffffff191662ffffff909216919091179055336000908152600d6020526040812080549161360783614eea565b91905055505b5050808061361a90614eea565b915050613368565b505050565b600654604080516315ab88c960e31b815290516000926001600160a01b03169163ad5c46489160048083019260209291908290030181865afa158015613671573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906136959190614d5c565b905090565b6136a2613905565b6001600160a01b0381166136cc57604051631e4fbdf760e01b815260006004820152602401610920565b61294081613eb8565b6136dd613905565b60008060005b6011548110156136225760006011828154811061370257613702614d79565b60009182526020822060049182020180546040516370a0823160e01b815230938101939093529093506001600160a01b0316906370a0823190602401602060405180830381865afa15801561375b573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061377f9190614cf4565b82546003840154919250309163a9492aeb916001600160a01b0316908490600287019062ffffff166137b96000546001600160a01b031690565b6040518663ffffffff1660e01b81526004016137d9959493929190614e0c565b6020604051808303816000875af1925050508015613814575060408051601f3d908101601f1916820190925261381191810190614cf4565b60015b156138e357604051613b1960f11b602082015260220160405160208183030381529060405280519060200120836002016040516020016138549190614e61565b6040516020818303038152906040528051906020012003613880576138798187614ed7565b95506138e1565b60405160200161388f90614e53565b60405160208183030381529060405280519060200120836002016040516020016138b99190614e61565b60405160208183030381529060405280519060200120036138e1576138de8186614ed7565b94505b505b505080806138f090614eea565b9150506136e3565b6136228383836001614341565b6000546001600160a01b031633146129555760405163118cdaa760e01b8152336004820152602401610920565b6001600160a01b038381166000908152600260209081526040808320938616835292905220546000198114611444578181101561399b57604051637dc7a0d960e11b81526001600160a01b03841660048201526024810182905260448101839052606401610920565b61144484848484036000614341565b6001600160a01b0383166139d457604051634b637e8f60e11b815260006004820152602401610920565b6001600160a01b0382166139fe5760405163ec442f0560e01b815260006004820152602401610920565b613622838383614416565b600054600160a01b900460ff16156129555760405163d93c066560e01b815260040160405180910390fd5b6001600160a01b038216613a5e57604051634b637e8f60e11b815260006004820152602401610920565b611f9e82600083614416565b604080516002808252606080830184529260009291906020830190803683375050600654604080516315ab88c960e31b815290519394506001600160a01b039091169263ad5c4648925060048083019260209291908290030181865afa158015613ad8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613afc9190614d5c565b81600081518110613b0f57613b0f614d79565b60200260200101906001600160a01b031690816001600160a01b0316815250508481600181518110613b4357613b43614d79565b6001600160a01b039283166020918202929092010152600654604051637ff36ab560e01b8152911690637ff36ab5908690613b8890879086903090429060040161528a565b60006040518083038185885af1158015613ba6573d6000803e3d6000fd5b50505050506040513d6000823e601f3d908101601f191682016040526132289190810190614f70565b6040805161010081018083526006546315ab88c960e31b909152915160009282916001600160a01b039091169063ad5c464890610104808501916020918187030181865afa158015613c25573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613c499190614d5c565b6001600160a01b039081168252878116602083015262ffffff861660408084019190915230606084015242608084015260a0830188905260c08301869052600060e090930192909252600754915163414bf38960e01b8152929350169063414bf389908690613cbc9085906004016152bf565b60206040518083038185885af1158015613cda573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190613cff9190614cf4565b505050505050565b6009548110613d415760405162461bcd60e51b8152602060048201526006602482015265042d2dcc8caf60d31b6044820152606401610920565b60098054613d5190600190614f03565b81548110613d6157613d61614d79565b906000526020600020906005020160098281548110613d8257613d82614d79565b60009182526020909120825460059092020180546001600160a01b039283166001600160a01b031991821617825560018085015490830180549190941691161790915560028083015490820155600380820190613de190840182615328565b506004918201549101805462ffffff191662ffffff9092169190911790556009805480613e1057613e106153fa565b60008281526020812060056000199093019283020180546001600160a01b0319908116825560018201805490911690556002810182905590613e55600383018261456a565b50600401805462ffffff19169055905550565b613e70614540565b6000805460ff60a01b191690557f5db9ee0a495bf2e6ff9c91a7834c1ba4fdd244a5e8aa4e537bd38aeae4b073aa335b6040516001600160a01b039091168152602001611fde565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b613f10613a09565b6000805460ff60a01b1916600160a01b1790557f62e78cea01bee320cd4e420270b5ea74000d11b0c9f74754ebdbfc544b05a258613ea03390565b604080516002808252606082018352600092839291906020830190803683370190505090508581600081518110613f8457613f84614d79565b6001600160a01b03928316602091820292909201810191909152600654604080516315ab88c960e31b81529051919093169263ad5c46489260048083019391928290030181865afa158015613fdd573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140019190614d5c565b8160018151811061401457614014614d79565b6001600160a01b03928316602091820292909201015260065460405163095ea7b360e01b81529082166004820152602481018790529087169063095ea7b3906044016020604051808303816000875af1158015614075573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906140999190614f16565b506006546040516318cbafe560e01b81526000916001600160a01b0316906318cbafe5906140d3908990899087908a904290600401615410565b6000604051808303816000875af11580156140f2573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261411a9190810190614f70565b90508060018151811061412f5761412f614d79565b602002602001015192505050949350505050565b600080604051806101000160405280886001600160a01b03168152602001600660009054906101000a90046001600160a01b03166001600160a01b031663ad5c46486040518163ffffffff1660e01b8152600401602060405180830381865afa1580156141b4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906141d89190614d5c565b6001600160a01b03908116825262ffffff88166020830152858116604080840191909152426060840152608083018a905260a08301889052600060c090930192909252600754915163095ea7b360e01b81529181166004830152602482018990529192509088169063095ea7b3906044016020604051808303816000875af1158015614268573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061428c9190614f16565b5060075460405163414bf38960e01b81526001600160a01b039091169063414bf389906142bd9084906004016152bf565b6020604051808303816000875af11580156142dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906143009190614cf4565b979650505050505050565b6001600160a01b0382166143355760405163ec442f0560e01b815260006004820152602401610920565b611f9e60008383614416565b6001600160a01b03841661436b5760405163e602df0560e01b815260006004820152602401610920565b6001600160a01b03831661439557604051634a1406b160e11b815260006004820152602401610920565b6001600160a01b038085166000908152600260209081526040808320938716835292905220829055801561144457826001600160a01b0316846001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258460405161440891815260200190565b60405180910390a350505050565b6001600160a01b0383166144415780600360008282546144369190614ed7565b909155506144b39050565b6001600160a01b038316600090815260016020526040902054818110156144945760405163391434e360e21b81526001600160a01b03851660048201526024810182905260448101839052606401610920565b6001600160a01b03841660009081526001602052604090209082900390555b6001600160a01b0382166144cf576003805482900390556144ee565b6001600160a01b03821660009081526001602052604090208054820190555b816001600160a01b0316836001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8360405161453391815260200190565b60405180910390a3505050565b600054600160a01b900460ff1661295557604051638dfc202b60e01b815260040160405180910390fd5b50805461457690614cba565b6000825580601f10614586575050565b601f01602090049060005260206000209081019061294091905b808211156145b457600081556001016145a0565b5090565b60005b838110156145d35781810151838201526020016145bb565b50506000910152565b600081518084526145f48160208601602086016145b8565b601f01601f19169290920160200192915050565b60208152600061461b60208301846145dc565b9392505050565b6001600160a01b038116811461294057600080fd5b6000806040838503121561464a57600080fd5b823561465581614622565b946020939093013593505050565b6000806040838503121561467657600080fd5b50508035926020909101359150565b60006020828403121561469757600080fd5b5035919050565b6000806000606084860312156146b357600080fd5b83356146be81614622565b925060208401356146ce81614622565b929592945050506040919091013590565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561476d57888303603f19018552815180516001600160a01b03168452878101518885015286810151608088860181905290614747828701826145dc565b60609384015162ffffff1696909301959095525094870194925090860190600101614706565b509098975050505050505050565b60006020828403121561478d57600080fd5b813561461b81614622565b6001600160a01b038681168252851660208201526040810184905260a0606082018190526000906147cb908301856145dc565b905062ffffff831660808301529695505050505050565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f191681016001600160401b0381118282101715614820576148206147e2565b604052919050565b600082601f83011261483957600080fd5b81356001600160401b03811115614852576148526147e2565b614865601f8201601f19166020016147f8565b81815284602083860101111561487a57600080fd5b816020850160208301376000918101602001919091529392505050565b803562ffffff811681146148aa57600080fd5b919050565b600080600080608085870312156148c557600080fd5b84356148d081614622565b93506020850135925060408501356001600160401b038111156148f257600080fd5b6148fe87828801614828565b92505061490d60608601614897565b905092959194509250565b600081518084526020808501945080840160005b838110156149515781516001600160a01b03168752958201959082019060010161492c565b509495945050505050565b60208152600061461b6020830184614918565b801515811461294057600080fd5b6000806040838503121561499057600080fd5b823561499b81614622565b915060208301356149ab8161496f565b809150509250929050565b60006001600160401b038211156149cf576149cf6147e2565b5060051b60200190565b600060208083850312156149ec57600080fd5b82356001600160401b03811115614a0257600080fd5b8301601f81018513614a1357600080fd5b8035614a26614a21826149b6565b6147f8565b81815260059190911b82018301908381019087831115614a4557600080fd5b928401925b8284101561430057833582529284019290840190614a4a565b60008083601f840112614a7557600080fd5b5081356001600160401b03811115614a8c57600080fd5b6020830191508360208260051b8501011115614aa757600080fd5b9250929050565b6000806000806000806000806080898b031215614aca57600080fd5b88356001600160401b0380821115614ae157600080fd5b614aed8c838d01614a63565b909a50985060208b0135915080821115614b0657600080fd5b614b128c838d01614a63565b909850965060408b0135915080821115614b2b57600080fd5b614b378c838d01614a63565b909650945060608b0135915080821115614b5057600080fd5b50614b5d8b828c01614a63565b999c989b5096995094979396929594505050565b60006020808301818452808551808352604092508286019150828160051b87010184880160005b8381101561476d57888303603f19018552815180516001600160a01b039081168552888201511688850152868101518785015260608082015160a08287018190529190614be7838801826145dc565b60809485015162ffffff169790940196909652505094870194925090860190600101614b98565b600080600080600060a08688031215614c2657600080fd5b8535614c3181614622565b94506020860135935060408601356001600160401b03811115614c5357600080fd5b614c5f88828901614828565b935050614c6e60608701614897565b91506080860135614c7e81614622565b809150509295509295909350565b60008060408385031215614c9f57600080fd5b8235614caa81614622565b915060208301356149ab81614622565b600181811c90821680614cce57607f821691505b602082108103614cee57634e487b7160e01b600052602260045260246000fd5b50919050565b600060208284031215614d0657600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176108dc576108dc614d0d565b600082614d5757634e487b7160e01b600052601260045260246000fd5b500490565b600060208284031215614d6e57600080fd5b815161461b81614622565b634e487b7160e01b600052603260045260246000fd5b60008154614d9c81614cba565b808552602060018381168015614db95760018114614dd357614e01565b60ff1985168884015283151560051b880183019550614e01565b866000528260002060005b85811015614df95781548a8201860152908301908401614dde565b890184019650505b505050505092915050565b600060018060a01b03808816835286602084015260a06040840152614e3460a0840187614d8f565b62ffffff95909516606084015292909216608090910152509392505050565b61763360f01b815260020190565b6000808354614e6f81614cba565b60018281168015614e875760018114614e9c57614ecb565b60ff1984168752821515830287019450614ecb565b8760005260208060002060005b85811015614ec25781548a820152908401908201614ea9565b50505082870194505b50929695505050505050565b808201808211156108dc576108dc614d0d565b600060018201614efc57614efc614d0d565b5060010190565b818103818111156108dc576108dc614d0d565b600060208284031215614f2857600080fd5b815161461b8161496f565b60008251614f458184602087016145b8565b9190910192915050565b828152604060208201526000614f686040830184614918565b949350505050565b60006020808385031215614f8357600080fd5b82516001600160401b03811115614f9957600080fd5b8301601f81018513614faa57600080fd5b8051614fb8614a21826149b6565b81815260059190911b82018301908381019087831115614fd757600080fd5b928401925b8284101561430057835182529284019290840190614fdc565b606093841b6bffffffffffffffffffffffff19908116825260e89390931b6001600160e81b0319166014820152921b166017820152602b0190565b60408152600061504360408301856145dc565b90508260208301529392505050565b60018060a01b038516815283602082015260806040820152600061507960808301856145dc565b905062ffffff8316606083015295945050505050565b601f82111561362257600081815260208120601f850160051c810160208610156150b65750805b601f850160051c820191505b81811015613cff578281556001016150c2565b81516001600160401b038111156150ee576150ee6147e2565b615102816150fc8454614cba565b8461508f565b602080601f831160018114615137576000841561511f5750858301515b600019600386901b1c1916600185901b178555613cff565b600085815260208120601f198616915b8281101561516657888601518255948401946001909101908401615147565b50858210156151845787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b6000816151a3576151a3614d0d565b506000190190565b6000808335601e198436030181126151c257600080fd5b8301803591506001600160401b038211156151dc57600080fd5b602001915036819003821315614aa757600080fd5b60006020828403121561520357600080fd5b61461b82614897565b6001600160a01b0386168152602081018590526080604082018190528101839052828460a0830137600060a08483010152600060a0601f19601f860116830101905062ffffff831660608301529695505050505050565b60018060a01b03851681528360208201526080604082015260006150796080830185614d8f565b8481526080602082015260006152a36080830186614918565b6001600160a01b03949094166040830152506060015292915050565b81516001600160a01b03908116825260208084015182169083015260408084015162ffffff16908301526060808401518216908301526080808401519083015260a0838101519083015260c0808401519083015260e09283015116918101919091526101000190565b818103615333575050565b61533d8254614cba565b6001600160401b03811115615354576153546147e2565b615362816150fc8454614cba565b6000601f821160018114615396576000831561537e5750848201545b600019600385901b1c1916600184901b178455611002565b600085815260209020601f19841690600086815260209020845b838110156153d057828601548255600195860195909101906020016153b0565b50858310156151845793015460001960f8600387901b161c19169092555050600190811b01905550565b634e487b7160e01b600052603160045260246000fd5b85815284602082015260a06040820152600061542f60a0830186614918565b6001600160a01b039490941660608301525060800152939250505056fea264697066735822122030ae60c139bcc506e6ea26409406bd9e6da3b54246661c1d3e6b33ff119ee9c364736f6c63430008140033
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.217547 | 0.00001 | $0.000002 |
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.