Feature Tip: Add private address tag to any address under My Name Tag !
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 54 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Collect | 17777625 | 550 days ago | IN | 0 ETH | 0.00754638 | ||||
Increase Liquidi... | 17009674 | 658 days ago | IN | 0 ETH | 0.00492844 | ||||
Collect | 17009665 | 658 days ago | IN | 0 ETH | 0.00503574 | ||||
Increase Liquidi... | 16851732 | 680 days ago | IN | 0 ETH | 0.00489757 | ||||
Collect | 16851726 | 680 days ago | IN | 0 ETH | 0.00452749 | ||||
Increase Liquidi... | 16710021 | 700 days ago | IN | 0 ETH | 0.00444964 | ||||
Collect | 16710014 | 700 days ago | IN | 0 ETH | 0.00494865 | ||||
Increase Liquidi... | 16620042 | 713 days ago | IN | 0 ETH | 0.00647196 | ||||
Exact Output | 16620035 | 713 days ago | IN | 0 ETH | 0.00445924 | ||||
Collect | 16620013 | 713 days ago | IN | 0 ETH | 0.00556082 | ||||
Increase Liquidi... | 16352264 | 750 days ago | IN | 0 ETH | 0.00332822 | ||||
Collect | 16352255 | 750 days ago | IN | 0 ETH | 0.00369843 | ||||
Increase Liquidi... | 16161342 | 777 days ago | IN | 0 ETH | 0.00704282 | ||||
Exact Input | 16161320 | 777 days ago | IN | 0 ETH | 0.00259777 | ||||
Collect | 16161062 | 777 days ago | IN | 0 ETH | 0.00297299 | ||||
Increase Liquidi... | 15951652 | 806 days ago | IN | 0 ETH | 0.00418652 | ||||
Exact Input | 15943974 | 807 days ago | IN | 0 ETH | 0.00382286 | ||||
Collect | 15943914 | 807 days ago | IN | 0 ETH | 0.00432282 | ||||
Increase Liquidi... | 15833257 | 822 days ago | IN | 0 ETH | 0.00808924 | ||||
Collect | 15828993 | 823 days ago | IN | 0 ETH | 0.00266604 | ||||
Mint | 15481581 | 873 days ago | IN | 0 ETH | 0.00763229 | ||||
Multicall | 15450345 | 878 days ago | IN | 0 ETH | 0.00305699 | ||||
Increase Liquidi... | 15304769 | 901 days ago | IN | 0 ETH | 0.00773036 | ||||
Exact Input | 15304755 | 901 days ago | IN | 0 ETH | 0.00306772 | ||||
Collect | 15304610 | 901 days ago | IN | 0 ETH | 0.00195581 |
Advanced mode: Intended for advanced users or developers and will display all Internal Transactions including zero value transfers. Name tag integration is not available in advanced view.
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
||||
---|---|---|---|---|---|---|---|
17781818 | 549 days ago | 0 ETH | |||||
17781818 | 549 days ago | 0 ETH | |||||
17781818 | 549 days ago | 0 ETH | |||||
17781818 | 549 days ago | 0 ETH | |||||
17781818 | 549 days ago | 0 ETH | |||||
17781818 | 549 days ago | 0 ETH | |||||
17781818 | 549 days ago | 0 ETH | |||||
17781818 | 549 days ago | 0 ETH | |||||
17781818 | 549 days ago | 0 ETH | |||||
17781818 | 549 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH | |||||
17777631 | 550 days ago | 0 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
AutoLiquidity
Compiler Version
v0.7.6+commit.7338295f
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "../interfaces/IVault.sol"; import "../libraries/ERC20Extends.sol"; import "../libraries/UniV3PMExtends.sol"; import "../storage/SmartPoolStorage.sol"; import "./UniV3Liquidity.sol"; pragma abicoder v2; /// @title Position Management /// @notice Provide asset operation functions, allow authorized identities to perform asset operations, and achieve the purpose of increasing the net value of the Vault contract AutoLiquidity is UniV3Liquidity { using SafeMath for uint256; using SafeERC20 for IERC20; using EnumerableSet for EnumerableSet.UintSet; using EnumerableSet for EnumerableSet.AddressSet; using UniV3SwapExtends for mapping(address => mapping(address => bytes)); //Vault purchase and redemption token IERC20 public ioToken; //Vault contract address IVault public vault; //Underlying asset EnumerableSet.AddressSet internal underlyings; event TakeFee(SmartPoolStorage.FeeType ft, address token, address rewards, uint256 fee); /// @notice Binding vaults and subscription redemption token /// @dev Only bind once and cannot be modified /// @param _vault Vault address /// @param _ioToken Subscription and redemption token function bind(address _vault, address _ioToken) external onlyGovernance { vault = IVault(_vault); ioToken = IERC20(_ioToken); } //Only allow vault contract access modifier onlyVault() { require(extAuthorize(), "!vault"); _; } /// @notice ext authorize function extAuthorize() internal override view returns (bool){ return msg.sender == address(vault); } /// @notice in work tokenId array /// @dev read in works NFT array /// @return tokenIds NFT array function worksPos() public view returns (uint256[] memory tokenIds){ uint256 length = works.length(); tokenIds = new uint256[](length); for (uint256 i = 0; i < length; i++) { tokenIds[i] = works.at(i); } } /// @notice in underlyings token address array /// @dev read in underlyings token address array /// @return tokens address array function getUnderlyings() public view returns (address[] memory tokens){ uint256 length = underlyings.length(); tokens = new address[](length); for (uint256 i = 0; i < underlyings.length(); i++) { tokens[i] = underlyings.at(i); } } /// @notice Set the underlying asset token address /// @dev Only allow the governance identity to set the underlying asset token address /// @param ts The underlying asset token address array to be added function setUnderlyings(address[] memory ts) public onlyGovernance { for (uint256 i = 0; i < ts.length; i++) { if (!underlyings.contains(ts[i])) { underlyings.add(ts[i]); } } } /// @notice Delete the underlying asset token address /// @dev Only allow the governance identity to delete the underlying asset token address /// @param ts The underlying asset token address array to be deleted function removeUnderlyings(address[] memory ts) public onlyGovernance { for (uint256 i = 0; i < ts.length; i++) { if (underlyings.contains(ts[i])) { underlyings.remove(ts[i]); } } } /// @notice swap after handle /// @param tokenOut token address /// @param amountOut token amount function swapAfter( address tokenOut, uint256 amountOut) internal override { uint256 fee = vault.calcRatioFee(SmartPoolStorage.FeeType.TURNOVER_FEE, amountOut); if (fee > 0) { address rewards = getRewards(); IERC20(tokenOut).safeTransfer(rewards, fee); emit TakeFee(SmartPoolStorage.FeeType.TURNOVER_FEE, tokenOut, rewards, fee); } } /// @notice collect after handle /// @param token0 token address /// @param token1 token address /// @param amount0 token amount /// @param amount1 token amount function collectAfter( address token0, address token1, uint256 amount0, uint256 amount1) internal override { uint256 fee0 = vault.calcRatioFee(SmartPoolStorage.FeeType.TURNOVER_FEE, amount0); uint256 fee1 = vault.calcRatioFee(SmartPoolStorage.FeeType.TURNOVER_FEE, amount1); address rewards = getRewards(); if (fee0 > 0) { IERC20(token0).safeTransfer(rewards, fee0); emit TakeFee(SmartPoolStorage.FeeType.TURNOVER_FEE, token0, rewards, fee0); } if (fee1 > 0) { IERC20(token1).safeTransfer(rewards, fee1); emit TakeFee(SmartPoolStorage.FeeType.TURNOVER_FEE, token1, rewards, fee1); } } /// @notice Asset transfer used to upgrade the contract /// @param to address function withdrawAll(address to) external onlyGovernance { for (uint256 i = 0; i < underlyings.length(); i++) { IERC20 token = IERC20(underlyings.at(i)); uint256 balance = token.balanceOf(address(this)); if (balance > 0) { token.safeTransfer(to, balance); } } } /// @notice Withdraw asset /// @dev Only vault contract can withdraw asset /// @param to Withdraw address /// @param amount Withdraw amount /// @param scale Withdraw percentage function withdraw(address to, uint256 amount, uint256 scale) external onlyVault { uint256 surplusAmount = ioToken.balanceOf(address(this)); if (surplusAmount < amount) { uint256 length = underlyings.length(); uint256[] memory balances = new uint256[](length); uint256[] memory withdrawAmounts = new uint256[](length); for (uint256 i = 0; i < length; i++) { address token = underlyings.at(i); uint256 balance = IERC20(token).balanceOf(address(this)); balances[i] = balance; withdrawAmounts[i] = balance.mul(scale).div(1e18); } _decreaseLiquidityByScale(scale); for (uint256 i = 0; i < length; i++) { address token = underlyings.at(i); uint256 balance = IERC20(token).balanceOf(address(this)); uint256 decreaseAmount = balance.sub(balances[i]); uint256 swapAmount = withdrawAmounts[i].add(decreaseAmount); if (token != address(ioToken) && swapAmount > 0) { exactInput(token, address(ioToken), swapAmount, 0); } } } surplusAmount = ioToken.balanceOf(address(this)); if (surplusAmount < amount) { amount = surplusAmount; } ioToken.safeTransfer(to, amount); } /// @notice Withdraw underlying asset /// @dev Only vault contract can withdraw underlying asset /// @param to Withdraw address /// @param scale Withdraw percentage function withdrawOfUnderlying(address to, uint256 scale) external onlyVault { uint256 length = underlyings.length(); uint256[] memory balances = new uint256[](length); uint256[] memory withdrawAmounts = new uint256[](length); for (uint256 i = 0; i < length; i++) { address token = underlyings.at(i); uint256 balance = IERC20(token).balanceOf(address(this)); balances[i] = balance; withdrawAmounts[i] = balance.mul(scale).div(1e18); } _decreaseLiquidityByScale(scale); for (uint256 i = 0; i < length; i++) { address token = underlyings.at(i); uint256 balance = IERC20(token).balanceOf(address(this)); uint256 decreaseAmount = balance.sub(balances[i]); uint256 transferAmount = withdrawAmounts[i].add(decreaseAmount); IERC20(token).safeTransfer(to, transferAmount); } } /// @notice Decrease liquidity by scale /// @dev Decrease liquidity by provided scale /// @param scale Scale of the liquidity function _decreaseLiquidityByScale(uint256 scale) internal { uint256 length = works.length(); for (uint256 i = 0; i < length; i++) { uint256 tokenId = works.at(i); ( , , , , , , , uint128 liquidity, , , , ) = UniV3PMExtends.PM.positions(tokenId); if (liquidity > 0) { uint256 _decreaseLiquidity = uint256(liquidity).mul(scale).div(1e18); (uint256 amount0, uint256 amount1) = decreaseLiquidity(tokenId, uint128(_decreaseLiquidity), 0, 0); collect(tokenId, uint128(amount0), uint128(amount1)); } } } /// @notice Total asset /// @dev This function calculates the net worth or AUM /// @return Total asset function assets() public view returns (uint256){ uint256 total = idleAssets(); total = total.add(liquidityAssets()); return total; } /// @notice idle asset /// @dev This function calculates idle asset /// @return idle asset function idleAssets() public view returns (uint256){ uint256 total; for (uint256 i = 0; i < underlyings.length(); i++) { address token = underlyings.at(i); uint256 balance = IERC20(token).balanceOf(address(this)); if (token == address(ioToken)) { total = total.add(balance); } else { uint256 _estimateAmountOut = estimateAmountOut(token, address(ioToken), balance); total = total.add(_estimateAmountOut); } } return total; } /// @notice at work liquidity asset /// @dev This function calculates liquidity asset /// @return liquidity asset function liquidityAssets() public view returns (uint256){ uint256 total; address ioTokenAddr = address(ioToken); uint256 length = works.length(); for (uint256 i = 0; i < length; i++) { uint256 tokenId = works.at(i); total = total.add(calcLiquidityAssets(tokenId, ioTokenAddr)); } return total; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/utils/EnumerableSet.sol"; import "../base/GovIdentity.sol"; import "../interfaces/uniswap-v3/Path.sol"; import "../libraries/ERC20Extends.sol"; import "../libraries/UniV3SwapExtends.sol"; import "../libraries/UniV3PMExtends.sol"; pragma abicoder v2; /// @title Position Management /// @notice Provide asset operation functions, allow authorized identities to perform asset operations, and achieve the purpose of increasing the net value of the fund contract UniV3Liquidity is GovIdentity { using SafeMath for uint256; using Path for bytes; using EnumerableSet for EnumerableSet.UintSet; using UniV3SwapExtends for mapping(address => mapping(address => bytes)); //Swap route mapping(address => mapping(address => bytes)) public swapRoute; //Position list mapping(bytes32 => uint256) public history; //position mapping owner mapping(uint256 => address) public positionOwners; //available token limit mapping(address => mapping(address => uint256)) public tokenLimit; //Working positions EnumerableSet.UintSet internal works; //Swap event Swap(address sender, address fromToken, address toToken, uint256 amountIn, uint256 amountOut); //Create positoin event Mint(address sender, uint256 tokenId, uint128 liquidity); //Increase liquidity event IncreaseLiquidity(address sender, uint256 tokenId, uint128 liquidity); //Decrease liquidity event DecreaseLiquidity(address sender, uint256 tokenId, uint128 liquidity); //Collect asset event Collect(address sender, uint256 tokenId, uint256 amount0, uint256 amount1); //Only allow governance, strategy, ext authorize modifier onlyAssetsManager() { require( msg.sender == getGovernance() || isAdmin(msg.sender) || isStrategist(msg.sender) || extAuthorize(), "!AM"); _; } //Only position owner modifier onlyPositionManager(uint256 tokenId) { require( msg.sender == getGovernance() || isAdmin(msg.sender) || positionOwners[tokenId] == msg.sender || extAuthorize(), "!PM"); _; } /// @notice extend authorize function extAuthorize() internal virtual view returns (bool){ return false; } /// @notice swap after handle function swapAfter( address, uint256) internal virtual { } /// @notice collect after handle function collectAfter( address, address, uint256, uint256) internal virtual { } /// @notice Check current position /// @dev Check the current UniV3 position by pool token ID. /// @param pool liquidity pool /// @param tickLower Tick lower bound /// @param tickUpper Tick upper bound /// @return atWork Position status /// @return has Check if the position ID exist /// @return tokenId Position ID function checkPos( address pool, int24 tickLower, int24 tickUpper ) public view returns (bool atWork, bool has, uint256 tokenId){ bytes32 pk = UniV3PMExtends.positionKey(pool, tickLower, tickUpper); tokenId = history[pk]; atWork = works.contains(tokenId); has = tokenId > 0 ? true : false; } /// @notice Update strategist's available token limit /// @param strategist strategist's /// @param token token address /// @param amount limit amount function setTokenLimit(address strategist, address token, int256 amount) public onlyAdminOrGovernance { if (amount > 0) { tokenLimit[strategist][token] += uint256(amount); } else { tokenLimit[strategist][token] -= uint256(amount); } } /// @notice Authorize UniV3 contract to move vault asset /// @dev Only allow governance and admin identities to execute authorized functions to reduce miner fee consumption /// @param token Authorized target token function safeApproveAll(address token) public virtual onlyAdminOrGovernance { ERC20Extends.safeApprove(token, address(UniV3PMExtends.PM), type(uint256).max); ERC20Extends.safeApprove(token, address(UniV3SwapExtends.SRT), type(uint256).max); } /// @notice Multiple functions of the contract can be executed at the same time /// @dev Only the assets manager identities are allowed to execute multiple function calls, /// and the execution of multiple functions can ensure the consistency of the execution results /// @param data Encode data of multiple execution functions /// @return results Execution result function multicall(bytes[] calldata data) external onlyAssetsManager returns (bytes[] memory results) { results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { (bool success, bytes memory result) = address(this).delegatecall(data[i]); if (!success) { if (result.length < 68) revert(); assembly { result := add(result, 0x04) } revert(abi.decode(result, (string))); } results[i] = result; } } /// @notice Set asset swap route /// @dev Only the governance and admin identity is allowed to set the asset swap path, and the firstToken and lastToken contained in the path will be used as the underlying asset token address by default /// @param path Swap path byte code function settingSwapRoute(bytes memory path) external onlyAdminOrGovernance { require(path.valid(), 'path is not valid'); address fromToken = path.getFirstAddress(); address toToken = path.getLastAddress(); swapRoute[fromToken][toToken] = path; } /// @notice Estimated to obtain the target token amount /// @dev Only allow the asset transaction path that has been set to be estimated /// @param from Source token address /// @param to Target token address /// @param amountIn Source token amount /// @return amountOut Target token amount function estimateAmountOut( address from, address to, uint256 amountIn ) public view returns (uint256 amountOut){ return swapRoute.estimateAmountOut(from, to, amountIn); } /// @notice Estimate the amount of source tokens that need to be provided /// @dev Only allow the governance identity to set the underlying asset token address /// @param from Source token address /// @param to Target token address /// @param amountOut Expect to get the target token amount /// @return amountIn Source token amount function estimateAmountIn( address from, address to, uint256 amountOut ) public view returns (uint256 amountIn){ return swapRoute.estimateAmountIn(from, to, amountOut); } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @dev Initiate a transaction with a known input amount and return the output amount /// @param tokenIn Token in address /// @param tokenOut Token out address /// @param amountIn Token in amount /// @param amountOutMinimum Expected to get minimum token out amount /// @return amountOut Token out amount function exactInput( address tokenIn, address tokenOut, uint256 amountIn, uint256 amountOutMinimum ) public onlyAssetsManager returns (uint256 amountOut) { bool _isStrategist = isStrategist(msg.sender); if (_isStrategist) { require(tokenLimit[msg.sender][tokenIn] >= amountIn, '!check limit'); } amountOut = swapRoute.exactInput(tokenIn, tokenOut, amountIn, address(this), amountOutMinimum); if (_isStrategist) { tokenLimit[msg.sender][tokenIn] -= amountIn; tokenLimit[msg.sender][tokenOut] += amountOut; } swapAfter(tokenOut, amountOut); emit Swap(msg.sender, tokenIn, tokenOut, amountIn, amountOut); } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @dev Initiate a transaction with a known output amount and return the input amount /// @param tokenIn Token in address /// @param tokenOut Token out address /// @param amountOut Token out amount /// @param amountInMaximum Expect to input the maximum amount of tokens /// @return amountIn Token in amount function exactOutput( address tokenIn, address tokenOut, uint256 amountOut, uint256 amountInMaximum ) public onlyAssetsManager returns (uint256 amountIn) { amountIn = swapRoute.exactOutput(tokenIn, tokenOut, address(this), amountOut, amountInMaximum); if (isStrategist(msg.sender)) { require(tokenLimit[msg.sender][tokenIn] >= amountIn, '!check limit'); tokenLimit[msg.sender][tokenIn] -= amountIn; tokenLimit[msg.sender][tokenOut] += amountOut; } swapAfter(tokenOut, amountOut); emit Swap(msg.sender, tokenIn, tokenOut, amountIn, amountOut); } /// @notice Create position /// @dev Repeated creation of the same position will cause an error, you need to change tickLower Or tickUpper /// @param token0 Liquidity pool token 0 contract address /// @param token1 Liquidity pool token 1 contract address /// @param fee Target liquidity pool rate /// @param tickLower Expect to place the lower price boundary of the target liquidity pool /// @param tickUpper Expect to place the upper price boundary of the target liquidity pool /// @param amount0Desired Desired token 0 amount /// @param amount1Desired Desired token 1 amount function mint( address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint256 amount0Desired, uint256 amount1Desired ) public onlyAssetsManager { bool _isStrategist = isStrategist(msg.sender); if (_isStrategist) { require(tokenLimit[msg.sender][token0] >= amount0Desired, '!check limit'); require(tokenLimit[msg.sender][token1] >= amount1Desired, '!check limit'); } ( uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1 ) = UniV3PMExtends.PM.mint(INonfungiblePositionManager.MintParams({ token0 : token0, token1 : token1, fee : fee, tickLower : tickLower, tickUpper : tickUpper, amount0Desired : amount0Desired, amount1Desired : amount1Desired, amount0Min : 0, amount1Min : 0, recipient : address(this), deadline : block.timestamp })); if (_isStrategist) { tokenLimit[msg.sender][token0] -= amount0; tokenLimit[msg.sender][token1] -= amount1; } address pool = UniV3PMExtends.getPool(tokenId); bytes32 pk = UniV3PMExtends.positionKey(pool, tickLower, tickUpper); history[pk] = tokenId; positionOwners[tokenId] = msg.sender; works.add(tokenId); emit Mint(msg.sender, tokenId, liquidity); } /// @notice Increase liquidity /// @dev Use checkPos to check the position ID /// @param tokenId Position ID /// @param amount0 Desired Desired token 0 amount /// @param amount1 Desired Desired token 1 amount /// @param amount0Min Minimum token 0 amount /// @param amount1Min Minimum token 1 amount /// @return liquidity The amount of liquidity /// @return amount0 Actual token 0 amount being added /// @return amount1 Actual token 1 amount being added function increaseLiquidity( uint256 tokenId, uint256 amount0Desired, uint256 amount1Desired, uint256 amount0Min, uint256 amount1Min ) public onlyPositionManager(tokenId) returns ( uint128 liquidity, uint256 amount0, uint256 amount1 ){ ( , , address token0, address token1, , , , , , , , ) = UniV3PMExtends.PM.positions(tokenId); address po = positionOwners[tokenId]; if (isStrategist(po)) { require(tokenLimit[po][token0] >= amount0Desired, '!check limit'); require(tokenLimit[po][token1] >= amount1Desired, '!check limit'); } (liquidity, amount0, amount1) = UniV3PMExtends.PM.increaseLiquidity(INonfungiblePositionManager.IncreaseLiquidityParams({ tokenId : tokenId, amount0Desired : amount0Desired, amount1Desired : amount1Desired, amount0Min : amount0Min, amount1Min : amount1Min, deadline : block.timestamp })); if (isStrategist(po)) { tokenLimit[po][token0] -= amount0; tokenLimit[po][token1] -= amount1; } if (!works.contains(tokenId)) { works.add(tokenId); } emit IncreaseLiquidity(msg.sender, tokenId, liquidity); } /// @notice Decrease liquidity /// @dev Use checkPos to query the position ID /// @param tokenId Position ID /// @param liquidity Expected reduction amount of liquidity /// @param amount0Min Minimum amount of token 0 to be reduced /// @param amount1Min Minimum amount of token 1 to be reduced /// @return amount0 Actual amount of token 0 being reduced /// @return amount1 Actual amount of token 1 being reduced function decreaseLiquidity( uint256 tokenId, uint128 liquidity, uint256 amount0Min, uint256 amount1Min ) public onlyPositionManager(tokenId) returns (uint256 amount0, uint256 amount1){ (amount0, amount1) = UniV3PMExtends.PM.decreaseLiquidity(INonfungiblePositionManager.DecreaseLiquidityParams({ tokenId : tokenId, liquidity : liquidity, amount0Min : amount0Min, amount1Min : amount1Min, deadline : block.timestamp })); emit DecreaseLiquidity(msg.sender, tokenId, liquidity); } /// @notice Collect position asset /// @dev Use checkPos to check the position ID /// @param tokenId Position ID /// @param amount0Max Maximum amount of token 0 to be collected /// @param amount1Max Maximum amount of token 1 to be collected /// @return amount0 Actual amount of token 0 being collected /// @return amount1 Actual amount of token 1 being collected function collect( uint256 tokenId, uint128 amount0Max, uint128 amount1Max ) public onlyPositionManager(tokenId) returns (uint256 amount0, uint256 amount1){ (amount0, amount1) = UniV3PMExtends.PM.collect(INonfungiblePositionManager.CollectParams({ tokenId : tokenId, recipient : address(this), amount0Max : amount0Max, amount1Max : amount1Max })); ( , , address token0, address token1, , , , uint128 liquidity, , , , ) = UniV3PMExtends.PM.positions(tokenId); address po = positionOwners[tokenId]; if (isStrategist(po)) { tokenLimit[po][token0] += amount0; tokenLimit[po][token1] += amount1; } if (liquidity == 0) { works.remove(tokenId); } collectAfter(token0, token1, amount0, amount1); emit Collect(msg.sender, tokenId, amount0, amount1); } /// @notice calc tokenId asset /// @dev This function calc tokenId asset /// @return tokenId asset function calcLiquidityAssets(uint256 tokenId, address toToken) internal view returns (uint256) { ( , , address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, , , , ) = UniV3PMExtends.PM.positions(tokenId); (uint256 amount0, uint256 amount1) = UniV3PMExtends.getAmountsForLiquidity( token0, token1, fee, tickLower, tickUpper, liquidity); (uint256 fee0, uint256 fee1) = UniV3PMExtends.getFeesForLiquidity(tokenId); (amount0, amount1) = (amount0.add(fee0), amount1.add(fee1)); uint256 total; if (token0 == toToken) { total = amount0; } else { uint256 _estimateAmountOut = swapRoute.estimateAmountOut(token0, toToken, amount0); total = _estimateAmountOut; } if (token1 == toToken) { total = total.add(amount1); } else { uint256 _estimateAmountOut = swapRoute.estimateAmountOut(token1, toToken, amount1); total = total.add(_estimateAmountOut); } return total; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; library SmartPoolStorage { bytes32 public constant sSlot = keccak256("SmartPoolStorage.storage.location"); struct Storage { mapping(FeeType => Fee) fees; mapping(address => uint256) nets; address token; address am; uint256 cap; uint256 lup; bool bind; bool suspend; bool allowJoin; bool allowExit; } struct Fee { uint256 ratio; uint256 denominator; uint256 lastTimestamp; uint256 minLine; } enum FeeType{ JOIN_FEE, EXIT_FEE, MANAGEMENT_FEE, PERFORMANCE_FEE,TURNOVER_FEE } function load() internal pure returns (Storage storage s) { bytes32 loc = sSlot; assembly { s.slot := loc } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "../interfaces/uniswap-v3/INonfungiblePositionManager.sol"; import "../interfaces/uniswap-v3/IUniswapV3Pool.sol"; import "../interfaces/uniswap-v3/TickMath.sol"; import "../interfaces/uniswap-v3/LiquidityAmounts.sol"; import "../interfaces/uniswap-v3/FixedPoint128.sol"; import "../interfaces/uniswap-v3/PoolAddress.sol"; /// @title UniV3 extends libraries /// @notice libraries library UniV3PMExtends { //Nonfungible Position Manager INonfungiblePositionManager constant internal PM = INonfungiblePositionManager(0xC36442b4a4522E871399CD717aBDD847Ab11FE88); /// @notice Position id /// @dev Position ID /// @param addr any address /// @param tickLower Tick lower price bound /// @param tickUpper Tick upper price bound /// @return ABI encode function positionKey( address addr, int24 tickLower, int24 tickUpper ) internal pure returns (bytes32) { return keccak256(abi.encodePacked(addr, tickLower, tickUpper)); } /// @notice get pool by tokenId /// @param tokenId position Id function getPool(uint256 tokenId) internal view returns (address){ ( , , address token0, address token1, uint24 fee, , , , , , , ) = PM.positions(tokenId); return PoolAddress.getPool(token0, token1, fee); } /// @notice Calculate the number of redeemable tokens based on the amount of liquidity /// @dev Used when redeeming liquidity /// @param token0 Token 0 address /// @param token1 Token 1 address /// @param fee Fee rate /// @param tickLower Tick lower price bound /// @param tickUpper Tick upper price bound /// @param liquidity Liquidity amount /// @return amount0 Token 0 amount /// @return amount1 Token 1 amount function getAmountsForLiquidity( address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity ) internal view returns (uint256 amount0, uint256 amount1) { (uint160 sqrtPriceX96,,,,,,) = IUniswapV3Pool(PoolAddress.getPool(token0, token1, fee)).slot0(); uint160 sqrtRatioAX96 = TickMath.getSqrtRatioAtTick(tickLower); uint160 sqrtRatioBX96 = TickMath.getSqrtRatioAtTick(tickUpper); (amount0, amount1) = LiquidityAmounts.getAmountsForLiquidity( sqrtPriceX96, sqrtRatioAX96, sqrtRatioBX96, liquidity ); } ///@notice Calculate unreceived handling fees for liquid positions /// @param tokenId Position ID /// @return fee0 Token 0 fee amount /// @return fee1 Token 1 fee amount function getFeesForLiquidity( uint256 tokenId ) internal view returns (uint256 fee0, uint256 fee1){ ( , , , , , , , uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ) = PM.positions(tokenId); (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) = getFeeGrowthInside(tokenId); fee0 = tokensOwed0 + FullMath.mulDiv( feeGrowthInside0X128 - feeGrowthInside0LastX128, liquidity, FixedPoint128.Q128 ); fee1 = tokensOwed1 + FullMath.mulDiv( feeGrowthInside1X128 - feeGrowthInside1LastX128, liquidity, FixedPoint128.Q128 ); } /// @notice Retrieves fee growth data function getFeeGrowthInside( uint256 tokenId ) internal view returns (uint256 feeGrowthInside0X128, uint256 feeGrowthInside1X128) { ( , , , , , int24 tickLower, int24 tickUpper, , , , , ) = PM.positions(tokenId); IUniswapV3Pool pool = IUniswapV3Pool(getPool(tokenId)); (,int24 tickCurrent,,,,,) = pool.slot0(); uint256 feeGrowthGlobal0X128 = pool.feeGrowthGlobal0X128(); uint256 feeGrowthGlobal1X128 = pool.feeGrowthGlobal1X128(); ( , , uint256 lowerFeeGrowthOutside0X128, uint256 lowerFeeGrowthOutside1X128, , , , ) = pool.ticks(tickLower); ( , , uint256 upperFeeGrowthOutside0X128, uint256 upperFeeGrowthOutside1X128, , , , ) = pool.ticks(tickUpper); // calculate fee growth below uint256 feeGrowthBelow0X128; uint256 feeGrowthBelow1X128; if (tickCurrent >= tickLower) { feeGrowthBelow0X128 = lowerFeeGrowthOutside0X128; feeGrowthBelow1X128 = lowerFeeGrowthOutside1X128; } else { feeGrowthBelow0X128 = feeGrowthGlobal0X128 - lowerFeeGrowthOutside0X128; feeGrowthBelow1X128 = feeGrowthGlobal1X128 - lowerFeeGrowthOutside1X128; } // calculate fee growth above uint256 feeGrowthAbove0X128; uint256 feeGrowthAbove1X128; if (tickCurrent < tickUpper) { feeGrowthAbove0X128 = upperFeeGrowthOutside0X128; feeGrowthAbove1X128 = upperFeeGrowthOutside1X128; } else { feeGrowthAbove0X128 = feeGrowthGlobal0X128 - upperFeeGrowthOutside0X128; feeGrowthAbove1X128 = feeGrowthGlobal1X128 - upperFeeGrowthOutside1X128; } feeGrowthInside0X128 = feeGrowthGlobal0X128 - feeGrowthBelow0X128 - feeGrowthAbove0X128; feeGrowthInside1X128 = feeGrowthGlobal1X128 - feeGrowthBelow1X128 - feeGrowthAbove1X128; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; /// @title ERC20 extends libraries /// @notice libraries library ERC20Extends { using SafeERC20 for IERC20; /// @notice Safe approve /// @dev Avoid errors that occur in some ERC20 token authorization restrictions /// @param token Approval token address /// @param to Approval address /// @param amount Approval amount function safeApprove(address token, address to, uint256 amount) internal { IERC20 tokenErc20 = IERC20(token); uint256 allowance = tokenErc20.allowance(address(this), to); if (allowance < amount) { if (allowance > 0) { tokenErc20.safeApprove(to, 0); } tokenErc20.safeApprove(to, amount); } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "../storage/SmartPoolStorage.sol"; pragma abicoder v2; /// @title Vault - the vault interface /// @notice This contract extends ERC20, defines basic vault functions and rewrites ERC20 transferFrom function interface IVault { /// @notice Vault cap /// @dev The max number of vault to be issued /// @return Max vault cap function getCap() external view returns (uint256); /// @notice Get fee by type /// @dev (0=JOIN_FEE,1=EXIT_FEE,2=MANAGEMENT_FEE,3=PERFORMANCE_FEE,4=TURNOVER_FEE) /// @param ft Fee type function getFee(SmartPoolStorage.FeeType ft) external view returns (SmartPoolStorage.Fee memory); /// @notice Calculate the fee by ratio /// @dev This is used to calculate join and redeem fee /// @param ft Fee type /// @param vaultAmount vault amount function calcRatioFee(SmartPoolStorage.FeeType ft, uint256 vaultAmount) external view returns (uint256); /// @notice The net worth of the vault from the time the last fee collected /// @dev This is used to calculate the performance fee /// @param account Account address /// @return The net worth of the vault function accountNetValue(address account) external view returns (uint256); /// @notice The current vault net worth /// @dev This is used to update and calculate account net worth /// @return The net worth of the vault function globalNetValue() external view returns (uint256); /// @notice Convert vault amount to cash amount /// @dev This converts the user vault amount to cash amount when a user redeems the vault /// @param vaultAmount Redeem vault amount /// @return Cash amount function convertToCash(uint256 vaultAmount) external view returns (uint256); /// @notice Convert cash amount to share amount /// @dev This converts cash amount to share amount when a user buys the vault /// @param cashAmount Join cash amount /// @return share amount function convertToShare(uint256 cashAmount) external view returns (uint256); /// @notice Vault token address for joining and redeeming /// @dev This is address is created when the vault is first created. /// @return Vault token address function ioToken() external view returns (address); /// @notice Vault mangement contract address /// @dev The vault management contract address is bind to the vault when the vault is created /// @return Vault management contract address function AM() external view returns (address); /// @notice Vault total asset /// @dev This calculates vault net worth or AUM /// @return Vault total asset function assets()external view returns(uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ``` * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position of the value in the `values` array, plus 1 because index 0 // means a value is not in the set. mapping (bytes32 => uint256) _indexes; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._indexes[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We read and store the value's index to prevent multiple reads from the same storage slot uint256 valueIndex = set._indexes[value]; if (valueIndex != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 toDeleteIndex = valueIndex - 1; uint256 lastIndex = set._values.length - 1; // When the value to delete is the last one, the swap operation is unnecessary. However, since this occurs // so rarely, we still do the swap anyway to avoid the gas cost of adding an 'if' statement. bytes32 lastvalue = set._values[lastIndex]; // Move the last value to the index where the value to delete is set._values[toDeleteIndex] = lastvalue; // Update the index for the moved value set._indexes[lastvalue] = toDeleteIndex + 1; // All indexes are 1-based // Delete the slot where the moved value was stored set._values.pop(); // Delete the index for the deleted slot delete set._indexes[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._indexes[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { require(set._values.length > index, "EnumerableSet: index out of bounds"); return set._values[index]; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values on the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; import "./IERC20.sol"; import "../../math/SafeMath.sol"; import "../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using SafeMath for uint256; using Address for address; function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' // solhint-disable-next-line max-line-length require((value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).add(value); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 newAllowance = token.allowance(address(this), spender).sub(value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address.functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); if (returndata.length > 0) { // Return data is optional // solhint-disable-next-line max-line-length require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `sender` to `recipient` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address sender, address recipient, uint256 amount) external returns (bool); /** * @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); }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "@openzeppelin/contracts/math/SafeMath.sol"; import "../interfaces/uniswap-v3/ISwapRouter.sol"; import "../interfaces/uniswap-v3/IUniswapV3Pool.sol"; import "../interfaces/uniswap-v3/PoolAddress.sol"; import "../interfaces/uniswap-v3/Path.sol"; import "./SafeMathExtends.sol"; pragma abicoder v2; /// @title UniV3 Swap extends libraries /// @notice libraries library UniV3SwapExtends { using Path for bytes; using SafeMath for uint256; using SafeMathExtends for uint256; //x96 uint256 constant internal x96 = 2 ** 96; //fee denominator uint256 constant internal denominator = 1000000; //Swap Router ISwapRouter constant internal SRT = ISwapRouter(0xE592427A0AEce92De3Edee1F18E0157C05861564); /// @notice Estimated to obtain the target token amount /// @dev Only allow the asset transaction path that has been set to be estimated /// @param self Mapping path /// @param from Source token address /// @param to Target token address /// @param amountIn Source token amount /// @return amountOut Target token amount function estimateAmountOut( mapping(address => mapping(address => bytes)) storage self, address from, address to, uint256 amountIn ) internal view returns (uint256 amountOut){ if (amountIn == 0) {return 0;} bytes memory path = self[from][to]; amountOut = amountIn; while (true) { (address fromToken, address toToken, uint24 fee) = path.getFirstPool().decodeFirstPool(); address _pool = PoolAddress.getPool(fromToken, toToken, fee); (uint160 sqrtPriceX96,,,,,,) = IUniswapV3Pool(_pool).slot0(); address token0 = fromToken < toToken ? fromToken : toToken; amountOut = amountOut.mul(denominator.sub(uint256(fee))).div(denominator); if (token0 == toToken) { amountOut = amountOut.sqrt().mul(x96).div(sqrtPriceX96) ** 2; } else { amountOut = amountOut.sqrt().mul(sqrtPriceX96).div(x96) ** 2; } bool hasMultiplePools = path.hasMultiplePools(); if (hasMultiplePools) { path = path.skipToken(); } else { break; } } } /// @notice Estimate the amount of source tokens that need to be provided /// @dev Only allow the governance identity to set the underlying asset token address /// @param self Mapping path /// @param from Source token address /// @param to Target token address /// @param amountOut Expected target token amount /// @return amountIn Source token amount function estimateAmountIn( mapping(address => mapping(address => bytes)) storage self, address from, address to, uint256 amountOut ) internal view returns (uint256 amountIn){ if (amountOut == 0) {return 0;} bytes memory path = self[from][to]; amountIn = amountOut; while (true) { (address fromToken, address toToken, uint24 fee) = path.getFirstPool().decodeFirstPool(); address _pool = PoolAddress.getPool(fromToken, toToken, fee); (uint160 sqrtPriceX96,,,,,,) = IUniswapV3Pool(_pool).slot0(); address token0 = fromToken < toToken ? fromToken : toToken; if (token0 == toToken) { amountIn = amountIn.sqrt().mul(sqrtPriceX96).div(x96) ** 2; } else { amountIn = amountIn.sqrt().mul(x96).div(sqrtPriceX96) ** 2; } amountIn = amountIn.mul(denominator).div(denominator.sub(uint256(fee))); bool hasMultiplePools = path.hasMultiplePools(); if (hasMultiplePools) { path = path.skipToken(); } else { break; } } } /// @notice Swaps `amountIn` of one token for as much as possible of another token /// @dev Initiate a transaction with a known input amount and return the output amount /// @param self Mapping path /// @param from Input token address /// @param to Output token address /// @param amountIn Token in amount /// @param recipient Recipient address /// @param amountOutMinimum Expected to get minimum token out amount /// @return Token out amount function exactInput( mapping(address => mapping(address => bytes)) storage self, address from, address to, uint256 amountIn, address recipient, uint256 amountOutMinimum ) internal returns (uint256){ bytes memory path = self[from][to]; return SRT.exactInput( ISwapRouter.ExactInputParams({ path : path, recipient : recipient, deadline : block.timestamp, amountIn : amountIn, amountOutMinimum : amountOutMinimum })); } /// @notice Swaps as little as possible of one token for `amountOut` of another token /// @dev Initiate a transaction with a known output amount and return the input amount /// @param self Mapping path /// @param from Input token address /// @param to Output token address /// @param recipient Recipient address /// @param amountOut Token out amount /// @param amountInMaximum Expect to input the maximum amount of tokens /// @return Token in amount function exactOutput( mapping(address => mapping(address => bytes)) storage self, address from, address to, address recipient, uint256 amountOut, uint256 amountInMaximum ) internal returns (uint256){ bytes memory path = self[to][from]; return SRT.exactOutput( ISwapRouter.ExactOutputParams({ path : path, recipient : recipient, deadline : block.timestamp, amountOut : amountOut, amountInMaximum : amountInMaximum })); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.6.0; import './BytesLib.sol'; /// @title Functions for manipulating path data for multihop swaps library Path { using BytesLib for bytes; /// @dev The length of the bytes encoded address uint256 private constant ADDR_SIZE = 20; /// @dev The length of the bytes encoded fee uint256 private constant FEE_SIZE = 3; /// @dev The offset of a single token address and pool fee uint256 private constant NEXT_OFFSET = ADDR_SIZE + FEE_SIZE; /// @dev The offset of an encoded pool key uint256 private constant POP_OFFSET = NEXT_OFFSET + ADDR_SIZE; /// @dev The minimum length of an encoding that contains 2 or more pools uint256 private constant MULTIPLE_POOLS_MIN_LENGTH = POP_OFFSET + NEXT_OFFSET; /// @notice Check the legitimacy of the path /// @param path The encoded swap path /// @return Legal path function valid(bytes memory path)internal pure returns(bool) { return path.length>=POP_OFFSET; } /// @notice Returns true iff the path contains two or more pools /// @param path The encoded swap path /// @return True if path contains two or more pools, otherwise false function hasMultiplePools(bytes memory path) internal pure returns (bool) { return path.length >= MULTIPLE_POOLS_MIN_LENGTH; } /// @notice Decodes the first pool in path /// @param path The bytes encoded swap path /// @return tokenA The first token of the given pool /// @return tokenB The second token of the given pool /// @return fee The fee level of the pool function decodeFirstPool(bytes memory path) internal pure returns ( address tokenA, address tokenB, uint24 fee ) { tokenA = path.toAddress(0); fee = path.toUint24(ADDR_SIZE); tokenB = path.toAddress(NEXT_OFFSET); } /// @notice Gets the segment corresponding to the first pool in the path /// @param path The bytes encoded swap path /// @return The segment containing all data necessary to target the first pool in the path function getFirstPool(bytes memory path) internal pure returns (bytes memory) { return path.slice(0, POP_OFFSET); } /// @notice Gets the segment corresponding to the last pool in the path /// @param path The bytes encoded swap path /// @return The segment containing all data necessary to target the last pool in the path function getLastPool(bytes memory path) internal pure returns (bytes memory) { if(path.length==POP_OFFSET){ return path; }else{ return path.slice(path.length-POP_OFFSET, path.length); } } /// @notice Gets the first address of the path /// @param path The encoded swap path /// @return address function getFirstAddress(bytes memory path)internal pure returns(address){ return path.toAddress(0); } /// @notice Gets the last address of the path /// @param path The encoded swap path /// @return address function getLastAddress(bytes memory path)internal pure returns(address){ return path.toAddress(path.length-ADDR_SIZE); } /// @notice Skips a token + fee element from the buffer and returns the remainder /// @param path The swap path /// @return The remaining token + fee elements in the path function skipToken(bytes memory path) internal pure returns (bytes memory) { return path.slice(NEXT_OFFSET, path.length - NEXT_OFFSET); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; import "../storage/GovIdentityStorage.sol"; /// @title manager role /// @notice provide a unified identity address pool contract GovIdentity { constructor() { _init(); } function _init() internal{ GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); identity.governance = msg.sender; identity.rewards = msg.sender; identity.strategist[msg.sender]=true; identity.admin[msg.sender]=true; } modifier onlyAdmin() { GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); require(isAdmin(msg.sender), "!admin"); _; } modifier onlyStrategist() { require(isStrategist(msg.sender), "!strategist"); _; } modifier onlyGovernance() { GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); require(msg.sender == identity.governance, "!governance"); _; } modifier onlyStrategistOrGovernance() { GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); require(identity.strategist[msg.sender] || msg.sender == identity.governance, "!governance and !strategist"); _; } modifier onlyAdminOrGovernance() { GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); require(identity.admin[msg.sender] || msg.sender == identity.governance, "!governance and !admin"); _; } function setGovernance(address _governance) public onlyGovernance{ GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); identity.governance = _governance; } function setRewards(address _rewards) public onlyGovernance{ GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); identity.rewards = _rewards; } function setStrategist(address _strategist,bool enable) public onlyGovernance{ GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); identity.strategist[_strategist]=enable; } function setAdmin(address _admin,bool enable) public onlyGovernance{ GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); identity.admin[_admin]=enable; } function getGovernance() public view returns(address){ GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); return identity.governance; } function getRewards() public view returns(address){ GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); return identity.rewards ; } function isStrategist(address _strategist) public view returns(bool){ GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); return identity.strategist[_strategist]; } function isAdmin(address _admin) public view returns(bool){ GovIdentityStorage.Identity storage identity= GovIdentityStorage.load(); return identity.admin[_admin]; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } /** * @dev Returns the substraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b > a) return (false, 0); return (true, a - b); } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a / b); } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { if (b == 0) return (false, 0); return (true, a % b); } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { require(b <= a, "SafeMath: subtraction overflow"); return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { if (a == 0) return 0; uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: division by zero"); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { require(b > 0, "SafeMath: modulo by zero"); return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); return a - b; } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryDiv}. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Provides functions for deriving a pool address from the factory, tokens, and the fee library PoolAddress { bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; //Uniswap V3 Factory address constant private factory = address(0x1F98431c8aD98523631AE4a59f267346ea31F984); /// @notice The identifying key of the pool struct PoolKey { address token0; address token1; uint24 fee; } /// @dev Returns the pool for the given token pair and fee. The pool contract may or may not exist. function getPool( address tokenA, address tokenB, uint24 fee ) internal pure returns (address) { return computeAddress(getPoolKey(tokenA, tokenB, fee)); } /// @notice Returns PoolKey: the ordered tokens with the matched fee levels /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted /// @param fee The fee level of the pool /// @return Poolkey The pool details with ordered token0 and token1 assignments function getPoolKey( address tokenA, address tokenB, uint24 fee ) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0 : tokenA, token1 : tokenB, fee : fee}); } /// @notice Deterministically computes the pool address given the factory and PoolKey /// @param key The PoolKey /// @return pool The contract address of the V3 pool function computeAddress(PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1); pool = address( uint256( keccak256( abi.encodePacked( hex'ff', factory, keccak256(abi.encode(key.token0, key.token1, key.fee)), POOL_INIT_CODE_HASH ) ) ) ); } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.4.0; /// @title FixedPoint128 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) library FixedPoint128 { uint256 internal constant Q128 = 0x100000000000000000000000000000000; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import './FullMath.sol'; import './FixedPoint96.sol'; /// @title Liquidity amount functions /// @notice Provides functions for computing liquidity amounts from token amounts and prices library LiquidityAmounts { /// @notice Downcasts uint256 to uint128 /// @param x The uint258 to be downcasted /// @return y The passed value, downcasted to uint128 function toUint128(uint256 x) private pure returns (uint128 y) { require((y = uint128(x)) == x); } /// @notice Computes the amount of liquidity received for a given amount of token0 and price range /// @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower)) /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param amount0 The amount0 being sent in /// @return liquidity The amount of returned liquidity function getLiquidityForAmount0( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount0 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96); return toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96)); } /// @notice Computes the amount of liquidity received for a given amount of token1 and price range /// @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)). /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param amount1 The amount1 being sent in /// @return liquidity The amount of returned liquidity function getLiquidityForAmount1( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount1 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96)); } /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current /// pool prices and the prices at the tick boundaries /// @param sqrtRatioX96 A sqrt price representing the current pool prices /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param amount0 The amount of token0 being sent in /// @param amount1 The amount of token1 being sent in /// @return liquidity The maximum amount of liquidity received function getLiquidityForAmounts( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount0, uint256 amount1 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); if (sqrtRatioX96 <= sqrtRatioAX96) { liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0); } else if (sqrtRatioX96 < sqrtRatioBX96) { uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0); uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1); liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1; } else { liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1); } } /// @notice Computes the amount of token0 for a given amount of liquidity and a price range /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount0 The amount of token0 function getAmount0ForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return FullMath.mulDiv( uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96 ) / sqrtRatioAX96; } /// @notice Computes the amount of token1 for a given amount of liquidity and a price range /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount1 The amount of token1 function getAmount1ForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); return FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96); } /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current /// pool prices and the prices at the tick boundaries /// @param sqrtRatioX96 A sqrt price representing the current pool prices /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount0 The amount of token0 /// @return amount1 The amount of token1 function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0, uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); if (sqrtRatioX96 <= sqrtRatioAX96) { amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } else if (sqrtRatioX96 < sqrtRatioBX96) { amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity); amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity); } else { amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Math library for computing sqrt prices from ticks and vice versa /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports /// prices between 2**-128 and 2**128 library TickMath { /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 int24 internal constant MIN_TICK = - 887272; /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 int24 internal constant MAX_TICK = - MIN_TICK; /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) uint160 internal constant MIN_SQRT_RATIO = 4295128739; /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; /// @notice Calculates sqrt(1.0001^tick) * 2^96 /// @dev Throws if |tick| > max tick /// @param tick The input tick for the above formula /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) /// at the given tick function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(- int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(MAX_TICK), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may /// ever return. /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { // second inequality must be < because the price can never reach the price at the max tick require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R'); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IUniswapV3Pool { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; pragma experimental ABIEncoderV2; interface INonfungiblePositionManager is IERC721 { /// @notice Returns the position information associated with a given token ID. /// @dev Throws if the token ID is not valid. /// @param tokenId The ID of the token that represents the position /// @return nonce The nonce for permits /// @return operator The address that is approved for spending /// @return token0 The address of the token0 for a specific pool /// @return token1 The address of the token1 for a specific pool /// @return fee The fee associated with the pool /// @return tickLower The lower end of the tick range for the position /// @return tickUpper The higher end of the tick range for the position /// @return liquidity The liquidity of the position /// @return feeGrowthInside0LastX128 The fee growth of token0 as of the last action on the individual position /// @return feeGrowthInside1LastX128 The fee growth of token1 as of the last action on the individual position /// @return tokensOwed0 The uncollected amount of token0 owed to the position as of the last computation /// @return tokensOwed1 The uncollected amount of token1 owed to the position as of the last computation function positions(uint256 tokenId) external view returns ( uint96 nonce, address operator, address token0, address token1, uint24 fee, int24 tickLower, int24 tickUpper, uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); struct MintParams { address token0; address token1; uint24 fee; int24 tickLower; int24 tickUpper; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; address recipient; uint256 deadline; } /// @notice Creates a new position wrapped in a NFT /// @dev Call this when the pool does exist and is initialized. Note that if the pool is created but not initialized /// a method does not exist, i.e. the pool is assumed to be initialized. /// @param params The params necessary to mint a position, encoded as `MintParams` in calldata /// @return tokenId The ID of the token that represents the minted position /// @return liquidity The amount of liquidity for this position /// @return amount0 The amount of token0 /// @return amount1 The amount of token1 function mint(MintParams calldata params) external payable returns ( uint256 tokenId, uint128 liquidity, uint256 amount0, uint256 amount1 ); struct IncreaseLiquidityParams { uint256 tokenId; uint256 amount0Desired; uint256 amount1Desired; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } /// @notice Increases the amount of liquidity in a position, with tokens paid by the `msg.sender` /// @param params tokenId The ID of the token for which liquidity is being increased, /// amount0Desired The desired amount of token0 to be spent, /// amount1Desired The desired amount of token1 to be spent, /// amount0Min The minimum amount of token0 to spend, which serves as a slippage check, /// amount1Min The minimum amount of token1 to spend, which serves as a slippage check, /// deadline The time by which the transaction must be included to effect the change /// @return liquidity The new liquidity amount as a result of the increase /// @return amount0 The amount of token0 to acheive resulting liquidity /// @return amount1 The amount of token1 to acheive resulting liquidity function increaseLiquidity(IncreaseLiquidityParams calldata params) external payable returns ( uint128 liquidity, uint256 amount0, uint256 amount1 ); struct DecreaseLiquidityParams { uint256 tokenId; uint128 liquidity; uint256 amount0Min; uint256 amount1Min; uint256 deadline; } /// @notice Decreases the amount of liquidity in a position and accounts it to the position /// @param params tokenId The ID of the token for which liquidity is being decreased, /// amount The amount by which liquidity will be decreased, /// amount0Min The minimum amount of token0 that should be accounted for the burned liquidity, /// amount1Min The minimum amount of token1 that should be accounted for the burned liquidity, /// deadline The time by which the transaction must be included to effect the change /// @return amount0 The amount of token0 accounted to the position's tokens owed /// @return amount1 The amount of token1 accounted to the position's tokens owed function decreaseLiquidity(DecreaseLiquidityParams calldata params) external payable returns (uint256 amount0, uint256 amount1); struct CollectParams { uint256 tokenId; address recipient; uint128 amount0Max; uint128 amount1Max; } /// @notice Collects up to a maximum amount of fees owed to a specific position to the recipient /// @param params tokenId The ID of the NFT for which tokens are being collected, /// recipient The account that should receive the tokens, /// amount0Max The maximum amount of token0 to collect, /// amount1Max The maximum amount of token1 to collect /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect(CollectParams calldata params) external payable returns (uint256 amount0, uint256 amount1); /// @notice Burns a token ID, which deletes it from the NFT contract. The token must have 0 liquidity and all tokens /// must be collected first. /// @param tokenId The ID of the token that is being burned function burn(uint256 tokenId) external payable; }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; // solhint-disable-next-line no-inline-assembly assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); // solhint-disable-next-line avoid-low-level-calls, avoid-call-value (bool success, ) = recipient.call{ value: amount }(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain`call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value, string memory errorMessage) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.call{ value: value }(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data, string memory errorMessage) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.staticcall(data); return _verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data, string memory errorMessage) internal returns (bytes memory) { require(isContract(target), "Address: delegate call to non-contract"); // solhint-disable-next-line avoid-low-level-calls (bool success, bytes memory returndata) = target.delegatecall(data); return _verifyCallResult(success, returndata, errorMessage); } function _verifyCallResult(bool success, bytes memory returndata, string memory errorMessage) private pure returns(bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly // solhint-disable-next-line no-inline-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; // a library for performing various math operations library SafeMathExtends { uint256 internal constant BONE = 10 ** 18; // Add two numbers together checking for overflows function badd(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "ERR_ADD_OVERFLOW"); return c; } // subtract two numbers and return diffecerence when it underflows function bsubSign(uint256 a, uint256 b) internal pure returns (uint256, bool) { if (a >= b) { return (a - b, false); } else { return (b - a, true); } } // Subtract two numbers checking for underflows function bsub(uint256 a, uint256 b) internal pure returns (uint256) { (uint256 c, bool flag) = bsubSign(a, b); require(!flag, "ERR_SUB_UNDERFLOW"); return c; } // Multiply two 18 decimals numbers function bmul(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c0 = a * b; require(a == 0 || c0 / a == b, "ERR_MUL_OVERFLOW"); uint256 c1 = c0 + (BONE / 2); require(c1 >= c0, "ERR_MUL_OVERFLOW"); uint256 c2 = c1 / BONE; return c2; } // Divide two 18 decimals numbers function bdiv(uint256 a, uint256 b) internal pure returns (uint256) { require(b != 0, "ERR_DIV_ZERO"); uint256 c0 = a * BONE; require(a == 0 || c0 / a == BONE, "ERR_DIV_INTERNAL"); // bmul overflow uint256 c1 = c0 + (b / 2); require(c1 >= c0, "ERR_DIV_INTERNAL"); // badd require uint256 c2 = c1 / b; return c2; } function min(uint x, uint y) internal pure returns (uint z) { z = x < y ? x : y; } // babylonian method (https://en.wikipedia.org/wiki/Methods_of_computing_square_roots#Babylonian_method) function sqrt(uint y) internal pure returns (uint z) { if (y > 3) { z = y; uint x = y / 2 + 1; while (x < z) { z = x; x = (y / x + x) / 2; } } else if (y != 0) { z = 1; } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; pragma experimental ABIEncoderV2; import './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); }
// SPDX-License-Identifier: GPL-2.0-or-later /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.5.0 <=0.8.0; library BytesLib { function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, 'slice_overflow'); require(_start + _length >= _start, 'slice_overflow'); require(_bytes.length >= _start + _length, 'slice_outOfBounds'); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_start + 20 >= _start, 'toAddress_overflow'); require(_bytes.length >= _start + 20, 'toAddress_outOfBounds'); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint24(bytes memory _bytes, uint256 _start) internal pure returns (uint24) { require(_start + 3 >= _start, 'toUint24_overflow'); require(_bytes.length >= _start + 3, 'toUint24_outOfBounds'); uint24 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x3), _start)) } return tempUint; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.4.0; /// @title FixedPoint96 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) /// @dev Used in SqrtPriceMath.sol library FixedPoint96 { uint8 internal constant RESOLUTION = 96; uint256 internal constant Q96 = 0x1000000000000000000000000; }
// SPDX-License-Identifier: MIT pragma solidity >=0.4.0; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = - denominator & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.2 <0.8.0; import "../../introspection/IERC165.sol"; /** * @dev Required interface of an ERC721 compliant contract. */ interface IERC721 is IERC165 { /** * @dev Emitted when `tokenId` token is transferred from `from` to `to`. */ event Transfer(address indexed from, address indexed to, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables `approved` to manage the `tokenId` token. */ event Approval(address indexed owner, address indexed approved, uint256 indexed tokenId); /** * @dev Emitted when `owner` enables or disables (`approved`) `operator` to manage all of its assets. */ event ApprovalForAll(address indexed owner, address indexed operator, bool approved); /** * @dev Returns the number of tokens in ``owner``'s account. */ function balanceOf(address owner) external view returns (uint256 balance); /** * @dev Returns the owner of the `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function ownerOf(uint256 tokenId) external view returns (address owner); /** * @dev Safely transfers `tokenId` token from `from` to `to`, checking first that contract recipients * are aware of the ERC721 protocol to prevent tokens from being forever locked. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be have been allowed to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId) external; /** * @dev Transfers `tokenId` token from `from` to `to`. * * WARNING: Usage of this method is discouraged, use {safeTransferFrom} whenever possible. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 tokenId) external; /** * @dev Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * * Only a single account can be approved at a time, so approving the zero address clears previous approvals. * * Requirements: * * - The caller must own the token or be an approved operator. * - `tokenId` must exist. * * Emits an {Approval} event. */ function approve(address to, uint256 tokenId) external; /** * @dev Returns the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @dev Approve or remove `operator` as an operator for the caller. * Operators can call {transferFrom} or {safeTransferFrom} for any token owned by the caller. * * Requirements: * * - The `operator` cannot be the caller. * * Emits an {ApprovalForAll} event. */ function setApprovalForAll(address operator, bool _approved) external; /** * @dev Returns if the `operator` is allowed to manage all of the assets of `owner`. * * See {setApprovalForAll} */ function isApprovedForAll(address owner, address operator) external view returns (bool); /** * @dev Safely transfers `tokenId` token from `from` to `to`. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `tokenId` token must exist and be owned by `from`. * - If the caller is not `from`, it must be approved to move this token by either {approve} or {setApprovalForAll}. * - If `to` refers to a smart contract, it must implement {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. * * Emits a {Transfer} event. */ function safeTransferFrom(address from, address to, uint256 tokenId, bytes calldata data) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.7.6; library GovIdentityStorage { bytes32 public constant govSlot = keccak256("GovIdentityStorage.storage.location"); struct Identity{ address governance; address rewards; mapping(address=>bool) strategist; mapping(address=>bool) admin; } function load() internal pure returns (Identity storage gov) { bytes32 loc = govSlot; assembly { gov.slot := loc } } }
// 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: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Collect","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"}],"name":"DecreaseLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"}],"name":"IncreaseLiquidity","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"tokenId","type":"uint256"},{"indexed":false,"internalType":"uint128","name":"liquidity","type":"uint128"}],"name":"Mint","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"address","name":"fromToken","type":"address"},{"indexed":false,"internalType":"address","name":"toToken","type":"address"},{"indexed":false,"internalType":"uint256","name":"amountIn","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"Swap","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"enum SmartPoolStorage.FeeType","name":"ft","type":"uint8"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"address","name":"rewards","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"TakeFee","type":"event"},{"inputs":[],"name":"assets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_vault","type":"address"},{"internalType":"address","name":"_ioToken","type":"address"}],"name":"bind","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"pool","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"}],"name":"checkPos","outputs":[{"internalType":"bool","name":"atWork","type":"bool"},{"internalType":"bool","name":"has","type":"bool"},{"internalType":"uint256","name":"tokenId","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"amount0Max","type":"uint128"},{"internalType":"uint128","name":"amount1Max","type":"uint128"}],"name":"collect","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"name":"decreaseLiquidity","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"}],"name":"estimateAmountIn","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"}],"name":"estimateAmountOut","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountIn","type":"uint256"},{"internalType":"uint256","name":"amountOutMinimum","type":"uint256"}],"name":"exactInput","outputs":[{"internalType":"uint256","name":"amountOut","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"tokenIn","type":"address"},{"internalType":"address","name":"tokenOut","type":"address"},{"internalType":"uint256","name":"amountOut","type":"uint256"},{"internalType":"uint256","name":"amountInMaximum","type":"uint256"}],"name":"exactOutput","outputs":[{"internalType":"uint256","name":"amountIn","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"getGovernance","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRewards","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnderlyings","outputs":[{"internalType":"address[]","name":"tokens","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"history","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"idleAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenId","type":"uint256"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"name":"increaseLiquidity","outputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"ioToken","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"}],"name":"isAdmin","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_strategist","type":"address"}],"name":"isStrategist","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"liquidityAssets","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token0","type":"address"},{"internalType":"address","name":"token1","type":"address"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"amount0Desired","type":"uint256"},{"internalType":"uint256","name":"amount1Desired","type":"uint256"}],"name":"mint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"positionOwners","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"ts","type":"address[]"}],"name":"removeUnderlyings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"safeApproveAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_admin","type":"address"},{"internalType":"bool","name":"enable","type":"bool"}],"name":"setAdmin","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_governance","type":"address"}],"name":"setGovernance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_rewards","type":"address"}],"name":"setRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_strategist","type":"address"},{"internalType":"bool","name":"enable","type":"bool"}],"name":"setStrategist","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"strategist","type":"address"},{"internalType":"address","name":"token","type":"address"},{"internalType":"int256","name":"amount","type":"int256"}],"name":"setTokenLimit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address[]","name":"ts","type":"address[]"}],"name":"setUnderlyings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes","name":"path","type":"bytes"}],"name":"settingSwapRoute","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"swapRoute","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"tokenLimit","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"vault","outputs":[{"internalType":"contract IVault","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"scale","type":"uint256"}],"name":"withdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"}],"name":"withdrawAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"scale","type":"uint256"}],"name":"withdrawOfUnderlying","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"worksPos","outputs":[{"internalType":"uint256[]","name":"tokenIds","type":"uint256[]"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b506200001c62000022565b620000b4565b6000620000396200009060201b620027fe1760201c565b8054336001600160a01b03199182168117835560018084018054909316821790925560009081526002830160209081526040808320805460ff19908116861790915560039095019091529020805490921617905550565b7fcb55949ab430320d1d890f811b8ef71f5738a7b79732c8a303f07d66f65bfcfa90565b615cce80620000c46000396000f3fe608060405234801561001057600080fd5b50600436106102325760003560e01c80639854211b11610130578063c691b0a1116100b8578063ed26bceb1161007c578063ed26bceb146104d5578063f2055297146104e8578063f65baefa14610508578063fa09e6301461051d578063fbfa77cf1461053057610232565b8063c691b0a114610472578063d1ec9f1414610494578063dbcea0a8146104a7578063e16b03a3146104ba578063ec38a862146104c257610232565b8063ac9650d8116100ff578063ac9650d814610406578063adb9aa3714610426578063b5c5f67214610439578063b9e0a2911461044c578063bcd9b38c1461045f57610232565b80639854211b146103ba5780639e5f76a9146103cd578063aa8d348e146103e0578063ab033ea9146103f357610232565b80634b0bddd2116101be5780637428f580116101825780637428f58014610356578063807f7738146103695780638157f72f1461038a57806381f47c6f1461039f5780638e5f5977146103a757610232565b80634b0bddd2146103025780634c341e131461031557806362474ea1146103285780636734faee1461033b57806371a973051461034e57610232565b806324d7806c1161020557806324d7806c146102aa578063289b3c0d146102ca5780632979da0b146102d257806331241492146102da57806345ed5569146102ef57610232565b80630572b0cc14610237578063131ba910146102555780631ab1fb191461027557806322d59b8a14610288575b600080fd5b61023f610538565b60405161024c9190615648565b60405180910390f35b610268610263366004614fa8565b610556565b60405161024c9190615aa2565b610268610283366004614fa8565b6106bd565b61029b61029636600461501a565b61080f565b60405161024c939291906157d0565b6102bd6102b8366004614e92565b61085e565b60405161024c91906157c5565b61023f610891565b6102686108ac565b6102ed6102e83660046150c3565b61090c565b005b6102ed6102fd366004614ee6565b6109d2565b6102ed610310366004614fed565b610abe565b6102ed610323366004614fed565b610b52565b61023f6103363660046151dd565b610be6565b6102bd610349366004614e92565b610c01565b610268610c33565b6102ed6103643660046150c3565b610c58565b61037c6103773660046153ba565b610d02565b60405161024c929190615aab565b610392610fb2565b60405161024c919061578d565b61023f61103f565b61037c6103b53660046153f0565b61104e565b6102686103c8366004614eae565b6111c8565b6102686103db366004614ee6565b6111e5565b6102ed6103ee366004615064565b6111fd565b6102ed610401366004614e92565b6114cc565b61041961041436600461516f565b611552565b60405161024c919061572d565b610268610434366004614ee6565b6116f5565b6102ed61044736600461508f565b611703565b6102ed61045a366004614f26565b611af8565b6102ed61046d3660046151f5565b611e5c565b610485610480366004615477565b611f58565b60405161024c93929190615a81565b6102ed6104a2366004614eae565b61229e565b6102ed6104b5366004614e92565b612326565b6102686123ec565b6102ed6104d0366004614e92565b6124f5565b6102686104e33660046151dd565b61257e565b6104fb6104f6366004614eae565b612590565b60405161024c91906157e8565b610510612631565b60405161024c91906156e0565b6102ed61052b366004614e92565b6126cf565b61023f6127ef565b6000806105436127fe565b600101546001600160a01b031691505090565b6000610560610891565b6001600160a01b0316336001600160a01b0316148061058357506105833361085e565b80610592575061059233610c01565b806105a057506105a0612822565b6105c55760405162461bcd60e51b81526004016105bc906158d9565b60405180910390fd5b60006105d033610c01565b9050801561061b573360009081526003602090815260408083206001600160a01b038a16845290915290205484111561061b5760405162461bcd60e51b81526004016105bc9061584b565b61062a60008787873088612833565b9150801561066b573360009081526003602090815260408083206001600160a01b038a81168552925280832080548890039055908716825290208054830190555b61067585836129a6565b7fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e4606233878787866040516106ac95949392919061565c565b60405180910390a150949350505050565b60006106c7610891565b6001600160a01b0316336001600160a01b031614806106ea57506106ea3361085e565b806106f957506106f933610c01565b806107075750610707612822565b6107235760405162461bcd60e51b81526004016105bc906158d9565b61073260008686308787612a95565b905061073d33610c01565b156107be573360009081526003602090815260408083206001600160a01b03891684529091529020548111156107855760405162461bcd60e51b81526004016105bc9061584b565b3360009081526003602090815260408083206001600160a01b038981168552925280832080548590039055908616825290208054840190555b6107c884846129a6565b7fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e4606233868684876040516107ff95949392919061565c565b60405180910390a1949350505050565b600080600080610820878787612baa565b6000818152600160205260409020549250905061083e600483612c00565b93506000821161084f576000610852565b60015b92505093509350939050565b6000806108696127fe565b6001600160a01b03841660009081526003909101602052604090205460ff169150505b919050565b60008061089c6127fe565b546001600160a01b031691505090565b60065460009081906001600160a01b0316816108c86004612c15565b905060005b818110156109035760006108e2600483612c20565b90506108f86108f18286612c2c565b8690612dba565b9450506001016108cd565b50919250505090565b60006109166127fe565b80549091506001600160a01b03163314610965576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60005b82518110156109cd5761099883828151811061098057fe5b60200260200101516008612e1490919063ffffffff16565b6109c5576109c38382815181106109ab57fe5b60200260200101516008612e2990919063ffffffff16565b505b600101610968565b505050565b60006109dc6127fe565b33600090815260038201602052604090205490915060ff1680610a08575080546001600160a01b031633145b610a52576040805162461bcd60e51b815260206004820152601660248201527510b3b7bb32b93730b731b29030b7321010b0b236b4b760511b604482015290519081900360640190fd5b6000821315610a8b576001600160a01b038085166000908152600360209081526040808320938716835292905220805483019055610ab8565b6001600160a01b038085166000908152600360209081526040808320938716835292905220805483900390555b50505050565b6000610ac86127fe565b80549091506001600160a01b03163314610b17576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6000610b216127fe565b6001600160a01b03949094166000908152600390940160205250506040909120805460ff1916911515919091179055565b6000610b5c6127fe565b80549091506001600160a01b03163314610bab576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6000610bb56127fe565b6001600160a01b03949094166000908152600290940160205250506040909120805460ff1916911515919091179055565b6002602052600090815260409020546001600160a01b031681565b600080610c0c6127fe565b6001600160a01b03841660009081526002909101602052604090205460ff16915050919050565b600080610c3e6123ec565b9050610c52610c4b6108ac565b8290612dba565b91505090565b6000610c626127fe565b80549091506001600160a01b03163314610cb1576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60005b82518110156109cd57610ccc83828151811061098057fe5b15610cfa57610cf8838281518110610ce057fe5b60200260200101516008612e3e90919063ffffffff16565b505b600101610cb4565b60008084610d0e610891565b6001600160a01b0316336001600160a01b03161480610d315750610d313361085e565b80610d5257506000818152600260205260409020546001600160a01b031633145b80610d605750610d60612822565b610d7c5760405162461bcd60e51b81526004016105bc9061589c565b604080516080810182528781523060208201526001600160801b038088168284015286166060820152905163fc6f786560e01b815273c36442b4a4522e871399cd717abdd847ab11fe889163fc6f786591610dda91906004016158f6565b6040805180830381600087803b158015610df357600080fd5b505af1158015610e07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2b9190615454565b60405163133f757160e31b815291945092506000908190819073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab8890610e6e908c90600401615aa2565b6101806040518083038186803b158015610e8757600080fd5b505afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906154b1565b5050505097505050509450945050506000600260008b815260200190815260200160002060009054906101000a90046001600160a01b03169050610f0281610c01565b15610f41576001600160a01b038181166000908152600360209081526040808320888516845290915280822080548b0190559185168152208054870190555b6001600160801b038216610f5c57610f5a60048b612e53565b505b610f6884848989612e5f565b7fde5e3abbba77c313e4f5881ab0685bbbbb54f38b5cfbdd6230e88642a5df29f1338b8989604051610f9d94939291906156ba565b60405180910390a15050505050935093915050565b60606000610fc06004612c15565b9050806001600160401b0381118015610fd857600080fd5b50604051908082528060200260200182016040528015611002578160200160208202803683370190505b50915060005b8181101561103a5761101b600482612c20565b83828151811061102757fe5b6020908102919091010152600101611008565b505090565b6006546001600160a01b031681565b6000808561105a610891565b6001600160a01b0316336001600160a01b0316148061107d575061107d3361085e565b8061109e57506000818152600260205260409020546001600160a01b031633145b806110ac57506110ac612822565b6110c85760405162461bcd60e51b81526004016105bc9061589c565b6040805160a0810182528881526001600160801b0388166020820152808201879052606081018690524260808201529051630624e65f60e11b815273c36442b4a4522e871399cd717abdd847ab11fe8891630c49ccbe9161112c9190600401615939565b6040805180830381600087803b15801561114557600080fd5b505af1158015611159573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117d9190615454565b60405191945092507f6693689f64043eabb83a49d6923e3f02afb22e2e1fe43fde0eea8e76e9944165906111b69033908a908a90615690565b60405180910390a15094509492505050565b600360209081526000928352604080842090915290825290205481565b60006111f381858585613033565b90505b9392505050565b611205612822565b6112215760405162461bcd60e51b81526004016105bc906158b9565b600061122d6008612c15565b90506000816001600160401b038111801561124757600080fd5b50604051908082528060200260200182016040528015611271578160200160208202803683370190505b5090506000826001600160401b038111801561128c57600080fd5b506040519080825280602002602001820160405280156112b6578160200160208202803683370190505b50905060005b838110156113a85760006112d1600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016113019190615648565b60206040518083038186803b15801561131957600080fd5b505afa15801561132d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135191906153a2565b90508085848151811061136057fe5b6020908102919091010152611387670de0b6b3a7640000611381838a613292565b906132eb565b84848151811061139357fe5b602090810291909101015250506001016112bc565b506113b284613352565b60005b838110156114c45760006113ca600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016113fa9190615648565b60206040518083038186803b15801561141257600080fd5b505afa158015611426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144a91906153a2565b9050600061147486858151811061145d57fe5b60200260200101518361347790919063ffffffff16565b9050600061149e8287878151811061148857fe5b6020026020010151612dba90919063ffffffff16565b90506114b46001600160a01b0385168b836134d4565b5050600190920191506113b59050565b505050505050565b60006114d66127fe565b80549091506001600160a01b03163314611525576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600061152f6127fe565b80546001600160a01b0319166001600160a01b0394909416939093179092555050565b606061155c610891565b6001600160a01b0316336001600160a01b0316148061157f575061157f3361085e565b8061158e575061158e33610c01565b8061159c575061159c612822565b6115b85760405162461bcd60e51b81526004016105bc906158d9565b816001600160401b03811180156115ce57600080fd5b5060405190808252806020026020018201604052801561160257816020015b60608152602001906001900390816115ed5790505b50905060005b828110156116ee576000803086868581811061162057fe5b90506020028101906116329190615ab9565b604051611640929190615638565b600060405180830381855af49150503d806000811461167b576040519150601f19603f3d011682016040523d82523d6000602084013e611680565b606091505b5091509150816116cc5760448151101561169957600080fd5b600481019050808060200190518101906116b3919061526d565b60405162461bcd60e51b81526004016105bc91906157e8565b808484815181106116d957fe5b60209081029190910101525050600101611608565b5092915050565b60006111f381858585613526565b61170b612822565b6117275760405162461bcd60e51b81526004016105bc906158b9565b6006546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611758903090600401615648565b60206040518083038186803b15801561177057600080fd5b505afa158015611784573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a891906153a2565b905082811015611a535760006117be6008612c15565b90506000816001600160401b03811180156117d857600080fd5b50604051908082528060200260200182016040528015611802578160200160208202803683370190505b5090506000826001600160401b038111801561181d57600080fd5b50604051908082528060200260200182016040528015611847578160200160208202803683370190505b50905060005b83811015611933576000611862600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016118929190615648565b60206040518083038186803b1580156118aa57600080fd5b505afa1580156118be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e291906153a2565b9050808584815181106118f157fe5b6020908102919091010152611912670de0b6b3a7640000611381838b613292565b84848151811061191e57fe5b6020908102919091010152505060010161184d565b5061193d85613352565b60005b83811015611a4e576000611955600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016119859190615648565b60206040518083038186803b15801561199d57600080fd5b505afa1580156119b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d591906153a2565b905060006119e886858151811061145d57fe5b905060006119fc8287878151811061148857fe5b6006549091506001600160a01b03858116911614801590611a1d5750600081115b15611a3e57600654611a3c9085906001600160a01b0316836000610556565b505b5050600190920191506119409050565b505050505b6006546040516370a0823160e01b81526001600160a01b03909116906370a0823190611a83903090600401615648565b60206040518083038186803b158015611a9b57600080fd5b505afa158015611aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad391906153a2565b905082811015611ae1578092505b600654610ab8906001600160a01b031685856134d4565b611b00610891565b6001600160a01b0316336001600160a01b03161480611b235750611b233361085e565b80611b325750611b3233610c01565b80611b405750611b40612822565b611b5c5760405162461bcd60e51b81526004016105bc906158d9565b6000611b6733610c01565b90508015611bf5573360009081526003602090815260408083206001600160a01b038c168452909152902054831115611bb25760405162461bcd60e51b81526004016105bc9061584b565b3360009081526003602090815260408083206001600160a01b038b168452909152902054821115611bf55760405162461bcd60e51b81526004016105bc9061584b565b60008060008073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b031663883164566040518061016001604052808f6001600160a01b031681526020018e6001600160a01b031681526020018d62ffffff1681526020018c60020b81526020018b60020b81526020018a81526020018981526020016000815260200160008152602001306001600160a01b03168152602001428152506040518263ffffffff1660e01b8152600401611cae91906159d3565b608060405180830381600087803b158015611cc857600080fd5b505af1158015611cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d009190615417565b93509350935093508415611dbb578160036000336001600160a01b03166001600160a01b0316815260200190815260200160002060008e6001600160a01b03166001600160a01b03168152602001908152602001600020600082825403925050819055508060036000336001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b03168152602001908152602001600020600082825403925050819055505b6000611dc685613761565b90506000611dd5828c8c612baa565b60008181526001602090815260408083208a90558983526002909152902080546001600160a01b031916331790559050611e10600487613818565b507fa049a7b0db25fd4a447d4a72385802f52641ca5797b84688137edbe240b2a57f338787604051611e4493929190615690565b60405180910390a15050505050505050505050505050565b6000611e666127fe565b33600090815260038201602052604090205490915060ff1680611e92575080546001600160a01b031633145b611edc576040805162461bcd60e51b815260206004820152601660248201527510b3b7bb32b93730b731b29030b7321010b0b236b4b760511b604482015290519081900360640190fd5b611ee582613824565b611f015760405162461bcd60e51b81526004016105bc90615871565b6000611f0c8361382c565b90506000611f1984613838565b6001600160a01b0380841660009081526020818152604080832093851683529281529190208651929350611f51929091870190614d93565b5050505050565b600080600087611f66610891565b6001600160a01b0316336001600160a01b03161480611f895750611f893361085e565b80611faa57506000818152600260205260409020546001600160a01b031633145b80611fb85750611fb8612822565b611fd45760405162461bcd60e51b81526004016105bc9061589c565b60405163133f757160e31b8152600090819073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab8890612010908e90600401615aa2565b6101806040518083038186803b15801561202957600080fd5b505afa15801561203d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206191906154b1565b50505050505050509350935050506000600260008d815260200190815260200160002060009054906101000a90046001600160a01b031690506120a381610c01565b15612132576001600160a01b038082166000908152600360209081526040808320938716835292905220548b11156120ed5760405162461bcd60e51b81526004016105bc9061584b565b6001600160a01b038082166000908152600360209081526040808320938616835292905220548a11156121325760405162461bcd60e51b81526004016105bc9061584b565b6040805160c0810182528d8152602081018d90528082018c9052606081018b9052608081018a90524260a0820152905163219f5d1760e01b815273c36442b4a4522e871399cd717abdd847ab11fe889163219f5d1791612195919060040161598f565b606060405180830381600087803b1580156121af57600080fd5b505af11580156121c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121e791906152d6565b919850965094506121f781610c01565b15612238576001600160a01b038181166000908152600360209081526040808320878516845290915280822080548a90039055918416815220805486900390555b61224360048d612c00565b6122545761225260048d613818565b505b7fcdabc26646509227c74ca625354a7b8160cd6a2a5476fc559e0d3e87652e5233338d8960405161228793929190615690565b60405180910390a150505050955095509592505050565b60006122a86127fe565b80549091506001600160a01b031633146122f7576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b50600780546001600160a01b039384166001600160a01b03199182161790915560068054929093169116179055565b60006123306127fe565b33600090815260038201602052604090205490915060ff168061235c575080546001600160a01b031633145b6123a6576040805162461bcd60e51b815260206004820152601660248201527510b3b7bb32b93730b731b29030b7321010b0b236b4b760511b604482015290519081900360640190fd5b6123c78273c36442b4a4522e871399cd717abdd847ab11fe88600019613851565b6123e88273e592427a0aece92de3edee1f18e0157c05861564600019613851565b5050565b60008060005b6123fc6008612c15565b8110156124ef576000612410600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016124409190615648565b60206040518083038186803b15801561245857600080fd5b505afa15801561246c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249091906153a2565b6006549091506001600160a01b03838116911614156124ba576124b38482612dba565b93506124e5565b6006546000906124d59084906001600160a01b0316846111e5565b90506124e18582612dba565b9450505b50506001016123f2565b50905090565b60006124ff6127fe565b80549091506001600160a01b0316331461254e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60006125586127fe565b60010180546001600160a01b0319166001600160a01b0394909416939093179092555050565b60016020526000908152604090205481565b60006020818152928152604080822084529181528190208054825160026001831615610100026000190190921691909104601f8101859004850282018501909352828152929091908301828280156126295780601f106125fe57610100808354040283529160200191612629565b820191906000526020600020905b81548152906001019060200180831161260c57829003601f168201915b505050505081565b6060600061263f6008612c15565b9050806001600160401b038111801561265757600080fd5b50604051908082528060200260200182016040528015612681578160200160208202803683370190505b50915060005b6126916008612c15565b81101561103a576126a3600882612c20565b8382815181106126af57fe5b6001600160a01b0390921660209283029190910190910152600101612687565b60006126d96127fe565b80549091506001600160a01b03163314612728576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60005b6127356008612c15565b8110156109cd576000612749600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016127799190615648565b60206040518083038186803b15801561279157600080fd5b505afa1580156127a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c991906153a2565b905080156127e5576127e56001600160a01b03831686836134d4565b505060010161272b565b6007546001600160a01b031681565b7fcb55949ab430320d1d890f811b8ef71f5738a7b79732c8a303f07d66f65bfcfa90565b6007546001600160a01b0316331490565b6001600160a01b0385811660009081526020888152604080832093881683529281528282208054845160026001831615610100026000190190921691909104601f810184900484028201840190955284815292938493928301828280156128db5780601f106128b0576101008083540402835291602001916128db565b820191906000526020600020905b8154815290600101906020018083116128be57829003601f168201915b50506040805160a0810182528581526001600160a01b038a1660208201524281830152606081018b905260808101899052905163c04b8d5960e01b815294955073e592427a0aece92de3edee1f18e0157c058615649463c04b8d599450612948935090915060040161597c565b602060405180830381600087803b15801561296257600080fd5b505af1158015612976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299a91906153a2565b98975050505050505050565b600754604051636d2227e960e11b81526000916001600160a01b03169063da444fd2906129d99060049086908201615830565b60206040518083038186803b1580156129f157600080fd5b505afa158015612a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2991906153a2565b905080156109cd576000612a3b610538565b9050612a516001600160a01b03851682846134d4565b7f23f1130767a74e11f5c444c8cc04e3e1fd5dd7c70d95202b6a248d3f14f0751f6004858385604051612a8794939291906157fb565b60405180910390a150505050565b6001600160a01b0384811660009081526020888152604080832093891683529281528282208054845160026001831615610100026000190190921691909104601f81018490048402820184019095528481529293849392830182828015612b3d5780601f10612b1257610100808354040283529160200191612b3d565b820191906000526020600020905b815481529060010190602001808311612b2057829003601f168201915b50506040805160a0810182528581526001600160a01b038b1660208201524281830152606081018a9052608081018990529051631e51809360e31b815294955073e592427a0aece92de3edee1f18e0157c058615649463f28c04989450612948935090915060040161597c565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a9093019052815191012090565b6000612c0c838361390b565b90505b92915050565b6000612c0f82613923565b6000612c0c8383613927565b600080600080600080600073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b03166399fbab888a6040518263ffffffff1660e01b8152600401612c779190615aa2565b6101806040518083038186803b158015612c9057600080fd5b505afa158015612ca4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cc891906154b1565b505050509750975097509750975097505050600080612ceb88888888888861398b565b91509150600080612cfb8d613a39565b9092509050612d0a8483612dba565b612d148483612dba565b909450925060006001600160a01b038b8116908e161415612d36575083612d54565b6000612d508c8f886000613033909392919063ffffffff16565b9150505b8c6001600160a01b03168a6001600160a01b03161415612d7f57612d788185612dba565b9050612da9565b6000612d998b8f876000613033909392919063ffffffff16565b9050612da58282612dba565b9150505b9d9c50505050505050505050505050565b600082820183811015612c0c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000612c0c836001600160a01b03841661390b565b6000612c0c836001600160a01b038416613b5e565b6000612c0c836001600160a01b038416613ba8565b6000612c0c8383613ba8565b600754604051636d2227e960e11b81526000916001600160a01b03169063da444fd290612e929060049087908201615830565b60206040518083038186803b158015612eaa57600080fd5b505afa158015612ebe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee291906153a2565b600754604051636d2227e960e11b81529192506000916001600160a01b039091169063da444fd290612f1a9060049087908201615830565b60206040518083038186803b158015612f3257600080fd5b505afa158015612f46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6a91906153a2565b90506000612f76610538565b90508215612fd157612f926001600160a01b03881682856134d4565b7f23f1130767a74e11f5c444c8cc04e3e1fd5dd7c70d95202b6a248d3f14f0751f6004888386604051612fc894939291906157fb565b60405180910390a15b811561302a57612feb6001600160a01b03871682846134d4565b7f23f1130767a74e11f5c444c8cc04e3e1fd5dd7c70d95202b6a248d3f14f0751f600487838560405161302194939291906157fb565b60405180910390a15b50505050505050565b6000816130425750600061328a565b6001600160a01b0384811660009081526020878152604080832093871683529281528282208054845160026001831615610100026000190190921691909104601f8101849004840282018401909552848152929390918301828280156130e95780601f106130be576101008083540402835291602001916130e9565b820191906000526020600020905b8154815290600101906020018083116130cc57829003601f168201915b505050505090508291505b600080600061310a61310585613c6e565b613c7d565b925092509250600061311d848484613cae565b90506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561315a57600080fd5b505afa15801561316e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613192919061530c565b50505050505090506000846001600160a01b0316866001600160a01b0316106131bb57846131bd565b855b90506131df620f42406113816131d88262ffffff8916613477565b8b90613292565b9750846001600160a01b0316816001600160a01b03161415613229576002613221836001600160a01b0316611381600160601b61321b8d613cc3565b90613292565b0a975061324d565b6002613249600160601b611381856001600160a01b031661321b8d613cc3565b0a97505b600061325888613d14565b905080156132705761326988613d1c565b975061327c565b50505050505050613288565b505050505050506130f4565b505b949350505050565b6000826132a157506000612c0f565b828202828482816132ae57fe5b0414612c0c5760405162461bcd60e51b8152600401808060200182810382526021815260200180615c186021913960400191505060405180910390fd5b6000808211613341576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161334a57fe5b049392505050565b600061335e6004612c15565b905060005b818110156109cd576000613378600483612c20565b60405163133f757160e31b815290915060009073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab88906133b5908590600401615aa2565b6101806040518083038186803b1580156133ce57600080fd5b505afa1580156133e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061340691906154b1565b505050509750505050505050506000816001600160801b0316111561346d576000613446670de0b6b3a76400006113816001600160801b03851689613292565b9050600080613458858460008061104e565b91509150613467858383610d02565b50505050505b5050600101613363565b6000828211156134ce576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109cd908490613d33565b6000816135355750600061328a565b6001600160a01b0384811660009081526020878152604080832093871683529281528282208054845160026001831615610100026000190190921691909104601f8101849004840282018401909552848152929390918301828280156135dc5780601f106135b1576101008083540402835291602001916135dc565b820191906000526020600020905b8154815290600101906020018083116135bf57829003601f168201915b505050505090508291505b60008060006135f861310585613c6e565b925092509250600061360b848484613cae565b90506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561364857600080fd5b505afa15801561365c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613680919061530c565b50505050505090506000846001600160a01b0316866001600160a01b0316106136a957846136ab565b855b9050846001600160a01b0316816001600160a01b031614156136ef5760026136e7600160601b611381856001600160a01b031661321b8d613cc3565b0a9750613713565b600261370f836001600160a01b0316611381600160601b61321b8d613cc3565b0a97505b613735613728620f424062ffffff8716613477565b6113818a620f4240613292565b9750600061374288613d14565b905080156132705761375388613d1c565b9750505050505050506135e7565b60008060008073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b03166399fbab88866040518263ffffffff1660e01b8152600401808281526020019150506101806040518083038186803b1580156137c057600080fd5b505afa1580156137d4573d6000803e3d6000fd5b505050506040513d6101808110156137eb57600080fd5b5060408101516060820151608090920151909450909250905061380f838383613cae565b95945050505050565b6000612c0c8383613b5e565b51602b111590565b6000612c0f8282613de4565b6000612c0f601483510383613de490919063ffffffff16565b60408051636eb1769f60e11b81523060048201526001600160a01b038481166024830152915185926000929084169163dd62ed3e91604480820192602092909190829003018186803b1580156138a657600080fd5b505afa1580156138ba573d6000803e3d6000fd5b505050506040513d60208110156138d057600080fd5b5051905082811015611f515780156138f7576138f76001600160a01b038316856000613e94565b611f516001600160a01b0383168585613e94565b60009081526001919091016020526040902054151590565b5490565b815460009082106139695760405162461bcd60e51b8152600401808060200182810382526022815260200180615bd06022913960400191505060405180910390fd5b82600001828154811061397857fe5b9060005260206000200154905092915050565b600080600061399b898989613cae565b6001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b1580156139d357600080fd5b505afa1580156139e7573d6000803e3d6000fd5b505050506040513d60e08110156139fd57600080fd5b505190506000613a0c87613fa7565b90506000613a1987613fa7565b9050613a27838383896142d9565b909c909b509950505050505050505050565b600080600080600080600073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b03166399fbab88896040518263ffffffff1660e01b8152600401808281526020019150506101806040518083038186803b158015613a9d57600080fd5b505afa158015613ab1573d6000803e3d6000fd5b505050506040513d610180811015613ac857600080fd5b5060e08101516101008201516101208301516101408401516101609094015192985090965094509092509050600080613b008a614375565b91509150613b1e868303886001600160801b0316600160801b6146ef565b846001600160801b0316019850613b45858203886001600160801b0316600160801b6146ef565b836001600160801b031601975050505050505050915091565b6000613b6a838361390b565b613ba057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612c0f565b506000612c0f565b60008181526001830160205260408120548015613c645783546000198083019190810190600090879083908110613bdb57fe5b9060005260206000200154905080876000018481548110613bf857fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080613c2857fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612c0f565b6000915050612c0f565b6060612c0f826000602b61479e565b60008080613c8b8482613de4565b9250613c988460146148ee565b9050613ca5846017613de4565b91509193909250565b60006111f3613cbe858585614995565b6149eb565b60006003821115613d06575080600160028204015b81811015613d0057809150600281828581613cef57fe5b040181613cf857fe5b049050613cd8565b5061088c565b811561088c57506001919050565b516042111590565b8051606090612c0f9083906017906016190161479e565b6000613d88826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614ad39092919063ffffffff16565b8051909150156109cd57808060200190516020811015613da757600080fd5b50516109cd5760405162461bcd60e51b815260040180806020018281038252602a815260200180615c39602a913960400191505060405180910390fd5b600081826014011015613e33576040805162461bcd60e51b8152602060048201526012602482015271746f416464726573735f6f766572666c6f7760701b604482015290519081900360640190fd5b8160140183511015613e84576040805162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b604482015290519081900360640190fd5b500160200151600160601b900490565b801580613f1a575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015613eec57600080fd5b505afa158015613f00573d6000803e3d6000fd5b505050506040513d6020811015613f1657600080fd5b5051155b613f555760405162461bcd60e51b8152600401808060200182810382526036815260200180615c636036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526109cd908490613d33565b60008060008360020b12613fbe578260020b613fc6565b8260020b6000035b9050620d89e8811115614004576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b60006001821661401857600160801b61402a565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561405e576ffff97272373d413259a46990580e213a0260801c5b600482161561407d576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b600882161561409c576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156140bb576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156140da576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156140f9576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615614118576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615614138576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615614158576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615614178576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615614198576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156141b8576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156141d8576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156141f8576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615614218576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615614239576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615614259576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615614278576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615614295576b048a170391f7dc42444e8fa20260801c5b60008460020b13156142b05780600019816142ac57fe5b0490505b6401000000008106156142c45760016142c7565b60005b60ff16602082901c0192505050919050565b600080836001600160a01b0316856001600160a01b031611156142fa579293925b846001600160a01b0316866001600160a01b0316116143255761431e858585614ae2565b915061436c565b836001600160a01b0316866001600160a01b0316101561435e5761434a868585614ae2565b9150614357858785614b4b565b905061436c565b614369858585614b4b565b90505b94509492505050565b60008060008073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b03166399fbab88866040518263ffffffff1660e01b8152600401808281526020019150506101806040518083038186803b1580156143d457600080fd5b505afa1580156143e8573d6000803e3d6000fd5b505050506040513d6101808110156143ff57600080fd5b5060a081015160c0909101519092509050600061441b86613761565b90506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561445857600080fd5b505afa15801561446c573d6000803e3d6000fd5b505050506040513d60e081101561448257600080fd5b506020908101516040805163f305839960e01b815290519193506000926001600160a01b0386169263f3058399926004808201939291829003018186803b1580156144cc57600080fd5b505afa1580156144e0573d6000803e3d6000fd5b505050506040513d60208110156144f657600080fd5b505160408051634614131960e01b815290519192506000916001600160a01b038616916346141319916004808301926020929190829003018186803b15801561453e57600080fd5b505afa158015614552573d6000803e3d6000fd5b505050506040513d602081101561456857600080fd5b50516040805163f30dba9360e01b8152600289900b6004820152905191925060009182916001600160a01b0388169163f30dba939160248082019261010092909190829003018186803b1580156145be57600080fd5b505afa1580156145d2573d6000803e3d6000fd5b505050506040513d6101008110156145e957600080fd5b50604080820151606090920151815163f30dba9360e01b815260028b900b60048201529151929450925060009182916001600160a01b038a169163f30dba939160248082019261010092909190829003018186803b15801561464a57600080fd5b505afa15801561465e573d6000803e3d6000fd5b505050506040513d61010081101561467557600080fd5b506040810151606090910151909250905060008060028c810b908a900b126146a15750849050836146aa565b50508386038386035b6000808c60020b8b60020b12156146c55750849050836146ce565b50508388038388035b81848b03039f5080838a03039e505050505050505050505050505050915091565b6000808060001985870986860292508281109083900303905080614725576000841161471a57600080fd5b5082900490506111f6565b80841161473157600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60608182601f0110156147e9576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015614831576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b8183018451101561487d576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561489c5760405191506000825260208201604052613288565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156148d55780518352602092830192016148bd565b5050858452601f01601f19166040525050949350505050565b60008182600301101561493c576040805162461bcd60e51b8152602060048201526011602482015270746f55696e7432345f6f766572666c6f7760781b604482015290519081900360640190fd5b816003018351101561498c576040805162461bcd60e51b8152602060048201526014602482015273746f55696e7432345f6f75744f66426f756e647360601b604482015290519081900360640190fd5b50016003015190565b61499d614e1f565b826001600160a01b0316846001600160a01b031611156149bb579192915b50604080516060810182526001600160a01b03948516815292909316602083015262ffffff169181019190915290565b600081602001516001600160a01b031682600001516001600160a01b031610614a1357600080fd5b50805160208083015160409384015184516001600160a01b0394851681850152939091168385015262ffffff16606080840191909152835180840390910181526080830184528051908201206001600160f81b031960a08401527307e610c722b66148d8c6b92967c99cd1ba8c7e6160621b60a184015260b58301527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808401919091528351808403909101815260f5909201909252805191012090565b60606111f38484600085614b8e565b6000826001600160a01b0316846001600160a01b03161115614b02579192915b836001600160a01b0316614b3b606060ff16846001600160801b0316901b8686036001600160a01b0316866001600160a01b03166146ef565b81614b4257fe5b04949350505050565b6000826001600160a01b0316846001600160a01b03161115614b6b579192915b6111f3826001600160801b03168585036001600160a01b0316600160601b6146ef565b606082471015614bcf5760405162461bcd60e51b8152600401808060200182810382526026815260200180615bf26026913960400191505060405180910390fd5b614bd885614ce9565b614c29576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310614c675780518252601f199092019160209182019101614c48565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614cc9576040519150601f19603f3d011682016040523d82523d6000602084013e614cce565b606091505b5091509150614cde828286614cef565b979650505050505050565b3b151590565b60608315614cfe5750816111f6565b825115614d0e5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614d58578181015183820152602001614d40565b50505050905090810190601f168015614d855780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282614dc95760008555614e0f565b82601f10614de257805160ff1916838001178555614e0f565b82800160010185558215614e0f579182015b82811115614e0f578251825591602001919060010190614df4565b50614e1b929150614e3f565b5090565b604080516060810182526000808252602082018190529181019190915290565b5b80821115614e1b5760008155600101614e40565b805161088c81615b74565b805161088c81615b9a565b805161088c81615ba9565b805161ffff8116811461088c57600080fd5b805161088c81615bbe565b600060208284031215614ea3578081fd5b8135612c0c81615b74565b60008060408385031215614ec0578081fd5b8235614ecb81615b74565b91506020830135614edb81615b74565b809150509250929050565b600080600060608486031215614efa578081fd5b8335614f0581615b74565b92506020840135614f1581615b74565b929592945050506040919091013590565b600080600080600080600060e0888a031215614f40578283fd5b8735614f4b81615b74565b96506020880135614f5b81615b74565b95506040880135614f6b81615bbe565b94506060880135614f7b81615b9a565b93506080880135614f8b81615b9a565b9699959850939692959460a0840135945060c09093013592915050565b60008060008060808587031215614fbd578182fd5b8435614fc881615b74565b93506020850135614fd881615b74565b93969395505050506040820135916060013590565b60008060408385031215614fff578182fd5b823561500a81615b74565b91506020830135614edb81615b8c565b60008060006060848603121561502e578081fd5b833561503981615b74565b9250602084013561504981615b9a565b9150604084013561505981615b9a565b809150509250925092565b60008060408385031215615076578182fd5b823561508181615b74565b946020939093013593505050565b6000806000606084860312156150a3578081fd5b83356150ae81615b74565b95602085013595506040909401359392505050565b600060208083850312156150d5578182fd5b82356001600160401b03808211156150eb578384fd5b818501915085601f8301126150fe578384fd5b81358181111561510a57fe5b838102915061511a848301615b04565b8181528481019084860184860187018a1015615134578788fd5b8795505b83861015615162578035945061514d85615b74565b84835260019590950194918601918601615138565b5098975050505050505050565b60008060208385031215615181578182fd5b82356001600160401b0380821115615197578384fd5b818501915085601f8301126151aa578384fd5b8135818111156151b8578485fd5b86602080830285010111156151cb578485fd5b60209290920196919550909350505050565b6000602082840312156151ee578081fd5b5035919050565b600060208284031215615206578081fd5b81356001600160401b0381111561521b578182fd5b8201601f8101841361522b578182fd5b803561523e61523982615b27565b615b04565b818152856020838501011115615252578384fd5b81602084016020830137908101602001929092525092915050565b60006020828403121561527e578081fd5b81516001600160401b03811115615293578182fd5b8201601f810184136152a3578182fd5b80516152b161523982615b27565b8181528560208385010111156152c5578384fd5b61380f826020830160208601615b48565b6000806000606084860312156152ea578081fd5b83516152f581615ba9565b602085015160409095015190969495509392505050565b600080600080600080600060e0888a031215615326578081fd5b875161533181615b74565b602089015190975061534281615b9a565b955061535060408901614e75565b945061535e60608901614e75565b935061536c60808901614e75565b925060a088015160ff81168114615381578182fd5b60c089015190925061539281615b8c565b8091505092959891949750929550565b6000602082840312156153b3578081fd5b5051919050565b6000806000606084860312156153ce578081fd5b8335925060208401356153e081615ba9565b9150604084013561505981615ba9565b60008060008060808587031215615405578182fd5b843593506020850135614fd881615ba9565b6000806000806080858703121561542c578182fd5b84519350602085015161543e81615ba9565b6040860151606090960151949790965092505050565b60008060408385031215615466578182fd5b505080516020909101519092909150565b600080600080600060a0868803121561548e578283fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000806000806000806000806000806000806101808d8f0312156154d3578586fd5b8c516bffffffffffffffffffffffff811681146154ee578687fd5b9b506154fc60208e01614e54565b9a5061550a60408e01614e54565b995061551860608e01614e54565b985061552660808e01614e87565b975061553460a08e01614e5f565b965061554260c08e01614e5f565b955061555060e08e01614e6a565b94506101008d015193506101208d0151925061556f6101408e01614e6a565b915061557e6101608e01614e6a565b90509295989b509295989b509295989b565b6001600160a01b03169052565b600081518084526155b5816020860160208601615b48565b601f01601f19169290920160200192915050565b600581106155d357fe5b9052565b60020b9052565b6000815160a084526155f360a085018261559d565b6020848101516001600160a01b031690860152604080850151908601526060808501519086015260809384015193909401929092525090919050565b62ffffff169052565b6000828483379101908152919050565b6001600160a01b0391909116815260200190565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b6001600160a01b0393909316835260208301919091526001600160801b0316604082015260600190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b6020808252825182820181905260009190848201906040850190845b818110156157215783516001600160a01b0316835292840192918401916001016156fc565b50909695505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b8281101561578057603f1988860301845261576e85835161559d565b94509285019290850190600101615752565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015615721578351835292840192918401916001016157a9565b901515815260200190565b92151583529015156020830152604082015260600190565b600060208252612c0c602083018461559d565b6080810161580982876155c9565b6001600160a01b039485166020830152929093166040840152606090920191909152919050565b6040810161583e82856155c9565b8260208301529392505050565b6020808252600c908201526b0858da1958dac81b1a5b5a5d60a21b604082015260600190565b6020808252601190820152701c185d1a081a5cc81b9bdd081d985b1a59607a1b604082015260600190565b60208082526003908201526221504d60e81b604082015260600190565b602080825260069082015265085d985d5b1d60d21b604082015260600190565b60208082526003908201526221414d60e81b604082015260600190565b815181526020808301516001600160a01b0316908201526040808301516001600160801b0390811691830191909152606092830151169181019190915260800190565b600060a082019050825182526001600160801b03602084015116602083015260408301516040830152606083015160608301526080830151608083015292915050565b600060208252612c0c60208301846155de565b600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b6000610160820190506159e7828451615590565b60208301516159f96020840182615590565b506040830151615a0c604084018261562f565b506060830151615a1f60608401826155d7565b506080830151615a3260808401826155d7565b5060a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525061012080840151615a7082850182615590565b505061014092830151919092015290565b6001600160801b039390931683526020830191909152604082015260600190565b90815260200190565b918252602082015260400190565b6000808335601e19843603018112615acf578283fd5b8301803591506001600160401b03821115615ae8578283fd5b602001915036819003821315615afd57600080fd5b9250929050565b6040518181016001600160401b0381118282101715615b1f57fe5b604052919050565b60006001600160401b03821115615b3a57fe5b50601f01601f191660200190565b60005b83811015615b63578181015183820152602001615b4b565b83811115610ab85750506000910152565b6001600160a01b0381168114615b8957600080fd5b50565b8015158114615b8957600080fd5b8060020b8114615b8957600080fd5b6001600160801b0381168114615b8957600080fd5b62ffffff81168114615b8957600080fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220a3af6800a15a5047175b98acb4172569c075649ffae8306dad23b4805786a73464736f6c63430007060033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106102325760003560e01c80639854211b11610130578063c691b0a1116100b8578063ed26bceb1161007c578063ed26bceb146104d5578063f2055297146104e8578063f65baefa14610508578063fa09e6301461051d578063fbfa77cf1461053057610232565b8063c691b0a114610472578063d1ec9f1414610494578063dbcea0a8146104a7578063e16b03a3146104ba578063ec38a862146104c257610232565b8063ac9650d8116100ff578063ac9650d814610406578063adb9aa3714610426578063b5c5f67214610439578063b9e0a2911461044c578063bcd9b38c1461045f57610232565b80639854211b146103ba5780639e5f76a9146103cd578063aa8d348e146103e0578063ab033ea9146103f357610232565b80634b0bddd2116101be5780637428f580116101825780637428f58014610356578063807f7738146103695780638157f72f1461038a57806381f47c6f1461039f5780638e5f5977146103a757610232565b80634b0bddd2146103025780634c341e131461031557806362474ea1146103285780636734faee1461033b57806371a973051461034e57610232565b806324d7806c1161020557806324d7806c146102aa578063289b3c0d146102ca5780632979da0b146102d257806331241492146102da57806345ed5569146102ef57610232565b80630572b0cc14610237578063131ba910146102555780631ab1fb191461027557806322d59b8a14610288575b600080fd5b61023f610538565b60405161024c9190615648565b60405180910390f35b610268610263366004614fa8565b610556565b60405161024c9190615aa2565b610268610283366004614fa8565b6106bd565b61029b61029636600461501a565b61080f565b60405161024c939291906157d0565b6102bd6102b8366004614e92565b61085e565b60405161024c91906157c5565b61023f610891565b6102686108ac565b6102ed6102e83660046150c3565b61090c565b005b6102ed6102fd366004614ee6565b6109d2565b6102ed610310366004614fed565b610abe565b6102ed610323366004614fed565b610b52565b61023f6103363660046151dd565b610be6565b6102bd610349366004614e92565b610c01565b610268610c33565b6102ed6103643660046150c3565b610c58565b61037c6103773660046153ba565b610d02565b60405161024c929190615aab565b610392610fb2565b60405161024c919061578d565b61023f61103f565b61037c6103b53660046153f0565b61104e565b6102686103c8366004614eae565b6111c8565b6102686103db366004614ee6565b6111e5565b6102ed6103ee366004615064565b6111fd565b6102ed610401366004614e92565b6114cc565b61041961041436600461516f565b611552565b60405161024c919061572d565b610268610434366004614ee6565b6116f5565b6102ed61044736600461508f565b611703565b6102ed61045a366004614f26565b611af8565b6102ed61046d3660046151f5565b611e5c565b610485610480366004615477565b611f58565b60405161024c93929190615a81565b6102ed6104a2366004614eae565b61229e565b6102ed6104b5366004614e92565b612326565b6102686123ec565b6102ed6104d0366004614e92565b6124f5565b6102686104e33660046151dd565b61257e565b6104fb6104f6366004614eae565b612590565b60405161024c91906157e8565b610510612631565b60405161024c91906156e0565b6102ed61052b366004614e92565b6126cf565b61023f6127ef565b6000806105436127fe565b600101546001600160a01b031691505090565b6000610560610891565b6001600160a01b0316336001600160a01b0316148061058357506105833361085e565b80610592575061059233610c01565b806105a057506105a0612822565b6105c55760405162461bcd60e51b81526004016105bc906158d9565b60405180910390fd5b60006105d033610c01565b9050801561061b573360009081526003602090815260408083206001600160a01b038a16845290915290205484111561061b5760405162461bcd60e51b81526004016105bc9061584b565b61062a60008787873088612833565b9150801561066b573360009081526003602090815260408083206001600160a01b038a81168552925280832080548890039055908716825290208054830190555b61067585836129a6565b7fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e4606233878787866040516106ac95949392919061565c565b60405180910390a150949350505050565b60006106c7610891565b6001600160a01b0316336001600160a01b031614806106ea57506106ea3361085e565b806106f957506106f933610c01565b806107075750610707612822565b6107235760405162461bcd60e51b81526004016105bc906158d9565b61073260008686308787612a95565b905061073d33610c01565b156107be573360009081526003602090815260408083206001600160a01b03891684529091529020548111156107855760405162461bcd60e51b81526004016105bc9061584b565b3360009081526003602090815260408083206001600160a01b038981168552925280832080548590039055908616825290208054840190555b6107c884846129a6565b7fcd3829a3813dc3cdd188fd3d01dcf3268c16be2fdd2dd21d0665418816e4606233868684876040516107ff95949392919061565c565b60405180910390a1949350505050565b600080600080610820878787612baa565b6000818152600160205260409020549250905061083e600483612c00565b93506000821161084f576000610852565b60015b92505093509350939050565b6000806108696127fe565b6001600160a01b03841660009081526003909101602052604090205460ff169150505b919050565b60008061089c6127fe565b546001600160a01b031691505090565b60065460009081906001600160a01b0316816108c86004612c15565b905060005b818110156109035760006108e2600483612c20565b90506108f86108f18286612c2c565b8690612dba565b9450506001016108cd565b50919250505090565b60006109166127fe565b80549091506001600160a01b03163314610965576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60005b82518110156109cd5761099883828151811061098057fe5b60200260200101516008612e1490919063ffffffff16565b6109c5576109c38382815181106109ab57fe5b60200260200101516008612e2990919063ffffffff16565b505b600101610968565b505050565b60006109dc6127fe565b33600090815260038201602052604090205490915060ff1680610a08575080546001600160a01b031633145b610a52576040805162461bcd60e51b815260206004820152601660248201527510b3b7bb32b93730b731b29030b7321010b0b236b4b760511b604482015290519081900360640190fd5b6000821315610a8b576001600160a01b038085166000908152600360209081526040808320938716835292905220805483019055610ab8565b6001600160a01b038085166000908152600360209081526040808320938716835292905220805483900390555b50505050565b6000610ac86127fe565b80549091506001600160a01b03163314610b17576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6000610b216127fe565b6001600160a01b03949094166000908152600390940160205250506040909120805460ff1916911515919091179055565b6000610b5c6127fe565b80549091506001600160a01b03163314610bab576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b6000610bb56127fe565b6001600160a01b03949094166000908152600290940160205250506040909120805460ff1916911515919091179055565b6002602052600090815260409020546001600160a01b031681565b600080610c0c6127fe565b6001600160a01b03841660009081526002909101602052604090205460ff16915050919050565b600080610c3e6123ec565b9050610c52610c4b6108ac565b8290612dba565b91505090565b6000610c626127fe565b80549091506001600160a01b03163314610cb1576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60005b82518110156109cd57610ccc83828151811061098057fe5b15610cfa57610cf8838281518110610ce057fe5b60200260200101516008612e3e90919063ffffffff16565b505b600101610cb4565b60008084610d0e610891565b6001600160a01b0316336001600160a01b03161480610d315750610d313361085e565b80610d5257506000818152600260205260409020546001600160a01b031633145b80610d605750610d60612822565b610d7c5760405162461bcd60e51b81526004016105bc9061589c565b604080516080810182528781523060208201526001600160801b038088168284015286166060820152905163fc6f786560e01b815273c36442b4a4522e871399cd717abdd847ab11fe889163fc6f786591610dda91906004016158f6565b6040805180830381600087803b158015610df357600080fd5b505af1158015610e07573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e2b9190615454565b60405163133f757160e31b815291945092506000908190819073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab8890610e6e908c90600401615aa2565b6101806040518083038186803b158015610e8757600080fd5b505afa158015610e9b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ebf91906154b1565b5050505097505050509450945050506000600260008b815260200190815260200160002060009054906101000a90046001600160a01b03169050610f0281610c01565b15610f41576001600160a01b038181166000908152600360209081526040808320888516845290915280822080548b0190559185168152208054870190555b6001600160801b038216610f5c57610f5a60048b612e53565b505b610f6884848989612e5f565b7fde5e3abbba77c313e4f5881ab0685bbbbb54f38b5cfbdd6230e88642a5df29f1338b8989604051610f9d94939291906156ba565b60405180910390a15050505050935093915050565b60606000610fc06004612c15565b9050806001600160401b0381118015610fd857600080fd5b50604051908082528060200260200182016040528015611002578160200160208202803683370190505b50915060005b8181101561103a5761101b600482612c20565b83828151811061102757fe5b6020908102919091010152600101611008565b505090565b6006546001600160a01b031681565b6000808561105a610891565b6001600160a01b0316336001600160a01b0316148061107d575061107d3361085e565b8061109e57506000818152600260205260409020546001600160a01b031633145b806110ac57506110ac612822565b6110c85760405162461bcd60e51b81526004016105bc9061589c565b6040805160a0810182528881526001600160801b0388166020820152808201879052606081018690524260808201529051630624e65f60e11b815273c36442b4a4522e871399cd717abdd847ab11fe8891630c49ccbe9161112c9190600401615939565b6040805180830381600087803b15801561114557600080fd5b505af1158015611159573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061117d9190615454565b60405191945092507f6693689f64043eabb83a49d6923e3f02afb22e2e1fe43fde0eea8e76e9944165906111b69033908a908a90615690565b60405180910390a15094509492505050565b600360209081526000928352604080842090915290825290205481565b60006111f381858585613033565b90505b9392505050565b611205612822565b6112215760405162461bcd60e51b81526004016105bc906158b9565b600061122d6008612c15565b90506000816001600160401b038111801561124757600080fd5b50604051908082528060200260200182016040528015611271578160200160208202803683370190505b5090506000826001600160401b038111801561128c57600080fd5b506040519080825280602002602001820160405280156112b6578160200160208202803683370190505b50905060005b838110156113a85760006112d1600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016113019190615648565b60206040518083038186803b15801561131957600080fd5b505afa15801561132d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061135191906153a2565b90508085848151811061136057fe5b6020908102919091010152611387670de0b6b3a7640000611381838a613292565b906132eb565b84848151811061139357fe5b602090810291909101015250506001016112bc565b506113b284613352565b60005b838110156114c45760006113ca600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016113fa9190615648565b60206040518083038186803b15801561141257600080fd5b505afa158015611426573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061144a91906153a2565b9050600061147486858151811061145d57fe5b60200260200101518361347790919063ffffffff16565b9050600061149e8287878151811061148857fe5b6020026020010151612dba90919063ffffffff16565b90506114b46001600160a01b0385168b836134d4565b5050600190920191506113b59050565b505050505050565b60006114d66127fe565b80549091506001600160a01b03163314611525576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b600061152f6127fe565b80546001600160a01b0319166001600160a01b0394909416939093179092555050565b606061155c610891565b6001600160a01b0316336001600160a01b0316148061157f575061157f3361085e565b8061158e575061158e33610c01565b8061159c575061159c612822565b6115b85760405162461bcd60e51b81526004016105bc906158d9565b816001600160401b03811180156115ce57600080fd5b5060405190808252806020026020018201604052801561160257816020015b60608152602001906001900390816115ed5790505b50905060005b828110156116ee576000803086868581811061162057fe5b90506020028101906116329190615ab9565b604051611640929190615638565b600060405180830381855af49150503d806000811461167b576040519150601f19603f3d011682016040523d82523d6000602084013e611680565b606091505b5091509150816116cc5760448151101561169957600080fd5b600481019050808060200190518101906116b3919061526d565b60405162461bcd60e51b81526004016105bc91906157e8565b808484815181106116d957fe5b60209081029190910101525050600101611608565b5092915050565b60006111f381858585613526565b61170b612822565b6117275760405162461bcd60e51b81526004016105bc906158b9565b6006546040516370a0823160e01b81526000916001600160a01b0316906370a0823190611758903090600401615648565b60206040518083038186803b15801561177057600080fd5b505afa158015611784573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117a891906153a2565b905082811015611a535760006117be6008612c15565b90506000816001600160401b03811180156117d857600080fd5b50604051908082528060200260200182016040528015611802578160200160208202803683370190505b5090506000826001600160401b038111801561181d57600080fd5b50604051908082528060200260200182016040528015611847578160200160208202803683370190505b50905060005b83811015611933576000611862600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016118929190615648565b60206040518083038186803b1580156118aa57600080fd5b505afa1580156118be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118e291906153a2565b9050808584815181106118f157fe5b6020908102919091010152611912670de0b6b3a7640000611381838b613292565b84848151811061191e57fe5b6020908102919091010152505060010161184d565b5061193d85613352565b60005b83811015611a4e576000611955600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016119859190615648565b60206040518083038186803b15801561199d57600080fd5b505afa1580156119b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119d591906153a2565b905060006119e886858151811061145d57fe5b905060006119fc8287878151811061148857fe5b6006549091506001600160a01b03858116911614801590611a1d5750600081115b15611a3e57600654611a3c9085906001600160a01b0316836000610556565b505b5050600190920191506119409050565b505050505b6006546040516370a0823160e01b81526001600160a01b03909116906370a0823190611a83903090600401615648565b60206040518083038186803b158015611a9b57600080fd5b505afa158015611aaf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ad391906153a2565b905082811015611ae1578092505b600654610ab8906001600160a01b031685856134d4565b611b00610891565b6001600160a01b0316336001600160a01b03161480611b235750611b233361085e565b80611b325750611b3233610c01565b80611b405750611b40612822565b611b5c5760405162461bcd60e51b81526004016105bc906158d9565b6000611b6733610c01565b90508015611bf5573360009081526003602090815260408083206001600160a01b038c168452909152902054831115611bb25760405162461bcd60e51b81526004016105bc9061584b565b3360009081526003602090815260408083206001600160a01b038b168452909152902054821115611bf55760405162461bcd60e51b81526004016105bc9061584b565b60008060008073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b031663883164566040518061016001604052808f6001600160a01b031681526020018e6001600160a01b031681526020018d62ffffff1681526020018c60020b81526020018b60020b81526020018a81526020018981526020016000815260200160008152602001306001600160a01b03168152602001428152506040518263ffffffff1660e01b8152600401611cae91906159d3565b608060405180830381600087803b158015611cc857600080fd5b505af1158015611cdc573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d009190615417565b93509350935093508415611dbb578160036000336001600160a01b03166001600160a01b0316815260200190815260200160002060008e6001600160a01b03166001600160a01b03168152602001908152602001600020600082825403925050819055508060036000336001600160a01b03166001600160a01b0316815260200190815260200160002060008d6001600160a01b03166001600160a01b03168152602001908152602001600020600082825403925050819055505b6000611dc685613761565b90506000611dd5828c8c612baa565b60008181526001602090815260408083208a90558983526002909152902080546001600160a01b031916331790559050611e10600487613818565b507fa049a7b0db25fd4a447d4a72385802f52641ca5797b84688137edbe240b2a57f338787604051611e4493929190615690565b60405180910390a15050505050505050505050505050565b6000611e666127fe565b33600090815260038201602052604090205490915060ff1680611e92575080546001600160a01b031633145b611edc576040805162461bcd60e51b815260206004820152601660248201527510b3b7bb32b93730b731b29030b7321010b0b236b4b760511b604482015290519081900360640190fd5b611ee582613824565b611f015760405162461bcd60e51b81526004016105bc90615871565b6000611f0c8361382c565b90506000611f1984613838565b6001600160a01b0380841660009081526020818152604080832093851683529281529190208651929350611f51929091870190614d93565b5050505050565b600080600087611f66610891565b6001600160a01b0316336001600160a01b03161480611f895750611f893361085e565b80611faa57506000818152600260205260409020546001600160a01b031633145b80611fb85750611fb8612822565b611fd45760405162461bcd60e51b81526004016105bc9061589c565b60405163133f757160e31b8152600090819073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab8890612010908e90600401615aa2565b6101806040518083038186803b15801561202957600080fd5b505afa15801561203d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061206191906154b1565b50505050505050509350935050506000600260008d815260200190815260200160002060009054906101000a90046001600160a01b031690506120a381610c01565b15612132576001600160a01b038082166000908152600360209081526040808320938716835292905220548b11156120ed5760405162461bcd60e51b81526004016105bc9061584b565b6001600160a01b038082166000908152600360209081526040808320938616835292905220548a11156121325760405162461bcd60e51b81526004016105bc9061584b565b6040805160c0810182528d8152602081018d90528082018c9052606081018b9052608081018a90524260a0820152905163219f5d1760e01b815273c36442b4a4522e871399cd717abdd847ab11fe889163219f5d1791612195919060040161598f565b606060405180830381600087803b1580156121af57600080fd5b505af11580156121c3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121e791906152d6565b919850965094506121f781610c01565b15612238576001600160a01b038181166000908152600360209081526040808320878516845290915280822080548a90039055918416815220805486900390555b61224360048d612c00565b6122545761225260048d613818565b505b7fcdabc26646509227c74ca625354a7b8160cd6a2a5476fc559e0d3e87652e5233338d8960405161228793929190615690565b60405180910390a150505050955095509592505050565b60006122a86127fe565b80549091506001600160a01b031633146122f7576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b50600780546001600160a01b039384166001600160a01b03199182161790915560068054929093169116179055565b60006123306127fe565b33600090815260038201602052604090205490915060ff168061235c575080546001600160a01b031633145b6123a6576040805162461bcd60e51b815260206004820152601660248201527510b3b7bb32b93730b731b29030b7321010b0b236b4b760511b604482015290519081900360640190fd5b6123c78273c36442b4a4522e871399cd717abdd847ab11fe88600019613851565b6123e88273e592427a0aece92de3edee1f18e0157c05861564600019613851565b5050565b60008060005b6123fc6008612c15565b8110156124ef576000612410600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016124409190615648565b60206040518083038186803b15801561245857600080fd5b505afa15801561246c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061249091906153a2565b6006549091506001600160a01b03838116911614156124ba576124b38482612dba565b93506124e5565b6006546000906124d59084906001600160a01b0316846111e5565b90506124e18582612dba565b9450505b50506001016123f2565b50905090565b60006124ff6127fe565b80549091506001600160a01b0316331461254e576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60006125586127fe565b60010180546001600160a01b0319166001600160a01b0394909416939093179092555050565b60016020526000908152604090205481565b60006020818152928152604080822084529181528190208054825160026001831615610100026000190190921691909104601f8101859004850282018501909352828152929091908301828280156126295780601f106125fe57610100808354040283529160200191612629565b820191906000526020600020905b81548152906001019060200180831161260c57829003601f168201915b505050505081565b6060600061263f6008612c15565b9050806001600160401b038111801561265757600080fd5b50604051908082528060200260200182016040528015612681578160200160208202803683370190505b50915060005b6126916008612c15565b81101561103a576126a3600882612c20565b8382815181106126af57fe5b6001600160a01b0390921660209283029190910190910152600101612687565b60006126d96127fe565b80549091506001600160a01b03163314612728576040805162461bcd60e51b815260206004820152600b60248201526a21676f7665726e616e636560a81b604482015290519081900360640190fd5b60005b6127356008612c15565b8110156109cd576000612749600883612c20565b90506000816001600160a01b03166370a08231306040518263ffffffff1660e01b81526004016127799190615648565b60206040518083038186803b15801561279157600080fd5b505afa1580156127a5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127c991906153a2565b905080156127e5576127e56001600160a01b03831686836134d4565b505060010161272b565b6007546001600160a01b031681565b7fcb55949ab430320d1d890f811b8ef71f5738a7b79732c8a303f07d66f65bfcfa90565b6007546001600160a01b0316331490565b6001600160a01b0385811660009081526020888152604080832093881683529281528282208054845160026001831615610100026000190190921691909104601f810184900484028201840190955284815292938493928301828280156128db5780601f106128b0576101008083540402835291602001916128db565b820191906000526020600020905b8154815290600101906020018083116128be57829003601f168201915b50506040805160a0810182528581526001600160a01b038a1660208201524281830152606081018b905260808101899052905163c04b8d5960e01b815294955073e592427a0aece92de3edee1f18e0157c058615649463c04b8d599450612948935090915060040161597c565b602060405180830381600087803b15801561296257600080fd5b505af1158015612976573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061299a91906153a2565b98975050505050505050565b600754604051636d2227e960e11b81526000916001600160a01b03169063da444fd2906129d99060049086908201615830565b60206040518083038186803b1580156129f157600080fd5b505afa158015612a05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a2991906153a2565b905080156109cd576000612a3b610538565b9050612a516001600160a01b03851682846134d4565b7f23f1130767a74e11f5c444c8cc04e3e1fd5dd7c70d95202b6a248d3f14f0751f6004858385604051612a8794939291906157fb565b60405180910390a150505050565b6001600160a01b0384811660009081526020888152604080832093891683529281528282208054845160026001831615610100026000190190921691909104601f81018490048402820184019095528481529293849392830182828015612b3d5780601f10612b1257610100808354040283529160200191612b3d565b820191906000526020600020905b815481529060010190602001808311612b2057829003601f168201915b50506040805160a0810182528581526001600160a01b038b1660208201524281830152606081018a9052608081018990529051631e51809360e31b815294955073e592427a0aece92de3edee1f18e0157c058615649463f28c04989450612948935090915060040161597c565b6040805160609490941b6bffffffffffffffffffffffff1916602080860191909152600293840b60e890811b60348701529290930b90911b60378401528051808403601a018152603a9093019052815191012090565b6000612c0c838361390b565b90505b92915050565b6000612c0f82613923565b6000612c0c8383613927565b600080600080600080600073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b03166399fbab888a6040518263ffffffff1660e01b8152600401612c779190615aa2565b6101806040518083038186803b158015612c9057600080fd5b505afa158015612ca4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612cc891906154b1565b505050509750975097509750975097505050600080612ceb88888888888861398b565b91509150600080612cfb8d613a39565b9092509050612d0a8483612dba565b612d148483612dba565b909450925060006001600160a01b038b8116908e161415612d36575083612d54565b6000612d508c8f886000613033909392919063ffffffff16565b9150505b8c6001600160a01b03168a6001600160a01b03161415612d7f57612d788185612dba565b9050612da9565b6000612d998b8f876000613033909392919063ffffffff16565b9050612da58282612dba565b9150505b9d9c50505050505050505050505050565b600082820183811015612c0c576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b6000612c0c836001600160a01b03841661390b565b6000612c0c836001600160a01b038416613b5e565b6000612c0c836001600160a01b038416613ba8565b6000612c0c8383613ba8565b600754604051636d2227e960e11b81526000916001600160a01b03169063da444fd290612e929060049087908201615830565b60206040518083038186803b158015612eaa57600080fd5b505afa158015612ebe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ee291906153a2565b600754604051636d2227e960e11b81529192506000916001600160a01b039091169063da444fd290612f1a9060049087908201615830565b60206040518083038186803b158015612f3257600080fd5b505afa158015612f46573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f6a91906153a2565b90506000612f76610538565b90508215612fd157612f926001600160a01b03881682856134d4565b7f23f1130767a74e11f5c444c8cc04e3e1fd5dd7c70d95202b6a248d3f14f0751f6004888386604051612fc894939291906157fb565b60405180910390a15b811561302a57612feb6001600160a01b03871682846134d4565b7f23f1130767a74e11f5c444c8cc04e3e1fd5dd7c70d95202b6a248d3f14f0751f600487838560405161302194939291906157fb565b60405180910390a15b50505050505050565b6000816130425750600061328a565b6001600160a01b0384811660009081526020878152604080832093871683529281528282208054845160026001831615610100026000190190921691909104601f8101849004840282018401909552848152929390918301828280156130e95780601f106130be576101008083540402835291602001916130e9565b820191906000526020600020905b8154815290600101906020018083116130cc57829003601f168201915b505050505090508291505b600080600061310a61310585613c6e565b613c7d565b925092509250600061311d848484613cae565b90506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561315a57600080fd5b505afa15801561316e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613192919061530c565b50505050505090506000846001600160a01b0316866001600160a01b0316106131bb57846131bd565b855b90506131df620f42406113816131d88262ffffff8916613477565b8b90613292565b9750846001600160a01b0316816001600160a01b03161415613229576002613221836001600160a01b0316611381600160601b61321b8d613cc3565b90613292565b0a975061324d565b6002613249600160601b611381856001600160a01b031661321b8d613cc3565b0a97505b600061325888613d14565b905080156132705761326988613d1c565b975061327c565b50505050505050613288565b505050505050506130f4565b505b949350505050565b6000826132a157506000612c0f565b828202828482816132ae57fe5b0414612c0c5760405162461bcd60e51b8152600401808060200182810382526021815260200180615c186021913960400191505060405180910390fd5b6000808211613341576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161334a57fe5b049392505050565b600061335e6004612c15565b905060005b818110156109cd576000613378600483612c20565b60405163133f757160e31b815290915060009073c36442b4a4522e871399cd717abdd847ab11fe88906399fbab88906133b5908590600401615aa2565b6101806040518083038186803b1580156133ce57600080fd5b505afa1580156133e2573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061340691906154b1565b505050509750505050505050506000816001600160801b0316111561346d576000613446670de0b6b3a76400006113816001600160801b03851689613292565b9050600080613458858460008061104e565b91509150613467858383610d02565b50505050505b5050600101613363565b6000828211156134ce576040805162461bcd60e51b815260206004820152601e60248201527f536166654d6174683a207375627472616374696f6e206f766572666c6f770000604482015290519081900360640190fd5b50900390565b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663a9059cbb60e01b1790526109cd908490613d33565b6000816135355750600061328a565b6001600160a01b0384811660009081526020878152604080832093871683529281528282208054845160026001831615610100026000190190921691909104601f8101849004840282018401909552848152929390918301828280156135dc5780601f106135b1576101008083540402835291602001916135dc565b820191906000526020600020905b8154815290600101906020018083116135bf57829003601f168201915b505050505090508291505b60008060006135f861310585613c6e565b925092509250600061360b848484613cae565b90506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561364857600080fd5b505afa15801561365c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613680919061530c565b50505050505090506000846001600160a01b0316866001600160a01b0316106136a957846136ab565b855b9050846001600160a01b0316816001600160a01b031614156136ef5760026136e7600160601b611381856001600160a01b031661321b8d613cc3565b0a9750613713565b600261370f836001600160a01b0316611381600160601b61321b8d613cc3565b0a97505b613735613728620f424062ffffff8716613477565b6113818a620f4240613292565b9750600061374288613d14565b905080156132705761375388613d1c565b9750505050505050506135e7565b60008060008073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b03166399fbab88866040518263ffffffff1660e01b8152600401808281526020019150506101806040518083038186803b1580156137c057600080fd5b505afa1580156137d4573d6000803e3d6000fd5b505050506040513d6101808110156137eb57600080fd5b5060408101516060820151608090920151909450909250905061380f838383613cae565b95945050505050565b6000612c0c8383613b5e565b51602b111590565b6000612c0f8282613de4565b6000612c0f601483510383613de490919063ffffffff16565b60408051636eb1769f60e11b81523060048201526001600160a01b038481166024830152915185926000929084169163dd62ed3e91604480820192602092909190829003018186803b1580156138a657600080fd5b505afa1580156138ba573d6000803e3d6000fd5b505050506040513d60208110156138d057600080fd5b5051905082811015611f515780156138f7576138f76001600160a01b038316856000613e94565b611f516001600160a01b0383168585613e94565b60009081526001919091016020526040902054151590565b5490565b815460009082106139695760405162461bcd60e51b8152600401808060200182810382526022815260200180615bd06022913960400191505060405180910390fd5b82600001828154811061397857fe5b9060005260206000200154905092915050565b600080600061399b898989613cae565b6001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b1580156139d357600080fd5b505afa1580156139e7573d6000803e3d6000fd5b505050506040513d60e08110156139fd57600080fd5b505190506000613a0c87613fa7565b90506000613a1987613fa7565b9050613a27838383896142d9565b909c909b509950505050505050505050565b600080600080600080600073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b03166399fbab88896040518263ffffffff1660e01b8152600401808281526020019150506101806040518083038186803b158015613a9d57600080fd5b505afa158015613ab1573d6000803e3d6000fd5b505050506040513d610180811015613ac857600080fd5b5060e08101516101008201516101208301516101408401516101609094015192985090965094509092509050600080613b008a614375565b91509150613b1e868303886001600160801b0316600160801b6146ef565b846001600160801b0316019850613b45858203886001600160801b0316600160801b6146ef565b836001600160801b031601975050505050505050915091565b6000613b6a838361390b565b613ba057508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155612c0f565b506000612c0f565b60008181526001830160205260408120548015613c645783546000198083019190810190600090879083908110613bdb57fe5b9060005260206000200154905080876000018481548110613bf857fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080613c2857fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050612c0f565b6000915050612c0f565b6060612c0f826000602b61479e565b60008080613c8b8482613de4565b9250613c988460146148ee565b9050613ca5846017613de4565b91509193909250565b60006111f3613cbe858585614995565b6149eb565b60006003821115613d06575080600160028204015b81811015613d0057809150600281828581613cef57fe5b040181613cf857fe5b049050613cd8565b5061088c565b811561088c57506001919050565b516042111590565b8051606090612c0f9083906017906016190161479e565b6000613d88826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316614ad39092919063ffffffff16565b8051909150156109cd57808060200190516020811015613da757600080fd5b50516109cd5760405162461bcd60e51b815260040180806020018281038252602a815260200180615c39602a913960400191505060405180910390fd5b600081826014011015613e33576040805162461bcd60e51b8152602060048201526012602482015271746f416464726573735f6f766572666c6f7760701b604482015290519081900360640190fd5b8160140183511015613e84576040805162461bcd60e51b8152602060048201526015602482015274746f416464726573735f6f75744f66426f756e647360581b604482015290519081900360640190fd5b500160200151600160601b900490565b801580613f1a575060408051636eb1769f60e11b81523060048201526001600160a01b03848116602483015291519185169163dd62ed3e91604480820192602092909190829003018186803b158015613eec57600080fd5b505afa158015613f00573d6000803e3d6000fd5b505050506040513d6020811015613f1657600080fd5b5051155b613f555760405162461bcd60e51b8152600401808060200182810382526036815260200180615c636036913960400191505060405180910390fd5b604080516001600160a01b038416602482015260448082018490528251808303909101815260649091019091526020810180516001600160e01b031663095ea7b360e01b1790526109cd908490613d33565b60008060008360020b12613fbe578260020b613fc6565b8260020b6000035b9050620d89e8811115614004576040805162461bcd60e51b81526020600482015260016024820152601560fa1b604482015290519081900360640190fd5b60006001821661401857600160801b61402a565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff169050600282161561405e576ffff97272373d413259a46990580e213a0260801c5b600482161561407d576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b600882161561409c576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b60108216156140bb576fffcb9843d60f6159c9db58835c9266440260801c5b60208216156140da576fff973b41fa98c081472e6896dfb254c00260801c5b60408216156140f9576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615614118576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615614138576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615614158576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615614178576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615614198576fe7159475a2c29b7443b29c7fa6e889d90260801c5b6110008216156141b8576fd097f3bdfd2022b8845ad8f792aa58250260801c5b6120008216156141d8576fa9f746462d870fdf8a65dc1f90e061e50260801c5b6140008216156141f8576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615614218576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615614239576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615614259576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615614278576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615614295576b048a170391f7dc42444e8fa20260801c5b60008460020b13156142b05780600019816142ac57fe5b0490505b6401000000008106156142c45760016142c7565b60005b60ff16602082901c0192505050919050565b600080836001600160a01b0316856001600160a01b031611156142fa579293925b846001600160a01b0316866001600160a01b0316116143255761431e858585614ae2565b915061436c565b836001600160a01b0316866001600160a01b0316101561435e5761434a868585614ae2565b9150614357858785614b4b565b905061436c565b614369858585614b4b565b90505b94509492505050565b60008060008073c36442b4a4522e871399cd717abdd847ab11fe886001600160a01b03166399fbab88866040518263ffffffff1660e01b8152600401808281526020019150506101806040518083038186803b1580156143d457600080fd5b505afa1580156143e8573d6000803e3d6000fd5b505050506040513d6101808110156143ff57600080fd5b5060a081015160c0909101519092509050600061441b86613761565b90506000816001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b15801561445857600080fd5b505afa15801561446c573d6000803e3d6000fd5b505050506040513d60e081101561448257600080fd5b506020908101516040805163f305839960e01b815290519193506000926001600160a01b0386169263f3058399926004808201939291829003018186803b1580156144cc57600080fd5b505afa1580156144e0573d6000803e3d6000fd5b505050506040513d60208110156144f657600080fd5b505160408051634614131960e01b815290519192506000916001600160a01b038616916346141319916004808301926020929190829003018186803b15801561453e57600080fd5b505afa158015614552573d6000803e3d6000fd5b505050506040513d602081101561456857600080fd5b50516040805163f30dba9360e01b8152600289900b6004820152905191925060009182916001600160a01b0388169163f30dba939160248082019261010092909190829003018186803b1580156145be57600080fd5b505afa1580156145d2573d6000803e3d6000fd5b505050506040513d6101008110156145e957600080fd5b50604080820151606090920151815163f30dba9360e01b815260028b900b60048201529151929450925060009182916001600160a01b038a169163f30dba939160248082019261010092909190829003018186803b15801561464a57600080fd5b505afa15801561465e573d6000803e3d6000fd5b505050506040513d61010081101561467557600080fd5b506040810151606090910151909250905060008060028c810b908a900b126146a15750849050836146aa565b50508386038386035b6000808c60020b8b60020b12156146c55750849050836146ce565b50508388038388035b81848b03039f5080838a03039e505050505050505050505050505050915091565b6000808060001985870986860292508281109083900303905080614725576000841161471a57600080fd5b5082900490506111f6565b80841161473157600080fd5b6000848688096000868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b60608182601f0110156147e9576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b828284011015614831576040805162461bcd60e51b815260206004820152600e60248201526d736c6963655f6f766572666c6f7760901b604482015290519081900360640190fd5b8183018451101561487d576040805162461bcd60e51b8152602060048201526011602482015270736c6963655f6f75744f66426f756e647360781b604482015290519081900360640190fd5b60608215801561489c5760405191506000825260208201604052613288565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156148d55780518352602092830192016148bd565b5050858452601f01601f19166040525050949350505050565b60008182600301101561493c576040805162461bcd60e51b8152602060048201526011602482015270746f55696e7432345f6f766572666c6f7760781b604482015290519081900360640190fd5b816003018351101561498c576040805162461bcd60e51b8152602060048201526014602482015273746f55696e7432345f6f75744f66426f756e647360601b604482015290519081900360640190fd5b50016003015190565b61499d614e1f565b826001600160a01b0316846001600160a01b031611156149bb579192915b50604080516060810182526001600160a01b03948516815292909316602083015262ffffff169181019190915290565b600081602001516001600160a01b031682600001516001600160a01b031610614a1357600080fd5b50805160208083015160409384015184516001600160a01b0394851681850152939091168385015262ffffff16606080840191909152835180840390910181526080830184528051908201206001600160f81b031960a08401527307e610c722b66148d8c6b92967c99cd1ba8c7e6160621b60a184015260b58301527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d5808401919091528351808403909101815260f5909201909252805191012090565b60606111f38484600085614b8e565b6000826001600160a01b0316846001600160a01b03161115614b02579192915b836001600160a01b0316614b3b606060ff16846001600160801b0316901b8686036001600160a01b0316866001600160a01b03166146ef565b81614b4257fe5b04949350505050565b6000826001600160a01b0316846001600160a01b03161115614b6b579192915b6111f3826001600160801b03168585036001600160a01b0316600160601b6146ef565b606082471015614bcf5760405162461bcd60e51b8152600401808060200182810382526026815260200180615bf26026913960400191505060405180910390fd5b614bd885614ce9565b614c29576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b600080866001600160a01b031685876040518082805190602001908083835b60208310614c675780518252601f199092019160209182019101614c48565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114614cc9576040519150601f19603f3d011682016040523d82523d6000602084013e614cce565b606091505b5091509150614cde828286614cef565b979650505050505050565b3b151590565b60608315614cfe5750816111f6565b825115614d0e5782518084602001fd5b8160405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015614d58578181015183820152602001614d40565b50505050905090810190601f168015614d855780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b828054600181600116156101000203166002900490600052602060002090601f016020900481019282614dc95760008555614e0f565b82601f10614de257805160ff1916838001178555614e0f565b82800160010185558215614e0f579182015b82811115614e0f578251825591602001919060010190614df4565b50614e1b929150614e3f565b5090565b604080516060810182526000808252602082018190529181019190915290565b5b80821115614e1b5760008155600101614e40565b805161088c81615b74565b805161088c81615b9a565b805161088c81615ba9565b805161ffff8116811461088c57600080fd5b805161088c81615bbe565b600060208284031215614ea3578081fd5b8135612c0c81615b74565b60008060408385031215614ec0578081fd5b8235614ecb81615b74565b91506020830135614edb81615b74565b809150509250929050565b600080600060608486031215614efa578081fd5b8335614f0581615b74565b92506020840135614f1581615b74565b929592945050506040919091013590565b600080600080600080600060e0888a031215614f40578283fd5b8735614f4b81615b74565b96506020880135614f5b81615b74565b95506040880135614f6b81615bbe565b94506060880135614f7b81615b9a565b93506080880135614f8b81615b9a565b9699959850939692959460a0840135945060c09093013592915050565b60008060008060808587031215614fbd578182fd5b8435614fc881615b74565b93506020850135614fd881615b74565b93969395505050506040820135916060013590565b60008060408385031215614fff578182fd5b823561500a81615b74565b91506020830135614edb81615b8c565b60008060006060848603121561502e578081fd5b833561503981615b74565b9250602084013561504981615b9a565b9150604084013561505981615b9a565b809150509250925092565b60008060408385031215615076578182fd5b823561508181615b74565b946020939093013593505050565b6000806000606084860312156150a3578081fd5b83356150ae81615b74565b95602085013595506040909401359392505050565b600060208083850312156150d5578182fd5b82356001600160401b03808211156150eb578384fd5b818501915085601f8301126150fe578384fd5b81358181111561510a57fe5b838102915061511a848301615b04565b8181528481019084860184860187018a1015615134578788fd5b8795505b83861015615162578035945061514d85615b74565b84835260019590950194918601918601615138565b5098975050505050505050565b60008060208385031215615181578182fd5b82356001600160401b0380821115615197578384fd5b818501915085601f8301126151aa578384fd5b8135818111156151b8578485fd5b86602080830285010111156151cb578485fd5b60209290920196919550909350505050565b6000602082840312156151ee578081fd5b5035919050565b600060208284031215615206578081fd5b81356001600160401b0381111561521b578182fd5b8201601f8101841361522b578182fd5b803561523e61523982615b27565b615b04565b818152856020838501011115615252578384fd5b81602084016020830137908101602001929092525092915050565b60006020828403121561527e578081fd5b81516001600160401b03811115615293578182fd5b8201601f810184136152a3578182fd5b80516152b161523982615b27565b8181528560208385010111156152c5578384fd5b61380f826020830160208601615b48565b6000806000606084860312156152ea578081fd5b83516152f581615ba9565b602085015160409095015190969495509392505050565b600080600080600080600060e0888a031215615326578081fd5b875161533181615b74565b602089015190975061534281615b9a565b955061535060408901614e75565b945061535e60608901614e75565b935061536c60808901614e75565b925060a088015160ff81168114615381578182fd5b60c089015190925061539281615b8c565b8091505092959891949750929550565b6000602082840312156153b3578081fd5b5051919050565b6000806000606084860312156153ce578081fd5b8335925060208401356153e081615ba9565b9150604084013561505981615ba9565b60008060008060808587031215615405578182fd5b843593506020850135614fd881615ba9565b6000806000806080858703121561542c578182fd5b84519350602085015161543e81615ba9565b6040860151606090960151949790965092505050565b60008060408385031215615466578182fd5b505080516020909101519092909150565b600080600080600060a0868803121561548e578283fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000806000806000806000806000806000806101808d8f0312156154d3578586fd5b8c516bffffffffffffffffffffffff811681146154ee578687fd5b9b506154fc60208e01614e54565b9a5061550a60408e01614e54565b995061551860608e01614e54565b985061552660808e01614e87565b975061553460a08e01614e5f565b965061554260c08e01614e5f565b955061555060e08e01614e6a565b94506101008d015193506101208d0151925061556f6101408e01614e6a565b915061557e6101608e01614e6a565b90509295989b509295989b509295989b565b6001600160a01b03169052565b600081518084526155b5816020860160208601615b48565b601f01601f19169290920160200192915050565b600581106155d357fe5b9052565b60020b9052565b6000815160a084526155f360a085018261559d565b6020848101516001600160a01b031690860152604080850151908601526060808501519086015260809384015193909401929092525090919050565b62ffffff169052565b6000828483379101908152919050565b6001600160a01b0391909116815260200190565b6001600160a01b03958616815293851660208501529190931660408301526060820192909252608081019190915260a00190565b6001600160a01b0393909316835260208301919091526001600160801b0316604082015260600190565b6001600160a01b0394909416845260208401929092526040830152606082015260800190565b6020808252825182820181905260009190848201906040850190845b818110156157215783516001600160a01b0316835292840192918401916001016156fc565b50909695505050505050565b6000602080830181845280855180835260408601915060408482028701019250838701855b8281101561578057603f1988860301845261576e85835161559d565b94509285019290850190600101615752565b5092979650505050505050565b6020808252825182820181905260009190848201906040850190845b81811015615721578351835292840192918401916001016157a9565b901515815260200190565b92151583529015156020830152604082015260600190565b600060208252612c0c602083018461559d565b6080810161580982876155c9565b6001600160a01b039485166020830152929093166040840152606090920191909152919050565b6040810161583e82856155c9565b8260208301529392505050565b6020808252600c908201526b0858da1958dac81b1a5b5a5d60a21b604082015260600190565b6020808252601190820152701c185d1a081a5cc81b9bdd081d985b1a59607a1b604082015260600190565b60208082526003908201526221504d60e81b604082015260600190565b602080825260069082015265085d985d5b1d60d21b604082015260600190565b60208082526003908201526221414d60e81b604082015260600190565b815181526020808301516001600160a01b0316908201526040808301516001600160801b0390811691830191909152606092830151169181019190915260800190565b600060a082019050825182526001600160801b03602084015116602083015260408301516040830152606083015160608301526080830151608083015292915050565b600060208252612c0c60208301846155de565b600060c082019050825182526020830151602083015260408301516040830152606083015160608301526080830151608083015260a083015160a083015292915050565b6000610160820190506159e7828451615590565b60208301516159f96020840182615590565b506040830151615a0c604084018261562f565b506060830151615a1f60608401826155d7565b506080830151615a3260808401826155d7565b5060a083015160a083015260c083015160c083015260e083015160e083015261010080840151818401525061012080840151615a7082850182615590565b505061014092830151919092015290565b6001600160801b039390931683526020830191909152604082015260600190565b90815260200190565b918252602082015260400190565b6000808335601e19843603018112615acf578283fd5b8301803591506001600160401b03821115615ae8578283fd5b602001915036819003821315615afd57600080fd5b9250929050565b6040518181016001600160401b0381118282101715615b1f57fe5b604052919050565b60006001600160401b03821115615b3a57fe5b50601f01601f191660200190565b60005b83811015615b63578181015183820152602001615b4b565b83811115610ab85750506000910152565b6001600160a01b0381168114615b8957600080fd5b50565b8015158114615b8957600080fd5b8060020b8114615b8957600080fd5b6001600160801b0381168114615b8957600080fd5b62ffffff81168114615b8957600080fdfe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e6473416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775361666545524332303a204552433230206f7065726174696f6e20646964206e6f7420737563636565645361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f20746f206e6f6e2d7a65726f20616c6c6f77616e6365a2646970667358221220a3af6800a15a5047175b98acb4172569c075649ffae8306dad23b4805786a73464736f6c63430007060033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.