Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 106 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Collect | 21155017 | 4 days ago | IN | 0 ETH | 0.00065313 | ||||
Collect | 21149334 | 5 days ago | IN | 0 ETH | 0.00053623 | ||||
Increase Liquidi... | 21148490 | 5 days ago | IN | 0.1942512 ETH | 0.00407127 | ||||
Collect | 21145382 | 5 days ago | IN | 0 ETH | 0.00082932 | ||||
Increase Liquidi... | 21141559 | 6 days ago | IN | 0.02414206 ETH | 0.0033403 | ||||
Collect | 21141502 | 6 days ago | IN | 0 ETH | 0.00072252 | ||||
Increase Liquidi... | 21136418 | 7 days ago | IN | 0.92 ETH | 0.00587881 | ||||
Collect | 21136245 | 7 days ago | IN | 0 ETH | 0.00115228 | ||||
Increase Liquidi... | 21135009 | 7 days ago | IN | 0.84432422 ETH | 0.00901512 | ||||
Collect | 21134007 | 7 days ago | IN | 0 ETH | 0.00052543 | ||||
Collect | 21124722 | 8 days ago | IN | 0 ETH | 0.00046905 | ||||
Increase Liquidi... | 21123728 | 8 days ago | IN | 0.25 ETH | 0.00479011 | ||||
Increase Liquidi... | 21119651 | 9 days ago | IN | 0.00327674 ETH | 0.00106355 | ||||
Collect | 21119595 | 9 days ago | IN | 0 ETH | 0.00021549 | ||||
Collect | 21115772 | 9 days ago | IN | 0 ETH | 0.00070267 | ||||
Collect | 21114658 | 10 days ago | IN | 0 ETH | 0.00045883 | ||||
Collect | 21113777 | 10 days ago | IN | 0 ETH | 0.00042477 | ||||
Collect | 21113763 | 10 days ago | IN | 0 ETH | 0.0002826 | ||||
Collect | 21112114 | 10 days ago | IN | 0 ETH | 0.00052512 | ||||
Collect | 21110378 | 10 days ago | IN | 0 ETH | 0.00033945 | ||||
Collect | 21110069 | 10 days ago | IN | 0 ETH | 0.00035257 | ||||
Collect | 21109345 | 10 days ago | IN | 0 ETH | 0.00036785 | ||||
Collect | 21105703 | 11 days ago | IN | 0 ETH | 0.00025749 | ||||
Collect | 21105638 | 11 days ago | IN | 0 ETH | 0.00027364 | ||||
Increase Liquidi... | 21098081 | 12 days ago | IN | 0 ETH | 0.00111237 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
21148490 | 5 days ago | 0.1942512 ETH | ||||
21141559 | 6 days ago | 0.02414206 ETH | ||||
21136418 | 7 days ago | 0.92 ETH | ||||
21135009 | 7 days ago | 0.84432422 ETH | ||||
21123728 | 8 days ago | 0.25 ETH | ||||
21119651 | 9 days ago | 0.00327674 ETH | ||||
20907398 | 39 days ago | 0.02337457 ETH | ||||
20906723 | 39 days ago | 0.01472276 ETH | ||||
20904956 | 39 days ago | 0.00919008 ETH | ||||
20899562 | 40 days ago | 0.00045218 ETH | ||||
20898768 | 40 days ago | 0.03873418 ETH | ||||
20898460 | 40 days ago | 0.116298 ETH | ||||
20898447 | 40 days ago | 0.4 ETH | ||||
20897871 | 40 days ago | 0.01020867 ETH | ||||
20897515 | 40 days ago | 0.03684307 ETH | ||||
20894639 | 40 days ago | 0.19299097 ETH | ||||
20893305 | 41 days ago | 0.13542792 ETH | ||||
20893293 | 41 days ago | 0.15965963 ETH | ||||
20891523 | 41 days ago | 0.01563474 ETH | ||||
20882992 | 42 days ago | 0.01285688 ETH | ||||
20882981 | 42 days ago | 0.01541155 ETH | ||||
20882969 | 42 days ago | 0.00777318 ETH | ||||
20881930 | 42 days ago | 0.1075323 ETH | ||||
20880718 | 42 days ago | 0.00213085 ETH | ||||
20878468 | 43 days ago | 0.00360404 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
RangeMaster
Compiler Version
v0.8.24+commit.e11b9ed9
Optimization Enabled:
Yes with 1 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import { Address } from "@openzeppelin/contracts/utils/Address.sol"; import { IUniswapV3Pool } from "./interfaces/IUniswapV3Pool.sol"; import { IPancakeV3Pool } from "./interfaces/IPancakeV3Pool.sol"; import { IUniswapV3Factory } from "./interfaces/IUniswapV3Factory.sol"; import { IQuoter } from "./interfaces/IQuoter.sol"; import { IWETH9 } from "./interfaces/IWETH9.sol"; import { IYieldManager } from "./interfaces/IYieldManager.sol"; import { TickMath } from "./libraries/TickMath.sol"; import { ISwapRouter } from "./interfaces/ISwapRouter.sol"; import { LiquidityAmounts } from "./libraries/LiquidityAmounts.sol"; import { INonfungiblePositionManager } from "./interfaces/INonfungiblePositionManager.sol"; import { IRangePositionManager } from "./interfaces/IRangePositionManager.sol"; /// @title RangeMaster Contract /// @notice Manages liquidity provision and fee collection across multiple DEXs /// @dev This contract manages an array of RangePositionManagers /// @dev This contract is designed to work only with native ETH, users with WETH should unwrap prior to interact with the contract /// @dev This contract is designed to work with non deflationary tokens and tokens without taxation contract RangeMaster is ReentrancyGuard { using SafeERC20 for IERC20; using Address for address payable; /// @dev Enumeration for supported DEXs position types. enum PositionType{ UNISWAP, PANCAKE } /// @dev Structure to represent a range position in a DEX. struct RangePosition { IRangePositionManager rangePositionAddress; uint256 suggestedWeight; PositionType posType; } struct UserInfo { uint256 liquidity; uint256 token0Balance; uint256 token1Balance; uint256 cakeTokenBalance; uint256 token0Lifetime; uint256 token1Lifetime; } struct CalculationValues { address positionManager; uint256 currentTokenId; uint24 fee; uint160 sqrtPriceX96; int24 tick; int24 tickLower; int24 tickUpper; uint256 userLiquidity; uint256 weight; } struct ReturnBool { address positionManager; bool indicator; } struct ReturnPendingFees { address positionManager; uint256 token0Balance; uint256 token1Balance; uint256 bonusTokenBalance; uint256 token0Lifetime; uint256 token1Lifetime; } struct ReturnLiquidity { address positionManager; uint256 token0Balance; uint256 token1Balance; } /// @dev Array of range position managers. RangePosition[] public rangePositionManagers; /// @dev Owner of the contract. address public owner; /// @dev Addresses for wrapped ether and tokens involved in liquidity provision. address public immutable WETH; address public immutable token0; address public immutable token1; address public immutable bonusToken; /// @dev Lock status for contract operations. bool public locked; /// @dev Length of the `rangePositionManagers` array. uint256 public contractsLen; /// @dev Yield manager contract for managing yield farming. IYieldManager public yieldManager; /// @dev MaxAmount of RangePositionManagers uint256 public constant maxRangePositionManager = 4; /// @dev Factor used for weight calculations, representing 100%. uint256 public constant FACTOR = 1000000; /// @dev Pending owner of the contract, used in two-step ownership transfer. address private _pendingOwner; /// @notice Emits when new sponsorship is created. /// @param sponsor The address of the sponsor. /// @param client The address of the client being sponsored. event NewSponsor(address indexed sponsor, address indexed client); /// @notice Emits when an ownership transfer starts. /// @param previousOwner The address of the previous owner. /// @param newOwner The address of the new owner. event OwnershipTransferStarted(address indexed previousOwner, address indexed newOwner); /// @notice Emits when a new owner is set. /// @param previousOwner The address of the old owner. /// @param newOwner The address of the new owner. event NewOwner(address indexed previousOwner, address indexed newOwner); /// @notice Emits when a new yield manager is set. /// @param oldYieldManager The address of the old yield manager. /// @param yieldManager The address of the new yield manager. event NewYieldManager(address indexed oldYieldManager, address indexed yieldManager); /// @notice Emitted when tokens are recovered from the contract. /// @param token The token address recovered /// @param amount The amount of tokens /// @param to The address to which the tokens were sent. event Recovered(address indexed token, uint256 amount, address to); /// @notice Emitted when ETH are recovered from the contract. /// @param amount The amount of ETH recovered. /// @param to The address to which ETH were sent. event RecoveredETH(uint256 amount, address indexed to); /// @notice Emitted when locked is changed /// @param oldLocked The value of locked old /// @param newLocked The value of locked event LockedChanged(bool oldLocked, bool newLocked); error Unauthorized(); error ZeroAddress(); error ZeroAddressOwner(); error ZeroAddressWETH(); error ZeroAddressTokens(); error ZeroAddressYieldManager(); error ZeroAddressRangePositionManagers(); error LenMismatchRangePositionManagers(); error LenMismatchPositionTypes(); error LenMismatchAmountDesired1Minimum(); error LenMismatchLiquidity(); error LenMismatchRM1(); error LenMismatchRM(); error LenMismatchRM3(); error LenMismatchRM4(); error WeightIs0(); error WeightsNotAddingUp(); error Locked(); error MaxRangePositionManagerBreached(); /// @dev Modifier to restrict function access to the contract owner. modifier onlyOwner { _onlyOwner(); _; } /// @notice Constructs the RangeMaster contract. /// @dev Initializes contract with given parameters, setting up range positions and tokens. /// @param _rangePositionManagers Addresses of the range position manager contracts. /// @param _rangeWeights Weights of each range position manager. /// @param _positionTypes Types of positions (UNISWAP, PANCAKE) for each manager. /// @param _owner Address of the contract owner. /// @param _token0 Address of the first token in the liquidity pairs. /// @param _token1 Address of the second token in the liquidity pairs. /// @param _bonusToken Address of the bonus token, if any. /// @param _WETH Address of the Wrapped Ether token. /// @param _yieldManager Address of the yield manager contract. constructor( address[] memory _rangePositionManagers, uint256[] memory _rangeWeights, PositionType[] memory _positionTypes, address _owner, address _token0, address _token1, address _bonusToken, address _WETH, address _yieldManager ) { if(_owner == address(0)){ revert ZeroAddressOwner(); } if(_WETH == address(0)){ revert ZeroAddressWETH(); } if(_rangePositionManagers.length > maxRangePositionManager) { revert MaxRangePositionManagerBreached(); } if(_rangeWeights.length != _rangePositionManagers.length){ revert LenMismatchRangePositionManagers(); } if(_rangeWeights.length != _positionTypes.length){ revert LenMismatchPositionTypes(); } if(_token0 == address(0) || _token1 == address(0)){ revert ZeroAddressTokens(); } if(_yieldManager == address(0)){ revert ZeroAddressYieldManager(); } uint256 weightCheck; // loop over the provided addresses for (uint256 i; i < _rangePositionManagers.length; i++) { if(_rangePositionManagers[i] == address(0)){ revert ZeroAddressRangePositionManagers(); } if(_rangeWeights[i] == 0){ revert WeightIs0(); } rangePositionManagers.push(RangePosition({ rangePositionAddress: IRangePositionManager(_rangePositionManagers[i]), suggestedWeight: _rangeWeights[i], posType: _positionTypes[i] })); weightCheck = weightCheck + _rangeWeights[i]; } if(weightCheck != FACTOR){ revert WeightsNotAddingUp(); } // set values owner = _owner; token0 = _token0; token1 = _token1; bonusToken = _bonusToken; WETH = _WETH; yieldManager = IYieldManager(_yieldManager); contractsLen = rangePositionManagers.length; } // default fallback and receive functions fallback() external payable {} receive() external payable {} /// @notice Updates the range position managers with new addresses and weights. /// @dev This function can only be called by the owner. /// @param _rangePositionManagers New addresses for the range position managers. /// @param _rangeWeights New weights for each range position manager. /// @param _positionTypes Types of positions (UNISWAP, PANCAKE) for each new manager. function updateRangePositionManagers( address[] memory _rangePositionManagers, uint256[] memory _rangeWeights, PositionType[] memory _positionTypes ) external onlyOwner nonReentrant { if(_rangePositionManagers.length > maxRangePositionManager) { revert MaxRangePositionManagerBreached(); } if(_rangeWeights.length != _rangePositionManagers.length){ revert LenMismatchRangePositionManagers(); } if(_rangeWeights.length != _positionTypes.length){ revert LenMismatchPositionTypes(); } uint256 weightCheck; // delete old array delete rangePositionManagers; // loop over the provided addresses for (uint256 i; i < _rangePositionManagers.length; i++) { if(_rangePositionManagers[i] == address(0)){ revert ZeroAddressRangePositionManagers(); } if(_rangeWeights[i] == 0){ revert WeightIs0(); } rangePositionManagers.push(RangePosition({ rangePositionAddress: IRangePositionManager(_rangePositionManagers[i]), suggestedWeight: _rangeWeights[i], posType: _positionTypes[i] })); weightCheck = weightCheck + _rangeWeights[i]; } if(weightCheck != FACTOR){ revert WeightsNotAddingUp(); } contractsLen = rangePositionManagers.length; } /// @notice Collects fees accrued from all positions for the caller. /// @dev Withdraws fees in `token0`, `token1`, and `bonusToken` to the caller. function collect() external nonReentrant { // loop over the position Managers for(uint256 i; i < rangePositionManagers.length; i++) { // collect rangePositionManagers[i].rangePositionAddress.userCollect( msg.sender ); } } /// @notice Allows public collection of fees from all managed positions. /// @dev Similar to `collect` but can be called by anyone to trigger fee collection. function publicCollect() external nonReentrant { // loop over the position Managers for(uint256 i; i < rangePositionManagers.length; i++) { // publicCollect rangePositionManagers[i].rangePositionAddress.publicCollect(); } } /// @notice Decreases liquidity in managed positions for the caller. /// @dev Decreases liquidity based on specified amounts and updates token balances. /// @param amountDesired0Minimum Minimum amounts to receive of `token0`. /// @param amountDesired1Minimum Minimum amounts to receive of `token1`. /// @param liquidity Amounts of liquidity to be decreased. function decreaseLiquidity( uint256[] memory amountDesired0Minimum, uint256[] memory amountDesired1Minimum, uint128[] memory liquidity ) external nonReentrant { if(amountDesired0Minimum.length != rangePositionManagers.length){ revert LenMismatchRangePositionManagers(); } if(amountDesired0Minimum.length != amountDesired1Minimum.length){ revert LenMismatchAmountDesired1Minimum(); } if(amountDesired1Minimum.length != liquidity.length){ revert LenMismatchLiquidity(); } // loop over the position Managers for(uint256 i; i < rangePositionManagers.length; i++) { // decrease if (liquidity[i] > 0) { rangePositionManagers[i].rangePositionAddress.decreaseLiquidityUser( amountDesired0Minimum[i], amountDesired1Minimum[i], liquidity[i], msg.sender ); } } } /// @notice Increases liquidity in managed positions for the caller. /// @dev Adds liquidity based on desired amounts and optional sponsorship. /// @param amountDesired0 Desired amounts of `token0` to use. /// @param amountDesired1 Desired amounts of `token1` to use. /// @param amount0Min Minimum amounts of `token0`. /// @param amount1Min Minimum amounts of `token1`. /// @param sponsor Address of the sponsor, if any. function increaseLiquidity( uint256[] memory amountDesired0, uint256[] memory amountDesired1, uint256[] memory amount0Min, uint256[] memory amount1Min, address sponsor ) external payable nonReentrant { if(amountDesired0.length != rangePositionManagers.length){ revert LenMismatchRM1(); } if(amountDesired0.length != amountDesired1.length){ revert LenMismatchRM(); } if(amountDesired0.length != amount0Min.length){ revert LenMismatchRM3(); } if(amount0Min.length != amount1Min.length){ revert LenMismatchRM4(); } if(locked){ revert Locked(); } // check sponsor if (sponsor != address(0) && sponsor != msg.sender && yieldManager.getAffiliate(msg.sender) == address(0)) { yieldManager.setAffiliate(msg.sender, sponsor); emit NewSponsor(sponsor, msg.sender); } // loop over the position Managers for(uint256 i; i < rangePositionManagers.length; i++) { // handle approvals if (token0 != WETH) { IERC20(token0).safeTransferFrom(msg.sender, address(this), amountDesired0[i]); IERC20(token0).forceApprove(address(rangePositionManagers[i].rangePositionAddress), amountDesired0[i]); } if (token1 != WETH) { IERC20(token1).safeTransferFrom(msg.sender, address(this), amountDesired1[i]); IERC20(token1).forceApprove(address(rangePositionManagers[i].rangePositionAddress), amountDesired1[i]); } uint256 ETHValue; // calculate the ETH value if (token0 == WETH) { ETHValue = amountDesired0[i]; } if (token1 == WETH) { ETHValue = amountDesired1[i]; } // increase liquidity rangePositionManagers[i].rangePositionAddress.increaseLiquidityUser{value : ETHValue}( amountDesired0[i], amountDesired1[i], amount0Min[i], amount1Min[i], msg.sender ); } } /// owner recover token /// @dev used to recover tokens from the contract /// @param token the token to recover /// @param amount the amount to recover /// @param to the address to recover to function recoverERC20(address token, uint256 amount, address to) external onlyOwner nonReentrant { IERC20(token).safeTransfer(to, amount); emit Recovered(token, amount, to); } /// owner recover ETH /// @dev used to recover ETH from the contract /// @param amount the amount to recover /// @param to the address to recover to function recoverETH(uint256 amount, address to) external onlyOwner nonReentrant { payable(to).sendValue(amount); emit RecoveredETH(amount, to); } /// sets the new yield manager /// @dev sets the value of the yield manager /// @param _newYieldManager the new value for _newYieldManager function changeYieldManager(address _newYieldManager) external onlyOwner { if(_newYieldManager == address(0)){ revert ZeroAddress(); } address oldYieldManager = address(yieldManager); yieldManager = IYieldManager(_newYieldManager); emit NewYieldManager(oldYieldManager, _newYieldManager); } /// sets the new locked status /// @dev sets the value of locked /// @param _newLocked the new value for locked function changeLocked(bool _newLocked) external onlyOwner { bool oldLocked = locked; locked = _newLocked; emit LockedChanged(oldLocked, _newLocked); } /** * @dev Starts the ownership transfer of the contract to a new account. Replaces the pending transfer if there is one. * Can only be called by the current owner. */ function changeOwner(address newOwner) external onlyOwner { if(newOwner == address(0)){ revert ZeroAddress(); } _pendingOwner = newOwner; emit OwnershipTransferStarted(owner, newOwner); } /** * @dev The new owner accepts the ownership transfer. */ function acceptOwner() external { if(_pendingOwner != msg.sender){ revert Unauthorized(); } address oldOwner = owner; owner = _pendingOwner; delete _pendingOwner; emit NewOwner(oldOwner, owner); } /// @notice Retrieves pending fees for a user from all managed positions. /// @dev Returns detailed fee information for `token0`, `token1`, and `bonusToken`. /// @param userAddress Address of the user to query. /// @return An array of `ReturnPendingFees` structs with detailed fee information. function getPendingFees(address userAddress) external view returns (ReturnPendingFees[] memory) { uint256 len = rangePositionManagers.length; ReturnPendingFees[] memory returnValues = new ReturnPendingFees[](len); // loop over the position Managers for(uint256 i; i < len; i++) { IRangePositionManager.UserInfo memory userElement = rangePositionManagers[i].rangePositionAddress.userMapping(userAddress); returnValues[i] = (ReturnPendingFees({ positionManager: address(rangePositionManagers[i].rangePositionAddress), token0Balance: userElement.token0Balance, token1Balance: userElement.token1Balance, bonusTokenBalance: userElement.cakeTokenBalance, token0Lifetime : userElement.token0Lifetime, token1Lifetime : userElement.token1Lifetime })); } return returnValues; } /// @notice Retrieves user's liquidity information from all managed positions. /// @dev Returns liquidity amounts in `token0` and `token1` for each position. /// @param userAddress Address of the user to query. /// @return An array of `ReturnLiquidity` structs with liquidity information. function getUserLiquidity(address userAddress) external view returns (ReturnLiquidity[] memory) { uint256 len = rangePositionManagers.length; ReturnLiquidity[] memory returnValues = new ReturnLiquidity[](len); // loop over the position Managers for(uint256 i; i < len; i++) { // get manager and token id INonfungiblePositionManager positionManager = INonfungiblePositionManager(rangePositionManagers[i].rangePositionAddress.positionManager()); uint256 tokenId = rangePositionManagers[i].rangePositionAddress.currentTokenId(); IRangePositionManager.UserInfo memory userElement = rangePositionManagers[i].rangePositionAddress.userMapping(userAddress); // get ticks (,,,,,int24 tickLower,int24 tickUpper,,,,,) = positionManager.positions(tokenId); // get amounts (uint256 amount0, uint256 amount1) = rangePositionManagers[i].rangePositionAddress.getAmountsForTicks(tickLower, tickUpper, uint128(userElement.liquidity)); // calculate returnValues[i] = (ReturnLiquidity({ positionManager: address(rangePositionManagers[i].rangePositionAddress), token0Balance: amount0, token1Balance: amount1 })); } return returnValues; } /// function for getting the liquidity amounts from the contracts /// @dev for getting liquidity /// @param liquidity the liquidity to simulate function getLiquidity(uint128 liquidity) external view returns (ReturnLiquidity[] memory) { uint256 len = rangePositionManagers.length; ReturnLiquidity[] memory returnValues = new ReturnLiquidity[](len); // loop over the position Managers for(uint256 i; i < len; i++) { // get manager and token id INonfungiblePositionManager positionManager = INonfungiblePositionManager(rangePositionManagers[i].rangePositionAddress.positionManager()); uint256 tokenId = rangePositionManagers[i].rangePositionAddress.currentTokenId(); // get ticks (,,,,,int24 tickLower,int24 tickUpper,,,,,) = positionManager.positions(tokenId); // get amounts (uint256 amount0, uint256 amount1) = rangePositionManagers[i].rangePositionAddress.getAmountsForTicks(tickLower, tickUpper, liquidity); // calculate returnValues[i] = (ReturnLiquidity({ positionManager: address(rangePositionManagers[i].rangePositionAddress), token0Balance: amount0, token1Balance: amount1 })); } return returnValues; } /// function for getting the position and pool data /// @dev for getting the position and pool data /// @param userAddress the address of the user function getPositionAndPoolData(address userAddress) external view returns (CalculationValues[] memory) { uint256 len = rangePositionManagers.length; CalculationValues[] memory returnValues = new CalculationValues[](len); // loop over the position Managers for(uint256 i; i < len; i++) { // get manager and token id INonfungiblePositionManager positionManager = INonfungiblePositionManager(rangePositionManagers[i].rangePositionAddress.positionManager()); uint256 tokenId = rangePositionManagers[i].rangePositionAddress.currentTokenId(); IRangePositionManager.UserInfo memory userElement = rangePositionManagers[i].rangePositionAddress.userMapping(userAddress); // get ticks and fee (,,,,uint24 fee,int24 tickLower,int24 tickUpper,,,,,) = positionManager.positions(tokenId); // get rest IUniswapV3Factory uniswapV3Factory = IUniswapV3Factory(positionManager.factory()); address uniswapV3Pool = uniswapV3Factory.getPool(token0, token1, fee); uint160 sqrtPriceX96; int24 currentTick; if (rangePositionManagers[i].posType == PositionType.UNISWAP) { (sqrtPriceX96,currentTick,,,,,) = IUniswapV3Pool(uniswapV3Pool).slot0(); } else { (sqrtPriceX96,currentTick,,,,,) = IPancakeV3Pool(uniswapV3Pool).slot0(); } // calculate returnValues[i] = (CalculationValues({ positionManager: address(rangePositionManagers[i].rangePositionAddress), currentTokenId: tokenId, fee: fee, sqrtPriceX96: sqrtPriceX96, tick: currentTick, tickLower: tickLower, tickUpper: tickUpper, userLiquidity: userElement.liquidity, weight: rangePositionManagers[i].suggestedWeight })); } return returnValues; } /// function to check if minimum 1 contract is in range /// @dev for checking the in Range parameter function getInRange() external view returns (ReturnBool[] memory) { uint256 len = rangePositionManagers.length; ReturnBool[] memory returnValues = new ReturnBool[](len); // loop over the position Managers for(uint256 i; i < len; i++) { // get is in range bool isOutOfRange = rangePositionManagers[i].rangePositionAddress.canMoveRange(); // out of range if (isOutOfRange) { returnValues[i] = (ReturnBool({ positionManager: address(rangePositionManagers[i].rangePositionAddress), indicator: false })); } else { returnValues[i] = (ReturnBool({ positionManager: address(rangePositionManagers[i].rangePositionAddress), indicator: true })); } } return returnValues; } /// function to check if user is eligible to deposit funds /// @dev for checking if user is eligible to deposit funds function getEligible(address userAddress) external view returns (bool) { bool isEligible; // loop over the position Managers uint256 rangeLength = rangePositionManagers.length; for(uint256 i; i < rangeLength; i++) { // get is in isEligible isEligible = rangePositionManagers[i].rangePositionAddress.showEligible(userAddress); // if one is in isEligible we return if (!isEligible) { return isEligible; } } return isEligible; } /// gets yield manager /// @dev gets the yield manager /// returns the yield manager function getYieldManager() external view returns (address) { return address(yieldManager); } // only owner view function _onlyOwner() private view { if(msg.sender != owner){ revert Unauthorized(); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.5.0) (token/ERC721/extensions/IERC721Enumerable.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional enumeration extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Enumerable is IERC721 { /** * @dev Returns the total amount of tokens stored by the contract. */ function totalSupply() external view returns (uint256); /** * @dev Returns a token ID owned by `owner` at a given `index` of its token list. * Use along with {balanceOf} to enumerate all of ``owner``'s tokens. */ function tokenOfOwnerByIndex(address owner, uint256 index) external view returns (uint256); /** * @dev Returns a token ID at a given `index` of all the tokens stored by the contract. * Use along with {totalSupply} to enumerate all tokens. */ function tokenByIndex(uint256 index) external view returns (uint256); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC721/extensions/IERC721Metadata.sol) pragma solidity ^0.8.0; import "../IERC721.sol"; /** * @title ERC-721 Non-Fungible Token Standard, optional metadata extension * @dev See https://eips.ethereum.org/EIPS/eip-721 */ interface IERC721Metadata is IERC721 { /** * @dev Returns the token collection name. */ function name() external view returns (string memory); /** * @dev Returns the token collection symbol. */ function symbol() external view returns (string memory); /** * @dev Returns the Uniform Resource Identifier (URI) for `tokenId` token. */ function tokenURI(uint256 tokenId) external view returns (string memory); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC721/IERC721.sol) pragma solidity ^0.8.0; import "../../utils/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`. * * 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; /** * @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 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: Note that the caller is responsible to confirm that the recipient is capable of receiving ERC721 * or else they may be permanently lost. Usage of {safeTransferFrom} prevents loss, though the caller must * understand this adds an external call which potentially creates a reentrancy vulnerability. * * 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 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 the account approved for `tokenId` token. * * Requirements: * * - `tokenId` must exist. */ function getApproved(uint256 tokenId) external view returns (address operator); /** * @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); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^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); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; import "@openzeppelin/contracts/token/ERC721/IERC721.sol"; /// @title ERC721 with permit /// @notice Extension to ERC721 that includes a permit function for signature based approvals interface IERC721Permit is IERC721 { /// @notice The permit typehash used in the permit signature /// @return The typehash for the permit function PERMIT_TYPEHASH() external pure returns (bytes32); /// @notice The domain separator used in the permit signature /// @return The domain seperator used in encoding of permit signature function DOMAIN_SEPARATOR() external view returns (bytes32); /// @notice Approve of a specific token ID for spending by spender via signature /// @param spender The account that is being approved /// @param tokenId The ID of the token that is being approved for spending /// @param deadline The deadline timestamp by which the call must be mined for the approve to work /// @param v Must produce valid secp256k1 signature from the holder along with `r` and `s` /// @param r Must produce valid secp256k1 signature from the holder along with `v` and `s` /// @param s Must produce valid secp256k1 signature from the holder along with `r` and `v` function permit( address spender, uint256 tokenId, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Metadata.sol"; import "@openzeppelin/contracts/token/ERC721/extensions/IERC721Enumerable.sol"; import "./IPoolInitializer.sol"; import "./IERC721Permit.sol"; import "./IPeripheryPayments.sol"; import "./IPeripheryImmutableState.sol"; /// @title Non-fungible token for positions /// @notice Wraps Uniswap V3 positions in a non-fungible token interface which allows for them to be transferred /// and authorized. interface INonfungiblePositionManager is IPoolInitializer, IPeripheryPayments, IPeripheryImmutableState, IERC721Metadata, IERC721Enumerable, IERC721Permit { /// @notice Emitted when liquidity is increased for a position NFT /// @dev Also emitted when a token is minted /// @param tokenId The ID of the token for which liquidity was increased /// @param liquidity The amount by which liquidity for the NFT position was increased /// @param amount0 The amount of token0 that was paid for the increase in liquidity /// @param amount1 The amount of token1 that was paid for the increase in liquidity event IncreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1); /// @notice Emitted when liquidity is decreased for a position NFT /// @param tokenId The ID of the token for which liquidity was decreased /// @param liquidity The amount by which liquidity for the NFT position was decreased /// @param amount0 The amount of token0 that was accounted for the decrease in liquidity /// @param amount1 The amount of token1 that was accounted for the decrease in liquidity event DecreaseLiquidity(uint256 indexed tokenId, uint128 liquidity, uint256 amount0, uint256 amount1); /// @notice Emitted when tokens are collected for a position NFT /// @dev The amounts reported may not be exactly equivalent to the amounts transferred, due to rounding behavior /// @param tokenId The ID of the token for which underlying tokens were collected /// @param recipient The address of the account that received the collected tokens /// @param amount0 The amount of token0 owed to the position that was collected /// @param amount1 The amount of token1 owed to the position that was collected event Collect(uint256 indexed tokenId, address recipient, uint256 amount0, uint256 amount1); /// @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: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IPancakeV3Pool { /// @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, uint32 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 The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @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 ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Immutable state /// @notice Functions that return immutable state of the router interface IPeripheryImmutableState { /// @return Returns the address of the Uniswap V3 factory function factory() external view returns (address); /// @return Returns the address of WETH9 function WETH9() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; /// @title Periphery Payments /// @notice Functions to ease deposits and withdrawals of ETH interface IPeripheryPayments { /// @notice Unwraps the contract's WETH9 balance and sends it to recipient as ETH. /// @dev The amountMinimum parameter prevents malicious contracts from stealing WETH9 from users. /// @param amountMinimum The minimum amount of WETH9 to unwrap /// @param recipient The address receiving ETH function unwrapWETH9(uint256 amountMinimum, address recipient) external payable; /// @notice Refunds any ETH balance held by this contract to the `msg.sender` /// @dev Useful for bundling with mint or increase liquidity that uses ether, or exact output swaps /// that use ether for the input amount function refundETH() external payable; /// @notice Transfers the full amount of a token held by this contract to recipient /// @dev The amountMinimum parameter prevents malicious contracts from stealing the token from users /// @param token The contract address of the token which will be transferred to `recipient` /// @param amountMinimum The minimum amount of token required for a transfer /// @param recipient The destination address of the token function sweepToken( address token, uint256 amountMinimum, address recipient ) external payable; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; /// @title Creates and initializes V3 Pools /// @notice Provides a method for creating and initializing a pool, if necessary, for bundling with other methods that /// require the pool to exist. interface IPoolInitializer { /// @notice Creates a new pool if it does not exist, then initializes if not initialized /// @dev This method can be bundled with others via IMulticall for the first action (e.g. mint) performed against a pool /// @param token0 The contract address of token0 of the pool /// @param token1 The contract address of token1 of the pool /// @param fee The fee amount of the v3 pool for the specified token pair /// @param sqrtPriceX96 The initial square root price of the pool as a Q64.96 value /// @return pool Returns the pool address based on the pair of tokens and fee, will return the newly created pool address if necessary function createAndInitializePoolIfNecessary( address token0, address token1, uint24 fee, uint160 sqrtPriceX96 ) external payable returns (address pool); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; /// @title Quoter Interface /// @notice Supports quoting the calculated amounts from exact input or exact output swaps /// @dev These functions are not marked view because they rely on calling non-view functions and reverting /// to compute the result. They are also not gas efficient and should not be called on-chain. interface IQuoter { /// @notice Returns the amount out received for a given exact input swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee /// @param amountIn The amount of the first token to swap /// @return amountOut The amount of the last token that would be received function quoteExactInput(bytes memory path, uint256 amountIn) external returns (uint256 amountOut); /// @notice Returns the amount out received for a given exact input but for a swap of a single pool /// @param tokenIn The token being swapped in /// @param tokenOut The token being swapped out /// @param fee The fee of the token pool to consider for the pair /// @param amountIn The desired input amount /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountOut The amount of `tokenOut` that would be received function quoteExactInputSingle( address tokenIn, address tokenOut, uint24 fee, uint256 amountIn, uint160 sqrtPriceLimitX96 ) external returns (uint256 amountOut); /// @notice Returns the amount in required for a given exact output swap without executing the swap /// @param path The path of the swap, i.e. each token pair and the pool fee. Path must be provided in reverse order /// @param amountOut The amount of the last token to receive /// @return amountIn The amount of first token required to be paid function quoteExactOutput(bytes memory path, uint256 amountOut) external returns (uint256 amountIn); /// @notice Returns the amount in required to receive the given exact output amount but for a swap of a single pool /// @param tokenIn The token being swapped in /// @param tokenOut The token being swapped out /// @param fee The fee of the token pool to consider for the pair /// @param amountOut The desired output amount /// @param sqrtPriceLimitX96 The price limit of the pool that cannot be exceeded by the swap /// @return amountIn The amount required as the input for the swap in order to receive `amountOut` function quoteExactOutputSingle( address tokenIn, address tokenOut, uint24 fee, uint256 amountOut, uint160 sqrtPriceLimitX96 ) external returns (uint256 amountIn); }
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; // interface for the range position manager interface IRangePositionManager { /// public function for increasing liquidity /// @dev for increasing liquidity, also sets the sponsor if new user /// @param amountDesired0 the desired amount to use of token0 /// @param amountDesired1 the desired amount to use of token1 /// @param amount0Min the minimum amount of token0 /// @param amount1Min the minimum amount of token1 /// @param userToIncrease the user to increase function increaseLiquidityUser( uint amountDesired0, uint amountDesired1, uint amount0Min, uint amount1Min, address userToIncrease ) external payable; /// public function for increasing liquidity automatically /// @dev for increasing liquidity auto /// @param amountDesired0 the desired amount to use of token0 /// @param amountDesired1 the desired amount to use of token1 /// @param amount0Min the minimum amount of token0 /// @param amount1Min the minimum amount of token1 /// @param userToIncrease the address of the user to increase function increaseLiquidityAuto( uint256 amountDesired0, uint256 amountDesired1, uint256 amount0Min, uint256 amount1Min, address userToIncrease ) external; /// function for moving range /// @dev this function is used to move the liquidity ranges (lower tick, upper tick). If possible (within the threshold) /// @dev it is possible to call this function. It will decrease all liquidity from the position, swap tokens in a ratio given in the parameter /// @dev and then mint a new position using this tokens swapped. Users will get the share of the new liquidity pro rata /// @param tickLower the new lower tick /// @param tickUpper the new upper tick /// @param tokenToSwap the token to be swapped /// @param amountToSwap the amount to be swapped from the tokenForRatios /// @param amountOutMinimum the minimum output function moveRange ( int24 tickLower, int24 tickUpper, address tokenToSwap, uint256 amountToSwap, uint256 amountDecrease0Min, uint256 amountDecrease1Min, uint256 amount0Min, uint256 amount1Min, uint256 amountOutMinimum, uint24 poolFee ) external; /// Checks if range can be moved /// @dev checks if the range position can be moved /// returns a bool indicating if position can be moved or not function canMoveRange() external view returns (bool); /// function to collect the accrued fees /// @dev used to collect the earned fees from the contract (as a user) function userCollect( address userToCollect ) external; /// function for decreasing liquidity, for msg.sender /// @dev for decreasing liquidity, for msg.sender /// @param amount0Min the minimum amount to receive of token0 /// @param amount1Min the minimum amount to receive of token1 /// @param liquidity the amount of liquidity to be decreased /// @param liquidity the userToDecrease to decrease function decreaseLiquidityUser( uint amount0Min, uint amount1Min, uint128 liquidity, address userToDecrease ) external; // User Information struct struct UserInfo { uint liquidity; uint token0Balance; uint token1Balance; uint cakeTokenBalance; uint token0Lifetime; uint token1Lifetime; } // returns the user Mapping function userMapping(address user) external view returns (UserInfo memory); // returns the current liquidity NFT token ID function currentTokenId() external view returns (uint256); // returns the position manager function positionManager() external view returns (address); /// View function to get the amount for ticks onchain /// @dev checks for liquidity amount s on chain /// @param tickLower the lower tick /// @param tickUpper the upper tick /// @param liquidity the amount of liquidity /// returns the output amount for token0 and token1 function getAmountsForTicks( int24 tickLower, int24 tickUpper, uint128 liquidity ) external view returns (uint256 amount0, uint256 amount1); /// function to check if holder is eligible /// @dev checking if an address has enough NFTs to use the product /// @param sender the sender address to check function showEligible(address sender) external view returns (bool); /// function for handling the collect /// @dev collects from a public address, can be called by anyone - used to collect fees /// @return amount0 the amount how much token0 we got as fees /// @return amount1 the amount how much token1 we got as fees function publicCollect() external returns ( uint256 amount0, uint256 amount1 ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.7.5; pragma abicoder v2; /// @title Router token swapping functionality /// @notice Functions for swapping tokens via Uniswap V3 interface ISwapRouter { 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 pragma solidity >=0.5.0; /// @title The interface for the Uniswap V3 Factory /// @notice The Uniswap V3 Factory facilitates creation of Uniswap V3 pools and control over the protocol fees interface IUniswapV3Factory { /// @notice Emitted when the owner of the factory is changed /// @param oldOwner The owner before the owner was changed /// @param newOwner The owner after the owner was changed event OwnerChanged(address indexed oldOwner, address indexed newOwner); /// @notice Emitted when a pool is created /// @param token0 The first token of the pool by address sort order /// @param token1 The second token of the pool by address sort order /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip /// @param tickSpacing The minimum number of ticks between initialized ticks /// @param pool The address of the created pool event PoolCreated( address indexed token0, address indexed token1, uint24 indexed fee, int24 tickSpacing, address pool ); /// @notice Emitted when a new fee amount is enabled for pool creation via the factory /// @param fee The enabled fee, denominated in hundredths of a bip /// @param tickSpacing The minimum number of ticks between initialized ticks for pools created with the given fee event FeeAmountEnabled(uint24 indexed fee, int24 indexed tickSpacing); /// @notice Returns the current owner of the factory /// @dev Can be changed by the current owner via setOwner /// @return The address of the factory owner function owner() external view returns (address); /// @notice Returns the tick spacing for a given fee amount, if enabled, or 0 if not enabled /// @dev A fee amount can never be removed, so this value should be hard coded or cached in the calling context /// @param fee The enabled fee, denominated in hundredths of a bip. Returns 0 in case of unenabled fee /// @return The tick spacing function feeAmountTickSpacing(uint24 fee) external view returns (int24); /// @notice Returns the pool address for a given pair of tokens and a fee, or address 0 if it does not exist /// @dev tokenA and tokenB may be passed in either token0/token1 or token1/token0 order /// @param tokenA The contract address of either token0 or token1 /// @param tokenB The contract address of the other token /// @param fee The fee collected upon every swap in the pool, denominated in hundredths of a bip /// @return pool The pool address function getPool( address tokenA, address tokenB, uint24 fee ) external view returns (address pool); /// @notice Creates a pool for the given two tokens and fee /// @param tokenA One of the two tokens in the desired pool /// @param tokenB The other of the two tokens in the desired pool /// @param fee The desired fee for the pool /// @dev tokenA and tokenB may be passed in either order: token0/token1 or token1/token0. tickSpacing is retrieved /// from the fee. The call will revert if the pool already exists, the fee is invalid, or the token arguments /// are invalid. /// @return pool The address of the newly created pool function createPool( address tokenA, address tokenB, uint24 fee ) external returns (address pool); /// @notice Updates the owner of the factory /// @dev Must be called by the current owner /// @param _owner The new owner of the factory function setOwner(address _owner) external; /// @notice Enables a fee amount with the given tickSpacing /// @dev Fee amounts may never be removed once enabled /// @param fee The fee amount to enable, denominated in hundredths of a bip (i.e. 1e-6) /// @param tickSpacing The spacing between ticks to be enforced for all pools created with the given fee amount function enableFeeAmount(uint24 fee, int24 tickSpacing) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction 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 The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @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 ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity 0.8.24; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /// @title Interface for WETH9 interface IWETH9 is IERC20 { /// @notice Deposit ether to get wrapped ether function deposit() external payable; /// @notice Withdraw wrapped ether to get ether function withdraw(uint256) external; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.24; // interface for the YieldManager interface IYieldManager { /// Sets the wanted affiliate /// @dev sets the value of the sponsor variable at a client object /// @param client the mapping entry point /// @param sponsor the address to set as a sponsor function setAffiliate(address client, address sponsor) external; /// Gets the factors for user and sponsor /// @dev returns the client and sponsor factors /// @param user the client to look up /// @param typer the type (sponsor or client mode) function getUserFactors( address user, uint typer ) external view returns (uint, uint, uint, uint); /// Gets the wanted affiliate /// @dev gets the value of the sponsor variable at a client object /// @param client the mapping entry point function getAffiliate(address client) external view returns (address); }
// 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.8.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) { unchecked { // 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 = a * b; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { assembly { result := div(prod0, denominator) } return result; } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod // Subtract 256 bit remainder from 512 bit number assembly { let remainder := mulmod(a, b, denominator) 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 = (0 - 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 preconditions 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) { unchecked { if (a == 0 || ((result = a * b) / a == b)) { require(denominator > 0); assembly { result := add(div(result, denominator), gt(mod(result, denominator), 0)) } } else { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } } /// @notice Returns ceil(x / y) /// @dev division by 0 has unspecified behavior, and must be checked externally /// @param x The dividend /// @param y The divisor /// @return z The quotient, ceil(x / y) function unsafeDivRoundingUp(uint256 x, uint256 y) internal pure returns (uint256 z) { assembly { z := add(div(x, y), gt(mod(x, y), 0)) } } }
// 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.8.24; /// @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(uint24(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; } }
{ "optimizer": { "enabled": true, "runs": 1 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address[]","name":"_rangePositionManagers","type":"address[]"},{"internalType":"uint256[]","name":"_rangeWeights","type":"uint256[]"},{"internalType":"enum RangeMaster.PositionType[]","name":"_positionTypes","type":"uint8[]"},{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_token0","type":"address"},{"internalType":"address","name":"_token1","type":"address"},{"internalType":"address","name":"_bonusToken","type":"address"},{"internalType":"address","name":"_WETH","type":"address"},{"internalType":"address","name":"_yieldManager","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"LenMismatchAmountDesired1Minimum","type":"error"},{"inputs":[],"name":"LenMismatchLiquidity","type":"error"},{"inputs":[],"name":"LenMismatchPositionTypes","type":"error"},{"inputs":[],"name":"LenMismatchRM","type":"error"},{"inputs":[],"name":"LenMismatchRM1","type":"error"},{"inputs":[],"name":"LenMismatchRM3","type":"error"},{"inputs":[],"name":"LenMismatchRM4","type":"error"},{"inputs":[],"name":"LenMismatchRangePositionManagers","type":"error"},{"inputs":[],"name":"Locked","type":"error"},{"inputs":[],"name":"MaxRangePositionManagerBreached","type":"error"},{"inputs":[],"name":"Unauthorized","type":"error"},{"inputs":[],"name":"WeightIs0","type":"error"},{"inputs":[],"name":"WeightsNotAddingUp","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"inputs":[],"name":"ZeroAddressOwner","type":"error"},{"inputs":[],"name":"ZeroAddressRangePositionManagers","type":"error"},{"inputs":[],"name":"ZeroAddressTokens","type":"error"},{"inputs":[],"name":"ZeroAddressWETH","type":"error"},{"inputs":[],"name":"ZeroAddressYieldManager","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bool","name":"oldLocked","type":"bool"},{"indexed":false,"internalType":"bool","name":"newLocked","type":"bool"}],"name":"LockedChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"NewOwner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sponsor","type":"address"},{"indexed":true,"internalType":"address","name":"client","type":"address"}],"name":"NewSponsor","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"oldYieldManager","type":"address"},{"indexed":true,"internalType":"address","name":"yieldManager","type":"address"}],"name":"NewYieldManager","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"Recovered","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"RecoveredETH","type":"event"},{"stateMutability":"payable","type":"fallback"},{"inputs":[],"name":"FACTOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"bonusToken","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bool","name":"_newLocked","type":"bool"}],"name":"changeLocked","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"changeOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_newYieldManager","type":"address"}],"name":"changeYieldManager","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"collect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"contractsLen","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"amountDesired0Minimum","type":"uint256[]"},{"internalType":"uint256[]","name":"amountDesired1Minimum","type":"uint256[]"},{"internalType":"uint128[]","name":"liquidity","type":"uint128[]"}],"name":"decreaseLiquidity","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getEligible","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInRange","outputs":[{"components":[{"internalType":"address","name":"positionManager","type":"address"},{"internalType":"bool","name":"indicator","type":"bool"}],"internalType":"struct RangeMaster.ReturnBool[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint128","name":"liquidity","type":"uint128"}],"name":"getLiquidity","outputs":[{"components":[{"internalType":"address","name":"positionManager","type":"address"},{"internalType":"uint256","name":"token0Balance","type":"uint256"},{"internalType":"uint256","name":"token1Balance","type":"uint256"}],"internalType":"struct RangeMaster.ReturnLiquidity[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getPendingFees","outputs":[{"components":[{"internalType":"address","name":"positionManager","type":"address"},{"internalType":"uint256","name":"token0Balance","type":"uint256"},{"internalType":"uint256","name":"token1Balance","type":"uint256"},{"internalType":"uint256","name":"bonusTokenBalance","type":"uint256"},{"internalType":"uint256","name":"token0Lifetime","type":"uint256"},{"internalType":"uint256","name":"token1Lifetime","type":"uint256"}],"internalType":"struct RangeMaster.ReturnPendingFees[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getPositionAndPoolData","outputs":[{"components":[{"internalType":"address","name":"positionManager","type":"address"},{"internalType":"uint256","name":"currentTokenId","type":"uint256"},{"internalType":"uint24","name":"fee","type":"uint24"},{"internalType":"uint160","name":"sqrtPriceX96","type":"uint160"},{"internalType":"int24","name":"tick","type":"int24"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"userLiquidity","type":"uint256"},{"internalType":"uint256","name":"weight","type":"uint256"}],"internalType":"struct RangeMaster.CalculationValues[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"userAddress","type":"address"}],"name":"getUserLiquidity","outputs":[{"components":[{"internalType":"address","name":"positionManager","type":"address"},{"internalType":"uint256","name":"token0Balance","type":"uint256"},{"internalType":"uint256","name":"token1Balance","type":"uint256"}],"internalType":"struct RangeMaster.ReturnLiquidity[]","name":"","type":"tuple[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getYieldManager","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"amountDesired0","type":"uint256[]"},{"internalType":"uint256[]","name":"amountDesired1","type":"uint256[]"},{"internalType":"uint256[]","name":"amount0Min","type":"uint256[]"},{"internalType":"uint256[]","name":"amount1Min","type":"uint256[]"},{"internalType":"address","name":"sponsor","type":"address"}],"name":"increaseLiquidity","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"locked","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxRangePositionManager","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"publicCollect","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rangePositionManagers","outputs":[{"internalType":"contract IRangePositionManager","name":"rangePositionAddress","type":"address"},{"internalType":"uint256","name":"suggestedWeight","type":"uint256"},{"internalType":"enum RangeMaster.PositionType","name":"posType","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"recoverERC20","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"address","name":"to","type":"address"}],"name":"recoverETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"token0","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"token1","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address[]","name":"_rangePositionManagers","type":"address[]"},{"internalType":"uint256[]","name":"_rangeWeights","type":"uint256[]"},{"internalType":"enum RangeMaster.PositionType[]","name":"_positionTypes","type":"uint8[]"}],"name":"updateRangePositionManagers","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"yieldManager","outputs":[{"internalType":"contract IYieldManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
61010060405234801562000011575f80fd5b5060405162003e0c38038062003e0c833981016040819052620000349162000575565b60015f556001600160a01b03861662000060576040516317b8ca8960e21b815260040160405180910390fd5b6001600160a01b03821662000088576040516308d4461960e41b815260040160405180910390fd5b600489511115620000ac576040516335d4169b60e21b815260040160405180910390fd5b8851885114620000cf57604051630318700160e11b815260040160405180910390fd5b8651885114620000f257604051630f74d28d60e31b815260040160405180910390fd5b6001600160a01b03851615806200011057506001600160a01b038416155b156200012f57604051631f99996d60e11b815260040160405180910390fd5b6001600160a01b038116620001575760405163057a57c360e31b815260040160405180910390fd5b5f805b8a5181101562000325575f6001600160a01b03168b82815181106200018357620001836200066e565b60200260200101516001600160a01b031603620001b35760405163412b301160e11b815260040160405180910390fd5b898181518110620001c857620001c86200066e565b60200260200101515f03620001f0576040516352d2a7df60e01b815260040160405180910390fd5b600160405180606001604052808d84815181106200021257620002126200066e565b60200260200101516001600160a01b031681526020018c84815181106200023d576200023d6200066e565b602002602001015181526020018b84815181106200025f576200025f6200066e565b602002602001015160018111156200027b576200027b62000682565b90528154600180820184555f938452602093849020835160039093020180546001600160a01b0319166001600160a01b0390931692909217825592820151818401556040820151600282018054939492939192909160ff1916908381811115620002e957620002e962000682565b021790555050508981815181106200030557620003056200066e565b6020026020010151826200031a919062000696565b91506001016200015a565b50620f424081146200034a57604051630fd68efd60e01b815260040160405180910390fd5b50600280546001600160a01b039788166001600160a01b03199182161790915594861660a05292851660c05290841660e052831660805260048054919093169116179055505060015460035550620006bc565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715620003dc57620003dc6200039d565b604052919050565b5f6001600160401b03821115620003ff57620003ff6200039d565b5060051b60200190565b80516001600160a01b038116811462000420575f80fd5b919050565b5f82601f83011262000435575f80fd5b815160206200044e6200044883620003e4565b620003b1565b8083825260208201915060208460051b87010193508684111562000470575f80fd5b602086015b848110156200049757620004898162000409565b835291830191830162000475565b509695505050505050565b5f82601f830112620004b2575f80fd5b81516020620004c56200044883620003e4565b8083825260208201915060208460051b870101935086841115620004e7575f80fd5b602086015b84811015620004975780518352918301918301620004ec565b5f82601f83011262000515575f80fd5b81516020620005286200044883620003e4565b8083825260208201915060208460051b8701019350868411156200054a575f80fd5b602086015b84811015620004975780516002811062000567575f80fd5b83529183019183016200054f565b5f805f805f805f805f6101208a8c0312156200058f575f80fd5b89516001600160401b0380821115620005a6575f80fd5b620005b48d838e0162000425565b9a5060208c0151915080821115620005ca575f80fd5b620005d88d838e01620004a2565b995060408c0151915080821115620005ee575f80fd5b50620005fd8c828d0162000505565b9750506200060e60608b0162000409565b95506200061e60808b0162000409565b94506200062e60a08b0162000409565b93506200063e60c08b0162000409565b92506200064e60e08b0162000409565b91506200065f6101008b0162000409565b90509295985092959850929598565b634e487b7160e01b5f52603260045260245ffd5b634e487b7160e01b5f52602160045260245ffd5b80820180821115620006b657634e487b7160e01b5f52601160045260245ffd5b92915050565b60805160a05160c05160e0516136ba620007525f395f61020b01525f818161046c015281816108b9015281816109070152818161098f01528181610a69015261135a01525f818161016c01528181610780015281816107ce01528181610856015281816109f3015261133201525f81816103b4015281816107560152818161088f015281816109c90152610a3f01526136ba5ff3fe608060405260043610610152575f3560e01c80630dfe16811461015b57806310ec2faa146101a45780631d6dc932146101b757806335815b95146101d657806341d4a1ab146101fa5780634d510bae1461022d57806353304ee41461024c5780635a8946e51461026957806372420d6c1461028857806375fbbee31461029c57806378da43c0146102c857806380b7af18146102e75780638da5cb5b146103065780639a0ca07d14610325578063a4bf34ba14610344578063a670ada414610370578063a6f9dae114610384578063ad5c4648146103a3578063b1484db3146103d6578063b51609b4146103f7578063be85552014610416578063cf3090121461042b578063d21220a71461045b578063d4dde11b1461048e578063dbbdd935146104ba578063e5225381146104d9578063ebbc4965146104ed578063fcd554d414610501578063fdf82caf1461052f57005b3661015957005b005b348015610166575f80fd5b5061018e7f000000000000000000000000000000000000000000000000000000000000000081565b60405161019b9190612b84565b60405180910390f35b6101596101b2366004612c7e565b61054e565b3480156101c2575f80fd5b506101596101d1366004612d37565b610bda565b3480156101e1575f80fd5b506101ec620f424081565b60405190815260200161019b565b348015610205575f80fd5b5061018e7f000000000000000000000000000000000000000000000000000000000000000081565b348015610238575f80fd5b50610159610247366004612dcd565b610c4d565b348015610257575f80fd5b506004546001600160a01b031661018e565b348015610274575f80fd5b50610159610283366004612eaa565b610eb8565b348015610293575f80fd5b50610159610f38565b3480156102a7575f80fd5b506102bb6102b6366004612eaa565b610ff5565b60405161019b9190612ecc565b3480156102d3575f80fd5b506101596102e2366004612fbb565b6115dd565b3480156102f2575f80fd5b5060045461018e906001600160a01b031681565b348015610311575f80fd5b5060025461018e906001600160a01b031681565b348015610330575f80fd5b5061015961033f3660046130a6565b611785565b34801561034f575f80fd5b5061036361035e366004612eaa565b6117f3565b60405161019b91906130c1565b34801561037b575f80fd5b506101ec600481565b34801561038f575f80fd5b5061015961039e366004612eaa565b6119af565b3480156103ae575f80fd5b5061018e7f000000000000000000000000000000000000000000000000000000000000000081565b3480156103e1575f80fd5b506103ea611a2f565b60405161019b9190613134565b348015610402575f80fd5b50610159610411366004613180565b611c02565b348015610421575f80fd5b506101ec60035481565b348015610436575f80fd5b5060025461044b90600160a01b900460ff1681565b604051901515815260200161019b565b348015610466575f80fd5b5061018e7f000000000000000000000000000000000000000000000000000000000000000081565b348015610499575f80fd5b506104ad6104a83660046131bf565b611c74565b60405161019b91906131da565b3480156104c5575f80fd5b506104ad6104d4366004612eaa565b611f87565b3480156104e4575f80fd5b5061015961231e565b3480156104f8575f80fd5b506101596123bb565b34801561050c575f80fd5b5061052061051b36600461322e565b612441565b60405161019b93929190613259565b34801561053a575f80fd5b5061044b610549366004612eaa565b61247f565b610556612540565b6001548551146105785760405162bf8b9960e11b815260040160405180910390fd5b835185511461059a5760405163387cab4360e11b815260040160405180910390fd5b82518551146105bc5760405163d062b3d760e01b815260040160405180910390fd5b81518351146105de57604051635dae87f360e11b815260040160405180910390fd5b600254600160a01b900460ff1615610609576040516303cb96db60e21b815260040160405180910390fd5b6001600160a01b0381161580159061062a57506001600160a01b0381163314155b80156106ac57506004805460405163bc019eed60e01b81525f926001600160a01b039092169163bc019eed9161066291339101612b84565b602060405180830381865afa15801561067d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106a191906132aa565b6001600160a01b0316145b156107485760048054604051630e6a5c9760e31b815233928101929092526001600160a01b0383811660248401521690637352e4b8906044015f604051808303815f87803b1580156106fc575f80fd5b505af115801561070e573d5f803e3d5ffd5b50506040513392506001600160a01b03841691507f4b79506fb58d249496a3306c868c4a5a53124dab1b38ff90c010c0744fa74c58905f90a35b5f5b600154811015610bc9577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161461088d5761080633308884815181106107c4576107c46132c5565b60200260200101517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661259c909392919063ffffffff16565b61088d6001828154811061081c5761081c6132c5565b5f91825260209091206003909102015487516001600160a01b039091169088908490811061084c5761084c6132c5565b60200260200101517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661260d9092919063ffffffff16565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146109c65761093f33308784815181106108fd576108fd6132c5565b60200260200101517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661259c909392919063ffffffff16565b6109c660018281548110610955576109556132c5565b5f91825260209091206003909102015486516001600160a01b0390911690879084908110610985576109856132c5565b60200260200101517f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031661260d9092919063ffffffff16565b5f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603610a3d57868281518110610a3257610a326132c5565b602002602001015190505b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031603610ab357858281518110610aa857610aa86132c5565b602002602001015190505b60018281548110610ac657610ac66132c5565b5f91825260209091206003909102015487516001600160a01b039091169063ee8ad7d79083908a9086908110610afe57610afe6132c5565b6020026020010151898681518110610b1857610b186132c5565b6020026020010151898781518110610b3257610b326132c5565b6020026020010151898881518110610b4c57610b4c6132c5565b60209081029190910101516040516001600160e01b031960e088901b168152600481019490945260248401929092526044830152606482015233608482015260a4015f604051808303818588803b158015610ba5575f80fd5b505af1158015610bb7573d5f803e3d5ffd5b50506001909401935061074a92505050565b50610bd360015f55565b5050505050565b610be26126a4565b610bea612540565b610bfd6001600160a01b038216836126ce565b806001600160a01b03167ffd19773960db3ffa2d12a2c85d3db65c4d836caeb978fc58764784eb3fa8c7ad83604051610c3891815260200190565b60405180910390a2610c4960015f55565b5050565b610c556126a4565b610c5d612540565b600483511115610c80576040516335d4169b60e21b815260040160405180910390fd5b8251825114610ca257604051630318700160e11b815260040160405180910390fd5b8051825114610cc457604051630f74d28d60e31b815260040160405180910390fd5b5f610cd0600182612b07565b5f5b8451811015610e7f575f6001600160a01b0316858281518110610cf757610cf76132c5565b60200260200101516001600160a01b031603610d265760405163412b301160e11b815260040160405180910390fd5b838181518110610d3857610d386132c5565b60200260200101515f03610d5f576040516352d2a7df60e01b815260040160405180910390fd5b60016040518060600160405280878481518110610d7e57610d7e6132c5565b60200260200101516001600160a01b03168152602001868481518110610da657610da66132c5565b60200260200101518152602001858481518110610dc557610dc56132c5565b60200260200101516001811115610dde57610dde613245565b90528154600180820184555f938452602093849020835160039093020180546001600160a01b0319166001600160a01b0390931692909217825592820151818401556040820151600282018054939492939192909160ff1916908381811115610e4957610e49613245565b02179055505050838181518110610e6257610e626132c5565b602002602001015182610e7591906132d9565b9150600101610cd2565b50620f42408114610ea357604051630fd68efd60e01b815260040160405180910390fd5b50600154600355610eb360015f55565b505050565b610ec06126a4565b6001600160a01b038116610ee75760405163d92e233d60e01b815260040160405180910390fd5b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f048611c5441b2428f273df1ccd326018fa213661c504eaaa3546b6e8cb3b3ce6905f90a35050565b610f40612540565b5f5b600154811015610fe95760018181548110610f5f57610f5f6132c5565b905f5260205f2090600302015f015f9054906101000a90046001600160a01b03166001600160a01b03166372420d6c6040518163ffffffff1660e01b815260040160408051808303815f875af1158015610fbb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fdf91906132f8565b5050600101610f42565b50610ff360015f55565b565b6001546060905f816001600160401b0381111561101457611014612b98565b60405190808252806020026020018201604052801561108957816020015b60408051610120810182525f8082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082015282525f199092019101816110325790505b5090505f5b828110156115d5575f600182815481106110aa576110aa6132c5565b5f9182526020918290206003909102015460408051631e46e62f60e21b815290516001600160a01b039092169263791b98bc926004808401938290030181865afa1580156110fa573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061111e91906132aa565b90505f60018381548110611134576111346132c5565b5f9182526020918290206003909102015460408051629a9b7b60e01b815290516001600160a01b0390921692629a9b7b926004808401938290030181865afa158015611182573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111a6919061331a565b90505f600184815481106111bc576111bc6132c5565b5f91825260209091206003909102015460405163118b953560e01b81526001600160a01b039091169063118b9535906111f9908b90600401612b84565b60c060405180830381865afa158015611214573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112389190613331565b90505f805f856001600160a01b03166399fbab88866040518263ffffffff1660e01b815260040161126b91815260200190565b61018060405180830381865afa158015611287573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112ab91906133d6565b5050505050965096509650505050505f866001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061131b91906132aa565b604051630b4c774160e11b81526001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000811660048301527f00000000000000000000000000000000000000000000000000000000000000008116602483015262ffffff871660448301529192505f91831690631698ee8290606401602060405180830381865afa1580156113b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113db91906132aa565b90505f808060018c815481106113f3576113f36132c5565b5f91825260209091206002600390920201015460ff16600181111561141a5761141a613245565b0361149057826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa15801561145b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061147f91906134bb565b509496509294506114fc9350505050565b826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156114cc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114f0919061354a565b50949650929450505050505b60405180610120016040528060018d8154811061151b5761151b6132c5565b5f918252602091829020600390910201546001600160a01b0390811683529082018c905262ffffff8a16604083015284166060820152600283810b608083015288810b60a083015287900b60c0820152895160e08201526001805461010092909201918e90811061158e5761158e6132c5565b905f5260205f209060030201600101548152508c8c815181106115b3576115b36132c5565b602002602001018190525050505050505050505050808060010191505061108e565b509392505050565b6115e5612540565b60015483511461160857604051630318700160e11b815260040160405180910390fd5b815183511461162a57604051630cd56ebd60e41b815260040160405180910390fd5b805182511461164c57604051632d4e48ed60e01b815260040160405180910390fd5b5f5b60015481101561177b575f82828151811061166b5761166b6132c5565b60200260200101516001600160801b031611156117735760018181548110611695576116956132c5565b5f91825260209091206003909102015484516001600160a01b039091169063268ce564908690849081106116cb576116cb6132c5565b60200260200101518584815181106116e5576116e56132c5565b60200260200101518585815181106116ff576116ff6132c5565b60209081029190910101516040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160801b031660448201523360648201526084015f604051808303815f87803b15801561175c575f80fd5b505af115801561176e573d5f803e3d5ffd5b505050505b60010161164e565b50610eb360015f55565b61178d6126a4565b6002805460ff60a01b198116600160a01b84151581810292909217909355604080519390920460ff1680151584526020840191909152917fdb62846f606c5317258768a4c1d3af593d861da6a61578aba6ade868a607d605910160405180910390a15050565b6001546060905f816001600160401b0381111561181257611812612b98565b60405190808252806020026020018201604052801561187f57816020015b61186c6040518060c001604052805f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f81525090565b8152602001906001900390816118305790505b5090505f5b828110156115d5575f600182815481106118a0576118a06132c5565b5f91825260209091206003909102015460405163118b953560e01b81526001600160a01b039091169063118b9535906118dd908990600401612b84565b60c060405180830381865afa1580156118f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061191c9190613331565b90506040518060c001604052806001848154811061193c5761193c6132c5565b5f918252602091829020600390910201546001600160a01b03168252838101519082015260408084015190820152606080840151908201526080808401519082015260a080840151910152835184908490811061199b5761199b6132c5565b602090810291909101015250600101611884565b6119b76126a4565b6001600160a01b0381166119de5760405163d92e233d60e01b815260040160405180910390fd5b600580546001600160a01b0319166001600160a01b03838116918217909255600254604051919216907f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700905f90a350565b6001546060905f816001600160401b03811115611a4e57611a4e612b98565b604051908082528060200260200182016040528015611a9257816020015b604080518082019091525f8082526020820152815260200190600190039081611a6c5790505b5090505f5b82811015611bfb575f60018281548110611ab357611ab36132c5565b5f918252602091829020600390910201546040805163084f56f760e01b815290516001600160a01b039092169263084f56f7926004808401938290030181865afa158015611b03573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b2791906135bb565b90508015611b9357604051806040016040528060018481548110611b4d57611b4d6132c5565b5f91825260208083206003909202909101546001600160a01b0316835291909101528351849084908110611b8357611b836132c5565b6020026020010181905250611bf2565b604051806040016040528060018481548110611bb157611bb16132c5565b5f918252602091829020600390910201546001600160a01b0316825260019101528351849084908110611be657611be66132c5565b60200260200101819052505b50600101611a97565b5092915050565b611c0a6126a4565b611c12612540565b611c266001600160a01b03841682846127e0565b604080518381526001600160a01b0383811660208301528516917fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5910160405180910390a2610eb360015f55565b6001546060905f816001600160401b03811115611c9357611c93612b98565b604051908082528060200260200182016040528015611ccc57816020015b611cb9612b28565b815260200190600190039081611cb15790505b5090505f5b828110156115d5575f60018281548110611ced57611ced6132c5565b5f9182526020918290206003909102015460408051631e46e62f60e21b815290516001600160a01b039092169263791b98bc926004808401938290030181865afa158015611d3d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d6191906132aa565b90505f60018381548110611d7757611d776132c5565b5f9182526020918290206003909102015460408051629a9b7b60e01b815290516001600160a01b0390921692629a9b7b926004808401938290030181865afa158015611dc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611de9919061331a565b90505f80836001600160a01b03166399fbab88846040518263ffffffff1660e01b8152600401611e1b91815260200190565b61018060405180830381865afa158015611e37573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e5b91906133d6565b50505050509650965050505050505f8060018781548110611e7e57611e7e6132c5565b905f5260205f2090600302015f015f9054906101000a90046001600160a01b03166001600160a01b031663eb50d83285858e6040518463ffffffff1660e01b8152600401611ece939291906135d6565b6040805180830381865afa158015611ee8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f0c91906132f8565b91509150604051806060016040528060018981548110611f2e57611f2e6132c5565b5f918252602091829020600390910201546001600160a01b0316825281018490526040018290528851899089908110611f6957611f696132c5565b60200260200101819052505050505050508080600101915050611cd1565b6001546060905f816001600160401b03811115611fa657611fa6612b98565b604051908082528060200260200182016040528015611fdf57816020015b611fcc612b28565b815260200190600190039081611fc45790505b5090505f5b828110156115d5575f60018281548110612000576120006132c5565b5f9182526020918290206003909102015460408051631e46e62f60e21b815290516001600160a01b039092169263791b98bc926004808401938290030181865afa158015612050573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061207491906132aa565b90505f6001838154811061208a5761208a6132c5565b5f9182526020918290206003909102015460408051629a9b7b60e01b815290516001600160a01b0390921692629a9b7b926004808401938290030181865afa1580156120d8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120fc919061331a565b90505f60018481548110612112576121126132c5565b5f91825260209091206003909102015460405163118b953560e01b81526001600160a01b039091169063118b95359061214f908b90600401612b84565b60c060405180830381865afa15801561216a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061218e9190613331565b90505f80846001600160a01b03166399fbab88856040518263ffffffff1660e01b81526004016121c091815260200190565b61018060405180830381865afa1580156121dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061220091906133d6565b50505050509650965050505050505f8060018881548110612223576122236132c5565b5f91825260209091206003909102015485516040516375a86c1960e11b81526001600160a01b039092169163eb50d8329161226491889188916004016135d6565b6040805180830381865afa15801561227e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122a291906132f8565b91509150604051806060016040528060018a815481106122c4576122c46132c5565b5f918252602091829020600390910201546001600160a01b03168252810184905260400182905289518a908a9081106122ff576122ff6132c5565b6020026020010181905250505050505050508080600101915050611fe4565b612326612540565b5f5b600154811015610fe95760018181548110612345576123456132c5565b5f918252602090912060039091020154604051632da48fad60e11b81526001600160a01b0390911690635b491f5a90612382903390600401612b84565b5f604051808303815f87803b158015612399575f80fd5b505af11580156123ab573d5f803e3d5ffd5b5050600190920191506123289050565b6005546001600160a01b031633146123e5576040516282b42960e81b815260040160405180910390fd5b60028054600580546001600160a01b03198084166001600160a01b038381169182179096559116909155604051929091169182907f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b2364905f90a350565b60018181548110612450575f80fd5b5f9182526020909120600390910201805460018201546002909201546001600160a01b03909116925060ff1683565b6001545f908190815b8181101561253757600181815481106124a3576124a36132c5565b5f918252602090912060039091020154604051630f7a51a760e01b81526001600160a01b0390911690630f7a51a7906124e0908890600401612b84565b602060405180830381865afa1580156124fb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061251f91906135bb565b92508261252f5750909392505050565b600101612488565b50909392505050565b60025f54036125965760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60025f55565b6040516001600160a01b03808516602483015283166044820152606481018290526126079085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526127ff565b50505050565b5f63095ea7b360e01b83836040516024016126299291906135fc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152905061266784826128d2565b612607576040516001600160a01b03841660248201525f604482015261269a90859063095ea7b360e01b906064016125d0565b61260784826127ff565b6002546001600160a01b03163314610ff3576040516282b42960e81b815260040160405180910390fd5b8047101561271e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161258d565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114612767576040519150601f19603f3d011682016040523d82523d5f602084013e61276c565b606091505b5050905080610eb35760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b606482015260840161258d565b610eb38363a9059cbb60e01b84846040516024016125d09291906135fc565b5f612853826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129709092919063ffffffff16565b905080515f148061287357508080602001905181019061287391906135bb565b610eb35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161258d565b5f805f846001600160a01b0316846040516128ed9190613637565b5f604051808303815f865af19150503d805f8114612926576040519150601f19603f3d011682016040523d82523d5f602084013e61292b565b606091505b509150915081801561295557508051158061295557508080602001905181019061295591906135bb565b8015612965575061296585612986565b925050505b92915050565b606061297e84845f85612995565b949350505050565b6001600160a01b03163b151590565b6060824710156129f65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161258d565b5f80866001600160a01b03168587604051612a119190613637565b5f6040518083038185875af1925050503d805f8114612a4b576040519150601f19603f3d011682016040523d82523d5f602084013e612a50565b606091505b5091509150612a6187838387612a6c565b979650505050505050565b60608315612ad85782515f03612ad157612a8585612986565b612ad15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161258d565b508161297e565b61297e8383815115612aed5781518083602001fd5b8060405162461bcd60e51b815260040161258d9190613652565b5080545f8255600302905f5260205f2090810190612b259190612b4f565b50565b60405180606001604052805f6001600160a01b031681526020015f81526020015f81525090565b5b80821115612b805780546001600160a01b03191681555f600182015560028101805460ff19169055600301612b50565b5090565b6001600160a01b0391909116815260200190565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715612bd457612bd4612b98565b604052919050565b5f6001600160401b03821115612bf457612bf4612b98565b5060051b60200190565b5f82601f830112612c0d575f80fd5b81356020612c22612c1d83612bdc565b612bac565b8083825260208201915060208460051b870101935086841115612c43575f80fd5b602086015b84811015612c5f5780358352918301918301612c48565b509695505050505050565b6001600160a01b0381168114612b25575f80fd5b5f805f805f60a08688031215612c92575f80fd5b85356001600160401b0380821115612ca8575f80fd5b612cb489838a01612bfe565b96506020880135915080821115612cc9575f80fd5b612cd589838a01612bfe565b95506040880135915080821115612cea575f80fd5b612cf689838a01612bfe565b94506060880135915080821115612d0b575f80fd5b50612d1888828901612bfe565b9250506080860135612d2981612c6a565b809150509295509295909350565b5f8060408385031215612d48575f80fd5b823591506020830135612d5a81612c6a565b809150509250929050565b5f82601f830112612d74575f80fd5b81356020612d84612c1d83612bdc565b8083825260208201915060208460051b870101935086841115612da5575f80fd5b602086015b84811015612c5f57803560028110612dc0575f80fd5b8352918301918301612daa565b5f805f60608486031215612ddf575f80fd5b83356001600160401b0380821115612df5575f80fd5b818601915086601f830112612e08575f80fd5b81356020612e18612c1d83612bdc565b82815260059290921b8401810191818101908a841115612e36575f80fd5b948201945b83861015612e5d578535612e4e81612c6a565b82529482019490820190612e3b565b97505087013592505080821115612e72575f80fd5b612e7e87838801612bfe565b93506040860135915080821115612e93575f80fd5b50612ea086828701612d65565b9150509250925092565b5f60208284031215612eba575f80fd5b8135612ec581612c6a565b9392505050565b602080825282518282018190525f919060409081850190868401855b82811015612f9a57815180516001600160a01b0316855286810151878601528581015162ffffff1686860152606080820151612f2e828801826001600160a01b03169052565b5050608080820151612f448288018260020b9052565b505060a080820151612f5a8288018260020b9052565b505060c080820151612f708288018260020b9052565b505060e0818101519086015261010090810151908501526101209093019290850190600101612ee8565b5091979650505050505050565b6001600160801b0381168114612b25575f80fd5b5f805f60608486031215612fcd575f80fd5b83356001600160401b0380821115612fe3575f80fd5b612fef87838801612bfe565b9450602091508186013581811115613005575f80fd5b61301188828901612bfe565b945050604086013581811115613025575f80fd5b86019050601f81018713613037575f80fd5b8035613045612c1d82612bdc565b81815260059190911b82018301908381019089831115613063575f80fd5b928401925b8284101561308a57833561307b81612fa7565b82529284019290840190613068565b80955050505050509250925092565b8015158114612b25575f80fd5b5f602082840312156130b6575f80fd5b8135612ec581613099565b602080825282518282018190525f919060409081850190868401855b82811015612f9a57815180516001600160a01b0316855286810151878601528581015186860152606080820151908601526080808201519086015260a0908101519085015260c090930192908501906001016130dd565b602080825282518282018190525f919060409081850190868401855b82811015612f9a57815180516001600160a01b031685528601511515868501529284019290850190600101613150565b5f805f60608486031215613192575f80fd5b833561319d81612c6a565b92506020840135915060408401356131b481612c6a565b809150509250925092565b5f602082840312156131cf575f80fd5b8135612ec581612fa7565b602080825282518282018190525f919060409081850190868401855b82811015612f9a57815180516001600160a01b03168552868101518786015285015185850152606090930192908501906001016131f6565b5f6020828403121561323e575f80fd5b5035919050565b634e487b7160e01b5f52602160045260245ffd5b6001600160a01b038416815260208101839052606081016002831061328c57634e487b7160e01b5f52602160045260245ffd5b826040830152949350505050565b80516132a581612c6a565b919050565b5f602082840312156132ba575f80fd5b8151612ec581612c6a565b634e487b7160e01b5f52603260045260245ffd5b8082018082111561296a57634e487b7160e01b5f52601160045260245ffd5b5f8060408385031215613309575f80fd5b505080516020909101519092909150565b5f6020828403121561332a575f80fd5b5051919050565b5f60c08284031215613341575f80fd5b60405160c081016001600160401b038111828210171561336357613363612b98565b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a08201528091505092915050565b805162ffffff811681146132a5575f80fd5b8051600281900b81146132a5575f80fd5b80516132a581612fa7565b5f805f805f805f805f805f806101808d8f0312156133f2575f80fd5b8c516001600160601b0381168114613408575f80fd5b9b5061341660208e0161329a565b9a5061342460408e0161329a565b995061343260608e0161329a565b985061344060808e016133a8565b975061344e60a08e016133ba565b965061345c60c08e016133ba565b955061346a60e08e016133cb565b94506101008d015193506101208d015192506134896101408e016133cb565b91506134986101608e016133cb565b90509295989b509295989b509295989b565b805161ffff811681146132a5575f80fd5b5f805f805f805f60e0888a0312156134d1575f80fd5b87516134dc81612c6a565b96506134ea602089016133ba565b95506134f8604089016134aa565b9450613506606089016134aa565b9350613514608089016134aa565b925060a088015160ff81168114613529575f80fd5b60c089015190925061353a81613099565b8091505092959891949750929550565b5f805f805f805f60e0888a031215613560575f80fd5b875161356b81612c6a565b9650613579602089016133ba565b9550613587604089016134aa565b9450613595606089016134aa565b93506135a3608089016134aa565b925060a088015163ffffffff81168114613529575f80fd5b5f602082840312156135cb575f80fd5b8151612ec581613099565b600293840b81529190920b60208201526001600160801b03909116604082015260600190565b6001600160a01b03929092168252602082015260400190565b5f5b8381101561362f578181015183820152602001613617565b50505f910152565b5f8251613648818460208701613615565b9190910192915050565b602081525f8251806020840152613670816040850160208701613615565b601f01601f1916919091016040019291505056fea26469706673582212202aa71efec2e32fb996c59d344d4d8718a213fee44b0528eaf48fc1951869b3fc64736f6c634300081800330000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000b788bb7c3638a4db22e214a0c31b3392c3caae1b0000000000000000000000006de037ef9ad2725eb40118bb1702ebb27e4aeb24000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000ccd05acd3cec7016e0ea2ef6f27a65b885344168000000000000000000000000000000000000000000000000000000000000000100000000000000000000000036232356758c746a50ad5078815f09e39e34628d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405260043610610152575f3560e01c80630dfe16811461015b57806310ec2faa146101a45780631d6dc932146101b757806335815b95146101d657806341d4a1ab146101fa5780634d510bae1461022d57806353304ee41461024c5780635a8946e51461026957806372420d6c1461028857806375fbbee31461029c57806378da43c0146102c857806380b7af18146102e75780638da5cb5b146103065780639a0ca07d14610325578063a4bf34ba14610344578063a670ada414610370578063a6f9dae114610384578063ad5c4648146103a3578063b1484db3146103d6578063b51609b4146103f7578063be85552014610416578063cf3090121461042b578063d21220a71461045b578063d4dde11b1461048e578063dbbdd935146104ba578063e5225381146104d9578063ebbc4965146104ed578063fcd554d414610501578063fdf82caf1461052f57005b3661015957005b005b348015610166575f80fd5b5061018e7f0000000000000000000000006de037ef9ad2725eb40118bb1702ebb27e4aeb2481565b60405161019b9190612b84565b60405180910390f35b6101596101b2366004612c7e565b61054e565b3480156101c2575f80fd5b506101596101d1366004612d37565b610bda565b3480156101e1575f80fd5b506101ec620f424081565b60405190815260200161019b565b348015610205575f80fd5b5061018e7f000000000000000000000000000000000000000000000000000000000000000081565b348015610238575f80fd5b50610159610247366004612dcd565b610c4d565b348015610257575f80fd5b506004546001600160a01b031661018e565b348015610274575f80fd5b50610159610283366004612eaa565b610eb8565b348015610293575f80fd5b50610159610f38565b3480156102a7575f80fd5b506102bb6102b6366004612eaa565b610ff5565b60405161019b9190612ecc565b3480156102d3575f80fd5b506101596102e2366004612fbb565b6115dd565b3480156102f2575f80fd5b5060045461018e906001600160a01b031681565b348015610311575f80fd5b5060025461018e906001600160a01b031681565b348015610330575f80fd5b5061015961033f3660046130a6565b611785565b34801561034f575f80fd5b5061036361035e366004612eaa565b6117f3565b60405161019b91906130c1565b34801561037b575f80fd5b506101ec600481565b34801561038f575f80fd5b5061015961039e366004612eaa565b6119af565b3480156103ae575f80fd5b5061018e7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b3480156103e1575f80fd5b506103ea611a2f565b60405161019b9190613134565b348015610402575f80fd5b50610159610411366004613180565b611c02565b348015610421575f80fd5b506101ec60035481565b348015610436575f80fd5b5060025461044b90600160a01b900460ff1681565b604051901515815260200161019b565b348015610466575f80fd5b5061018e7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b348015610499575f80fd5b506104ad6104a83660046131bf565b611c74565b60405161019b91906131da565b3480156104c5575f80fd5b506104ad6104d4366004612eaa565b611f87565b3480156104e4575f80fd5b5061015961231e565b3480156104f8575f80fd5b506101596123bb565b34801561050c575f80fd5b5061052061051b36600461322e565b612441565b60405161019b93929190613259565b34801561053a575f80fd5b5061044b610549366004612eaa565b61247f565b610556612540565b6001548551146105785760405162bf8b9960e11b815260040160405180910390fd5b835185511461059a5760405163387cab4360e11b815260040160405180910390fd5b82518551146105bc5760405163d062b3d760e01b815260040160405180910390fd5b81518351146105de57604051635dae87f360e11b815260040160405180910390fd5b600254600160a01b900460ff1615610609576040516303cb96db60e21b815260040160405180910390fd5b6001600160a01b0381161580159061062a57506001600160a01b0381163314155b80156106ac57506004805460405163bc019eed60e01b81525f926001600160a01b039092169163bc019eed9161066291339101612b84565b602060405180830381865afa15801561067d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906106a191906132aa565b6001600160a01b0316145b156107485760048054604051630e6a5c9760e31b815233928101929092526001600160a01b0383811660248401521690637352e4b8906044015f604051808303815f87803b1580156106fc575f80fd5b505af115801561070e573d5f803e3d5ffd5b50506040513392506001600160a01b03841691507f4b79506fb58d249496a3306c868c4a5a53124dab1b38ff90c010c0744fa74c58905f90a35b5f5b600154811015610bc9577f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b03167f0000000000000000000000006de037ef9ad2725eb40118bb1702ebb27e4aeb246001600160a01b03161461088d5761080633308884815181106107c4576107c46132c5565b60200260200101517f0000000000000000000000006de037ef9ad2725eb40118bb1702ebb27e4aeb246001600160a01b031661259c909392919063ffffffff16565b61088d6001828154811061081c5761081c6132c5565b5f91825260209091206003909102015487516001600160a01b039091169088908490811061084c5761084c6132c5565b60200260200101517f0000000000000000000000006de037ef9ad2725eb40118bb1702ebb27e4aeb246001600160a01b031661260d9092919063ffffffff16565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b03167f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316146109c65761093f33308784815181106108fd576108fd6132c5565b60200260200101517f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031661259c909392919063ffffffff16565b6109c660018281548110610955576109556132c5565b5f91825260209091206003909102015486516001600160a01b0390911690879084908110610985576109856132c5565b60200260200101517f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031661260d9092919063ffffffff16565b5f7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b03167f0000000000000000000000006de037ef9ad2725eb40118bb1702ebb27e4aeb246001600160a01b031603610a3d57868281518110610a3257610a326132c5565b602002602001015190505b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b03167f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031603610ab357858281518110610aa857610aa86132c5565b602002602001015190505b60018281548110610ac657610ac66132c5565b5f91825260209091206003909102015487516001600160a01b039091169063ee8ad7d79083908a9086908110610afe57610afe6132c5565b6020026020010151898681518110610b1857610b186132c5565b6020026020010151898781518110610b3257610b326132c5565b6020026020010151898881518110610b4c57610b4c6132c5565b60209081029190910101516040516001600160e01b031960e088901b168152600481019490945260248401929092526044830152606482015233608482015260a4015f604051808303818588803b158015610ba5575f80fd5b505af1158015610bb7573d5f803e3d5ffd5b50506001909401935061074a92505050565b50610bd360015f55565b5050505050565b610be26126a4565b610bea612540565b610bfd6001600160a01b038216836126ce565b806001600160a01b03167ffd19773960db3ffa2d12a2c85d3db65c4d836caeb978fc58764784eb3fa8c7ad83604051610c3891815260200190565b60405180910390a2610c4960015f55565b5050565b610c556126a4565b610c5d612540565b600483511115610c80576040516335d4169b60e21b815260040160405180910390fd5b8251825114610ca257604051630318700160e11b815260040160405180910390fd5b8051825114610cc457604051630f74d28d60e31b815260040160405180910390fd5b5f610cd0600182612b07565b5f5b8451811015610e7f575f6001600160a01b0316858281518110610cf757610cf76132c5565b60200260200101516001600160a01b031603610d265760405163412b301160e11b815260040160405180910390fd5b838181518110610d3857610d386132c5565b60200260200101515f03610d5f576040516352d2a7df60e01b815260040160405180910390fd5b60016040518060600160405280878481518110610d7e57610d7e6132c5565b60200260200101516001600160a01b03168152602001868481518110610da657610da66132c5565b60200260200101518152602001858481518110610dc557610dc56132c5565b60200260200101516001811115610dde57610dde613245565b90528154600180820184555f938452602093849020835160039093020180546001600160a01b0319166001600160a01b0390931692909217825592820151818401556040820151600282018054939492939192909160ff1916908381811115610e4957610e49613245565b02179055505050838181518110610e6257610e626132c5565b602002602001015182610e7591906132d9565b9150600101610cd2565b50620f42408114610ea357604051630fd68efd60e01b815260040160405180910390fd5b50600154600355610eb360015f55565b505050565b610ec06126a4565b6001600160a01b038116610ee75760405163d92e233d60e01b815260040160405180910390fd5b600480546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f048611c5441b2428f273df1ccd326018fa213661c504eaaa3546b6e8cb3b3ce6905f90a35050565b610f40612540565b5f5b600154811015610fe95760018181548110610f5f57610f5f6132c5565b905f5260205f2090600302015f015f9054906101000a90046001600160a01b03166001600160a01b03166372420d6c6040518163ffffffff1660e01b815260040160408051808303815f875af1158015610fbb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610fdf91906132f8565b5050600101610f42565b50610ff360015f55565b565b6001546060905f816001600160401b0381111561101457611014612b98565b60405190808252806020026020018201604052801561108957816020015b60408051610120810182525f8082526020808301829052928201819052606082018190526080820181905260a0820181905260c0820181905260e0820181905261010082015282525f199092019101816110325790505b5090505f5b828110156115d5575f600182815481106110aa576110aa6132c5565b5f9182526020918290206003909102015460408051631e46e62f60e21b815290516001600160a01b039092169263791b98bc926004808401938290030181865afa1580156110fa573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061111e91906132aa565b90505f60018381548110611134576111346132c5565b5f9182526020918290206003909102015460408051629a9b7b60e01b815290516001600160a01b0390921692629a9b7b926004808401938290030181865afa158015611182573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906111a6919061331a565b90505f600184815481106111bc576111bc6132c5565b5f91825260209091206003909102015460405163118b953560e01b81526001600160a01b039091169063118b9535906111f9908b90600401612b84565b60c060405180830381865afa158015611214573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112389190613331565b90505f805f856001600160a01b03166399fbab88866040518263ffffffff1660e01b815260040161126b91815260200190565b61018060405180830381865afa158015611287573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906112ab91906133d6565b5050505050965096509650505050505f866001600160a01b031663c45a01556040518163ffffffff1660e01b8152600401602060405180830381865afa1580156112f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061131b91906132aa565b604051630b4c774160e11b81526001600160a01b037f0000000000000000000000006de037ef9ad2725eb40118bb1702ebb27e4aeb24811660048301527f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc28116602483015262ffffff871660448301529192505f91831690631698ee8290606401602060405180830381865afa1580156113b7573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906113db91906132aa565b90505f808060018c815481106113f3576113f36132c5565b5f91825260209091206002600390920201015460ff16600181111561141a5761141a613245565b0361149057826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa15801561145b573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061147f91906134bb565b509496509294506114fc9350505050565b826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156114cc573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906114f0919061354a565b50949650929450505050505b60405180610120016040528060018d8154811061151b5761151b6132c5565b5f918252602091829020600390910201546001600160a01b0390811683529082018c905262ffffff8a16604083015284166060820152600283810b608083015288810b60a083015287900b60c0820152895160e08201526001805461010092909201918e90811061158e5761158e6132c5565b905f5260205f209060030201600101548152508c8c815181106115b3576115b36132c5565b602002602001018190525050505050505050505050808060010191505061108e565b509392505050565b6115e5612540565b60015483511461160857604051630318700160e11b815260040160405180910390fd5b815183511461162a57604051630cd56ebd60e41b815260040160405180910390fd5b805182511461164c57604051632d4e48ed60e01b815260040160405180910390fd5b5f5b60015481101561177b575f82828151811061166b5761166b6132c5565b60200260200101516001600160801b031611156117735760018181548110611695576116956132c5565b5f91825260209091206003909102015484516001600160a01b039091169063268ce564908690849081106116cb576116cb6132c5565b60200260200101518584815181106116e5576116e56132c5565b60200260200101518585815181106116ff576116ff6132c5565b60209081029190910101516040516001600160e01b031960e086901b168152600481019390935260248301919091526001600160801b031660448201523360648201526084015f604051808303815f87803b15801561175c575f80fd5b505af115801561176e573d5f803e3d5ffd5b505050505b60010161164e565b50610eb360015f55565b61178d6126a4565b6002805460ff60a01b198116600160a01b84151581810292909217909355604080519390920460ff1680151584526020840191909152917fdb62846f606c5317258768a4c1d3af593d861da6a61578aba6ade868a607d605910160405180910390a15050565b6001546060905f816001600160401b0381111561181257611812612b98565b60405190808252806020026020018201604052801561187f57816020015b61186c6040518060c001604052805f6001600160a01b031681526020015f81526020015f81526020015f81526020015f81526020015f81525090565b8152602001906001900390816118305790505b5090505f5b828110156115d5575f600182815481106118a0576118a06132c5565b5f91825260209091206003909102015460405163118b953560e01b81526001600160a01b039091169063118b9535906118dd908990600401612b84565b60c060405180830381865afa1580156118f8573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061191c9190613331565b90506040518060c001604052806001848154811061193c5761193c6132c5565b5f918252602091829020600390910201546001600160a01b03168252838101519082015260408084015190820152606080840151908201526080808401519082015260a080840151910152835184908490811061199b5761199b6132c5565b602090810291909101015250600101611884565b6119b76126a4565b6001600160a01b0381166119de5760405163d92e233d60e01b815260040160405180910390fd5b600580546001600160a01b0319166001600160a01b03838116918217909255600254604051919216907f38d16b8cac22d99fc7c124b9cd0de2d3fa1faef420bfe791d8c362d765e22700905f90a350565b6001546060905f816001600160401b03811115611a4e57611a4e612b98565b604051908082528060200260200182016040528015611a9257816020015b604080518082019091525f8082526020820152815260200190600190039081611a6c5790505b5090505f5b82811015611bfb575f60018281548110611ab357611ab36132c5565b5f918252602091829020600390910201546040805163084f56f760e01b815290516001600160a01b039092169263084f56f7926004808401938290030181865afa158015611b03573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611b2791906135bb565b90508015611b9357604051806040016040528060018481548110611b4d57611b4d6132c5565b5f91825260208083206003909202909101546001600160a01b0316835291909101528351849084908110611b8357611b836132c5565b6020026020010181905250611bf2565b604051806040016040528060018481548110611bb157611bb16132c5565b5f918252602091829020600390910201546001600160a01b0316825260019101528351849084908110611be657611be66132c5565b60200260200101819052505b50600101611a97565b5092915050565b611c0a6126a4565b611c12612540565b611c266001600160a01b03841682846127e0565b604080518381526001600160a01b0383811660208301528516917fb197f0a554c4d7840105e6ae65f0e275e9e8605a969dffa8caa7f1f118a2e1f5910160405180910390a2610eb360015f55565b6001546060905f816001600160401b03811115611c9357611c93612b98565b604051908082528060200260200182016040528015611ccc57816020015b611cb9612b28565b815260200190600190039081611cb15790505b5090505f5b828110156115d5575f60018281548110611ced57611ced6132c5565b5f9182526020918290206003909102015460408051631e46e62f60e21b815290516001600160a01b039092169263791b98bc926004808401938290030181865afa158015611d3d573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611d6191906132aa565b90505f60018381548110611d7757611d776132c5565b5f9182526020918290206003909102015460408051629a9b7b60e01b815290516001600160a01b0390921692629a9b7b926004808401938290030181865afa158015611dc5573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611de9919061331a565b90505f80836001600160a01b03166399fbab88846040518263ffffffff1660e01b8152600401611e1b91815260200190565b61018060405180830381865afa158015611e37573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e5b91906133d6565b50505050509650965050505050505f8060018781548110611e7e57611e7e6132c5565b905f5260205f2090600302015f015f9054906101000a90046001600160a01b03166001600160a01b031663eb50d83285858e6040518463ffffffff1660e01b8152600401611ece939291906135d6565b6040805180830381865afa158015611ee8573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f0c91906132f8565b91509150604051806060016040528060018981548110611f2e57611f2e6132c5565b5f918252602091829020600390910201546001600160a01b0316825281018490526040018290528851899089908110611f6957611f696132c5565b60200260200101819052505050505050508080600101915050611cd1565b6001546060905f816001600160401b03811115611fa657611fa6612b98565b604051908082528060200260200182016040528015611fdf57816020015b611fcc612b28565b815260200190600190039081611fc45790505b5090505f5b828110156115d5575f60018281548110612000576120006132c5565b5f9182526020918290206003909102015460408051631e46e62f60e21b815290516001600160a01b039092169263791b98bc926004808401938290030181865afa158015612050573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061207491906132aa565b90505f6001838154811061208a5761208a6132c5565b5f9182526020918290206003909102015460408051629a9b7b60e01b815290516001600160a01b0390921692629a9b7b926004808401938290030181865afa1580156120d8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906120fc919061331a565b90505f60018481548110612112576121126132c5565b5f91825260209091206003909102015460405163118b953560e01b81526001600160a01b039091169063118b95359061214f908b90600401612b84565b60c060405180830381865afa15801561216a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061218e9190613331565b90505f80846001600160a01b03166399fbab88856040518263ffffffff1660e01b81526004016121c091815260200190565b61018060405180830381865afa1580156121dc573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061220091906133d6565b50505050509650965050505050505f8060018881548110612223576122236132c5565b5f91825260209091206003909102015485516040516375a86c1960e11b81526001600160a01b039092169163eb50d8329161226491889188916004016135d6565b6040805180830381865afa15801561227e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122a291906132f8565b91509150604051806060016040528060018a815481106122c4576122c46132c5565b5f918252602091829020600390910201546001600160a01b03168252810184905260400182905289518a908a9081106122ff576122ff6132c5565b6020026020010181905250505050505050508080600101915050611fe4565b612326612540565b5f5b600154811015610fe95760018181548110612345576123456132c5565b5f918252602090912060039091020154604051632da48fad60e11b81526001600160a01b0390911690635b491f5a90612382903390600401612b84565b5f604051808303815f87803b158015612399575f80fd5b505af11580156123ab573d5f803e3d5ffd5b5050600190920191506123289050565b6005546001600160a01b031633146123e5576040516282b42960e81b815260040160405180910390fd5b60028054600580546001600160a01b03198084166001600160a01b038381169182179096559116909155604051929091169182907f70aea8d848e8a90fb7661b227dc522eb6395c3dac71b63cb59edd5c9899b2364905f90a350565b60018181548110612450575f80fd5b5f9182526020909120600390910201805460018201546002909201546001600160a01b03909116925060ff1683565b6001545f908190815b8181101561253757600181815481106124a3576124a36132c5565b5f918252602090912060039091020154604051630f7a51a760e01b81526001600160a01b0390911690630f7a51a7906124e0908890600401612b84565b602060405180830381865afa1580156124fb573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061251f91906135bb565b92508261252f5750909392505050565b600101612488565b50909392505050565b60025f54036125965760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c0060448201526064015b60405180910390fd5b60025f55565b6040516001600160a01b03808516602483015283166044820152606481018290526126079085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b0319909316929092179091526127ff565b50505050565b5f63095ea7b360e01b83836040516024016126299291906135fc565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152905061266784826128d2565b612607576040516001600160a01b03841660248201525f604482015261269a90859063095ea7b360e01b906064016125d0565b61260784826127ff565b6002546001600160a01b03163314610ff3576040516282b42960e81b815260040160405180910390fd5b8047101561271e5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e6365000000604482015260640161258d565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114612767576040519150601f19603f3d011682016040523d82523d5f602084013e61276c565b606091505b5050905080610eb35760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c20726044820152791958da5c1a595b9d081b585e481a185d99481c995d995c9d195960321b606482015260840161258d565b610eb38363a9059cbb60e01b84846040516024016125d09291906135fc565b5f612853826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166129709092919063ffffffff16565b905080515f148061287357508080602001905181019061287391906135bb565b610eb35760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161258d565b5f805f846001600160a01b0316846040516128ed9190613637565b5f604051808303815f865af19150503d805f8114612926576040519150601f19603f3d011682016040523d82523d5f602084013e61292b565b606091505b509150915081801561295557508051158061295557508080602001905181019061295591906135bb565b8015612965575061296585612986565b925050505b92915050565b606061297e84845f85612995565b949350505050565b6001600160a01b03163b151590565b6060824710156129f65760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b606482015260840161258d565b5f80866001600160a01b03168587604051612a119190613637565b5f6040518083038185875af1925050503d805f8114612a4b576040519150601f19603f3d011682016040523d82523d5f602084013e612a50565b606091505b5091509150612a6187838387612a6c565b979650505050505050565b60608315612ad85782515f03612ad157612a8585612986565b612ad15760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161258d565b508161297e565b61297e8383815115612aed5781518083602001fd5b8060405162461bcd60e51b815260040161258d9190613652565b5080545f8255600302905f5260205f2090810190612b259190612b4f565b50565b60405180606001604052805f6001600160a01b031681526020015f81526020015f81525090565b5b80821115612b805780546001600160a01b03191681555f600182015560028101805460ff19169055600301612b50565b5090565b6001600160a01b0391909116815260200190565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715612bd457612bd4612b98565b604052919050565b5f6001600160401b03821115612bf457612bf4612b98565b5060051b60200190565b5f82601f830112612c0d575f80fd5b81356020612c22612c1d83612bdc565b612bac565b8083825260208201915060208460051b870101935086841115612c43575f80fd5b602086015b84811015612c5f5780358352918301918301612c48565b509695505050505050565b6001600160a01b0381168114612b25575f80fd5b5f805f805f60a08688031215612c92575f80fd5b85356001600160401b0380821115612ca8575f80fd5b612cb489838a01612bfe565b96506020880135915080821115612cc9575f80fd5b612cd589838a01612bfe565b95506040880135915080821115612cea575f80fd5b612cf689838a01612bfe565b94506060880135915080821115612d0b575f80fd5b50612d1888828901612bfe565b9250506080860135612d2981612c6a565b809150509295509295909350565b5f8060408385031215612d48575f80fd5b823591506020830135612d5a81612c6a565b809150509250929050565b5f82601f830112612d74575f80fd5b81356020612d84612c1d83612bdc565b8083825260208201915060208460051b870101935086841115612da5575f80fd5b602086015b84811015612c5f57803560028110612dc0575f80fd5b8352918301918301612daa565b5f805f60608486031215612ddf575f80fd5b83356001600160401b0380821115612df5575f80fd5b818601915086601f830112612e08575f80fd5b81356020612e18612c1d83612bdc565b82815260059290921b8401810191818101908a841115612e36575f80fd5b948201945b83861015612e5d578535612e4e81612c6a565b82529482019490820190612e3b565b97505087013592505080821115612e72575f80fd5b612e7e87838801612bfe565b93506040860135915080821115612e93575f80fd5b50612ea086828701612d65565b9150509250925092565b5f60208284031215612eba575f80fd5b8135612ec581612c6a565b9392505050565b602080825282518282018190525f919060409081850190868401855b82811015612f9a57815180516001600160a01b0316855286810151878601528581015162ffffff1686860152606080820151612f2e828801826001600160a01b03169052565b5050608080820151612f448288018260020b9052565b505060a080820151612f5a8288018260020b9052565b505060c080820151612f708288018260020b9052565b505060e0818101519086015261010090810151908501526101209093019290850190600101612ee8565b5091979650505050505050565b6001600160801b0381168114612b25575f80fd5b5f805f60608486031215612fcd575f80fd5b83356001600160401b0380821115612fe3575f80fd5b612fef87838801612bfe565b9450602091508186013581811115613005575f80fd5b61301188828901612bfe565b945050604086013581811115613025575f80fd5b86019050601f81018713613037575f80fd5b8035613045612c1d82612bdc565b81815260059190911b82018301908381019089831115613063575f80fd5b928401925b8284101561308a57833561307b81612fa7565b82529284019290840190613068565b80955050505050509250925092565b8015158114612b25575f80fd5b5f602082840312156130b6575f80fd5b8135612ec581613099565b602080825282518282018190525f919060409081850190868401855b82811015612f9a57815180516001600160a01b0316855286810151878601528581015186860152606080820151908601526080808201519086015260a0908101519085015260c090930192908501906001016130dd565b602080825282518282018190525f919060409081850190868401855b82811015612f9a57815180516001600160a01b031685528601511515868501529284019290850190600101613150565b5f805f60608486031215613192575f80fd5b833561319d81612c6a565b92506020840135915060408401356131b481612c6a565b809150509250925092565b5f602082840312156131cf575f80fd5b8135612ec581612fa7565b602080825282518282018190525f919060409081850190868401855b82811015612f9a57815180516001600160a01b03168552868101518786015285015185850152606090930192908501906001016131f6565b5f6020828403121561323e575f80fd5b5035919050565b634e487b7160e01b5f52602160045260245ffd5b6001600160a01b038416815260208101839052606081016002831061328c57634e487b7160e01b5f52602160045260245ffd5b826040830152949350505050565b80516132a581612c6a565b919050565b5f602082840312156132ba575f80fd5b8151612ec581612c6a565b634e487b7160e01b5f52603260045260245ffd5b8082018082111561296a57634e487b7160e01b5f52601160045260245ffd5b5f8060408385031215613309575f80fd5b505080516020909101519092909150565b5f6020828403121561332a575f80fd5b5051919050565b5f60c08284031215613341575f80fd5b60405160c081016001600160401b038111828210171561336357613363612b98565b8060405250825181526020830151602082015260408301516040820152606083015160608201526080830151608082015260a083015160a08201528091505092915050565b805162ffffff811681146132a5575f80fd5b8051600281900b81146132a5575f80fd5b80516132a581612fa7565b5f805f805f805f805f805f806101808d8f0312156133f2575f80fd5b8c516001600160601b0381168114613408575f80fd5b9b5061341660208e0161329a565b9a5061342460408e0161329a565b995061343260608e0161329a565b985061344060808e016133a8565b975061344e60a08e016133ba565b965061345c60c08e016133ba565b955061346a60e08e016133cb565b94506101008d015193506101208d015192506134896101408e016133cb565b91506134986101608e016133cb565b90509295989b509295989b509295989b565b805161ffff811681146132a5575f80fd5b5f805f805f805f60e0888a0312156134d1575f80fd5b87516134dc81612c6a565b96506134ea602089016133ba565b95506134f8604089016134aa565b9450613506606089016134aa565b9350613514608089016134aa565b925060a088015160ff81168114613529575f80fd5b60c089015190925061353a81613099565b8091505092959891949750929550565b5f805f805f805f60e0888a031215613560575f80fd5b875161356b81612c6a565b9650613579602089016133ba565b9550613587604089016134aa565b9450613595606089016134aa565b93506135a3608089016134aa565b925060a088015163ffffffff81168114613529575f80fd5b5f602082840312156135cb575f80fd5b8151612ec581613099565b600293840b81529190920b60208201526001600160801b03909116604082015260600190565b6001600160a01b03929092168252602082015260400190565b5f5b8381101561362f578181015183820152602001613617565b50505f910152565b5f8251613648818460208701613615565b9190910192915050565b602081525f8251806020840152613670816040850160208701613615565b601f01601f1916919091016040019291505056fea26469706673582212202aa71efec2e32fb996c59d344d4d8718a213fee44b0528eaf48fc1951869b3fc64736f6c63430008180033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000b788bb7c3638a4db22e214a0c31b3392c3caae1b0000000000000000000000006de037ef9ad2725eb40118bb1702ebb27e4aeb24000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc20000000000000000000000000000000000000000000000000000000000000000000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2000000000000000000000000ccd05acd3cec7016e0ea2ef6f27a65b885344168000000000000000000000000000000000000000000000000000000000000000100000000000000000000000036232356758c746a50ad5078815f09e39e34628d000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000f424000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _rangePositionManagers (address[]): 0x36232356758c746A50AD5078815F09e39E34628d
Arg [1] : _rangeWeights (uint256[]): 1000000
Arg [2] : _positionTypes (uint8[]): 0
Arg [3] : _owner (address): 0xB788bb7C3638A4db22E214a0C31B3392C3CAAE1B
Arg [4] : _token0 (address): 0x6De037ef9aD2725EB40118Bb1702EBb27e4Aeb24
Arg [5] : _token1 (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [6] : _bonusToken (address): 0x0000000000000000000000000000000000000000
Arg [7] : _WETH (address): 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
Arg [8] : _yieldManager (address): 0xcCd05ACd3cEC7016E0EA2eF6F27A65b885344168
-----Encoded View---------------
15 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000160
Arg [2] : 00000000000000000000000000000000000000000000000000000000000001a0
Arg [3] : 000000000000000000000000b788bb7c3638a4db22e214a0c31b3392c3caae1b
Arg [4] : 0000000000000000000000006de037ef9ad2725eb40118bb1702ebb27e4aeb24
Arg [5] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [7] : 000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2
Arg [8] : 000000000000000000000000ccd05acd3cec7016e0ea2ef6f27a65b885344168
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [10] : 00000000000000000000000036232356758c746a50ad5078815f09e39e34628d
Arg [11] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [12] : 00000000000000000000000000000000000000000000000000000000000f4240
Arg [13] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [14] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.