Overview
TokenID
29
Total Transfers
-
Market
Onchain Market Cap
-
Circulating Supply Market Cap
-
Other Info
Token Contract
Loading...
Loading
Loading...
Loading
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Source Code Verified (Exact Match)
Contract Name:
OptionMarketOTMFE
Compiler Version
v0.8.26+commit.8a97fa7a
Optimization Enabled:
Yes with 200 runs
Other Settings:
shanghai EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0 <0.9.0; import {IPositionManager} from "../../interfaces/IPositionManager.sol"; import {IOptionPricingV2} from "./pricing/IOptionPricingV2.sol"; import {IHandler} from "../../interfaces/IHandler.sol"; import {IClammFeeStrategyV2} from "./pricing/fees/IClammFeeStrategyV2.sol"; import {ISwapper} from "../../interfaces/ISwapper.sol"; import {ITokenURIFetcher} from "../../interfaces/ITokenURIFetcher.sol"; import {IVerifiedSpotPrice} from "../../interfaces/IVerifiedSpotPrice.sol"; import {ERC721} from "../../libraries/tokens/ERC721.sol"; import {ERC20} from "openzeppelin-contracts/contracts/token/ERC20/ERC20.sol"; import {Ownable} from "openzeppelin-contracts/contracts/access/Ownable.sol"; import {ReentrancyGuard} from "openzeppelin-contracts/contracts/utils/ReentrancyGuard.sol"; import {Multicall} from "openzeppelin-contracts/contracts/utils/Multicall.sol"; import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; import {LiquidityAmounts} from "v3-periphery/libraries/LiquidityAmounts.sol"; import {TickMath} from "@uniswap/v3-core/contracts/libraries/TickMath.sol"; import {FullMath} from "@uniswap/v3-core/contracts/libraries/FullMath.sol"; /// @title OptionMarketOTMFE (Option Market Out-of-the-Money Fixed Expiry) /// @author 0xcarrot /// @notice This contract implements an options market for out-of-the-money (OTM) options with fixed expiry /// @dev Inherits from ReentrancyGuard, Multicall, Ownable, and ERC721 contract OptionMarketOTMFE is ReentrancyGuard, Multicall, Ownable, ERC721 { using TickMath for int24; /// @notice Struct to store option data struct OptionData { uint256 opTickArrayLen; uint256 expiry; int24 tickLower; int24 tickUpper; bool isCall; } /// @notice Struct to store option ticks data struct OptionTicks { IHandler _handler; IUniswapV3Pool pool; address hook; int24 tickLower; int24 tickUpper; uint256 liquidityToUse; } /// @notice Struct for option parameters struct OptionParams { OptionTicks[] optionTicks; uint256 ttl; uint256 maxCostAllowance; int24 tickLower; int24 tickUpper; bool isCall; } /// @notice Struct for settling option parameters struct SettleOptionParams { uint256 optionId; ISwapper[] swapper; bytes[] swapData; uint256[] liquidityToSettle; } /// @notice Struct for position splitter parameters struct PositionSplitterParams { uint256 optionId; address to; uint256[] liquidityToSplit; } // Events event LogMintOption( OptionParams _params, uint256 optionId, uint256 premiumAmount, uint256 size, uint256 protocolFees ); event LogSettleOption(AssetsCache assetsCache, uint256[] liquiditySettled, address owner, uint256 optionId); event LogSplitOption(PositionSplitterParams params, uint256 newOptionId, address oldOwner); event LogUpdateExerciseDelegate(address owner, address delegate, bool status); event LogOptionsMarketInitialized( address primePool, address optionPricing, address dpFee, address callAsset, address putAsset ); event LogUpdatePoolApprovals( address settler, bool statusSettler, address pool, bool statusPools, uint256 ttl, uint256 ttlStartTime, bool ttlStatus, uint256 bufferTime ); event LogUpdatePoolSettings(address feeTo, address tokenURIFetcher, address dpFee, address optionPricing); // Errors error MaxOptionBuyReached(); error IVNotSet(); error NotValidStrikeTick(); error PoolNotApproved(); error MaxCostAllowanceExceeded(); error NotOwnerOrDelegator(); error ArrayLenMismatch(); error NotEnoughAfterSwap(); error NotApprovedSettler(); error InvalidPool(); error NotApprovedTTL(); error InBUFFER_TIME(); error Expired(); error TTLNotSet(); /// @notice Counter for option IDs uint256 public optionIds; /// @notice Buffer time for option expiry uint256 BUFFER_TIME = 10 minutes; /// @notice Interface for fee strategy IClammFeeStrategyV2 public dpFee; /// @notice Interface for option pricing IOptionPricingV2 public optionPricing; /// @notice Interface for verified spot price IVerifiedSpotPrice public verifiedSpotPrice; /// @notice Interface for position manager IPositionManager public immutable positionManager; /// @notice Interface for prime pool IUniswapV3Pool public immutable primePool; /// @notice Address of the call asset address public immutable callAsset; /// @notice Address of the put asset address public immutable putAsset; /// @notice Address to receive fees address public feeTo; /// @notice Address of the token URI fetcher address public tokenURIFetcher; /// @notice Decimals of the call asset uint8 public immutable callAssetDecimals; /// @notice Decimals of the put asset uint8 public immutable putAssetDecimals; /// @notice Mapping of option ID to option data mapping(uint256 => OptionData) public opData; /// @notice Mapping of option ID to option ticks mapping(uint256 => OptionTicks[]) public opTickMap; /// @notice Mapping of owner to delegate to exercise status mapping(address => mapping(address => bool)) public exerciseDelegator; /// @notice Mapping of pool address to approval status mapping(address => bool) public approvedPools; /// @notice Mapping of settler address to approval status mapping(address => bool) public settlers; /// @notice Mapping of TTL to approval status mapping(uint256 => bool) public approvedTTLs; /// @notice Mapping of TTL to start time mapping(uint256 => uint256) public ttlStartTime; /// @notice Constructor for the OptionMarketOTM_Fixed_Expiry_V1 contract /// @param _pm Address of the position manager /// @param _optionPricing Address of the option pricing contract /// @param _dpFee Address of the fee strategy contract /// @param _callAsset Address of the call asset /// @param _putAsset Address of the put asset /// @param _primePool Address of the prime pool constructor( address _pm, address _optionPricing, address _dpFee, address _callAsset, address _putAsset, address _primePool, address _verifiedSpotPrice ) Ownable(msg.sender) { positionManager = IPositionManager(_pm); callAsset = _callAsset; putAsset = _putAsset; dpFee = IClammFeeStrategyV2(_dpFee); optionPricing = IOptionPricingV2(_optionPricing); primePool = IUniswapV3Pool(_primePool); verifiedSpotPrice = IVerifiedSpotPrice(_verifiedSpotPrice); if (primePool.token0() != _callAsset && primePool.token1() != _callAsset) revert InvalidPool(); if (primePool.token0() != _putAsset && primePool.token1() != _putAsset) { revert InvalidPool(); } callAssetDecimals = ERC20(_callAsset).decimals(); putAssetDecimals = ERC20(_putAsset).decimals(); emit LogOptionsMarketInitialized(_primePool, _optionPricing, _dpFee, _callAsset, _putAsset); } /// @notice Returns the name of the contract /// @return string The name of the contract function name() public view override returns (string memory) { return "MarginZero Option Market OTM FE"; } /// @notice Returns the symbol of the contract /// @return string The symbol of the contract function symbol() public view override returns (string memory) { return "MZ-OM-OTM-FE"; } /// @notice Returns the token URI for a given token ID /// @param id The token ID /// @return string The token URI function tokenURI(uint256 id) public view override returns (string memory) { return ITokenURIFetcher(tokenURIFetcher).onFetchTokenURIData(id); } /// @notice Mints a new option /// @param _params The option parameters function mintOption(OptionParams calldata _params) external nonReentrant { optionIds += 1; if (_params.optionTicks.length > 20) { revert MaxOptionBuyReached(); } if (!approvedTTLs[_params.ttl]) { revert NotApprovedTTL(); } uint256 expiry = block.timestamp + (_params.ttl - ((block.timestamp - ttlStartTime[_params.ttl]) % _params.ttl)); if (expiry - block.timestamp > _params.ttl - BUFFER_TIME) { revert InBUFFER_TIME(); } uint256[] memory amountsPerOptionTicks = new uint256[](_params.optionTicks.length); uint256 totalAssetWithdrawn; bool isAmount0; address assetToUse = _params.isCall ? callAsset : putAsset; OptionTicks memory opTick; for (uint256 i; i < _params.optionTicks.length; i++) { opTick = _params.optionTicks[i]; if (_params.isCall ? _params.tickUpper != opTick.tickUpper : _params.tickLower != opTick.tickLower) { revert NotValidStrikeTick(); } opTickMap[optionIds].push( OptionTicks({ _handler: opTick._handler, pool: opTick.pool, hook: opTick.hook, tickLower: opTick.tickLower, tickUpper: opTick.tickUpper, liquidityToUse: opTick.liquidityToUse }) ); if (!approvedPools[address(opTick.pool)]) { revert PoolNotApproved(); } bytes memory usePositionData = abi.encode( opTick.pool, opTick.hook, opTick.tickLower, opTick.tickUpper, opTick.liquidityToUse, abi.encode( address(this), expiry, _params.isCall, opTick.pool, opTick.tickLower, opTick.tickUpper, opTick.liquidityToUse ) ); (address[] memory tokens, uint256[] memory amounts,) = positionManager.usePosition(opTick._handler, usePositionData); if (tokens[0] == assetToUse) { require(amounts[0] > 0 && amounts[1] == 0); amountsPerOptionTicks[i] = (amounts[0]); totalAssetWithdrawn += amounts[0]; isAmount0 = true; } else { require(amounts[1] > 0 && amounts[0] == 0); amountsPerOptionTicks[i] = (amounts[1]); totalAssetWithdrawn += amounts[1]; isAmount0 = false; } } uint256 strike = getPricePerCallAssetViaTick(primePool, _params.isCall ? _params.tickUpper : _params.tickLower); uint256 premiumAmount = _getPremiumAmount( opTick.hook, _params.isCall ? false : true, // isPut expiry, // expiry _params.ttl, // ttl strike, // Strike verifiedSpotPrice.getSpotPrice(primePool, callAsset, callAssetDecimals), // Current price _params.isCall ? totalAssetWithdrawn : (totalAssetWithdrawn * (10 ** putAssetDecimals)) / strike ); if (premiumAmount == 0) revert IVNotSet(); uint256 protocolFees; if (feeTo != address(0)) { protocolFees = getFee(totalAssetWithdrawn, premiumAmount); ERC20(assetToUse).transferFrom(msg.sender, feeTo, protocolFees); } if (premiumAmount + protocolFees > _params.maxCostAllowance) { revert MaxCostAllowanceExceeded(); } ERC20(assetToUse).transferFrom(msg.sender, address(this), premiumAmount); ERC20(assetToUse).approve(address(positionManager), premiumAmount); for (uint256 i; i < _params.optionTicks.length; i++) { opTick = _params.optionTicks[i]; uint256 premiumAmountEarned = (amountsPerOptionTicks[i] * premiumAmount) / totalAssetWithdrawn; bytes memory donatePositionData = abi.encode( opTick.pool, opTick.hook, opTick.tickLower, opTick.tickUpper, isAmount0 ? premiumAmountEarned : 0, isAmount0 ? 0 : premiumAmountEarned, abi.encode("") ); positionManager.donateToPosition(opTick._handler, donatePositionData); } opData[optionIds] = OptionData({ opTickArrayLen: _params.optionTicks.length, tickLower: _params.tickLower, tickUpper: _params.tickUpper, expiry: expiry, isCall: _params.isCall }); _safeMint(msg.sender, optionIds); emit LogMintOption(_params, optionIds, premiumAmount, totalAssetWithdrawn, protocolFees); } /// @notice Struct to cache asset-related data during option settlement struct AssetsCache { uint256 totalProfit; uint256 totalAssetRelocked; ERC20 assetToUse; ERC20 assetToGet; bool isSettle; } /// @notice Settles an option /// @param _params The settlement parameters /// @return ac The assets cache containing settlement results function settleOption(SettleOptionParams calldata _params) external nonReentrant returns (AssetsCache memory ac) { OptionData memory oData = opData[_params.optionId]; if (oData.opTickArrayLen != _params.liquidityToSettle.length) { revert ArrayLenMismatch(); } if (block.timestamp >= oData.expiry) { ac.isSettle = true; if (!settlers[msg.sender]) { revert NotApprovedSettler(); } } else { if ( ownerOf(_params.optionId) != msg.sender && exerciseDelegator[ownerOf(_params.optionId)][msg.sender] == false ) revert NotOwnerOrDelegator(); } bool isAmount0 = oData.isCall ? primePool.token0() == callAsset : primePool.token0() == putAsset; ac.assetToUse = ERC20(oData.isCall ? callAsset : putAsset); ac.assetToGet = ERC20(oData.isCall ? putAsset : callAsset); for (uint256 i; i < oData.opTickArrayLen; i++) { if (_params.liquidityToSettle[i] == 0) continue; OptionTicks storage opTick = opTickMap[_params.optionId][i]; uint256 liquidityToSettle = _params.liquidityToSettle[i]; (uint256 amount0, uint256 amount1) = LiquidityAmounts.getAmountsForLiquidity( _getCurrentSqrtPriceX96(opTick.pool), opTick.tickLower.getSqrtRatioAtTick(), opTick.tickUpper.getSqrtRatioAtTick(), uint128(liquidityToSettle) ); if ((amount0 > 0 && amount1 == 0) || (amount1 > 0 && amount0 == 0)) { if (isAmount0 && amount0 > 0 && ac.isSettle == true) { ac.assetToUse.approve(address(positionManager), amount0); ac.totalAssetRelocked += amount0; } else if (!isAmount0 && amount1 > 0 && ac.isSettle == true) { ac.assetToUse.approve(address(positionManager), amount1); ac.totalAssetRelocked += amount1; } else { uint256 amountToSwap = isAmount0 ? LiquidityAmounts.getAmount0ForLiquidity( opTick.tickLower.getSqrtRatioAtTick(), opTick.tickUpper.getSqrtRatioAtTick(), uint128(liquidityToSettle) ) : LiquidityAmounts.getAmount1ForLiquidity( opTick.tickLower.getSqrtRatioAtTick(), opTick.tickUpper.getSqrtRatioAtTick(), uint128(liquidityToSettle) ); ac.totalAssetRelocked += amountToSwap; uint256 prevBalance = ac.assetToGet.balanceOf(address(this)); ac.assetToUse.transfer(address(_params.swapper[i]), amountToSwap); _params.swapper[i].onSwapReceived( address(ac.assetToUse), address(ac.assetToGet), amountToSwap, _params.swapData[i] ); uint256 amountReq = isAmount0 ? LiquidityAmounts.getAmount1ForLiquidity( opTick.tickLower.getSqrtRatioAtTick(), opTick.tickUpper.getSqrtRatioAtTick(), uint128(liquidityToSettle) ) : LiquidityAmounts.getAmount0ForLiquidity( opTick.tickLower.getSqrtRatioAtTick(), opTick.tickUpper.getSqrtRatioAtTick(), uint128(liquidityToSettle) ); uint256 currentBalance = ac.assetToGet.balanceOf(address(this)); if (currentBalance < prevBalance + amountReq) { revert NotEnoughAfterSwap(); } ac.assetToGet.approve(address(positionManager), amountReq); ac.totalProfit += currentBalance - (prevBalance + amountReq); } } else { if (isAmount0 && ac.isSettle == true) { ac.assetToUse.approve(address(positionManager), amount0); ac.assetToGet.approve(address(positionManager), amount1); uint256 actualAmount0 = LiquidityAmounts.getAmount0ForLiquidity( opTick.tickLower.getSqrtRatioAtTick(), opTick.tickUpper.getSqrtRatioAtTick(), uint128(liquidityToSettle) ); ac.assetToGet.transferFrom(msg.sender, address(this), amount1); ac.assetToUse.transfer(msg.sender, actualAmount0 - amount0); } else if (!isAmount0 && ac.isSettle == true) { ac.assetToUse.approve(address(positionManager), amount1); ac.assetToGet.approve(address(positionManager), amount0); uint256 actualAmount1 = LiquidityAmounts.getAmount1ForLiquidity( opTick.tickLower.getSqrtRatioAtTick(), opTick.tickUpper.getSqrtRatioAtTick(), uint128(liquidityToSettle) ); ac.assetToGet.transferFrom(msg.sender, address(this), amount0); ac.assetToUse.transfer(msg.sender, actualAmount1 - amount1); } } bytes memory unusePositionData = abi.encode( opTick.pool, opTick.hook, opTick.tickLower, opTick.tickUpper, liquidityToSettle, abi.encode("") ); positionManager.unusePosition(opTick._handler, unusePositionData); if (ac.totalProfit > 0) { ac.assetToGet.transfer(msg.sender, ac.totalProfit); } opTick.liquidityToUse -= liquidityToSettle; } emit LogSettleOption(ac, _params.liquidityToSettle, ownerOf(_params.optionId), _params.optionId); } /// @notice Splits a position into a new option /// @param _params The position splitter parameters function positionSplitter(PositionSplitterParams calldata _params) external nonReentrant { optionIds += 1; if (ownerOf(_params.optionId) != msg.sender) { revert NotOwnerOrDelegator(); } OptionData memory oData = opData[_params.optionId]; if (oData.opTickArrayLen != _params.liquidityToSplit.length) { revert ArrayLenMismatch(); } if (oData.expiry < block.timestamp) { revert Expired(); } for (uint256 i; i < _params.liquidityToSplit.length; i++) { OptionTicks storage opTick = opTickMap[_params.optionId][i]; opTick.liquidityToUse -= _params.liquidityToSplit[i]; opTickMap[optionIds].push( OptionTicks({ _handler: opTick._handler, pool: opTick.pool, hook: opTick.hook, tickLower: opTick.tickLower, tickUpper: opTick.tickUpper, liquidityToUse: _params.liquidityToSplit[i] }) ); } opData[optionIds] = OptionData({ opTickArrayLen: _params.liquidityToSplit.length, tickLower: oData.tickLower, tickUpper: oData.tickUpper, expiry: oData.expiry, isCall: oData.isCall }); _safeMint(_params.to, optionIds); emit LogSplitOption(_params, optionIds, ownerOf(_params.optionId)); } /// @notice Updates the exercise delegate for the caller /// @param _delegateTo The address to delegate to /// @param _status The delegation status function updateExerciseDelegate(address _delegateTo, bool _status) external { exerciseDelegator[msg.sender][_delegateTo] = _status; emit LogUpdateExerciseDelegate(msg.sender, _delegateTo, _status); } /// @notice Gets the price per call asset via a specific tick /// @param _pool The Uniswap V3 pool /// @param _tick The tick to get the price for /// @return uint256 The price per call asset function getPricePerCallAssetViaTick(IUniswapV3Pool _pool, int24 _tick) public view returns (uint256) { uint160 sqrtPriceX96 = TickMath.getSqrtRatioAtTick(_tick); return _getPrice(_pool, sqrtPriceX96); } /// @notice Gets the premium amount for an option /// @param hook The hook address /// @param isPut Whether the option is a put /// @param expiry The expiry timestamp /// @param strike The strike price /// @param lastPrice The last price /// @param amount The option amount /// @return uint256 The premium amount function getPremiumAmount( address hook, bool isPut, uint256 expiry, uint256 ttl, uint256 strike, uint256 lastPrice, uint256 amount ) external view returns (uint256) { return _getPremiumAmount(hook, isPut, expiry, ttl, strike, lastPrice, amount); } /// @notice Gets the current sqrt price X96 /// @param pool The Uniswap V3 pool /// @return sqrtPriceX96 The current sqrt price X96 function _getCurrentSqrtPriceX96(IUniswapV3Pool pool) internal view returns (uint160 sqrtPriceX96) { (, bytes memory result) = address(pool).staticcall(abi.encodeWithSignature("slot0()")); sqrtPriceX96 = abi.decode(result, (uint160)); } /// @notice Internal function to get the premium amount /// @param hook The hook address /// @param isPut Whether the option is a put /// @param expiry The expiry timestamp /// @param strike The strike price /// @param lastPrice The last price /// @param amount The option amount /// @return premiumAmount The premium amount function _getPremiumAmount( address hook, bool isPut, uint256 expiry, uint256 ttl, uint256 strike, uint256 lastPrice, uint256 amount ) internal view returns (uint256 premiumAmount) { uint256 premiumInQuote = (amount * optionPricing.getOptionPrice(hook, isPut, expiry, ttl, strike, lastPrice)) / (isPut ? 10 ** putAssetDecimals : 10 ** callAssetDecimals); if (isPut) { return premiumInQuote; } return (premiumInQuote * (10 ** callAssetDecimals)) / lastPrice; } /// @notice Internal function to get the price /// @param _pool The Uniswap V3 pool /// @param sqrtPriceX96 The sqrt price X96 /// @return price The calculated price function _getPrice(IUniswapV3Pool _pool, uint160 sqrtPriceX96) internal view returns (uint256 price) { if (sqrtPriceX96 <= type(uint128).max) { uint256 priceX192 = uint256(sqrtPriceX96) * sqrtPriceX96; price = callAsset == _pool.token0() ? FullMath.mulDiv(priceX192, 10 ** callAssetDecimals, 1 << 192) : FullMath.mulDiv(1 << 192, 10 ** callAssetDecimals, priceX192); } else { uint256 priceX128 = FullMath.mulDiv(sqrtPriceX96, sqrtPriceX96, 1 << 64); price = callAsset == _pool.token0() ? FullMath.mulDiv(priceX128, 10 ** callAssetDecimals, 1 << 128) : FullMath.mulDiv(1 << 128, 10 ** callAssetDecimals, priceX128); } } /// @notice Gets the fee for a given amount and premium /// @param amount The option amount /// @param premium The option premium /// @return uint256 The calculated fee function getFee(uint256 amount, uint256 premium) public view returns (uint256) { return dpFee.onFeeReqReceive(address(this), amount, premium); } /// @notice Updates pool approvals and settings /// @param _settler The settler address /// @param _statusSettler The settler status /// @param _pool The pool address /// @param _statusPools The pool status /// @param _ttl The time-to-live /// @param _ttlStartTime The start time for the TTL /// @param ttlStatus The TTL status /// @param _BUFFER_TIME The buffer time function updatePoolApporvals( address _settler, bool _statusSettler, address _pool, bool _statusPools, uint256 _ttl, uint256 _ttlStartTime, bool ttlStatus, uint256 _BUFFER_TIME ) external onlyOwner { settlers[_settler] = _statusSettler; approvedPools[_pool] = _statusPools; approvedTTLs[_ttl] = ttlStatus; BUFFER_TIME = _BUFFER_TIME; if (_ttlStartTime == 0) revert TTLNotSet(); ttlStartTime[_ttl] = _ttlStartTime; IUniswapV3Pool pool = IUniswapV3Pool(_pool); if (pool.token0() != callAsset && pool.token1() != callAsset) { revert InvalidPool(); } if (pool.token0() != putAsset && pool.token1() != putAsset) { revert InvalidPool(); } emit LogUpdatePoolApprovals( _settler, _statusSettler, _pool, _statusPools, _ttl, _ttlStartTime, ttlStatus, _BUFFER_TIME ); } /// @notice Updates pool settings /// @param _feeTo The fee recipient address /// @param _tokenURIFetcher The token URI fetcher address /// @param _dpFee The fee strategy address /// @param _optionPricing The option pricing address /// @param _verifiedSpotPrice The verified spot price address function updatePoolSettings( address _feeTo, address _tokenURIFetcher, address _dpFee, address _optionPricing, address _verifiedSpotPrice ) external onlyOwner { feeTo = _feeTo; tokenURIFetcher = _tokenURIFetcher; dpFee = IClammFeeStrategyV2(_dpFee); optionPricing = IOptionPricingV2(_optionPricing); verifiedSpotPrice = IVerifiedSpotPrice(_verifiedSpotPrice); emit LogUpdatePoolSettings(_feeTo, _tokenURIFetcher, _dpFee, _optionPricing); } /// @notice Emergency withdraw function /// @param token The token address to withdraw function emergencyWithdraw(address token) external onlyOwner { ERC20(token).transfer(msg.sender, ERC20(token).balanceOf(address(this))); } }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0 <0.9.0; import {IHandler} from "./IHandler.sol"; interface IPositionManager { function mintPosition(IHandler _handler, bytes calldata _mintPositionData) external returns (uint256 sharesMinted); function burnPosition(IHandler _handler, bytes calldata _burnPositionData) external returns (uint256 sharesBurned); function usePosition(IHandler _handler, bytes calldata _usePositionData) external returns (address[] memory tokens, uint256[] memory amounts, uint256 liquidityUsed); function unusePosition(IHandler _handler, bytes calldata _unusePositionData) external returns (uint256[] memory amounts, uint256 liquidity); function donateToPosition(IHandler _handler, bytes calldata _donatePosition) external returns (uint256[] memory amounts, uint256 liquidity); function wildcard(IHandler _handler, bytes calldata _wildcardData) external returns (bytes memory wildcardRetData); function sweepTokens(address _token, uint256 _amount) external; function updateWhitelistHandlerWithApp(address _handler, address _app, bool _status) external; function updateWhitelistHandler(address _handler, bool _status) external; function whitelistedHandlersWithApp(bytes32) external view returns (bool); function whitelistedHandlers(address) external view returns (bool); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; interface IOptionPricingV2 { function getOptionPrice(address hook, bool isPut, uint256 expiry, uint256 ttl, uint256 strike, uint256 lastPrice) external view returns (uint256); }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0 <0.9.0; interface IHandler { struct HookPermInfo { bool onMint; bool onBurn; bool onUse; bool onUnuse; bool onDonate; bool allowSplit; } function registerHook(address _hook, HookPermInfo memory _info) external; function getHandlerIdentifier(bytes calldata _data) external view returns (uint256 handlerIdentifierId); function tokensToPullForMint(bytes calldata _mintPositionData) external view returns (address[] memory tokens, uint256[] memory amounts); function mintPositionHandler(address context, bytes calldata _mintPositionData) external returns (uint256 sharesMinted); function burnPositionHandler(address context, bytes calldata _burnPositionData) external returns (uint256 sharesBurned); function usePositionHandler(bytes calldata _usePositionData) external returns (address[] memory tokens, uint256[] memory amounts, uint256 liquidityUsed); function wildcardHandler(address context, bytes calldata _wildcardData) external returns (bytes memory wildcardRetData); function tokensToPullForUnUse(bytes calldata _unusePositionData) external view returns (address[] memory tokens, uint256[] memory amounts); function unusePositionHandler(bytes calldata _unusePositionData) external returns (uint256[] memory amounts, uint256 liquidity); function donateToPosition(bytes calldata _donatePosition) external returns (uint256[] memory amounts, uint256 liquidity); function tokensToPullForDonate(bytes calldata _donatePosition) external view returns (address[] memory tokens, uint256[] memory amounts); function tokensToPullForWildcard(bytes calldata _wildcardData) external view returns (address[] memory tokens, uint256[] memory amounts); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; interface IClammFeeStrategyV2 { /// @notice Computes the fee for an option purchase on CLAMM /// @param _optionMarket Address of the option market /// @param _amount Notional Amount /// @param _premium Total premium being charged for the option purchase /// @return fee the computed fee function onFeeReqReceive(address _optionMarket, uint256 _amount, uint256 _premium) external view returns (uint256 fee); }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0 <0.9.0; interface ISwapper { function onSwapReceived(address _tokenIn, address _tokenOut, uint256 _amountIn, bytes calldata _swapData) external returns (uint256 amountOut); }
// SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.13; interface ITokenURIFetcher { function onFetchTokenURIData(uint256 id) external view returns (string memory); }
// SPDX-License-Identifier: UNLICENSED pragma solidity >=0.8.0 <0.9.0; import {IUniswapV3Pool} from "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; interface IVerifiedSpotPrice { function getSpotPrice(IUniswapV3Pool pool, address callAsset, uint8 callAssetDecimals) external view returns (uint256); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0 <0.9.0; /// @notice Simple ERC721 implementation with storage hitchhiking. /// @author Solady (https://github.com/vectorized/solady/blob/main/src/tokens/ERC721.sol) /// @author Modified from Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC721.sol) /// @author Modified from OpenZeppelin (https://github.com/OpenZeppelin/openzeppelin-contracts/tree/master/contracts/token/ERC721/ERC721.sol) /// /// @dev Note: /// - The ERC721 standard allows for self-approvals. /// For performance, this implementation WILL NOT revert for such actions. /// Please add any checks with overrides if desired. /// - For performance, methods are made payable where permitted by the ERC721 standard. /// - The `safeTransfer` functions use the identity precompile (0x4) /// to copy memory internally. /// /// If you are overriding: /// - NEVER violate the ERC721 invariant: /// the balance of an owner MUST always be equal to their number of ownership slots. /// The transfer functions do not have an underflow guard for user token balances. /// - Make sure all variables written to storage are properly cleaned // (e.g. the bool value for `isApprovedForAll` MUST be either 1 or 0 under the hood). /// - Check that the overridden function is actually used in the function you want to /// change the behavior of. Much of the code has been manually inlined for performance. abstract contract ERC721 { /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CONSTANTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev An account can hold up to 4294967295 tokens. uint256 internal constant _MAX_ACCOUNT_BALANCE = 0xffffffff; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* CUSTOM ERRORS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Only the token owner or an approved account can manage the token. error NotOwnerNorApproved(); /// @dev The token does not exist. error TokenDoesNotExist(); /// @dev The token already exists. error TokenAlreadyExists(); /// @dev Cannot query the balance for the zero address. error BalanceQueryForZeroAddress(); /// @dev Cannot mint or transfer to the zero address. error TransferToZeroAddress(); /// @dev The token must be owned by `from`. error TransferFromIncorrectOwner(); /// @dev The recipient's balance has overflowed. error AccountBalanceOverflow(); /// @dev Cannot safely transfer to a contract that does not implement /// the ERC721Receiver interface. error TransferToNonERC721ReceiverImplementer(); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* EVENTS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Emitted when token `id` is transferred from `from` to `to`. event Transfer(address indexed from, address indexed to, uint256 indexed id); /// @dev Emitted when `owner` enables `account` to manage the `id` token. event Approval(address indexed owner, address indexed account, uint256 indexed id); /// @dev Emitted when `owner` enables or disables `operator` to manage all of their tokens. event ApprovalForAll(address indexed owner, address indexed operator, bool isApproved); /// @dev `keccak256(bytes("Transfer(address,address,uint256)"))`. uint256 private constant _TRANSFER_EVENT_SIGNATURE = 0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef; /// @dev `keccak256(bytes("Approval(address,address,uint256)"))`. uint256 private constant _APPROVAL_EVENT_SIGNATURE = 0x8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925; /// @dev `keccak256(bytes("ApprovalForAll(address,address,bool)"))`. uint256 private constant _APPROVAL_FOR_ALL_EVENT_SIGNATURE = 0x17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c31; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* STORAGE */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev The ownership data slot of `id` is given by: /// ``` /// mstore(0x00, id) /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) /// let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) /// ``` /// Bits Layout: /// - [0..159] `addr` /// - [160..255] `extraData` /// /// The approved address slot is given by: `add(1, ownershipSlot)`. /// /// See: https://notes.ethereum.org/%40vbuterin/verkle_tree_eip /// /// The balance slot of `owner` is given by: /// ``` /// mstore(0x1c, _ERC721_MASTER_SLOT_SEED) /// mstore(0x00, owner) /// let balanceSlot := keccak256(0x0c, 0x1c) /// ``` /// Bits Layout: /// - [0..31] `balance` /// - [32..255] `aux` /// /// The `operator` approval slot of `owner` is given by: /// ``` /// mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) /// mstore(0x00, owner) /// let operatorApprovalSlot := keccak256(0x0c, 0x30) /// ``` uint256 private constant _ERC721_MASTER_SLOT_SEED = 0x7d8825530a5a2e7a << 192; /// @dev Pre-shifted and pre-masked constant. uint256 private constant _ERC721_MASTER_SLOT_SEED_MASKED = 0x0a5a2e7a00000000; /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC721 METADATA */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the token collection name. function name() public view virtual returns (string memory); /// @dev Returns the token collection symbol. function symbol() public view virtual returns (string memory); /// @dev Returns the Uniform Resource Identifier (URI) for token `id`. function tokenURI(uint256 id) public view virtual returns (string memory); /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* ERC721 */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns the owner of token `id`. /// /// Requirements: /// - Token `id` must exist. function ownerOf(uint256 id) public view virtual returns (address result) { result = _ownerOf(id); /// @solidity memory-safe-assembly assembly { if iszero(result) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } } } /// @dev Returns the number of tokens owned by `owner`. /// /// Requirements: /// - `owner` must not be the zero address. function balanceOf(address owner) public view virtual returns (uint256 result) { /// @solidity memory-safe-assembly assembly { // Revert if the `owner` is the zero address. if iszero(owner) { mstore(0x00, 0x8f4eb604) // `BalanceQueryForZeroAddress()`. revert(0x1c, 0x04) } mstore(0x1c, _ERC721_MASTER_SLOT_SEED) mstore(0x00, owner) result := and(sload(keccak256(0x0c, 0x1c)), _MAX_ACCOUNT_BALANCE) } } /// @dev Returns the account approved to manage token `id`. /// /// Requirements: /// - Token `id` must exist. function getApproved(uint256 id) public view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) if iszero(shl(96, sload(ownershipSlot))) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } result := sload(add(1, ownershipSlot)) } } /// @dev Sets `account` as the approved account to manage token `id`. /// /// Requirements: /// - Token `id` must exist. /// - The caller must be the owner of the token, /// or an approved operator for the token owner. /// /// Emits an {Approval} event. function approve(address account, uint256 id) public payable virtual { _approve(msg.sender, account, id); } /// @dev Returns whether `operator` is approved to manage the tokens of `owner`. function isApprovedForAll(address owner, address operator) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { mstore(0x1c, operator) mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) mstore(0x00, owner) result := sload(keccak256(0x0c, 0x30)) } } /// @dev Sets whether `operator` is approved to manage the tokens of the caller. /// /// Emits an {ApprovalForAll} event. function setApprovalForAll(address operator, bool isApproved) public virtual { /// @solidity memory-safe-assembly assembly { // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) // Update the `isApproved` for (`msg.sender`, `operator`). mstore(0x1c, operator) mstore(0x08, _ERC721_MASTER_SLOT_SEED_MASKED) mstore(0x00, caller()) sstore(keccak256(0x0c, 0x30), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) // forgefmt: disable-next-item log3( 0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, caller(), shr(96, shl(96, operator)) ) } } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function transferFrom(address from, address to, uint256 id) public payable virtual { _beforeTokenTransfer(from, to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. let bitmaskAddress := shr(96, not(0)) from := and(bitmaskAddress, from) to := and(bitmaskAddress, to) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, caller())) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) let owner := and(bitmaskAddress, ownershipPacked) // Revert if `from` is not the owner, or does not exist. if iszero(mul(owner, eq(owner, from))) { if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } mstore(0x00, 0xa1148100) // `TransferFromIncorrectOwner()`. revert(0x1c, 0x04) } // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Load, check, and update the token approval. { mstore(0x00, from) let approvedAddress := sload(add(1, ownershipSlot)) // Revert if the caller is not the owner, nor approved. if iszero(or(eq(caller(), from), eq(caller(), approvedAddress))) { if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Delete the approved address if any. if approvedAddress { sstore(add(1, ownershipSlot), 0) } } // Update with the new owner. sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) // Decrement the balance of `from`. { let fromBalanceSlot := keccak256(0x0c, 0x1c) sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) } // Increment the balance of `to`. { mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x1c) let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceSlotPacked) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) } _afterTokenTransfer(from, to, id); } /// @dev Equivalent to `safeTransferFrom(from, to, id, "")`. function safeTransferFrom(address from, address to, uint256 id) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// - 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 id, bytes calldata data) public payable virtual { transferFrom(from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /// @dev Returns true if this contract implements the interface defined by `interfaceId`. /// See: https://eips.ethereum.org/EIPS/eip-165 /// This function call must use less than 30000 gas. function supportsInterface(bytes4 interfaceId) public view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { let s := shr(224, interfaceId) // ERC165: 0x01ffc9a7, ERC721: 0x80ac58cd, ERC721Metadata: 0x5b5e139f. result := or(or(eq(s, 0x01ffc9a7), eq(s, 0x80ac58cd)), eq(s, 0x5b5e139f)) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL QUERY FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns if token `id` exists. function _exists(uint256 id) internal view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := iszero(iszero(shl(96, sload(add(id, add(id, keccak256(0x00, 0x20))))))) } } /// @dev Returns the owner of token `id`. /// Returns the zero address instead of reverting if the token does not exist. function _ownerOf(uint256 id) internal view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := shr(96, shl(96, sload(add(id, add(id, keccak256(0x00, 0x20)))))) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL DATA HITCHHIKING FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ // For performance, no events are emitted for the hitchhiking setters. // Please emit your own events if required. /// @dev Returns the auxiliary data for `owner`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _getAux(address owner) internal view virtual returns (uint224 result) { /// @solidity memory-safe-assembly assembly { mstore(0x1c, _ERC721_MASTER_SLOT_SEED) mstore(0x00, owner) result := shr(32, sload(keccak256(0x0c, 0x1c))) } } /// @dev Set the auxiliary data for `owner` to `value`. /// Minting, transferring, burning the tokens of `owner` will not change the auxiliary data. /// Auxiliary data can be set for any address, even if it does not have any tokens. function _setAux(address owner, uint224 value) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x1c, _ERC721_MASTER_SLOT_SEED) mstore(0x00, owner) let balanceSlot := keccak256(0x0c, 0x1c) let packed := sload(balanceSlot) sstore(balanceSlot, xor(packed, shl(32, xor(value, shr(32, packed))))) } } /// @dev Returns the extra data for token `id`. /// Minting, transferring, burning a token will not change the extra data. /// The extra data can be set on a non-existent token. function _getExtraData(uint256 id) internal view virtual returns (uint96 result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := shr(160, sload(add(id, add(id, keccak256(0x00, 0x20))))) } } /// @dev Sets the extra data for token `id` to `value`. /// Minting, transferring, burning a token will not change the extra data. /// The extra data can be set on a non-existent token. function _setExtraData(uint256 id, uint96 value) internal virtual { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let packed := sload(ownershipSlot) sstore(ownershipSlot, xor(packed, shl(160, xor(value, shr(160, packed))))) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL MINT FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Mints token `id` to `to`. /// /// Requirements: /// /// - Token `id` must not exist. /// - `to` cannot be the zero address. /// /// Emits a {Transfer} event. function _mint(address to, uint256 id) internal virtual { _beforeTokenTransfer(address(0), to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. to := shr(96, shl(96, to)) // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Load the ownership data. mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) // Revert if the token already exists. if shl(96, ownershipPacked) { mstore(0x00, 0xc991cbb1) // `TokenAlreadyExists()`. revert(0x1c, 0x04) } // Update with the owner. sstore(ownershipSlot, or(ownershipPacked, to)) // Increment the balance of the owner. { mstore(0x00, to) let balanceSlot := keccak256(0x0c, 0x1c) let balanceSlotPacked := add(sload(balanceSlot), 1) if iszero(and(balanceSlotPacked, _MAX_ACCOUNT_BALANCE)) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(balanceSlot, balanceSlotPacked) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, 0, to, id) } _afterTokenTransfer(address(0), to, id); } /// @dev Equivalent to `_safeMint(to, id, "")`. function _safeMint(address to, uint256 id) internal virtual { _safeMint(to, id, ""); } /// @dev Mints token `id` to `to`. /// /// Requirements: /// /// - Token `id` must not exist. /// - `to` cannot be the zero address. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function _safeMint(address to, uint256 id, bytes memory data) internal virtual { _mint(to, id); if (_hasCode(to)) _checkOnERC721Received(address(0), to, id, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL BURN FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_burn(address(0), id)`. function _burn(uint256 id) internal virtual { _burn(address(0), id); } /// @dev Destroys token `id`, using `by`. /// /// Requirements: /// /// - Token `id` must exist. /// - If `by` is not the zero address, /// it must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _burn(address by, uint256 id) internal virtual { address owner = ownerOf(id); _beforeTokenTransfer(owner, address(0), id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. by := shr(96, shl(96, by)) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) // Reload the owner in case it is changed in `_beforeTokenTransfer`. owner := shr(96, shl(96, ownershipPacked)) // Revert if the token does not exist. if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } // Load and check the token approval. { mstore(0x00, owner) let approvedAddress := sload(add(1, ownershipSlot)) // If `by` is not the zero address, do the authorization check. // Revert if the `by` is not the owner, nor approved. if iszero(or(iszero(by), or(eq(by, owner), eq(by, approvedAddress)))) { if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Delete the approved address if any. if approvedAddress { sstore(add(1, ownershipSlot), 0) } } // Clear the owner. sstore(ownershipSlot, xor(ownershipPacked, owner)) // Decrement the balance of `owner`. { let balanceSlot := keccak256(0x0c, 0x1c) sstore(balanceSlot, sub(sload(balanceSlot), 1)) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, owner, 0, id) } _afterTokenTransfer(owner, address(0), id); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL APPROVAL FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns whether `account` is the owner of token `id`, or is approved to manage it. /// /// Requirements: /// - Token `id` must exist. function _isApprovedOrOwner(address account, uint256 id) internal view virtual returns (bool result) { /// @solidity memory-safe-assembly assembly { result := 1 // Clear the upper 96 bits. account := shr(96, shl(96, account)) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, account)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let owner := shr(96, shl(96, sload(ownershipSlot))) // Revert if the token does not exist. if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } // Check if `account` is the `owner`. if iszero(eq(account, owner)) { mstore(0x00, owner) // Check if `account` is approved to manage the token. if iszero(sload(keccak256(0x0c, 0x30))) { result := eq(account, sload(add(1, ownershipSlot))) } } } } /// @dev Returns the account approved to manage token `id`. /// Returns the zero address instead of reverting if the token does not exist. function _getApproved(uint256 id) internal view virtual returns (address result) { /// @solidity memory-safe-assembly assembly { mstore(0x00, id) mstore(0x1c, _ERC721_MASTER_SLOT_SEED) result := sload(add(1, add(id, add(id, keccak256(0x00, 0x20))))) } } /// @dev Equivalent to `_approve(address(0), account, id)`. function _approve(address account, uint256 id) internal virtual { _approve(address(0), account, id); } /// @dev Sets `account` as the approved account to manage token `id`, using `by`. /// /// Requirements: /// - Token `id` must exist. /// - If `by` is not the zero address, `by` must be the owner /// or an approved operator for the token owner. /// /// Emits a {Transfer} event. function _approve(address by, address account, uint256 id) internal virtual { assembly { // Clear the upper 96 bits. let bitmaskAddress := shr(96, not(0)) account := and(bitmaskAddress, account) by := and(bitmaskAddress, by) // Load the owner of the token. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let owner := and(bitmaskAddress, sload(ownershipSlot)) // Revert if the token does not exist. if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } // If `by` is not the zero address, do the authorization check. // Revert if `by` is not the owner, nor approved. if iszero(or(iszero(by), eq(by, owner))) { mstore(0x00, owner) if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Sets `account` as the approved account to manage `id`. sstore(add(1, ownershipSlot), account) // Emit the {Approval} event. log4(codesize(), 0x00, _APPROVAL_EVENT_SIGNATURE, owner, account, id) } } /// @dev Approve or remove the `operator` as an operator for `by`, /// without authorization checks. /// /// Emits an {ApprovalForAll} event. function _setApprovalForAll(address by, address operator, bool isApproved) internal virtual { /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. by := shr(96, shl(96, by)) operator := shr(96, shl(96, operator)) // Convert to 0 or 1. isApproved := iszero(iszero(isApproved)) // Update the `isApproved` for (`by`, `operator`). mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, operator)) mstore(0x00, by) sstore(keccak256(0x0c, 0x30), isApproved) // Emit the {ApprovalForAll} event. mstore(0x00, isApproved) log3(0x00, 0x20, _APPROVAL_FOR_ALL_EVENT_SIGNATURE, by, operator) } } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* INTERNAL TRANSFER FUNCTIONS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Equivalent to `_transfer(address(0), from, to, id)`. function _transfer(address from, address to, uint256 id) internal virtual { _transfer(address(0), from, to, id); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - If `by` is not the zero address, /// it must be the owner of the token, or be approved to manage the token. /// /// Emits a {Transfer} event. function _transfer(address by, address from, address to, uint256 id) internal virtual { _beforeTokenTransfer(from, to, id); /// @solidity memory-safe-assembly assembly { // Clear the upper 96 bits. let bitmaskAddress := shr(96, not(0)) from := and(bitmaskAddress, from) to := and(bitmaskAddress, to) by := and(bitmaskAddress, by) // Load the ownership data. mstore(0x00, id) mstore(0x1c, or(_ERC721_MASTER_SLOT_SEED, by)) let ownershipSlot := add(id, add(id, keccak256(0x00, 0x20))) let ownershipPacked := sload(ownershipSlot) let owner := and(bitmaskAddress, ownershipPacked) // Revert if `from` is not the owner, or does not exist. if iszero(mul(owner, eq(owner, from))) { if iszero(owner) { mstore(0x00, 0xceea21b6) // `TokenDoesNotExist()`. revert(0x1c, 0x04) } mstore(0x00, 0xa1148100) // `TransferFromIncorrectOwner()`. revert(0x1c, 0x04) } // Revert if `to` is the zero address. if iszero(to) { mstore(0x00, 0xea553b34) // `TransferToZeroAddress()`. revert(0x1c, 0x04) } // Load, check, and update the token approval. { mstore(0x00, from) let approvedAddress := sload(add(1, ownershipSlot)) // If `by` is not the zero address, do the authorization check. // Revert if the `by` is not the owner, nor approved. if iszero(or(iszero(by), or(eq(by, from), eq(by, approvedAddress)))) { if iszero(sload(keccak256(0x0c, 0x30))) { mstore(0x00, 0x4b6e7f18) // `NotOwnerNorApproved()`. revert(0x1c, 0x04) } } // Delete the approved address if any. if approvedAddress { sstore(add(1, ownershipSlot), 0) } } // Update with the new owner. sstore(ownershipSlot, xor(ownershipPacked, xor(from, to))) // Decrement the balance of `from`. { let fromBalanceSlot := keccak256(0x0c, 0x1c) sstore(fromBalanceSlot, sub(sload(fromBalanceSlot), 1)) } // Increment the balance of `to`. { mstore(0x00, to) let toBalanceSlot := keccak256(0x0c, 0x1c) let toBalanceSlotPacked := add(sload(toBalanceSlot), 1) if iszero(and(toBalanceSlotPacked, _MAX_ACCOUNT_BALANCE)) { mstore(0x00, 0x01336cea) // `AccountBalanceOverflow()`. revert(0x1c, 0x04) } sstore(toBalanceSlot, toBalanceSlotPacked) } // Emit the {Transfer} event. log4(codesize(), 0x00, _TRANSFER_EVENT_SIGNATURE, from, to, id) } _afterTokenTransfer(from, to, id); } /// @dev Equivalent to `_safeTransfer(from, to, id, "")`. function _safeTransfer(address from, address to, uint256 id) internal virtual { _safeTransfer(from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - The caller must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function _safeTransfer(address from, address to, uint256 id, bytes memory data) internal virtual { _transfer(address(0), from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /// @dev Equivalent to `_safeTransfer(by, from, to, id, "")`. function _safeTransfer(address by, address from, address to, uint256 id) internal virtual { _safeTransfer(by, from, to, id, ""); } /// @dev Transfers token `id` from `from` to `to`. /// /// Requirements: /// /// - Token `id` must exist. /// - `from` must be the owner of the token. /// - `to` cannot be the zero address. /// - If `by` is not the zero address, /// it must be the owner of the token, or be approved to manage the token. /// - If `to` refers to a smart contract, it must implement /// {IERC721Receiver-onERC721Received}, which is called upon a safe transfer. /// /// Emits a {Transfer} event. function _safeTransfer(address by, address from, address to, uint256 id, bytes memory data) internal virtual { _transfer(by, from, to, id); if (_hasCode(to)) _checkOnERC721Received(from, to, id, data); } /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* HOOKS FOR OVERRIDING */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Hook that is called before any token transfers, including minting and burning. function _beforeTokenTransfer(address from, address to, uint256 id) internal virtual {} /// @dev Hook that is called after any token transfers, including minting and burning. function _afterTokenTransfer(address from, address to, uint256 id) internal virtual {} /*´:°•.°+.*•´.*:˚.°*.˚•´.°:°•.°•.*•´.*:˚.°*.˚•´.°:°•.°+.*•´.*:*/ /* PRIVATE HELPERS */ /*.•°:°.´+˚.*°.˚:*.´•*.+°.•°:´*.´•*.•°.•°:°.´:•˚°.*°.˚:*.´+°.•*/ /// @dev Returns if `a` has bytecode of non-zero length. function _hasCode(address a) private view returns (bool result) { /// @solidity memory-safe-assembly assembly { result := extcodesize(a) // Can handle dirty upper bits. } } /// @dev Perform a call to invoke {IERC721Receiver-onERC721Received} on `to`. /// Reverts if the target does not support the function correctly. function _checkOnERC721Received(address from, address to, uint256 id, bytes memory data) private { /// @solidity memory-safe-assembly assembly { // Prepare the calldata. let m := mload(0x40) let onERC721ReceivedSelector := 0x150b7a02 mstore(m, onERC721ReceivedSelector) mstore(add(m, 0x20), caller()) // The `operator`, which is always `msg.sender`. mstore(add(m, 0x40), shr(96, shl(96, from))) mstore(add(m, 0x60), id) mstore(add(m, 0x80), 0x80) let n := mload(data) mstore(add(m, 0xa0), n) if n { pop(staticcall(gas(), 4, add(data, 0x20), n, add(m, 0xc0), n)) } // Revert if the call reverts. if iszero(call(gas(), to, 0, add(m, 0x1c), add(n, 0xa4), m, 0x20)) { if returndatasize() { // Bubble up the revert if the call reverts. returndatacopy(m, 0x00, returndatasize()) revert(m, returndatasize()) } } // Load the returndata and compare it. if iszero(eq(mload(m), shl(224, onERC721ReceivedSelector))) { mstore(0x00, 0xd1a57ed6) // `TransferToNonERC721ReceiverImplementer()`. revert(0x1c, 0x04) } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC20Metadata} from "./extensions/IERC20Metadata.sol"; import {Context} from "../../utils/Context.sol"; import {IERC20Errors} from "../../interfaces/draft-IERC6093.sol"; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. */ abstract contract ERC20 is Context, IERC20, IERC20Metadata, IERC20Errors { mapping(address account => uint256) private _balances; mapping(address account => mapping(address spender => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `value`. */ function transfer(address to, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _transfer(owner, to, value); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `value` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 value) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, value); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `value`. * - the caller must have allowance for ``from``'s tokens of at least * `value`. */ function transferFrom(address from, address to, uint256 value) public virtual returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, value); _transfer(from, to, value); return true; } /** * @dev Moves a `value` amount of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _transfer(address from, address to, uint256 value) internal { if (from == address(0)) { revert ERC20InvalidSender(address(0)); } if (to == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(from, to, value); } /** * @dev Transfers a `value` amount of tokens from `from` to `to`, or alternatively mints (or burns) if `from` * (or `to`) is the zero address. All customizations to transfers, mints, and burns should be done by overriding * this function. * * Emits a {Transfer} event. */ function _update(address from, address to, uint256 value) internal virtual { if (from == address(0)) { // Overflow check required: The rest of the code assumes that totalSupply never overflows _totalSupply += value; } else { uint256 fromBalance = _balances[from]; if (fromBalance < value) { revert ERC20InsufficientBalance(from, fromBalance, value); } unchecked { // Overflow not possible: value <= fromBalance <= totalSupply. _balances[from] = fromBalance - value; } } if (to == address(0)) { unchecked { // Overflow not possible: value <= totalSupply or value <= fromBalance <= totalSupply. _totalSupply -= value; } } else { unchecked { // Overflow not possible: balance + value is at most totalSupply, which we know fits into a uint256. _balances[to] += value; } } emit Transfer(from, to, value); } /** * @dev Creates a `value` amount of tokens and assigns them to `account`, by transferring it from address(0). * Relies on the `_update` mechanism * * Emits a {Transfer} event with `from` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead. */ function _mint(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidReceiver(address(0)); } _update(address(0), account, value); } /** * @dev Destroys a `value` amount of tokens from `account`, lowering the total supply. * Relies on the `_update` mechanism. * * Emits a {Transfer} event with `to` set to the zero address. * * NOTE: This function is not virtual, {_update} should be overridden instead */ function _burn(address account, uint256 value) internal { if (account == address(0)) { revert ERC20InvalidSender(address(0)); } _update(account, address(0), value); } /** * @dev Sets `value` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. * * Overrides to this logic should be done to the variant with an additional `bool emitEvent` argument. */ function _approve(address owner, address spender, uint256 value) internal { _approve(owner, spender, value, true); } /** * @dev Variant of {_approve} with an optional flag to enable or disable the {Approval} event. * * By default (when calling {_approve}) the flag is set to true. On the other hand, approval changes made by * `_spendAllowance` during the `transferFrom` operation set the flag to false. This saves gas by not emitting any * `Approval` event during `transferFrom` operations. * * Anyone who wishes to continue emitting `Approval` events on the`transferFrom` operation can force the flag to * true using the following override: * ``` * function _approve(address owner, address spender, uint256 value, bool) internal virtual override { * super._approve(owner, spender, value, true); * } * ``` * * Requirements are the same as {_approve}. */ function _approve(address owner, address spender, uint256 value, bool emitEvent) internal virtual { if (owner == address(0)) { revert ERC20InvalidApprover(address(0)); } if (spender == address(0)) { revert ERC20InvalidSpender(address(0)); } _allowances[owner][spender] = value; if (emitEvent) { emit Approval(owner, spender, value); } } /** * @dev Updates `owner` s allowance for `spender` based on spent `value`. * * Does not update the allowance value in case of infinite allowance. * Revert if not enough allowance is available. * * Does not emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 value) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { if (currentAllowance < value) { revert ERC20InsufficientAllowance(spender, currentAllowance, value); } unchecked { _approve(owner, spender, currentAllowance - value, false); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * The initial owner is set to the address provided by the deployer. This can * later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ constructor(address initialOwner) { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol) pragma solidity ^0.8.20; /** * @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; /** * @dev Unauthorized reentrant call. */ error ReentrancyGuardReentrantCall(); 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 if (_status == ENTERED) { revert ReentrancyGuardReentrantCall(); } // 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 v5.0.1) (utils/Multicall.sol) pragma solidity ^0.8.20; import {Address} from "./Address.sol"; import {Context} from "./Context.sol"; /** * @dev Provides a function to batch together multiple calls in a single external call. * * Consider any assumption about calldata validation performed by the sender may be violated if it's not especially * careful about sending transactions invoking {multicall}. For example, a relay address that filters function * selectors won't filter calls nested within a {multicall} operation. * * NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}). * If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data` * to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of * {_msgSender} are not propagated to subcalls. */ abstract contract Multicall is Context { /** * @dev Receives and executes a batch of function calls on this contract. * @custom:oz-upgrades-unsafe-allow-reachable delegatecall */ function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) { bytes memory context = msg.sender == _msgSender() ? new bytes(0) : msg.data[msg.data.length - _contextSuffixLength():]; results = new bytes[](data.length); for (uint256 i = 0; i < data.length; i++) { results[i] = Address.functionDelegateCall(address(this), bytes.concat(data[i], context)); } return results; } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import {IUniswapV3PoolImmutables} from './pool/IUniswapV3PoolImmutables.sol'; import {IUniswapV3PoolState} from './pool/IUniswapV3PoolState.sol'; import {IUniswapV3PoolDerivedState} from './pool/IUniswapV3PoolDerivedState.sol'; import {IUniswapV3PoolActions} from './pool/IUniswapV3PoolActions.sol'; import {IUniswapV3PoolOwnerActions} from './pool/IUniswapV3PoolOwnerActions.sol'; import {IUniswapV3PoolErrors} from './pool/IUniswapV3PoolErrors.sol'; import {IUniswapV3PoolEvents} from './pool/IUniswapV3PoolEvents.sol'; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState, IUniswapV3PoolDerivedState, IUniswapV3PoolActions, IUniswapV3PoolOwnerActions, IUniswapV3PoolErrors, IUniswapV3PoolEvents { }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import '@uniswap/v3-core/contracts/libraries/FullMath.sol'; import '@uniswap/v3-core/contracts/libraries/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); unchecked { 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); unchecked { 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) { unchecked { 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); unchecked { 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.0; /// @title Math library for computing sqrt prices from ticks and vice versa /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports /// prices between 2**-128 and 2**128 library TickMath { error T(); error R(); /// @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) { unchecked { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); if (absTick > uint256(int256(MAX_TICK))) revert 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) { unchecked { // second inequality must be < because the price can never reach the price at the max tick if (!(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO)) revert R(); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.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; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = (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 precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { unchecked { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 value) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 value) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/draft-IERC6093.sol) pragma solidity ^0.8.20; /** * @dev Standard ERC20 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC20 tokens. */ interface IERC20Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientBalance(address sender, uint256 balance, uint256 needed); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC20InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC20InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `spender`’s `allowance`. Used in transfers. * @param spender Address that may be allowed to operate on tokens without being their owner. * @param allowance Amount of tokens a `spender` is allowed to operate with. * @param needed Minimum amount required to perform a transfer. */ error ERC20InsufficientAllowance(address spender, uint256 allowance, uint256 needed); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC20InvalidApprover(address approver); /** * @dev Indicates a failure with the `spender` to be approved. Used in approvals. * @param spender Address that may be allowed to operate on tokens without being their owner. */ error ERC20InvalidSpender(address spender); } /** * @dev Standard ERC721 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC721 tokens. */ interface IERC721Errors { /** * @dev Indicates that an address can't be an owner. For example, `address(0)` is a forbidden owner in EIP-20. * Used in balance queries. * @param owner Address of the current owner of a token. */ error ERC721InvalidOwner(address owner); /** * @dev Indicates a `tokenId` whose `owner` is the zero address. * @param tokenId Identifier number of a token. */ error ERC721NonexistentToken(uint256 tokenId); /** * @dev Indicates an error related to the ownership over a particular token. Used in transfers. * @param sender Address whose tokens are being transferred. * @param tokenId Identifier number of a token. * @param owner Address of the current owner of a token. */ error ERC721IncorrectOwner(address sender, uint256 tokenId, address owner); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC721InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC721InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param tokenId Identifier number of a token. */ error ERC721InsufficientApproval(address operator, uint256 tokenId); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC721InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC721InvalidOperator(address operator); } /** * @dev Standard ERC1155 Errors * Interface of the https://eips.ethereum.org/EIPS/eip-6093[ERC-6093] custom errors for ERC1155 tokens. */ interface IERC1155Errors { /** * @dev Indicates an error related to the current `balance` of a `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. * @param balance Current balance for the interacting account. * @param needed Minimum amount required to perform a transfer. * @param tokenId Identifier number of a token. */ error ERC1155InsufficientBalance(address sender, uint256 balance, uint256 needed, uint256 tokenId); /** * @dev Indicates a failure with the token `sender`. Used in transfers. * @param sender Address whose tokens are being transferred. */ error ERC1155InvalidSender(address sender); /** * @dev Indicates a failure with the token `receiver`. Used in transfers. * @param receiver Address to which tokens are being transferred. */ error ERC1155InvalidReceiver(address receiver); /** * @dev Indicates a failure with the `operator`’s approval. Used in transfers. * @param operator Address that may be allowed to operate on tokens without being their owner. * @param owner Address of the current owner of a token. */ error ERC1155MissingApprovalForAll(address operator, address owner); /** * @dev Indicates a failure with the `approver` of a token to be approved. Used in approvals. * @param approver Address initiating an approval operation. */ error ERC1155InvalidApprover(address approver); /** * @dev Indicates a failure with the `operator` to be approved. Used in approvals. * @param operator Address that may be allowed to operate on tokens without being their owner. */ error ERC1155InvalidOperator(address operator); /** * @dev Indicates an array length mismatch between ids and values in a safeBatchTransferFrom operation. * Used in batch transfers. * @param idsLength Length of the array of token identifiers * @param valuesLength Length of the array of token amounts */ error ERC1155InvalidArrayLength(uint256 idsLength, uint256 valuesLength); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {FailedInnerCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert AddressInsufficientBalance(address(this)); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an * unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {FailedInnerCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}. */ function _revert(bytes memory returndata) 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 FailedInnerCall(); } } }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @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); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @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 maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); }
// 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 IUniswapV3PoolState { /// @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 /// @return 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. /// @return observationIndex The index of the last oracle observation that was written, /// @return observationCardinality The current maximum number of observations stored in the pool, /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// @return 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 /// @return The liquidity at the current price of the pool 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 /// @return liquidityNet how much liquidity changes when the pool price crosses the tick, /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// @return secondsOutside the seconds spent on the other side of the tick from the current tick, /// @return 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, /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// @return 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, /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// @return 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 ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IUniswapV3PoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block /// timestamp function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first /// snapshot is taken and the second snapshot is taken. /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return tickCumulativeInside The snapshot of the tick accumulator for the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) external view returns ( int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IUniswapV3PoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 function initialize(uint160 sqrtPriceX96) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling /// with 0 amount{0,1} and sending the donation amount(s) from the callback /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; /// @notice Increase the maximum number of price and liquidity observations that this pool will store /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to /// the input observationCardinalityNext. /// @param observationCardinalityNext The desired minimum number of observations for the pool to store function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external; }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IUniswapV3PoolOwnerActions { /// @notice Set the denominator of the protocol's % share of the fees /// @param feeProtocol0 new protocol fee for token0 of the pool /// @param feeProtocol1 new protocol fee for token1 of the pool function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external; /// @notice Collect the protocol fee accrued to the pool /// @param recipient The address to which collected protocol fees should be sent /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1 /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0 /// @return amount0 The protocol fee collected in token0 /// @return amount1 The protocol fee collected in token1 function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Errors emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolErrors { error LOK(); error TLU(); error TLM(); error TUM(); error AI(); error M0(); error M1(); error AS(); error IIA(); error L(); error F0(); error F1(); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); }
// 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; }
{ "remappings": [ "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/", "ds-test/=lib/openzeppelin-contracts/lib/forge-std/lib/ds-test/src/", "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/", "forge-std/=lib/forge-std/src/", "openzeppelin-contracts/=lib/openzeppelin-contracts/", "v3-core/=lib/v3-core/contracts/", "v3-periphery/=lib/v3-periphery/contracts/", "@uniswap/v3-core/=lib/v3-core/", "@uniswap/v3-periphery/=lib/v3-periphery/", "@openzeppelin/=lib/openzeppelin-contracts/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "shanghai", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_pm","type":"address"},{"internalType":"address","name":"_optionPricing","type":"address"},{"internalType":"address","name":"_dpFee","type":"address"},{"internalType":"address","name":"_callAsset","type":"address"},{"internalType":"address","name":"_putAsset","type":"address"},{"internalType":"address","name":"_primePool","type":"address"},{"internalType":"address","name":"_verifiedSpotPrice","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AccountBalanceOverflow","type":"error"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"ArrayLenMismatch","type":"error"},{"inputs":[],"name":"BalanceQueryForZeroAddress","type":"error"},{"inputs":[],"name":"Expired","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"IVNotSet","type":"error"},{"inputs":[],"name":"InBUFFER_TIME","type":"error"},{"inputs":[],"name":"InvalidPool","type":"error"},{"inputs":[],"name":"MaxCostAllowanceExceeded","type":"error"},{"inputs":[],"name":"MaxOptionBuyReached","type":"error"},{"inputs":[],"name":"NotApprovedSettler","type":"error"},{"inputs":[],"name":"NotApprovedTTL","type":"error"},{"inputs":[],"name":"NotEnoughAfterSwap","type":"error"},{"inputs":[],"name":"NotOwnerNorApproved","type":"error"},{"inputs":[],"name":"NotOwnerOrDelegator","type":"error"},{"inputs":[],"name":"NotValidStrikeTick","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"PoolNotApproved","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"T","type":"error"},{"inputs":[],"name":"TTLNotSet","type":"error"},{"inputs":[],"name":"TokenAlreadyExists","type":"error"},{"inputs":[],"name":"TokenDoesNotExist","type":"error"},{"inputs":[],"name":"TransferFromIncorrectOwner","type":"error"},{"inputs":[],"name":"TransferToNonERC721ReceiverImplementer","type":"error"},{"inputs":[],"name":"TransferToZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"operator","type":"address"},{"indexed":false,"internalType":"bool","name":"isApproved","type":"bool"}],"name":"ApprovalForAll","type":"event"},{"anonymous":false,"inputs":[{"components":[{"components":[{"internalType":"contract IHandler","name":"_handler","type":"address"},{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"liquidityToUse","type":"uint256"}],"internalType":"struct OptionMarketOTMFE.OptionTicks[]","name":"optionTicks","type":"tuple[]"},{"internalType":"uint256","name":"ttl","type":"uint256"},{"internalType":"uint256","name":"maxCostAllowance","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"bool","name":"isCall","type":"bool"}],"indexed":false,"internalType":"struct OptionMarketOTMFE.OptionParams","name":"_params","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"optionId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"premiumAmount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"size","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"protocolFees","type":"uint256"}],"name":"LogMintOption","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"primePool","type":"address"},{"indexed":false,"internalType":"address","name":"optionPricing","type":"address"},{"indexed":false,"internalType":"address","name":"dpFee","type":"address"},{"indexed":false,"internalType":"address","name":"callAsset","type":"address"},{"indexed":false,"internalType":"address","name":"putAsset","type":"address"}],"name":"LogOptionsMarketInitialized","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"totalProfit","type":"uint256"},{"internalType":"uint256","name":"totalAssetRelocked","type":"uint256"},{"internalType":"contract ERC20","name":"assetToUse","type":"address"},{"internalType":"contract ERC20","name":"assetToGet","type":"address"},{"internalType":"bool","name":"isSettle","type":"bool"}],"indexed":false,"internalType":"struct OptionMarketOTMFE.AssetsCache","name":"assetsCache","type":"tuple"},{"indexed":false,"internalType":"uint256[]","name":"liquiditySettled","type":"uint256[]"},{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"uint256","name":"optionId","type":"uint256"}],"name":"LogSettleOption","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint256","name":"optionId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"liquidityToSplit","type":"uint256[]"}],"indexed":false,"internalType":"struct OptionMarketOTMFE.PositionSplitterParams","name":"params","type":"tuple"},{"indexed":false,"internalType":"uint256","name":"newOptionId","type":"uint256"},{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"}],"name":"LogSplitOption","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"owner","type":"address"},{"indexed":false,"internalType":"address","name":"delegate","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"LogUpdateExerciseDelegate","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"settler","type":"address"},{"indexed":false,"internalType":"bool","name":"statusSettler","type":"bool"},{"indexed":false,"internalType":"address","name":"pool","type":"address"},{"indexed":false,"internalType":"bool","name":"statusPools","type":"bool"},{"indexed":false,"internalType":"uint256","name":"ttl","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"ttlStartTime","type":"uint256"},{"indexed":false,"internalType":"bool","name":"ttlStatus","type":"bool"},{"indexed":false,"internalType":"uint256","name":"bufferTime","type":"uint256"}],"name":"LogUpdatePoolApprovals","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"feeTo","type":"address"},{"indexed":false,"internalType":"address","name":"tokenURIFetcher","type":"address"},{"indexed":false,"internalType":"address","name":"dpFee","type":"address"},{"indexed":false,"internalType":"address","name":"optionPricing","type":"address"}],"name":"LogUpdatePoolSettings","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":true,"internalType":"uint256","name":"id","type":"uint256"}],"name":"Transfer","type":"event"},{"inputs":[{"internalType":"address","name":"account","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"approve","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"approvedPools","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"approvedTTLs","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"result","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callAssetDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"dpFee","outputs":[{"internalType":"contract IClammFeeStrategyV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"emergencyWithdraw","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"exerciseDelegator","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"feeTo","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"getApproved","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"premium","type":"uint256"}],"name":"getFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"hook","type":"address"},{"internalType":"bool","name":"isPut","type":"bool"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"uint256","name":"ttl","type":"uint256"},{"internalType":"uint256","name":"strike","type":"uint256"},{"internalType":"uint256","name":"lastPrice","type":"uint256"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"getPremiumAmount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IUniswapV3Pool","name":"_pool","type":"address"},{"internalType":"int24","name":"_tick","type":"int24"}],"name":"getPricePerCallAssetViaTick","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"operator","type":"address"}],"name":"isApprovedForAll","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"components":[{"internalType":"contract IHandler","name":"_handler","type":"address"},{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"liquidityToUse","type":"uint256"}],"internalType":"struct OptionMarketOTMFE.OptionTicks[]","name":"optionTicks","type":"tuple[]"},{"internalType":"uint256","name":"ttl","type":"uint256"},{"internalType":"uint256","name":"maxCostAllowance","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"bool","name":"isCall","type":"bool"}],"internalType":"struct OptionMarketOTMFE.OptionParams","name":"_params","type":"tuple"}],"name":"mintOption","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"opData","outputs":[{"internalType":"uint256","name":"opTickArrayLen","type":"uint256"},{"internalType":"uint256","name":"expiry","type":"uint256"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"bool","name":"isCall","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"opTickMap","outputs":[{"internalType":"contract IHandler","name":"_handler","type":"address"},{"internalType":"contract IUniswapV3Pool","name":"pool","type":"address"},{"internalType":"address","name":"hook","type":"address"},{"internalType":"int24","name":"tickLower","type":"int24"},{"internalType":"int24","name":"tickUpper","type":"int24"},{"internalType":"uint256","name":"liquidityToUse","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"optionIds","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"optionPricing","outputs":[{"internalType":"contract IOptionPricingV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"ownerOf","outputs":[{"internalType":"address","name":"result","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"positionManager","outputs":[{"internalType":"contract IPositionManager","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"optionId","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256[]","name":"liquidityToSplit","type":"uint256[]"}],"internalType":"struct OptionMarketOTMFE.PositionSplitterParams","name":"_params","type":"tuple"}],"name":"positionSplitter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"primePool","outputs":[{"internalType":"contract IUniswapV3Pool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"putAsset","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"putAssetDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"}],"name":"safeTransferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"operator","type":"address"},{"internalType":"bool","name":"isApproved","type":"bool"}],"name":"setApprovalForAll","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint256","name":"optionId","type":"uint256"},{"internalType":"contract ISwapper[]","name":"swapper","type":"address[]"},{"internalType":"bytes[]","name":"swapData","type":"bytes[]"},{"internalType":"uint256[]","name":"liquidityToSettle","type":"uint256[]"}],"internalType":"struct OptionMarketOTMFE.SettleOptionParams","name":"_params","type":"tuple"}],"name":"settleOption","outputs":[{"components":[{"internalType":"uint256","name":"totalProfit","type":"uint256"},{"internalType":"uint256","name":"totalAssetRelocked","type":"uint256"},{"internalType":"contract ERC20","name":"assetToUse","type":"address"},{"internalType":"contract ERC20","name":"assetToGet","type":"address"},{"internalType":"bool","name":"isSettle","type":"bool"}],"internalType":"struct OptionMarketOTMFE.AssetsCache","name":"ac","type":"tuple"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"settlers","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"result","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"id","type":"uint256"}],"name":"tokenURI","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"tokenURIFetcher","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"id","type":"uint256"}],"name":"transferFrom","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"ttlStartTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_delegateTo","type":"address"},{"internalType":"bool","name":"_status","type":"bool"}],"name":"updateExerciseDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_settler","type":"address"},{"internalType":"bool","name":"_statusSettler","type":"bool"},{"internalType":"address","name":"_pool","type":"address"},{"internalType":"bool","name":"_statusPools","type":"bool"},{"internalType":"uint256","name":"_ttl","type":"uint256"},{"internalType":"uint256","name":"_ttlStartTime","type":"uint256"},{"internalType":"bool","name":"ttlStatus","type":"bool"},{"internalType":"uint256","name":"_BUFFER_TIME","type":"uint256"}],"name":"updatePoolApporvals","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_feeTo","type":"address"},{"internalType":"address","name":"_tokenURIFetcher","type":"address"},{"internalType":"address","name":"_dpFee","type":"address"},{"internalType":"address","name":"_optionPricing","type":"address"},{"internalType":"address","name":"_verifiedSpotPrice","type":"address"}],"name":"updatePoolSettings","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"verifiedSpotPrice","outputs":[{"internalType":"contract IVerifiedSpotPrice","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
610140604052610258600355348015610016575f80fd5b50604051615bd8380380615bd88339810160408190526100359161047d565b60015f55338061005e57604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b61006781610411565b506001600160a01b0387811660805284811660c081905284821660e052600480546001600160a01b03199081168985161782556005805482168b861617905585841660a08190526006805490921694861694909417905560408051630dfe168160e01b81529051929392630dfe1681928281019260209291908290030181865afa1580156100f7573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061011b91906104fe565b6001600160a01b0316141580156101a55750836001600160a01b031660a0516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610175573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061019991906104fe565b6001600160a01b031614155b156101c25760405162820f3560e61b815260040160405180910390fd5b826001600160a01b031660a0516001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561020a573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061022e91906104fe565b6001600160a01b0316141580156102b85750826001600160a01b031660a0516001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610288573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102ac91906104fe565b6001600160a01b031614155b156102d55760405162820f3560e61b815260040160405180910390fd5b836001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610311573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610335919061051e565b60ff166101008160ff1681525050826001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801561037f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906103a3919061051e565b60ff1661012052604080516001600160a01b03848116825288811660208301528781168284015286811660608301528516608082015290517ff432a680e02fd7036a5fd19b4cc769273e33297dfb07a00278dd8f5bfa3fb67d9181900360a00190a15050505050505061053e565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b80516001600160a01b0381168114610478575f80fd5b919050565b5f805f805f805f60e0888a031215610493575f80fd5b61049c88610462565b96506104aa60208901610462565b95506104b860408901610462565b94506104c660608901610462565b93506104d460808901610462565b92506104e260a08901610462565b91506104f060c08901610462565b905092959891949750929550565b5f6020828403121561050e575f80fd5b61051782610462565b9392505050565b5f6020828403121561052e575f80fd5b815160ff81168114610517575f80fd5b60805160a05160c05160e05161010051610120516155426106965f395f81816103b3015281816132270152613fb101525f81816104cc0152818161318101528181613f8101528181614090015281816141aa015281816141e4015281816142e1015261431501525f818161088f01528181610d8701528181610e230152818161180a0152818161198301528181611a080152612b2501525f81816105c101528181610c3801528181610cd4015281816118c3015281816119a9015281816119e201528181612b4b0152818161315f0152818161417001526142a701525f818161044d01528181611834015281816118ed0152818161308f015261313d01525f818161066501528181611b8001528181611c510152818161209d015281816121770152818161220a015281816123cf015281816124620152818161269001528181612e70015281816133e8015261356301526155425ff3fe608060405260043610610275575f3560e01c80638da5cb5b1161014a578063c87b56dd116100be578063dd2e71d011610078578063dd2e71d014610939578063e985e9c514610958578063eb22eccb1461098c578063ed2b0b8a146109ab578063f0bbcec4146109ca578063f2fde38b146109f8575f80fd5b8063c87b56dd1461085f578063c8de6e831461087e578063cf5c1a2c146108b1578063d250185c146108d0578063d302f2b8146108ef578063d5cbe96d1461090e575f80fd5b8063a22cb4651161010f578063a22cb46514610744578063a2b15e4c14610763578063aad2402a146107c6578063ac9650d8146107f2578063b88d4fde1461081e578063c70a900f14610831575f80fd5b80638da5cb5b1461068757806391457d78146106a457806395d89b41146106d2578063997bdef3146107065780639d98f41214610725575f80fd5b80633b2b4603116101ec57806361f812a4116101a657806361f812a4146105b05780636352211e146105e35780636ff1c9bc1461060257806370a0823114610621578063715018a614610640578063791b98bc14610654575f80fd5b80633b2b46031461046f57806342842e0e146104a857806350373276146104bb57806353f689d8146104ee5780635673a2211461050d578063600b584b14610591575f80fd5b8063095ea7b31161023d578063095ea7b31461038d5780630d51249b146103a25780631508b8e2146103e75780631e3394fb1461040a57806323b872dd14610429578063271ab5171461043c575f80fd5b8063017e7e581461027957806301ffc9a7146102b557806306fdde031461030157806307d88aad1461034f578063081812fc1461036e575b5f80fd5b348015610284575f80fd5b50600754610298906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102c0575f80fd5b506102f16102cf366004614538565b6301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b60405190151581526020016102ac565b34801561030c575f80fd5b5060408051808201909152601f81527f4d617267696e5a65726f204f7074696f6e204d61726b6574204f544d2046450060208201525b6040516102ac91906145ac565b34801561035a575f80fd5b50600854610298906001600160a01b031681565b348015610379575f80fd5b506102986103883660046145be565b610a17565b6103a061039b3660046145e9565b610a52565b005b3480156103ad575f80fd5b506103d57f000000000000000000000000000000000000000000000000000000000000000081565b60405160ff90911681526020016102ac565b3480156103f2575f80fd5b506103fc60025481565b6040519081526020016102ac565b348015610415575f80fd5b50600554610298906001600160a01b031681565b6103a0610437366004614613565b610a61565b348015610447575f80fd5b506102987f000000000000000000000000000000000000000000000000000000000000000081565b34801561047a575f80fd5b506102f1610489366004614651565b600b60209081525f928352604080842090915290825290205460ff1681565b6103a06104b6366004614613565b610b6d565b3480156104c6575f80fd5b506103d57f000000000000000000000000000000000000000000000000000000000000000081565b3480156104f9575f80fd5b506103a06105083660046146a0565b610b99565b348015610518575f80fd5b506105606105273660046145be565b60096020525f90815260409020805460018201546002928301549192909180820b9163010000008204900b90600160301b900460ff1685565b604080519586526020860194909452600292830b93850193909352900b60608301521515608082015260a0016102ac565b34801561059c575f80fd5b506103a06105ab366004614729565b610f50565b3480156105bb575f80fd5b506102987f000000000000000000000000000000000000000000000000000000000000000081565b3480156105ee575f80fd5b506102986105fd3660046145be565b610fc5565b34801561060d575f80fd5b506103a061061c366004614755565b611001565b34801561062c575f80fd5b506103fc61063b366004614755565b6110d6565b34801561064b575f80fd5b506103a061110e565b34801561065f575f80fd5b506102987f000000000000000000000000000000000000000000000000000000000000000081565b348015610692575f80fd5b506001546001600160a01b0316610298565b3480156106af575f80fd5b506102f16106be3660046145be565b600e6020525f908152604090205460ff1681565b3480156106dd575f80fd5b5060408051808201909152600c81526b4d5a2d4f4d2d4f544d2d464560a01b6020820152610342565b348015610711575f80fd5b506103a0610720366004614770565b611121565b348015610730575f80fd5b506103a061073f3660046147dd565b6111d6565b34801561074f575f80fd5b506103a061075e366004614729565b6115c6565b34801561076e575f80fd5b5061078261077d366004614813565b611619565b604080516001600160a01b03978816815295871660208701529390951692840192909252600290810b60608401520b608082015260a081019190915260c0016102ac565b3480156107d1575f80fd5b506107e56107e0366004614833565b611682565b6040516102ac91906148a9565b3480156107fd575f80fd5b5061081161080c3660046148b7565b612810565b6040516102ac9190614926565b6103a061082c366004614989565b6128f6565b34801561083c575f80fd5b506102f161084b366004614755565b600d6020525f908152604090205460ff1681565b34801561086a575f80fd5b506103426108793660046145be565b612950565b348015610889575f80fd5b506102987f000000000000000000000000000000000000000000000000000000000000000081565b3480156108bc575f80fd5b506103a06108cb366004614a20565b6129be565b3480156108db575f80fd5b506103fc6108ea366004614813565b613724565b3480156108fa575f80fd5b50600454610298906001600160a01b031681565b348015610919575f80fd5b506103fc6109283660046145be565b600f6020525f908152604090205481565b348015610944575f80fd5b506103fc610953366004614a56565b6137a8565b348015610963575f80fd5b506102f1610972366004614651565b601c52670a5a2e7a000000006008525f526030600c205490565b348015610997575f80fd5b506103fc6109a6366004614ac4565b6137c6565b3480156109b6575f80fd5b50600654610298906001600160a01b031681565b3480156109d5575f80fd5b506102f16109e4366004614755565b600c6020525f908152604090205460ff1681565b348015610a03575f80fd5b506103a0610a12366004614755565b6137e5565b5f815f52673ec412a9852d173d60c11b601c5260205f2082018201805460601b610a485763ceea21b65f526004601cfd5b6001015492915050565b610a5d338383613824565b5050565b5f818152673ec412a9852d173d60c11b3317601c52602090208101810180546001600160a01b039485169493841693811691908286148302610abc5782610aaf5763ceea21b65f526004601cfd5b63a11481005f526004601cfd5b84610ace5763ea553b345f526004601cfd5b855f528160010154925082331486331417610afa576030600c2054610afa57634b6e7f185f526004601cfd5b8215610b07575f82600101555b85851818905550601c600c81812080545f190190555f84905220805460010163ffffffff8116610b3e576301336cea5f526004601cfd5b90558082847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f38a45b505050565b610b78838383610a61565b813b15610b6857610b6883838360405180602001604052805f8152506138be565b610ba1613947565b6001600160a01b038881165f908152600d60209081526040808320805460ff199081168d151517909155938a168352600c8252808320805485168a1515179055878352600e90915281208054909216841515179091556003829055839003610c1c576040516382ee924160e01b815260040160405180910390fd5b82600f5f8681526020019081526020015f20819055505f8690507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c9c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cc09190614af7565b6001600160a01b031614158015610d6857507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d38573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d5c9190614af7565b6001600160a01b031614155b15610d855760405162820f3560e61b815260040160405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610deb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0f9190614af7565b6001600160a01b031614158015610eb757507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e87573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eab9190614af7565b6001600160a01b031614155b15610ed45760405162820f3560e61b815260040160405180910390fd5b604080516001600160a01b038b811682528a1515602083015289168183015287151560608201526080810187905260a0810186905284151560c082015260e0810184905290517fef14ffdf10adf830963eb3e930628d3f16624558826d02369483d63dc1224c09918190036101000190a1505050505050505050565b335f818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815194855291840192909252908201527f4ee86bb98ad0d189c6475dd48829e8525e468f3721ab971f0c0914e6693c8da69060600160405180910390a15050565b5f818152673ec412a9852d173d60c11b601c526020902081018101546001600160a01b031680610ffc5763ceea21b65f526004601cfd5b919050565b611009613947565b6040516370a0823160e01b81523060048201526001600160a01b0382169063a9059cbb90339083906370a0823190602401602060405180830381865afa158015611055573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110799190614b12565b6040518363ffffffff1660e01b8152600401611096929190614b29565b6020604051808303815f875af11580156110b2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a5d9190614b42565b5f816110e957638f4eb6045f526004601cfd5b673ec412a9852d173d60c11b601c52815f5263ffffffff601c600c2054169050919050565b611116613947565b61111f5f613974565b565b611129613947565b600780546001600160a01b038781166001600160a01b0319928316811790935560088054888316908416811790915560048054888416908516811790915560058054888516908616811790915560068054948816949095169390931790935560408051948552602085019190915283019190915260608201527f2a38eeb7b477d2d02f8c59437e9493ed71a5c5a1d426dfd40446830348acf8909060800160405180910390a15050505050565b6111de6139c5565b600160025f8282546111f09190614b71565b909155503390506112018235610fc5565b6001600160a01b03161461122b57604051600162486bc960e11b0319815260040160405180910390fd5b80355f90815260096020908152604091829020825160a0810184528154815260018201549281019290925260029081015480820b838501526301000000810490910b6060830152600160301b900460ff16151560808201529061129090830183614b84565b82511490506112b257604051630dcb503560e11b815260040160405180910390fd5b42816020015110156112d757604051630407b05b60e31b815260040160405180910390fd5b5f5b6112e66040840184614b84565b905081101561149e5782355f908152600a6020526040812080548390811061131057611310614bd0565b905f5260205f209060040201905083806040019061132e9190614b84565b8381811061133e5761133e614bd0565b90506020020135816003015f8282546113579190614be4565b9091555050600280545f908152600a6020908152604091829020825160c08101845285546001600160a01b03908116825260018701548116938201939093528585015492831681850152600160a01b8304850b6060820152600160b81b90920490930b60808201529060a08201906113d190880188614b84565b868181106113e1576113e1614bd0565b602090810292909201359092528354600180820186555f95865294829020845160049092020180546001600160a01b03199081166001600160a01b0393841617825592850151818701805490941690831617909255604084015160028301805460608701516080880151939094166001600160b81b031990911617600160a01b62ffffff948516021762ffffff60b81b1916600160b81b939092169290920217905560a090920151600390920191909155509190910190506112d9565b506040518060a001604052808380604001906114ba9190614b84565b82525060208381015181830152604080850151600290810b82850152606080870151820b8186015260808088015115159581019590955281545f908152600985528390208651815586850151600182015586840151920180549187015196909501511515600160301b0266ff0000000000001962ffffff97881663010000000265ffffffffffff1990931697909316969096171716939093179091556115719161156991908501908501614755565b6002546139ed565b7f44b72a7e3474ccca11170d15b3e7a2f31bc170284829bdec3e017198cfff6d5f826002546115a2855f0135610fc5565b6040516115b193929190614c27565b60405180910390a1506115c360015f55565b50565b801515905081601c52670a5a2e7a00000000600852335f52806030600c2055805f528160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160205fa35050565b600a602052815f5260405f208181548110611632575f80fd5b5f9182526020909120600490910201805460018201546002808401546003909401546001600160a01b039384169650918316945091831692600160a01b8104830b92600160b81b909104900b9086565b6040805160a0810182525f808252602082018190529181018290526060810182905260808101919091526116b46139c5565b81355f90815260096020908152604091829020825160a0810184528154815260018201549281019290925260029081015480820b9383019390935263010000008304900b606080830191909152600160301b90920460ff16151560808201529061172090840184614b84565b825114905061174257604051630dcb503560e11b815260040160405180910390fd5b806020015142106117885760016080830152335f908152600d602052604090205460ff1661178357604051630184bf0960e01b815260040160405180910390fd5b6117fe565b336117938435610fc5565b6001600160a01b0316141580156117dd5750600b5f6117b28535610fc5565b6001600160a01b0316815260208082019290925260409081015f90812033825290925290205460ff16155b156117fe57604051600162486bc960e11b0319815260040160405180910390fd5b5f81608001516118c1577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561188e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118b29190614af7565b6001600160a01b031614611976565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611947573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061196b9190614af7565b6001600160a01b0316145b905081608001516119a7577f00000000000000000000000000000000000000000000000000000000000000006119c9565b7f00000000000000000000000000000000000000000000000000000000000000005b6001600160a01b031660408401526080820151611a06577f0000000000000000000000000000000000000000000000000000000000000000611a28565b7f00000000000000000000000000000000000000000000000000000000000000005b6001600160a01b031660608401525f5b82518110156127b057611a4e6060860186614b84565b82818110611a5e57611a5e614bd0565b905060200201355f03156127a85784355f908152600a60205260408120805483908110611a8d57611a8d614bd0565b5f918252602082206004909102019150611aaa6060880188614b84565b84818110611aba57611aba614bd0565b9050602002013590505f80611b1f611ae7856001015f9054906101000a90046001600160a01b0316613a06565b600280870154611b0091600160a01b909104900b613a9d565b600280880154611b1991600160b81b909104900b613a9d565b86613db8565b915091505f82118015611b30575080155b80611b4357505f81118015611b43575081155b1561214a57858015611b5457505f82115b8015611b665750608088015115156001145b15611c185787604001516001600160a01b031663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000846040518363ffffffff1660e01b8152600401611bbd929190614b29565b6020604051808303815f875af1158015611bd9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bfd9190614b42565b508188602001818151611c109190614b71565b9052506125f5565b85158015611c2557505f81115b8015611c375750608088015115156001145b15611ce15787604001516001600160a01b031663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000836040518363ffffffff1660e01b8152600401611c8e929190614b29565b6020604051808303815f875af1158015611caa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cce9190614b42565b508088602001818151611c109190614b71565b5f86611d2757600280860154611d2291611d0391600160a01b9004900b613a9d565b600280880154611d1c91600160b81b909104900b613a9d565b86613e53565b611d62565b600280860154611d6291611d4391600160a01b9004900b613a9d565b600280880154611d5c91600160b81b909104900b613a9d565b86613e95565b90508089602001818151611d769190614b71565b90525060608901516040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa158015611dc1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611de59190614b12565b60408b01519091506001600160a01b031663a9059cbb611e0860208e018e614b84565b8a818110611e1857611e18614bd0565b9050602002016020810190611e2d9190614755565b846040518363ffffffff1660e01b8152600401611e4b929190614b29565b6020604051808303815f875af1158015611e67573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e8b9190614b42565b50611e9960208c018c614b84565b88818110611ea957611ea9614bd0565b9050602002016020810190611ebe9190614755565b6001600160a01b031663f3be6fc28b604001518c60600151858f8060400190611ee79190614b84565b8d818110611ef757611ef7614bd0565b9050602002810190611f099190614cc6565b6040518663ffffffff1660e01b8152600401611f29959493929190614d08565b6020604051808303815f875af1158015611f45573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f699190614b12565b505f88611fb057600280880154611fab91611f8c91600160a01b9004900b613a9d565b6002808a0154611fa591600160b81b909104900b613a9d565b88613e95565b611feb565b600280880154611feb91611fcc91600160a01b9004900b613a9d565b6002808a0154611fe591600160b81b909104900b613a9d565b88613e53565b60608c01516040516370a0823160e01b81523060048201529192505f916001600160a01b03909116906370a0823190602401602060405180830381865afa158015612038573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061205c9190614b12565b90506120688284614b71565b811015612088576040516360e710f160e01b815260040160405180910390fd5b8b606001516001600160a01b031663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000846040518363ffffffff1660e01b81526004016120da929190614b29565b6020604051808303815f875af11580156120f6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061211a9190614b42565b506121258284614b71565b61212f9082614be4565b8c518d9061213e908390614b71565b905250505050506125f5565b85801561215d5750608088015115156001145b156123a15787604001516001600160a01b031663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000846040518363ffffffff1660e01b81526004016121b4929190614b29565b6020604051808303815f875af11580156121d0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121f49190614b42565b5087606001516001600160a01b031663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000836040518363ffffffff1660e01b8152600401612247929190614b29565b6020604051808303815f875af1158015612263573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122879190614b42565b506002808501545f916122a791611d4391600160a01b909104900b613a9d565b60608a01516040516323b872dd60e01b81529192506001600160a01b0316906323b872dd906122de90339030908790600401614d58565b6020604051808303815f875af11580156122fa573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061231e9190614b42565b5060408901516001600160a01b031663a9059cbb3361233d8685614be4565b6040518363ffffffff1660e01b815260040161235a929190614b29565b6020604051808303815f875af1158015612376573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061239a9190614b42565b50506125f5565b851580156123b55750608088015115156001145b156125f55787604001516001600160a01b031663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000836040518363ffffffff1660e01b815260040161240c929190614b29565b6020604051808303815f875af1158015612428573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061244c9190614b42565b5087606001516001600160a01b031663095ea7b37f0000000000000000000000000000000000000000000000000000000000000000846040518363ffffffff1660e01b815260040161249f929190614b29565b6020604051808303815f875af11580156124bb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124df9190614b42565b506002808501545f916124ff91611d0391600160a01b909104900b613a9d565b60608a01516040516323b872dd60e01b81529192506001600160a01b0316906323b872dd9061253690339030908890600401614d58565b6020604051808303815f875af1158015612552573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125769190614b42565b5060408901516001600160a01b031663a9059cbb336125958585614be4565b6040518363ffffffff1660e01b81526004016125b2929190614b29565b6020604051808303815f875af11580156125ce573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125f29190614b42565b50505b60018401546002808601546040515f936001600160a01b039081169390831692600160a01b8104820b92600160b81b90910490910b9088906126449060200160208082525f9082015260400190565b60408051601f1981840301815290829052612666969594939291602001614d7c565b60408051601f1981840301815290829052865463d5256ca360e01b83529092506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081169263d5256ca3926126c89216908590600401614dc0565b5f604051808303815f875af11580156126e3573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261270a9190810190614eb3565b505088511561278a576060890151895160405163a9059cbb60e01b81526001600160a01b039092169163a9059cbb9161274891339190600401614b29565b6020604051808303815f875af1158015612764573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127889190614b42565b505b83856003015f82825461279d9190614be4565b909155505050505050505b600101611a38565b507f15171d5e55f89523d32cad253e2cc81847991a01581eb370494379e025b170ec836127e06060870187614b84565b6127ea8835610fc5565b6040516127fd94939291908a3590614ef6565b60405180910390a15050610ffc60015f55565b604080515f815260208101909152606090826001600160401b0381111561283957612839614de3565b60405190808252806020026020018201604052801561286c57816020015b60608152602001906001900390816128575790505b5091505f5b838110156128ed576128c83086868481811061288f5761288f614bd0565b90506020028101906128a19190614cc6565b856040516020016128b493929190614f35565b604051602081830303815290604052613f03565b8382815181106128da576128da614bd0565b6020908102919091010152600101612871565b50505b92915050565b612901858585610a61565b833b156129495761294985858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506138be92505050565b5050505050565b6008546040516373ea766160e01b8152600481018390526060916001600160a01b0316906373ea7661906024015f60405180830381865afa158015612997573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526128f09190810190614f5a565b6129c66139c5565b600160025f8282546129d89190614b71565b90915550601490506129ea8280614fe0565b90501115612a0b57604051636c9735f760e11b815260040160405180910390fd5b6020808201355f908152600e909152604090205460ff16612a3f576040516398ac918960e01b815260040160405180910390fd5b6020808201355f818152600f9092526040822054612a5d9042614be4565b612a679190615038565b612a75906020840135614be4565b612a7f9042614b71565b90506003548260200135612a939190614be4565b612a9d4283614be4565b1115612abc57604051634046db7560e01b815260040160405180910390fd5b5f612ac78380614fe0565b90506001600160401b03811115612ae057612ae0614de3565b604051908082528060200260200182016040528015612b09578160200160208202803683370190505b5090505f8080612b1f60c0870160a0880161504b565b612b49577f0000000000000000000000000000000000000000000000000000000000000000612b6b565b7f00000000000000000000000000000000000000000000000000000000000000005b6040805160c0810182525f80825260208201819052918101829052606081018290526080810182905260a081018290529192505b612ba98880614fe0565b905081101561308857612bbc8880614fe0565b82818110612bcc57612bcc614bd0565b905060c00201803603810190612be29190615066565b9150612bf460c0890160a08a0161504b565b612c1d57816060015160020b886060016020810190612c139190615105565b60020b1415612c3e565b816080015160020b886080016020810190612c389190615105565b60020b14155b15612c5c57604051631759c67760e01b815260040160405180910390fd5b600280545f908152600a60209081526040808320815160c08101835287516001600160a01b039081168252888501805182168387019081528a86015183168487019081526060808d01518b0b9086019081526080808e01518c0b90870190815260a0808f0151908801908152885460018181018b55998d528b8d209851600490910290980180549888166001600160a01b0319998a16178155945198850180549988169990981698909817909655905199820180549151955162ffffff908116600160b81b0262ffffff60b81b1991909716600160a01b026001600160b81b03199093169b86169b909b17919091179990991693909317909755915160039091015593519093168252600c9052205460ff16612d8b576040516336cc3cab60e21b815260040160405180910390fd5b5f82602001518360400151846060015185608001518660a00151308d8f60a0016020810190612dba919061504b565b6020808c015160608d015160808e015160a08f0151604051612e2098979695016001600160a01b03978816815260208101969096529315156040860152919094166060840152600293840b608084015290920b60a082015260c081019190915260e00190565b60408051601f1981840301815290829052612e42969594939291602001614d7c565b60408051601f198184030181529082905284516339ef369360e21b83529092505f9182916001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169163e7bcda4c91612ea5918790600401614dc0565b5f604051808303815f875af1158015612ec0573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612ee7919081019061511e565b5091509150856001600160a01b0316825f81518110612f0857612f08614bd0565b60200260200101516001600160a01b031603612fcf575f815f81518110612f3157612f31614bd0565b6020026020010151118015612f5f575080600181518110612f5457612f54614bd0565b60200260200101515f145b612f67575f80fd5b805f81518110612f7957612f79614bd0565b6020026020010151898581518110612f9357612f93614bd0565b602002602001018181525050805f81518110612fb157612fb1614bd0565b602002602001015188612fc49190614b71565b97506001965061307d565b5f81600181518110612fe357612fe3614bd0565b60200260200101511180156130105750805f8151811061300557613005614bd0565b60200260200101515f145b613018575f80fd5b8060018151811061302b5761302b614bd0565b602002602001015189858151811061304557613045614bd0565b6020026020010181815250508060018151811061306457613064614bd0565b6020026020010151886130779190614b71565b97505f96505b505050600101612b9f565b505f6130e27f00000000000000000000000000000000000000000000000000000000000000006130be60c08b0160a08c0161504b565b6130d2576109a660808b0160608c01615105565b6109a660a08b0160808c01615105565b90505f61326c83604001518a60a0016020810190613100919061504b565b61310b57600161310d565b5f5b60065460405163322092f560e21b81528c9160208f01359188916001600160a01b03169063c8824bd4906131cb907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000907f0000000000000000000000000000000000000000000000000000000000000000906004016001600160a01b03938416815291909216602082015260ff91909116604082015260600190565b602060405180830381865afa1580156131e6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061320a9190614b12565b8f60a001602081019061321d919061504b565b613266578861324d7f0000000000000000000000000000000000000000000000000000000000000000600a6152d1565b613257908f6152df565b61326191906152f6565b613f75565b8c613f75565b9050805f0361328e57604051638c18744360e01b815260040160405180910390fd5b6007545f906001600160a01b031615613325576132ab8783613724565b6007546040516323b872dd60e01b81529192506001600160a01b03808816926323b872dd926132e39233929116908690600401614d58565b6020604051808303815f875af11580156132ff573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906133239190614b42565b505b60408a01356133348284614b71565b111561335357604051630bea79f960e11b815260040160405180910390fd5b6040516323b872dd60e01b81526001600160a01b038616906323b872dd9061338390339030908790600401614d58565b6020604051808303815f875af115801561339f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906133c39190614b42565b5060405163095ea7b360e01b81526001600160a01b0386169063095ea7b390613412907f0000000000000000000000000000000000000000000000000000000000000000908690600401614b29565b6020604051808303815f875af115801561342e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134529190614b42565b505f5b61345f8b80614fe0565b90508110156135ea576134728b80614fe0565b8281811061348257613482614bd0565b905060c002018036038101906134989190615066565b94505f88848b84815181106134af576134af614bd0565b60200260200101516134c191906152df565b6134cb91906152f6565b90505f86602001518760400151886060015189608001518c6134ed575f6134ef565b855b8d6134fa57866134fc565b5f5b6040516020016135169060208082525f9082015260400190565b60408051601f198184030181529082905261353997969594939291602001615309565b60408051601f198184030181529082905288516304e94bdb60e51b83529092506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691639d297b6091613598918590600401614dc0565b5f604051808303815f875af11580156135b3573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526135da9190810190614eb3565b5050600190920191506134559050565b506040805160a08101909152806136018c80614fe0565b825250602081018b905260400161361e60808d0160608e01615105565b60020b815260200161363660a08d0160808e01615105565b60020b815260200161364e60c08d0160a08e0161504b565b15159052600280545f908152600960209081526040918290208451815590840151600182015590830151908201805460608501516080909501511515600160301b0266ff0000000000001962ffffff96871663010000000265ffffffffffff199093169690941695909517179190911692909217909155546136d19033906139ed565b7f17d317786006ee80c691dec9221cbf7d2b913ee2cb0d426e29d6e03fadac16778a600254848a8560405161370a95949392919061540d565b60405180910390a15050505050505050506115c360015f55565b60048054604051637669909560e01b8152309281019290925260248201849052604482018390525f916001600160a01b0390911690637669909590606401602060405180830381865afa15801561377d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137a19190614b12565b9392505050565b5f6137b888888888888888613f75565b90505b979650505050505050565b5f806137d183613a9d565b90506137dd84826140d7565b949350505050565b6137ed613947565b6001600160a01b03811661381b57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6115c381613974565b5f1960601c82811692508381169350815f5283673ec412a9852d173d60c11b17601c5260205f2082018201805482169150816138675763ceea21b65f526004601cfd5b81851485151761388b57815f526030600c205461388b57634b6e7f185f526004601cfd5b6001018390558183827f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f38a450505050565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a08401528015613905578060c08401826020870160045afa505b60208360a48301601c86015f8a5af1613926573d15613926573d5f843e3d83fd5b508060e01b82511461393f5763d1a57ed65f526004601cfd5b505050505050565b6001546001600160a01b0316331461111f5760405163118cdaa760e01b8152336004820152602401613812565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60025f54036139e757604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b610a5d828260405180602001604052805f815250614345565b60408051600481526024810182526020810180516001600160e01b0316633850c7bd60e01b17905290515f9182916001600160a01b03851691613a48916154f1565b5f60405180830381855afa9150503d805f8114613a80576040519150601f19603f3d011682016040523d82523d5f602084013e613a85565b606091505b50915050808060200190518101906137a19190614af7565b5f805f8360020b12613ab2578260020b613ab9565b8260020b5f035b9050620d89e8811115613adf576040516315e4079d60e11b815260040160405180910390fd5b5f816001165f03613af457600160801b613b06565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615613b3a576ffff97272373d413259a46990580e213a0260801c5b6004821615613b59576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615613b78576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615613b97576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615613bb6576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615613bd5576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615613bf4576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615613c14576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615613c34576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615613c54576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615613c74576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615613c94576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615613cb4576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615613cd4576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615613cf4576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615613d15576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615613d35576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615613d54576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615613d71576b048a170391f7dc42444e8fa20260801c5b5f8460020b1315613d9057805f1981613d8c57613d8c615024565b0490505b640100000000810615613da4576001613da6565b5f5b60ff16602082901c0192505050919050565b5f80836001600160a01b0316856001600160a01b03161115613dd8579293925b846001600160a01b0316866001600160a01b031611613e0357613dfc858585613e95565b9150613e4a565b836001600160a01b0316866001600160a01b03161015613e3c57613e28868585613e95565b9150613e35858785613e53565b9050613e4a565b613e47858585613e53565b90505b94509492505050565b5f826001600160a01b0316846001600160a01b03161115613e72579192915b6137dd826001600160801b03168585036001600160a01b0316600160601b614362565b5f826001600160a01b0316846001600160a01b03161115613eb4579192915b836001600160a01b0316613eed606060ff16846001600160801b0316901b8686036001600160a01b0316866001600160a01b0316614362565b81613efa57613efa615024565b04949350505050565b60605f80846001600160a01b031684604051613f1f91906154f1565b5f60405180830381855af49150503d805f8114613f57576040519150601f19603f3d011682016040523d82523d5f602084013e613f5c565b606091505b5091509150613f6c85838361440c565b95945050505050565b5f8087613fac57613fa77f0000000000000000000000000000000000000000000000000000000000000000600a6152d1565b613fd7565b613fd77f0000000000000000000000000000000000000000000000000000000000000000600a6152d1565b60055460405163641ffd6960e11b81526001600160a01b038c811660048301528b15156024830152604482018b9052606482018a90526084820189905260a482018890529091169063c83ffad29060c401602060405180830381865afa158015614043573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140679190614b12565b61407190856152df565b61407b91906152f6565b9050871561408a5790506137bb565b836140b67f0000000000000000000000000000000000000000000000000000000000000000600a6152d1565b6140c090836152df565b6140ca91906152f6565b9998505050505050505050565b5f6001600160801b036001600160a01b0383161161421c575f6141036001600160a01b038416806152df565b9050836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015614141573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141659190614af7565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316146141db576141d6600160c01b6141d07f0000000000000000000000000000000000000000000000000000000000000000600a6152d1565b83614362565b614214565b6142148161420a7f0000000000000000000000000000000000000000000000000000000000000000600a6152d1565b600160c01b614362565b9150506128f0565b5f61423a6001600160a01b0384168068010000000000000000614362565b9050836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015614278573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061429c9190614af7565b6001600160a01b03167f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03161461430c57614307600160801b6141d07f0000000000000000000000000000000000000000000000000000000000000000600a6152d1565b6137dd565b6137dd8161433b7f0000000000000000000000000000000000000000000000000000000000000000600a6152d1565b600160801b614362565b61434f8383614468565b823b15610b6857610b685f8484846138be565b5f80805f19858709858702925082811083820303915050805f03614396575f841161438b575f80fd5b5082900490506137a1565b8084116143a1575f80fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6060826144215761441c8261450f565b6137a1565b815115801561443857506001600160a01b0384163b155b1561446157604051639996b31560e01b81526001600160a01b0385166004820152602401613812565b50806137a1565b6001600160a01b0390911690816144865763ea553b345f526004601cfd5b805f52673ec412a9852d173d60c11b601c5260205f208101810180548060601b156144b85763c991cbb15f526004601cfd5b831790555f829052601c600c20805460010163ffffffff81166144e2576301336cea5f526004601cfd5b905580825f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8138a45050565b80511561451f5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f60208284031215614548575f80fd5b81356001600160e01b0319811681146137a1575f80fd5b5f5b83811015614579578181015183820152602001614561565b50505f910152565b5f815180845261459881602086016020860161455f565b601f01601f19169290920160200192915050565b602081525f6137a16020830184614581565b5f602082840312156145ce575f80fd5b5035919050565b6001600160a01b03811681146115c3575f80fd5b5f80604083850312156145fa575f80fd5b8235614605816145d5565b946020939093013593505050565b5f805f60608486031215614625575f80fd5b8335614630816145d5565b92506020840135614640816145d5565b929592945050506040919091013590565b5f8060408385031215614662575f80fd5b823561466d816145d5565b9150602083013561467d816145d5565b809150509250929050565b80151581146115c3575f80fd5b8035610ffc81614688565b5f805f805f805f80610100898b0312156146b8575f80fd5b88356146c3816145d5565b975060208901356146d381614688565b965060408901356146e3816145d5565b955060608901356146f381614688565b94506080890135935060a0890135925060c089013561471181614688565b979a969950949793969295919450919260e001359150565b5f806040838503121561473a575f80fd5b8235614745816145d5565b9150602083013561467d81614688565b5f60208284031215614765575f80fd5b81356137a1816145d5565b5f805f805f60a08688031215614784575f80fd5b853561478f816145d5565b9450602086013561479f816145d5565b935060408601356147af816145d5565b925060608601356147bf816145d5565b915060808601356147cf816145d5565b809150509295509295909350565b5f602082840312156147ed575f80fd5b81356001600160401b03811115614802575f80fd5b8201606081850312156137a1575f80fd5b5f8060408385031215614824575f80fd5b50508035926020909101359150565b5f60208284031215614843575f80fd5b81356001600160401b03811115614858575f80fd5b8201608081850312156137a1575f80fd5b80518252602080820151908301526040808201516001600160a01b0390811691840191909152606080830151909116908301526080908101511515910152565b60a081016128f08284614869565b5f80602083850312156148c8575f80fd5b82356001600160401b038111156148dd575f80fd5b8301601f810185136148ed575f80fd5b80356001600160401b03811115614902575f80fd5b8560208260051b8401011115614916575f80fd5b6020919091019590945092505050565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b8281101561497d57603f19878603018452614968858351614581565b9450602093840193919091019060010161494c565b50929695505050505050565b5f805f805f6080868803121561499d575f80fd5b85356149a8816145d5565b945060208601356149b8816145d5565b93506040860135925060608601356001600160401b038111156149d9575f80fd5b8601601f810188136149e9575f80fd5b80356001600160401b038111156149fe575f80fd5b886020828401011115614a0f575f80fd5b959894975092955050506020019190565b5f60208284031215614a30575f80fd5b81356001600160401b03811115614a45575f80fd5b820160c081850312156137a1575f80fd5b5f805f805f805f60e0888a031215614a6c575f80fd5b8735614a77816145d5565b96506020880135614a8781614688565b96999698505050506040850135946060810135946080820135945060a0820135935060c0909101359150565b8035600281900b8114610ffc575f80fd5b5f8060408385031215614ad5575f80fd5b8235614ae0816145d5565b9150614aee60208401614ab3565b90509250929050565b5f60208284031215614b07575f80fd5b81516137a1816145d5565b5f60208284031215614b22575f80fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b5f60208284031215614b52575f80fd5b81516137a181614688565b634e487b7160e01b5f52601160045260245ffd5b808201808211156128f0576128f0614b5d565b5f808335601e19843603018112614b99575f80fd5b8301803591506001600160401b03821115614bb2575f80fd5b6020019150600581901b3603821315614bc9575f80fd5b9250929050565b634e487b7160e01b5f52603260045260245ffd5b818103818111156128f0576128f0614b5d565b8183525f6001600160fb1b03831115614c0e575f80fd5b8260051b80836020870137939093016020019392505050565b60608082528435908201525f6020850135614c41816145d5565b6001600160a01b03166080830152604085013536869003601e19018112614c66575f80fd5b85016020810190356001600160401b03811115614c81575f80fd5b8060051b3603821315614c92575f80fd5b606060a0850152614ca760c085018284614bf7565b925050508360208301526137dd60408301846001600160a01b03169052565b5f808335601e19843603018112614cdb575f80fd5b8301803591506001600160401b03821115614cf4575f80fd5b602001915036819003821315614bc9575f80fd5b6001600160a01b03868116825285166020820152604081018490526080606082018190528101829052818360a08301375f81830160a090810191909152601f909201601f19160101949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03878116825286166020820152600285810b604083015284900b60608201526080810183905260c060a082018190525f906137b890830184614581565b6001600160a01b03831681526040602082018190525f906137dd90830184614581565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715614e1f57614e1f614de3565b604052919050565b5f6001600160401b03821115614e3f57614e3f614de3565b5060051b60200190565b5f82601f830112614e58575f80fd5b8151614e6b614e6682614e27565b614df7565b8082825260208201915060208360051b860101925085831115614e8c575f80fd5b602085015b83811015614ea9578051835260209283019201614e91565b5095945050505050565b5f8060408385031215614ec4575f80fd5b82516001600160401b03811115614ed9575f80fd5b614ee585828601614e49565b602094909401519395939450505050565b614f008187614869565b61010060a08201525f614f1861010083018688614bf7565b6001600160a01b039490941660c08301525060e001529392505050565b828482375f8382015f81528351614f5081836020880161455f565b0195945050505050565b5f60208284031215614f6a575f80fd5b81516001600160401b03811115614f7f575f80fd5b8201601f81018413614f8f575f80fd5b80516001600160401b03811115614fa857614fa8614de3565b614fbb601f8201601f1916602001614df7565b818152856020838501011115614fcf575f80fd5b613f6c82602083016020860161455f565b5f808335601e19843603018112614ff5575f80fd5b8301803591506001600160401b0382111561500e575f80fd5b602001915060c081023603821315614bc9575f80fd5b634e487b7160e01b5f52601260045260245ffd5b5f8261504657615046615024565b500690565b5f6020828403121561505b575f80fd5b81356137a181614688565b5f60c0828403128015615077575f80fd5b5060405160c081016001600160401b038111828210171561509a5761509a614de3565b60405282356150a8816145d5565b815260208301356150b8816145d5565b602082015260408301356150cb816145d5565b60408201526150dc60608401614ab3565b60608201526150ed60808401614ab3565b608082015260a0928301359281019290925250919050565b5f60208284031215615115575f80fd5b6137a182614ab3565b5f805f60608486031215615130575f80fd5b83516001600160401b03811115615145575f80fd5b8401601f81018613615155575f80fd5b8051615163614e6682614e27565b8082825260208201915060208360051b850101925088831115615184575f80fd5b6020840193505b828410156151af57835161519e816145d5565b82526020938401939091019061518b565b8096505050505060208401516001600160401b038111156151ce575f80fd5b6151da86828701614e49565b604095909501519396949550929392505050565b6001815b60018411156152295780850481111561520d5761520d614b5d565b600184161561521b57908102905b60019390931c9280026151f2565b935093915050565b5f8261523f575060016128f0565b8161524b57505f6128f0565b8160018114615261576002811461526b57615287565b60019150506128f0565b60ff84111561527c5761527c614b5d565b50506001821b6128f0565b5060208310610133831016604e8410600b84101617156152aa575081810a6128f0565b6152b65f1984846151ee565b805f19048211156152c9576152c9614b5d565b029392505050565b5f6137a160ff841683615231565b80820281158282048414176128f0576128f0614b5d565b5f8261530457615304615024565b500490565b6001600160a01b03888116825287166020820152600286810b604083015285900b60608201526080810184905260a0810183905260e060c082018190525f906140ca90830184614581565b8183526020830192505f815f5b84811015615403578135615374816145d5565b6001600160a01b03168652602082013561538d816145d5565b6001600160a01b0316602087015260408201356153a9816145d5565b6001600160a01b031660408701526153c360608301614ab3565b60020b60608701526153d760808301614ab3565b6153e6608088018260020b9052565b5060a0828101359087015260c09586019590910190600101615361565b5093949350505050565b60a081525f8635601e19883603018112615425575f80fd5b87016020810190356001600160401b03811115615440575f80fd5b60c081023603821315615451575f80fd5b60c060a085015261546761016085018284615354565b60208a013560c086015260408a013560e0860152915061548b905060608901614ab3565b61549b61010085018260020b9052565b506154a860808901614ab3565b6154b861012085018260020b9052565b506154c560a08901614695565b151561014084015260208301969096525060408101939093526060830191909152608090910152919050565b5f825161550281846020870161455f565b919091019291505056fea26469706673582212203163ea3cbc8670a99542db70b0c2651f62bced5c6a7340464dd74c4b71c092ad64736f6c634300081a0033000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5000000000000000000000000ba49d0e7bb755c1f40b7675c6474558f9f06b301000000000000000000000000fd5fd368322e229a8378c9a8df4d1450f488e8d5000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000029219dd400f2bf60e5a23d13be72b486d403889400000000000000000000000025f746bb206041ed8da6f08ed1d32454a5856d370000000000000000000000001a2010e66e65ada65accf8c2b60c7b40a155089b
Deployed Bytecode
0x608060405260043610610275575f3560e01c80638da5cb5b1161014a578063c87b56dd116100be578063dd2e71d011610078578063dd2e71d014610939578063e985e9c514610958578063eb22eccb1461098c578063ed2b0b8a146109ab578063f0bbcec4146109ca578063f2fde38b146109f8575f80fd5b8063c87b56dd1461085f578063c8de6e831461087e578063cf5c1a2c146108b1578063d250185c146108d0578063d302f2b8146108ef578063d5cbe96d1461090e575f80fd5b8063a22cb4651161010f578063a22cb46514610744578063a2b15e4c14610763578063aad2402a146107c6578063ac9650d8146107f2578063b88d4fde1461081e578063c70a900f14610831575f80fd5b80638da5cb5b1461068757806391457d78146106a457806395d89b41146106d2578063997bdef3146107065780639d98f41214610725575f80fd5b80633b2b4603116101ec57806361f812a4116101a657806361f812a4146105b05780636352211e146105e35780636ff1c9bc1461060257806370a0823114610621578063715018a614610640578063791b98bc14610654575f80fd5b80633b2b46031461046f57806342842e0e146104a857806350373276146104bb57806353f689d8146104ee5780635673a2211461050d578063600b584b14610591575f80fd5b8063095ea7b31161023d578063095ea7b31461038d5780630d51249b146103a25780631508b8e2146103e75780631e3394fb1461040a57806323b872dd14610429578063271ab5171461043c575f80fd5b8063017e7e581461027957806301ffc9a7146102b557806306fdde031461030157806307d88aad1461034f578063081812fc1461036e575b5f80fd5b348015610284575f80fd5b50600754610298906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b3480156102c0575f80fd5b506102f16102cf366004614538565b6301ffc9a760e09190911c9081146380ac58cd821417635b5e139f9091141790565b60405190151581526020016102ac565b34801561030c575f80fd5b5060408051808201909152601f81527f4d617267696e5a65726f204f7074696f6e204d61726b6574204f544d2046450060208201525b6040516102ac91906145ac565b34801561035a575f80fd5b50600854610298906001600160a01b031681565b348015610379575f80fd5b506102986103883660046145be565b610a17565b6103a061039b3660046145e9565b610a52565b005b3480156103ad575f80fd5b506103d57f000000000000000000000000000000000000000000000000000000000000000681565b60405160ff90911681526020016102ac565b3480156103f2575f80fd5b506103fc60025481565b6040519081526020016102ac565b348015610415575f80fd5b50600554610298906001600160a01b031681565b6103a0610437366004614613565b610a61565b348015610447575f80fd5b506102987f00000000000000000000000025f746bb206041ed8da6f08ed1d32454a5856d3781565b34801561047a575f80fd5b506102f1610489366004614651565b600b60209081525f928352604080842090915290825290205460ff1681565b6103a06104b6366004614613565b610b6d565b3480156104c6575f80fd5b506103d57f000000000000000000000000000000000000000000000000000000000000001281565b3480156104f9575f80fd5b506103a06105083660046146a0565b610b99565b348015610518575f80fd5b506105606105273660046145be565b60096020525f90815260409020805460018201546002928301549192909180820b9163010000008204900b90600160301b900460ff1685565b604080519586526020860194909452600292830b93850193909352900b60608301521515608082015260a0016102ac565b34801561059c575f80fd5b506103a06105ab366004614729565b610f50565b3480156105bb575f80fd5b506102987f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3881565b3480156105ee575f80fd5b506102986105fd3660046145be565b610fc5565b34801561060d575f80fd5b506103a061061c366004614755565b611001565b34801561062c575f80fd5b506103fc61063b366004614755565b6110d6565b34801561064b575f80fd5b506103a061110e565b34801561065f575f80fd5b506102987f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c581565b348015610692575f80fd5b506001546001600160a01b0316610298565b3480156106af575f80fd5b506102f16106be3660046145be565b600e6020525f908152604090205460ff1681565b3480156106dd575f80fd5b5060408051808201909152600c81526b4d5a2d4f4d2d4f544d2d464560a01b6020820152610342565b348015610711575f80fd5b506103a0610720366004614770565b611121565b348015610730575f80fd5b506103a061073f3660046147dd565b6111d6565b34801561074f575f80fd5b506103a061075e366004614729565b6115c6565b34801561076e575f80fd5b5061078261077d366004614813565b611619565b604080516001600160a01b03978816815295871660208701529390951692840192909252600290810b60608401520b608082015260a081019190915260c0016102ac565b3480156107d1575f80fd5b506107e56107e0366004614833565b611682565b6040516102ac91906148a9565b3480156107fd575f80fd5b5061081161080c3660046148b7565b612810565b6040516102ac9190614926565b6103a061082c366004614989565b6128f6565b34801561083c575f80fd5b506102f161084b366004614755565b600d6020525f908152604090205460ff1681565b34801561086a575f80fd5b506103426108793660046145be565b612950565b348015610889575f80fd5b506102987f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d403889481565b3480156108bc575f80fd5b506103a06108cb366004614a20565b6129be565b3480156108db575f80fd5b506103fc6108ea366004614813565b613724565b3480156108fa575f80fd5b50600454610298906001600160a01b031681565b348015610919575f80fd5b506103fc6109283660046145be565b600f6020525f908152604090205481565b348015610944575f80fd5b506103fc610953366004614a56565b6137a8565b348015610963575f80fd5b506102f1610972366004614651565b601c52670a5a2e7a000000006008525f526030600c205490565b348015610997575f80fd5b506103fc6109a6366004614ac4565b6137c6565b3480156109b6575f80fd5b50600654610298906001600160a01b031681565b3480156109d5575f80fd5b506102f16109e4366004614755565b600c6020525f908152604090205460ff1681565b348015610a03575f80fd5b506103a0610a12366004614755565b6137e5565b5f815f52673ec412a9852d173d60c11b601c5260205f2082018201805460601b610a485763ceea21b65f526004601cfd5b6001015492915050565b610a5d338383613824565b5050565b5f818152673ec412a9852d173d60c11b3317601c52602090208101810180546001600160a01b039485169493841693811691908286148302610abc5782610aaf5763ceea21b65f526004601cfd5b63a11481005f526004601cfd5b84610ace5763ea553b345f526004601cfd5b855f528160010154925082331486331417610afa576030600c2054610afa57634b6e7f185f526004601cfd5b8215610b07575f82600101555b85851818905550601c600c81812080545f190190555f84905220805460010163ffffffff8116610b3e576301336cea5f526004601cfd5b90558082847fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef5f38a45b505050565b610b78838383610a61565b813b15610b6857610b6883838360405180602001604052805f8152506138be565b610ba1613947565b6001600160a01b038881165f908152600d60209081526040808320805460ff199081168d151517909155938a168352600c8252808320805485168a1515179055878352600e90915281208054909216841515179091556003829055839003610c1c576040516382ee924160e01b815260040160405180910390fd5b82600f5f8681526020019081526020015f20819055505f8690507f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b0316816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c9c573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610cc09190614af7565b6001600160a01b031614158015610d6857507f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b0316816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d38573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610d5c9190614af7565b6001600160a01b031614155b15610d855760405162820f3560e61b815260040160405180910390fd5b7f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b0316816001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015610deb573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610e0f9190614af7565b6001600160a01b031614158015610eb757507f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b0316816001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e87573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610eab9190614af7565b6001600160a01b031614155b15610ed45760405162820f3560e61b815260040160405180910390fd5b604080516001600160a01b038b811682528a1515602083015289168183015287151560608201526080810187905260a0810186905284151560c082015260e0810184905290517fef14ffdf10adf830963eb3e930628d3f16624558826d02369483d63dc1224c09918190036101000190a1505050505050505050565b335f818152600b602090815260408083206001600160a01b03871680855290835292819020805460ff1916861515908117909155815194855291840192909252908201527f4ee86bb98ad0d189c6475dd48829e8525e468f3721ab971f0c0914e6693c8da69060600160405180910390a15050565b5f818152673ec412a9852d173d60c11b601c526020902081018101546001600160a01b031680610ffc5763ceea21b65f526004601cfd5b919050565b611009613947565b6040516370a0823160e01b81523060048201526001600160a01b0382169063a9059cbb90339083906370a0823190602401602060405180830381865afa158015611055573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906110799190614b12565b6040518363ffffffff1660e01b8152600401611096929190614b29565b6020604051808303815f875af11580156110b2573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610a5d9190614b42565b5f816110e957638f4eb6045f526004601cfd5b673ec412a9852d173d60c11b601c52815f5263ffffffff601c600c2054169050919050565b611116613947565b61111f5f613974565b565b611129613947565b600780546001600160a01b038781166001600160a01b0319928316811790935560088054888316908416811790915560048054888416908516811790915560058054888516908616811790915560068054948816949095169390931790935560408051948552602085019190915283019190915260608201527f2a38eeb7b477d2d02f8c59437e9493ed71a5c5a1d426dfd40446830348acf8909060800160405180910390a15050505050565b6111de6139c5565b600160025f8282546111f09190614b71565b909155503390506112018235610fc5565b6001600160a01b03161461122b57604051600162486bc960e11b0319815260040160405180910390fd5b80355f90815260096020908152604091829020825160a0810184528154815260018201549281019290925260029081015480820b838501526301000000810490910b6060830152600160301b900460ff16151560808201529061129090830183614b84565b82511490506112b257604051630dcb503560e11b815260040160405180910390fd5b42816020015110156112d757604051630407b05b60e31b815260040160405180910390fd5b5f5b6112e66040840184614b84565b905081101561149e5782355f908152600a6020526040812080548390811061131057611310614bd0565b905f5260205f209060040201905083806040019061132e9190614b84565b8381811061133e5761133e614bd0565b90506020020135816003015f8282546113579190614be4565b9091555050600280545f908152600a6020908152604091829020825160c08101845285546001600160a01b03908116825260018701548116938201939093528585015492831681850152600160a01b8304850b6060820152600160b81b90920490930b60808201529060a08201906113d190880188614b84565b868181106113e1576113e1614bd0565b602090810292909201359092528354600180820186555f95865294829020845160049092020180546001600160a01b03199081166001600160a01b0393841617825592850151818701805490941690831617909255604084015160028301805460608701516080880151939094166001600160b81b031990911617600160a01b62ffffff948516021762ffffff60b81b1916600160b81b939092169290920217905560a090920151600390920191909155509190910190506112d9565b506040518060a001604052808380604001906114ba9190614b84565b82525060208381015181830152604080850151600290810b82850152606080870151820b8186015260808088015115159581019590955281545f908152600985528390208651815586850151600182015586840151920180549187015196909501511515600160301b0266ff0000000000001962ffffff97881663010000000265ffffffffffff1990931697909316969096171716939093179091556115719161156991908501908501614755565b6002546139ed565b7f44b72a7e3474ccca11170d15b3e7a2f31bc170284829bdec3e017198cfff6d5f826002546115a2855f0135610fc5565b6040516115b193929190614c27565b60405180910390a1506115c360015f55565b50565b801515905081601c52670a5a2e7a00000000600852335f52806030600c2055805f528160601b60601c337f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160205fa35050565b600a602052815f5260405f208181548110611632575f80fd5b5f9182526020909120600490910201805460018201546002808401546003909401546001600160a01b039384169650918316945091831692600160a01b8104830b92600160b81b909104900b9086565b6040805160a0810182525f808252602082018190529181018290526060810182905260808101919091526116b46139c5565b81355f90815260096020908152604091829020825160a0810184528154815260018201549281019290925260029081015480820b9383019390935263010000008304900b606080830191909152600160301b90920460ff16151560808201529061172090840184614b84565b825114905061174257604051630dcb503560e11b815260040160405180910390fd5b806020015142106117885760016080830152335f908152600d602052604090205460ff1661178357604051630184bf0960e01b815260040160405180910390fd5b6117fe565b336117938435610fc5565b6001600160a01b0316141580156117dd5750600b5f6117b28535610fc5565b6001600160a01b0316815260208082019290925260409081015f90812033825290925290205460ff16155b156117fe57604051600162486bc960e11b0319815260040160405180910390fd5b5f81608001516118c1577f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946001600160a01b03167f00000000000000000000000025f746bb206041ed8da6f08ed1d32454a5856d376001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801561188e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906118b29190614af7565b6001600160a01b031614611976565b7f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03167f00000000000000000000000025f746bb206041ed8da6f08ed1d32454a5856d376001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015611947573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061196b9190614af7565b6001600160a01b0316145b905081608001516119a7577f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388946119c9565b7f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad385b6001600160a01b031660408401526080820151611a06577f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38611a28565b7f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d40388945b6001600160a01b031660608401525f5b82518110156127b057611a4e6060860186614b84565b82818110611a5e57611a5e614bd0565b905060200201355f03156127a85784355f908152600a60205260408120805483908110611a8d57611a8d614bd0565b5f918252602082206004909102019150611aaa6060880188614b84565b84818110611aba57611aba614bd0565b9050602002013590505f80611b1f611ae7856001015f9054906101000a90046001600160a01b0316613a06565b600280870154611b0091600160a01b909104900b613a9d565b600280880154611b1991600160b81b909104900b613a9d565b86613db8565b915091505f82118015611b30575080155b80611b4357505f81118015611b43575081155b1561214a57858015611b5457505f82115b8015611b665750608088015115156001145b15611c185787604001516001600160a01b031663095ea7b37f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5846040518363ffffffff1660e01b8152600401611bbd929190614b29565b6020604051808303815f875af1158015611bd9573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611bfd9190614b42565b508188602001818151611c109190614b71565b9052506125f5565b85158015611c2557505f81115b8015611c375750608088015115156001145b15611ce15787604001516001600160a01b031663095ea7b37f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5836040518363ffffffff1660e01b8152600401611c8e929190614b29565b6020604051808303815f875af1158015611caa573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611cce9190614b42565b508088602001818151611c109190614b71565b5f86611d2757600280860154611d2291611d0391600160a01b9004900b613a9d565b600280880154611d1c91600160b81b909104900b613a9d565b86613e53565b611d62565b600280860154611d6291611d4391600160a01b9004900b613a9d565b600280880154611d5c91600160b81b909104900b613a9d565b86613e95565b90508089602001818151611d769190614b71565b90525060608901516040516370a0823160e01b81523060048201525f916001600160a01b0316906370a0823190602401602060405180830381865afa158015611dc1573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611de59190614b12565b60408b01519091506001600160a01b031663a9059cbb611e0860208e018e614b84565b8a818110611e1857611e18614bd0565b9050602002016020810190611e2d9190614755565b846040518363ffffffff1660e01b8152600401611e4b929190614b29565b6020604051808303815f875af1158015611e67573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611e8b9190614b42565b50611e9960208c018c614b84565b88818110611ea957611ea9614bd0565b9050602002016020810190611ebe9190614755565b6001600160a01b031663f3be6fc28b604001518c60600151858f8060400190611ee79190614b84565b8d818110611ef757611ef7614bd0565b9050602002810190611f099190614cc6565b6040518663ffffffff1660e01b8152600401611f29959493929190614d08565b6020604051808303815f875af1158015611f45573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190611f699190614b12565b505f88611fb057600280880154611fab91611f8c91600160a01b9004900b613a9d565b6002808a0154611fa591600160b81b909104900b613a9d565b88613e95565b611feb565b600280880154611feb91611fcc91600160a01b9004900b613a9d565b6002808a0154611fe591600160b81b909104900b613a9d565b88613e53565b60608c01516040516370a0823160e01b81523060048201529192505f916001600160a01b03909116906370a0823190602401602060405180830381865afa158015612038573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061205c9190614b12565b90506120688284614b71565b811015612088576040516360e710f160e01b815260040160405180910390fd5b8b606001516001600160a01b031663095ea7b37f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5846040518363ffffffff1660e01b81526004016120da929190614b29565b6020604051808303815f875af11580156120f6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061211a9190614b42565b506121258284614b71565b61212f9082614be4565b8c518d9061213e908390614b71565b905250505050506125f5565b85801561215d5750608088015115156001145b156123a15787604001516001600160a01b031663095ea7b37f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5846040518363ffffffff1660e01b81526004016121b4929190614b29565b6020604051808303815f875af11580156121d0573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906121f49190614b42565b5087606001516001600160a01b031663095ea7b37f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5836040518363ffffffff1660e01b8152600401612247929190614b29565b6020604051808303815f875af1158015612263573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906122879190614b42565b506002808501545f916122a791611d4391600160a01b909104900b613a9d565b60608a01516040516323b872dd60e01b81529192506001600160a01b0316906323b872dd906122de90339030908790600401614d58565b6020604051808303815f875af11580156122fa573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061231e9190614b42565b5060408901516001600160a01b031663a9059cbb3361233d8685614be4565b6040518363ffffffff1660e01b815260040161235a929190614b29565b6020604051808303815f875af1158015612376573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061239a9190614b42565b50506125f5565b851580156123b55750608088015115156001145b156125f55787604001516001600160a01b031663095ea7b37f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5836040518363ffffffff1660e01b815260040161240c929190614b29565b6020604051808303815f875af1158015612428573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061244c9190614b42565b5087606001516001600160a01b031663095ea7b37f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5846040518363ffffffff1660e01b815260040161249f929190614b29565b6020604051808303815f875af11580156124bb573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906124df9190614b42565b506002808501545f916124ff91611d0391600160a01b909104900b613a9d565b60608a01516040516323b872dd60e01b81529192506001600160a01b0316906323b872dd9061253690339030908890600401614d58565b6020604051808303815f875af1158015612552573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125769190614b42565b5060408901516001600160a01b031663a9059cbb336125958585614be4565b6040518363ffffffff1660e01b81526004016125b2929190614b29565b6020604051808303815f875af11580156125ce573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906125f29190614b42565b50505b60018401546002808601546040515f936001600160a01b039081169390831692600160a01b8104820b92600160b81b90910490910b9088906126449060200160208082525f9082015260400190565b60408051601f1981840301815290829052612666969594939291602001614d7c565b60408051601f1981840301815290829052865463d5256ca360e01b83529092506001600160a01b037f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c581169263d5256ca3926126c89216908590600401614dc0565b5f604051808303815f875af11580156126e3573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f1916820160405261270a9190810190614eb3565b505088511561278a576060890151895160405163a9059cbb60e01b81526001600160a01b039092169163a9059cbb9161274891339190600401614b29565b6020604051808303815f875af1158015612764573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906127889190614b42565b505b83856003015f82825461279d9190614be4565b909155505050505050505b600101611a38565b507f15171d5e55f89523d32cad253e2cc81847991a01581eb370494379e025b170ec836127e06060870187614b84565b6127ea8835610fc5565b6040516127fd94939291908a3590614ef6565b60405180910390a15050610ffc60015f55565b604080515f815260208101909152606090826001600160401b0381111561283957612839614de3565b60405190808252806020026020018201604052801561286c57816020015b60608152602001906001900390816128575790505b5091505f5b838110156128ed576128c83086868481811061288f5761288f614bd0565b90506020028101906128a19190614cc6565b856040516020016128b493929190614f35565b604051602081830303815290604052613f03565b8382815181106128da576128da614bd0565b6020908102919091010152600101612871565b50505b92915050565b612901858585610a61565b833b156129495761294985858585858080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506138be92505050565b5050505050565b6008546040516373ea766160e01b8152600481018390526060916001600160a01b0316906373ea7661906024015f60405180830381865afa158015612997573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526128f09190810190614f5a565b6129c66139c5565b600160025f8282546129d89190614b71565b90915550601490506129ea8280614fe0565b90501115612a0b57604051636c9735f760e11b815260040160405180910390fd5b6020808201355f908152600e909152604090205460ff16612a3f576040516398ac918960e01b815260040160405180910390fd5b6020808201355f818152600f9092526040822054612a5d9042614be4565b612a679190615038565b612a75906020840135614be4565b612a7f9042614b71565b90506003548260200135612a939190614be4565b612a9d4283614be4565b1115612abc57604051634046db7560e01b815260040160405180910390fd5b5f612ac78380614fe0565b90506001600160401b03811115612ae057612ae0614de3565b604051908082528060200260200182016040528015612b09578160200160208202803683370190505b5090505f8080612b1f60c0870160a0880161504b565b612b49577f00000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894612b6b565b7f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad385b6040805160c0810182525f80825260208201819052918101829052606081018290526080810182905260a081018290529192505b612ba98880614fe0565b905081101561308857612bbc8880614fe0565b82818110612bcc57612bcc614bd0565b905060c00201803603810190612be29190615066565b9150612bf460c0890160a08a0161504b565b612c1d57816060015160020b886060016020810190612c139190615105565b60020b1415612c3e565b816080015160020b886080016020810190612c389190615105565b60020b14155b15612c5c57604051631759c67760e01b815260040160405180910390fd5b600280545f908152600a60209081526040808320815160c08101835287516001600160a01b039081168252888501805182168387019081528a86015183168487019081526060808d01518b0b9086019081526080808e01518c0b90870190815260a0808f0151908801908152885460018181018b55998d528b8d209851600490910290980180549888166001600160a01b0319998a16178155945198850180549988169990981698909817909655905199820180549151955162ffffff908116600160b81b0262ffffff60b81b1991909716600160a01b026001600160b81b03199093169b86169b909b17919091179990991693909317909755915160039091015593519093168252600c9052205460ff16612d8b576040516336cc3cab60e21b815260040160405180910390fd5b5f82602001518360400151846060015185608001518660a00151308d8f60a0016020810190612dba919061504b565b6020808c015160608d015160808e015160a08f0151604051612e2098979695016001600160a01b03978816815260208101969096529315156040860152919094166060840152600293840b608084015290920b60a082015260c081019190915260e00190565b60408051601f1981840301815290829052612e42969594939291602001614d7c565b60408051601f198184030181529082905284516339ef369360e21b83529092505f9182916001600160a01b037f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5169163e7bcda4c91612ea5918790600401614dc0565b5f604051808303815f875af1158015612ec0573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f19168201604052612ee7919081019061511e565b5091509150856001600160a01b0316825f81518110612f0857612f08614bd0565b60200260200101516001600160a01b031603612fcf575f815f81518110612f3157612f31614bd0565b6020026020010151118015612f5f575080600181518110612f5457612f54614bd0565b60200260200101515f145b612f67575f80fd5b805f81518110612f7957612f79614bd0565b6020026020010151898581518110612f9357612f93614bd0565b602002602001018181525050805f81518110612fb157612fb1614bd0565b602002602001015188612fc49190614b71565b97506001965061307d565b5f81600181518110612fe357612fe3614bd0565b60200260200101511180156130105750805f8151811061300557613005614bd0565b60200260200101515f145b613018575f80fd5b8060018151811061302b5761302b614bd0565b602002602001015189858151811061304557613045614bd0565b6020026020010181815250508060018151811061306457613064614bd0565b6020026020010151886130779190614b71565b97505f96505b505050600101612b9f565b505f6130e27f00000000000000000000000025f746bb206041ed8da6f08ed1d32454a5856d376130be60c08b0160a08c0161504b565b6130d2576109a660808b0160608c01615105565b6109a660a08b0160808c01615105565b90505f61326c83604001518a60a0016020810190613100919061504b565b61310b57600161310d565b5f5b60065460405163322092f560e21b81528c9160208f01359188916001600160a01b03169063c8824bd4906131cb907f00000000000000000000000025f746bb206041ed8da6f08ed1d32454a5856d37907f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38907f0000000000000000000000000000000000000000000000000000000000000012906004016001600160a01b03938416815291909216602082015260ff91909116604082015260600190565b602060405180830381865afa1580156131e6573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061320a9190614b12565b8f60a001602081019061321d919061504b565b613266578861324d7f0000000000000000000000000000000000000000000000000000000000000006600a6152d1565b613257908f6152df565b61326191906152f6565b613f75565b8c613f75565b9050805f0361328e57604051638c18744360e01b815260040160405180910390fd5b6007545f906001600160a01b031615613325576132ab8783613724565b6007546040516323b872dd60e01b81529192506001600160a01b03808816926323b872dd926132e39233929116908690600401614d58565b6020604051808303815f875af11580156132ff573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906133239190614b42565b505b60408a01356133348284614b71565b111561335357604051630bea79f960e11b815260040160405180910390fd5b6040516323b872dd60e01b81526001600160a01b038616906323b872dd9061338390339030908790600401614d58565b6020604051808303815f875af115801561339f573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906133c39190614b42565b5060405163095ea7b360e01b81526001600160a01b0386169063095ea7b390613412907f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5908690600401614b29565b6020604051808303815f875af115801561342e573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906134529190614b42565b505f5b61345f8b80614fe0565b90508110156135ea576134728b80614fe0565b8281811061348257613482614bd0565b905060c002018036038101906134989190615066565b94505f88848b84815181106134af576134af614bd0565b60200260200101516134c191906152df565b6134cb91906152f6565b90505f86602001518760400151886060015189608001518c6134ed575f6134ef565b855b8d6134fa57866134fc565b5f5b6040516020016135169060208082525f9082015260400190565b60408051601f198184030181529082905261353997969594939291602001615309565b60408051601f198184030181529082905288516304e94bdb60e51b83529092506001600160a01b037f000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c51691639d297b6091613598918590600401614dc0565b5f604051808303815f875af11580156135b3573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526135da9190810190614eb3565b5050600190920191506134559050565b506040805160a08101909152806136018c80614fe0565b825250602081018b905260400161361e60808d0160608e01615105565b60020b815260200161363660a08d0160808e01615105565b60020b815260200161364e60c08d0160a08e0161504b565b15159052600280545f908152600960209081526040918290208451815590840151600182015590830151908201805460608501516080909501511515600160301b0266ff0000000000001962ffffff96871663010000000265ffffffffffff199093169690941695909517179190911692909217909155546136d19033906139ed565b7f17d317786006ee80c691dec9221cbf7d2b913ee2cb0d426e29d6e03fadac16778a600254848a8560405161370a95949392919061540d565b60405180910390a15050505050505050506115c360015f55565b60048054604051637669909560e01b8152309281019290925260248201849052604482018390525f916001600160a01b0390911690637669909590606401602060405180830381865afa15801561377d573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906137a19190614b12565b9392505050565b5f6137b888888888888888613f75565b90505b979650505050505050565b5f806137d183613a9d565b90506137dd84826140d7565b949350505050565b6137ed613947565b6001600160a01b03811661381b57604051631e4fbdf760e01b81525f60048201526024015b60405180910390fd5b6115c381613974565b5f1960601c82811692508381169350815f5283673ec412a9852d173d60c11b17601c5260205f2082018201805482169150816138675763ceea21b65f526004601cfd5b81851485151761388b57815f526030600c205461388b57634b6e7f185f526004601cfd5b6001018390558183827f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9255f38a450505050565b60405163150b7a028082523360208301528560601b60601c604083015283606083015260808083015282518060a08401528015613905578060c08401826020870160045afa505b60208360a48301601c86015f8a5af1613926573d15613926573d5f843e3d83fd5b508060e01b82511461393f5763d1a57ed65f526004601cfd5b505050505050565b6001546001600160a01b0316331461111f5760405163118cdaa760e01b8152336004820152602401613812565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b60025f54036139e757604051633ee5aeb560e01b815260040160405180910390fd5b60025f55565b610a5d828260405180602001604052805f815250614345565b60408051600481526024810182526020810180516001600160e01b0316633850c7bd60e01b17905290515f9182916001600160a01b03851691613a48916154f1565b5f60405180830381855afa9150503d805f8114613a80576040519150601f19603f3d011682016040523d82523d5f602084013e613a85565b606091505b50915050808060200190518101906137a19190614af7565b5f805f8360020b12613ab2578260020b613ab9565b8260020b5f035b9050620d89e8811115613adf576040516315e4079d60e11b815260040160405180910390fd5b5f816001165f03613af457600160801b613b06565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615613b3a576ffff97272373d413259a46990580e213a0260801c5b6004821615613b59576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615613b78576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615613b97576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615613bb6576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615613bd5576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615613bf4576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615613c14576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615613c34576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615613c54576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615613c74576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615613c94576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615613cb4576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615613cd4576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615613cf4576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615613d15576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615613d35576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615613d54576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615613d71576b048a170391f7dc42444e8fa20260801c5b5f8460020b1315613d9057805f1981613d8c57613d8c615024565b0490505b640100000000810615613da4576001613da6565b5f5b60ff16602082901c0192505050919050565b5f80836001600160a01b0316856001600160a01b03161115613dd8579293925b846001600160a01b0316866001600160a01b031611613e0357613dfc858585613e95565b9150613e4a565b836001600160a01b0316866001600160a01b03161015613e3c57613e28868585613e95565b9150613e35858785613e53565b9050613e4a565b613e47858585613e53565b90505b94509492505050565b5f826001600160a01b0316846001600160a01b03161115613e72579192915b6137dd826001600160801b03168585036001600160a01b0316600160601b614362565b5f826001600160a01b0316846001600160a01b03161115613eb4579192915b836001600160a01b0316613eed606060ff16846001600160801b0316901b8686036001600160a01b0316866001600160a01b0316614362565b81613efa57613efa615024565b04949350505050565b60605f80846001600160a01b031684604051613f1f91906154f1565b5f60405180830381855af49150503d805f8114613f57576040519150601f19603f3d011682016040523d82523d5f602084013e613f5c565b606091505b5091509150613f6c85838361440c565b95945050505050565b5f8087613fac57613fa77f0000000000000000000000000000000000000000000000000000000000000012600a6152d1565b613fd7565b613fd77f0000000000000000000000000000000000000000000000000000000000000006600a6152d1565b60055460405163641ffd6960e11b81526001600160a01b038c811660048301528b15156024830152604482018b9052606482018a90526084820189905260a482018890529091169063c83ffad29060c401602060405180830381865afa158015614043573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906140679190614b12565b61407190856152df565b61407b91906152f6565b9050871561408a5790506137bb565b836140b67f0000000000000000000000000000000000000000000000000000000000000012600a6152d1565b6140c090836152df565b6140ca91906152f6565b9998505050505050505050565b5f6001600160801b036001600160a01b0383161161421c575f6141036001600160a01b038416806152df565b9050836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015614141573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906141659190614af7565b6001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b0316146141db576141d6600160c01b6141d07f0000000000000000000000000000000000000000000000000000000000000012600a6152d1565b83614362565b614214565b6142148161420a7f0000000000000000000000000000000000000000000000000000000000000012600a6152d1565b600160c01b614362565b9150506128f0565b5f61423a6001600160a01b0384168068010000000000000000614362565b9050836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa158015614278573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061429c9190614af7565b6001600160a01b03167f000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad386001600160a01b03161461430c57614307600160801b6141d07f0000000000000000000000000000000000000000000000000000000000000012600a6152d1565b6137dd565b6137dd8161433b7f0000000000000000000000000000000000000000000000000000000000000012600a6152d1565b600160801b614362565b61434f8383614468565b823b15610b6857610b685f8484846138be565b5f80805f19858709858702925082811083820303915050805f03614396575f841161438b575f80fd5b5082900490506137a1565b8084116143a1575f80fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b6060826144215761441c8261450f565b6137a1565b815115801561443857506001600160a01b0384163b155b1561446157604051639996b31560e01b81526001600160a01b0385166004820152602401613812565b50806137a1565b6001600160a01b0390911690816144865763ea553b345f526004601cfd5b805f52673ec412a9852d173d60c11b601c5260205f208101810180548060601b156144b85763c991cbb15f526004601cfd5b831790555f829052601c600c20805460010163ffffffff81166144e2576301336cea5f526004601cfd5b905580825f7fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef8138a45050565b80511561451f5780518082602001fd5b604051630a12f52160e11b815260040160405180910390fd5b5f60208284031215614548575f80fd5b81356001600160e01b0319811681146137a1575f80fd5b5f5b83811015614579578181015183820152602001614561565b50505f910152565b5f815180845261459881602086016020860161455f565b601f01601f19169290920160200192915050565b602081525f6137a16020830184614581565b5f602082840312156145ce575f80fd5b5035919050565b6001600160a01b03811681146115c3575f80fd5b5f80604083850312156145fa575f80fd5b8235614605816145d5565b946020939093013593505050565b5f805f60608486031215614625575f80fd5b8335614630816145d5565b92506020840135614640816145d5565b929592945050506040919091013590565b5f8060408385031215614662575f80fd5b823561466d816145d5565b9150602083013561467d816145d5565b809150509250929050565b80151581146115c3575f80fd5b8035610ffc81614688565b5f805f805f805f80610100898b0312156146b8575f80fd5b88356146c3816145d5565b975060208901356146d381614688565b965060408901356146e3816145d5565b955060608901356146f381614688565b94506080890135935060a0890135925060c089013561471181614688565b979a969950949793969295919450919260e001359150565b5f806040838503121561473a575f80fd5b8235614745816145d5565b9150602083013561467d81614688565b5f60208284031215614765575f80fd5b81356137a1816145d5565b5f805f805f60a08688031215614784575f80fd5b853561478f816145d5565b9450602086013561479f816145d5565b935060408601356147af816145d5565b925060608601356147bf816145d5565b915060808601356147cf816145d5565b809150509295509295909350565b5f602082840312156147ed575f80fd5b81356001600160401b03811115614802575f80fd5b8201606081850312156137a1575f80fd5b5f8060408385031215614824575f80fd5b50508035926020909101359150565b5f60208284031215614843575f80fd5b81356001600160401b03811115614858575f80fd5b8201608081850312156137a1575f80fd5b80518252602080820151908301526040808201516001600160a01b0390811691840191909152606080830151909116908301526080908101511515910152565b60a081016128f08284614869565b5f80602083850312156148c8575f80fd5b82356001600160401b038111156148dd575f80fd5b8301601f810185136148ed575f80fd5b80356001600160401b03811115614902575f80fd5b8560208260051b8401011115614916575f80fd5b6020919091019590945092505050565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b8281101561497d57603f19878603018452614968858351614581565b9450602093840193919091019060010161494c565b50929695505050505050565b5f805f805f6080868803121561499d575f80fd5b85356149a8816145d5565b945060208601356149b8816145d5565b93506040860135925060608601356001600160401b038111156149d9575f80fd5b8601601f810188136149e9575f80fd5b80356001600160401b038111156149fe575f80fd5b886020828401011115614a0f575f80fd5b959894975092955050506020019190565b5f60208284031215614a30575f80fd5b81356001600160401b03811115614a45575f80fd5b820160c081850312156137a1575f80fd5b5f805f805f805f60e0888a031215614a6c575f80fd5b8735614a77816145d5565b96506020880135614a8781614688565b96999698505050506040850135946060810135946080820135945060a0820135935060c0909101359150565b8035600281900b8114610ffc575f80fd5b5f8060408385031215614ad5575f80fd5b8235614ae0816145d5565b9150614aee60208401614ab3565b90509250929050565b5f60208284031215614b07575f80fd5b81516137a1816145d5565b5f60208284031215614b22575f80fd5b5051919050565b6001600160a01b03929092168252602082015260400190565b5f60208284031215614b52575f80fd5b81516137a181614688565b634e487b7160e01b5f52601160045260245ffd5b808201808211156128f0576128f0614b5d565b5f808335601e19843603018112614b99575f80fd5b8301803591506001600160401b03821115614bb2575f80fd5b6020019150600581901b3603821315614bc9575f80fd5b9250929050565b634e487b7160e01b5f52603260045260245ffd5b818103818111156128f0576128f0614b5d565b8183525f6001600160fb1b03831115614c0e575f80fd5b8260051b80836020870137939093016020019392505050565b60608082528435908201525f6020850135614c41816145d5565b6001600160a01b03166080830152604085013536869003601e19018112614c66575f80fd5b85016020810190356001600160401b03811115614c81575f80fd5b8060051b3603821315614c92575f80fd5b606060a0850152614ca760c085018284614bf7565b925050508360208301526137dd60408301846001600160a01b03169052565b5f808335601e19843603018112614cdb575f80fd5b8301803591506001600160401b03821115614cf4575f80fd5b602001915036819003821315614bc9575f80fd5b6001600160a01b03868116825285166020820152604081018490526080606082018190528101829052818360a08301375f81830160a090810191909152601f909201601f19160101949350505050565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b03878116825286166020820152600285810b604083015284900b60608201526080810183905260c060a082018190525f906137b890830184614581565b6001600160a01b03831681526040602082018190525f906137dd90830184614581565b634e487b7160e01b5f52604160045260245ffd5b604051601f8201601f191681016001600160401b0381118282101715614e1f57614e1f614de3565b604052919050565b5f6001600160401b03821115614e3f57614e3f614de3565b5060051b60200190565b5f82601f830112614e58575f80fd5b8151614e6b614e6682614e27565b614df7565b8082825260208201915060208360051b860101925085831115614e8c575f80fd5b602085015b83811015614ea9578051835260209283019201614e91565b5095945050505050565b5f8060408385031215614ec4575f80fd5b82516001600160401b03811115614ed9575f80fd5b614ee585828601614e49565b602094909401519395939450505050565b614f008187614869565b61010060a08201525f614f1861010083018688614bf7565b6001600160a01b039490941660c08301525060e001529392505050565b828482375f8382015f81528351614f5081836020880161455f565b0195945050505050565b5f60208284031215614f6a575f80fd5b81516001600160401b03811115614f7f575f80fd5b8201601f81018413614f8f575f80fd5b80516001600160401b03811115614fa857614fa8614de3565b614fbb601f8201601f1916602001614df7565b818152856020838501011115614fcf575f80fd5b613f6c82602083016020860161455f565b5f808335601e19843603018112614ff5575f80fd5b8301803591506001600160401b0382111561500e575f80fd5b602001915060c081023603821315614bc9575f80fd5b634e487b7160e01b5f52601260045260245ffd5b5f8261504657615046615024565b500690565b5f6020828403121561505b575f80fd5b81356137a181614688565b5f60c0828403128015615077575f80fd5b5060405160c081016001600160401b038111828210171561509a5761509a614de3565b60405282356150a8816145d5565b815260208301356150b8816145d5565b602082015260408301356150cb816145d5565b60408201526150dc60608401614ab3565b60608201526150ed60808401614ab3565b608082015260a0928301359281019290925250919050565b5f60208284031215615115575f80fd5b6137a182614ab3565b5f805f60608486031215615130575f80fd5b83516001600160401b03811115615145575f80fd5b8401601f81018613615155575f80fd5b8051615163614e6682614e27565b8082825260208201915060208360051b850101925088831115615184575f80fd5b6020840193505b828410156151af57835161519e816145d5565b82526020938401939091019061518b565b8096505050505060208401516001600160401b038111156151ce575f80fd5b6151da86828701614e49565b604095909501519396949550929392505050565b6001815b60018411156152295780850481111561520d5761520d614b5d565b600184161561521b57908102905b60019390931c9280026151f2565b935093915050565b5f8261523f575060016128f0565b8161524b57505f6128f0565b8160018114615261576002811461526b57615287565b60019150506128f0565b60ff84111561527c5761527c614b5d565b50506001821b6128f0565b5060208310610133831016604e8410600b84101617156152aa575081810a6128f0565b6152b65f1984846151ee565b805f19048211156152c9576152c9614b5d565b029392505050565b5f6137a160ff841683615231565b80820281158282048414176128f0576128f0614b5d565b5f8261530457615304615024565b500490565b6001600160a01b03888116825287166020820152600286810b604083015285900b60608201526080810184905260a0810183905260e060c082018190525f906140ca90830184614581565b8183526020830192505f815f5b84811015615403578135615374816145d5565b6001600160a01b03168652602082013561538d816145d5565b6001600160a01b0316602087015260408201356153a9816145d5565b6001600160a01b031660408701526153c360608301614ab3565b60020b60608701526153d760808301614ab3565b6153e6608088018260020b9052565b5060a0828101359087015260c09586019590910190600101615361565b5093949350505050565b60a081525f8635601e19883603018112615425575f80fd5b87016020810190356001600160401b03811115615440575f80fd5b60c081023603821315615451575f80fd5b60c060a085015261546761016085018284615354565b60208a013560c086015260408a013560e0860152915061548b905060608901614ab3565b61549b61010085018260020b9052565b506154a860808901614ab3565b6154b861012085018260020b9052565b506154c560a08901614695565b151561014084015260208301969096525060408101939093526060830191909152608090910152919050565b5f825161550281846020870161455f565b919091019291505056fea26469706673582212203163ea3cbc8670a99542db70b0c2651f62bced5c6a7340464dd74c4b71c092ad64736f6c634300081a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5000000000000000000000000ba49d0e7bb755c1f40b7675c6474558f9f06b301000000000000000000000000fd5fd368322e229a8378c9a8df4d1450f488e8d5000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad3800000000000000000000000029219dd400f2bf60e5a23d13be72b486d403889400000000000000000000000025f746bb206041ed8da6f08ed1d32454a5856d370000000000000000000000001a2010e66e65ada65accf8c2b60c7b40a155089b
-----Decoded View---------------
Arg [0] : _pm (address): 0xC87520C85c56Eb83122ABA145912A5F7a7f927c5
Arg [1] : _optionPricing (address): 0xBA49d0E7Bb755c1f40b7675c6474558F9F06B301
Arg [2] : _dpFee (address): 0xfd5FD368322E229a8378C9A8df4D1450F488E8D5
Arg [3] : _callAsset (address): 0x039e2fB66102314Ce7b64Ce5Ce3E5183bc94aD38
Arg [4] : _putAsset (address): 0x29219dd400f2Bf60E5a23d13Be72B486D4038894
Arg [5] : _primePool (address): 0x25f746bB206041Ed8dA6F08Ed1D32454A5856D37
Arg [6] : _verifiedSpotPrice (address): 0x1A2010e66E65adA65ACcf8c2B60C7b40A155089b
-----Encoded View---------------
7 Constructor Arguments found :
Arg [0] : 000000000000000000000000c87520c85c56eb83122aba145912a5f7a7f927c5
Arg [1] : 000000000000000000000000ba49d0e7bb755c1f40b7675c6474558f9f06b301
Arg [2] : 000000000000000000000000fd5fd368322e229a8378c9a8df4d1450f488e8d5
Arg [3] : 000000000000000000000000039e2fb66102314ce7b64ce5ce3e5183bc94ad38
Arg [4] : 00000000000000000000000029219dd400f2bf60e5a23d13be72b486d4038894
Arg [5] : 00000000000000000000000025f746bb206041ed8da6f08ed1d32454a5856d37
Arg [6] : 0000000000000000000000001a2010e66e65ada65accf8c2b60c7b40a155089b
[ Download: CSV Export ]
A token is a representation of an on-chain or off-chain asset. The token page shows information such as price, total supply, holders, transfers and social links. Learn more about this page in our Knowledge Base.