Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
PriceFeed
Compiler Version
v0.8.4+commit.c7e474f2
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Inheritance import "../utils/proxy/solidity-0.8.0/ProxyOwned.sol"; import "../utils/libraries/UniswapMath.sol"; // Libraries import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol"; import "@openzeppelin/contracts-4.4.1/utils/math/SafeMath.sol"; // Internal references // AggregatorInterface from Chainlink represents a decentralized pricing network for a single currency key import "@chainlink/contracts-0.0.10/src/v0.5/interfaces/AggregatorV2V3Interface.sol"; import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; contract PriceFeed is Initializable, ProxyOwned { using SafeMath for uint; // Decentralized oracle networks that feed into pricing aggregators mapping(bytes32 => AggregatorV2V3Interface) public aggregators; mapping(bytes32 => uint8) public currencyKeyDecimals; bytes32[] public aggregatorKeys; // List of currency keys for convenient iteration bytes32[] public currencyKeys; mapping(bytes32 => IUniswapV3Pool) public pools; int56 public twapInterval; struct RateAndUpdatedTime { uint216 rate; uint40 time; } address public _ETH; address public _wETH; mapping(bytes32 => bool) public useLastTickForTWAP; mapping(bytes32 => RateAndUpdatedTime) public staticPricePerAsset; function initialize(address _owner) external initializer { setOwner(_owner); twapInterval = 300; } /* ========== MUTATIVE FUNCTIONS ========== */ function addAggregator(bytes32 currencyKey, address aggregatorAddress) external onlyOwner { AggregatorV2V3Interface aggregator = AggregatorV2V3Interface(aggregatorAddress); require(aggregator.latestRound() >= 0, "Given Aggregator is invalid"); uint8 decimals = aggregator.decimals(); require(decimals <= 18, "Aggregator decimals should be lower or equal to 18"); if (address(aggregators[currencyKey]) == address(0)) { currencyKeys.push(currencyKey); } aggregators[currencyKey] = aggregator; currencyKeyDecimals[currencyKey] = decimals; emit AggregatorAdded(currencyKey, address(aggregator)); } function addPool( bytes32 currencyKey, address currencyAddress, address poolAddress ) external onlyOwner { // check if aggregator exists for given currency key AggregatorV2V3Interface aggregator = aggregators[currencyKey]; require(address(aggregator) == address(0), "Aggregator already exists for key"); IUniswapV3Pool pool = IUniswapV3Pool(poolAddress); address token0 = pool.token0(); address token1 = pool.token1(); bool token0valid = token0 == _wETH || token0 == _ETH; bool token1valid = token1 == _wETH || token1 == _ETH; // check if one of tokens is wETH or ETH require(token0valid || token1valid, "Pool not valid: ETH is not an asset"); // check if currency is asset in given require(currencyAddress == token0 || currencyAddress == token1, "Pool not valid: currency is not an asset"); (uint160 sqrtPriceX96, , , , , , ) = pool.slot0(); require(sqrtPriceX96 > 0, "Pool not valid"); if (address(pools[currencyKey]) == address(0)) { currencyKeys.push(currencyKey); } pools[currencyKey] = pool; currencyKeyDecimals[currencyKey] = 18; emit PoolAdded(currencyKey, address(pool)); } function removeAggregator(bytes32 currencyKey) external onlyOwner { address aggregator = address(aggregators[currencyKey]); require(aggregator != address(0), "No aggregator exists for key"); delete aggregators[currencyKey]; delete currencyKeyDecimals[currencyKey]; bool wasRemoved = removeFromArray(currencyKey, currencyKeys); if (wasRemoved) { emit AggregatorRemoved(currencyKey, aggregator); } } function removePool(bytes32 currencyKey) external onlyOwner { address pool = address(pools[currencyKey]); require(pool != address(0), "No pool exists for key"); delete pools[currencyKey]; bool wasRemoved = removeFromArray(currencyKey, currencyKeys); if (wasRemoved) { emit PoolRemoved(currencyKey, pool); } } function getRates() external view returns (uint[] memory rates) { uint count = 0; rates = new uint[](currencyKeys.length); for (uint i = 0; i < currencyKeys.length; i++) { bytes32 currencyKey = currencyKeys[i]; rates[count++] = _getRateAndUpdatedTime(currencyKey).rate; } } function getCurrencies() external view returns (bytes32[] memory) { return currencyKeys; } function rateForCurrency(bytes32 currencyKey) external view returns (uint) { return _getRateAndUpdatedTime(currencyKey).rate; } function rateAndUpdatedTime(bytes32 currencyKey) external view returns (uint rate, uint time) { RateAndUpdatedTime memory rateAndTime = _getRateAndUpdatedTime(currencyKey); return (rateAndTime.rate, rateAndTime.time); } function removeFromArray(bytes32 entry, bytes32[] storage array) internal returns (bool) { for (uint i = 0; i < array.length; i++) { if (array[i] == entry) { delete array[i]; array[i] = array[array.length - 1]; array.pop(); return true; } } return false; } function setTwapInterval(int56 _twapInterval) external onlyOwner { twapInterval = _twapInterval; emit TwapIntervalChanged(_twapInterval); } function setLastTickForTWAP(bytes32 _currencyKey) external onlyOwner { useLastTickForTWAP[_currencyKey] = !useLastTickForTWAP[_currencyKey]; emit LastTickForTWAPChanged(_currencyKey); } function setWETH(address token) external onlyOwner { _wETH = token; emit AddressChangedwETH(token); } function setETH(address token) external onlyOwner { _ETH = token; emit AddressChangedETH(token); } function setStaticPricePerAsset(bytes32 currencyKey, uint216 rate) external onlyOwner { bool hasCurrencyKey = false; for (uint i = 0; i < currencyKeys.length; i++) { if (currencyKeys[i] == currencyKey) { hasCurrencyKey = true; break; } } if (!hasCurrencyKey) { currencyKeys.push(currencyKey); } staticPricePerAsset[currencyKey] = RateAndUpdatedTime({rate: rate, time: uint40(block.timestamp)}); emit SetStaticPricePerAsset(currencyKey, rate, block.timestamp); } function _formatAnswer(bytes32 currencyKey, int256 rate) internal view returns (uint) { require(rate >= 0, "Negative rate not supported"); if (currencyKeyDecimals[currencyKey] > 0) { uint multiplier = 10**uint(SafeMath.sub(18, currencyKeyDecimals[currencyKey])); return uint(uint(rate).mul(multiplier)); } return uint(rate); } function _getRateAndUpdatedTime(bytes32 currencyKey) internal view returns (RateAndUpdatedTime memory) { if (staticPricePerAsset[currencyKey].rate > 0) { return staticPricePerAsset[currencyKey]; } AggregatorV2V3Interface aggregator = aggregators[currencyKey]; IUniswapV3Pool pool = pools[currencyKey]; require(address(aggregator) != address(0) || address(pool) != address(0), "No aggregator or pool exists for key"); if (aggregator != AggregatorV2V3Interface(address(0))) { return _getAggregatorRate(address(aggregator), currencyKey); } else { require(address(aggregators["ETH"]) != address(0), "Price for ETH does not exist"); uint256 ratio = _getPriceFromSqrtPrice(_getTwap(address(pool), currencyKey)); uint256 ethPrice = _getAggregatorRate(address(aggregators["ETH"]), "ETH").rate * 10**18; address token0 = pool.token0(); uint answer; if (token0 == _ETH || token0 == _wETH) { answer = ethPrice / ratio; } else { answer = ethPrice * ratio; } return RateAndUpdatedTime({ rate: uint216(_formatAnswer(currencyKey, int256(answer))), time: uint40(block.timestamp) }); } } function _getAggregatorRate(address aggregator, bytes32 currencyKey) internal view returns (RateAndUpdatedTime memory) { // this view from the aggregator is the most gas efficient but it can throw when there's no data, // so let's call it low-level to suppress any reverts bytes memory payload = abi.encodeWithSignature("latestRoundData()"); // solhint-disable avoid-low-level-calls (bool success, bytes memory returnData) = aggregator.staticcall(payload); if (success) { (, int256 answer, , uint256 updatedAt, ) = abi.decode(returnData, (uint80, int256, uint256, uint256, uint80)); return RateAndUpdatedTime({rate: uint216(_formatAnswer(currencyKey, answer)), time: uint40(updatedAt)}); } // must return assigned value return RateAndUpdatedTime({rate: 0, time: 0}); } function _getTwap(address pool, bytes32 currencyKey) internal view returns (uint160 sqrtPriceX96) { if (twapInterval == 0 || useLastTickForTWAP[currencyKey]) { // return the current price (sqrtPriceX96, , , , , , ) = IUniswapV3Pool(pool).slot0(); } else { uint32[] memory secondsAgos = new uint32[](2); secondsAgos[0] = uint32(uint56(twapInterval)); secondsAgos[1] = 0; // to (now) (int56[] memory tickCumulatives, ) = IUniswapV3Pool(pool).observe(secondsAgos); // tick(imprecise as it's an integer) to price sqrtPriceX96 = UniswapMath.getSqrtRatioAtTick(int24((tickCumulatives[1] - tickCumulatives[0]) / twapInterval)); } } function _getPriceFromSqrtPrice(uint160 sqrtPriceX96) internal pure returns (uint256 priceX96) { uint256 price = UniswapMath.mulDiv(sqrtPriceX96, sqrtPriceX96, UniswapMath.Q96); return UniswapMath.mulDiv(price, 10**18, UniswapMath.Q96); } function transferCurrencyKeys() external onlyOwner { require(currencyKeys.length == 0, "Currency keys is not empty"); for (uint i = 0; i < aggregatorKeys.length; i++) { currencyKeys[i] = aggregatorKeys[i]; } } /* ========== EVENTS ========== */ event AggregatorAdded(bytes32 currencyKey, address aggregator); event AggregatorRemoved(bytes32 currencyKey, address aggregator); event PoolAdded(bytes32 currencyKey, address pool); event PoolRemoved(bytes32 currencyKey, address pool); event AddressChangedETH(address token); event AddressChangedwETH(address token); event LastTickForTWAPChanged(bytes32 currencyKey); event TwapIntervalChanged(int56 twapInterval); event SetStaticPricePerAsset(bytes32 currencyKey, uint216 rate, uint timestamp); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; // Clone of syntetix contract without constructor contract ProxyOwned { address public owner; address public nominatedOwner; bool private _initialized; bool private _transferredAtInit; function setOwner(address _owner) public { require(_owner != address(0), "Owner address cannot be 0"); require(!_initialized, "Already initialized, use nominateNewOwner"); _initialized = true; owner = _owner; emit OwnerChanged(address(0), _owner); } function nominateNewOwner(address _owner) external onlyOwner { nominatedOwner = _owner; emit OwnerNominated(_owner); } function acceptOwnership() external { require(msg.sender == nominatedOwner, "You must be nominated before you can accept ownership"); emit OwnerChanged(owner, nominatedOwner); owner = nominatedOwner; nominatedOwner = address(0); } function transferOwnershipAtInit(address proxyAddress) external onlyOwner { require(proxyAddress != address(0), "Invalid address"); require(!_transferredAtInit, "Already transferred"); owner = proxyAddress; _transferredAtInit = true; emit OwnerChanged(owner, proxyAddress); } modifier onlyOwner { _onlyOwner(); _; } function _onlyOwner() private view { require(msg.sender == owner, "Only the contract owner may perform this action"); } event OwnerNominated(address newOwner); event OwnerChanged(address oldOwner, address newOwner); }
// SPDX-License-Identifier: MIT pragma solidity >=0.7.0; /// @title Math library for computing sqrt prices from ticks and vice versa; Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision; /// 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 /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library UniswapMath { uint256 internal constant Q192 = 0x1000000000000000000000000000000000000000000000000; uint256 internal constant Q96 = 0x1000000000000000000000000; /// @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 floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = denominator & (~denominator + 1); // 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 sqrt(1.0001^tick) * 2^96 /// @dev Throws if |tick| > max tick /// @param tick The input tick for the above formula /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) /// at the given tick function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(int256(MAX_TICK)), 'T'); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may /// ever return. /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { // second inequality must be < because the price can never reach the price at the max tick require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, 'R'); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (proxy/utils/Initializable.sol) pragma solidity ^0.8.0; import "../../utils/AddressUpgradeable.sol"; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since a proxied contract can't have a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() initializer {} * ``` * ==== */ abstract contract Initializable { /** * @dev Indicates that the contract has been initialized. */ bool private _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool private _initializing; /** * @dev Modifier to protect an initializer function from being invoked twice. */ modifier initializer() { // If the contract is initializing we ignore whether _initialized is set in order to support multiple // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the // contract may have been reentered. require(_initializing ? _isConstructor() : !_initialized, "Initializable: contract is already initialized"); bool isTopLevelCall = !_initializing; if (isTopLevelCall) { _initializing = true; _initialized = true; } _; if (isTopLevelCall) { _initializing = false; } } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} modifier, directly or indirectly. */ modifier onlyInitializing() { require(_initializing, "Initializable: contract is not initializing"); _; } function _isConstructor() private view returns (bool) { return !AddressUpgradeable.isContract(address(this)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (utils/math/SafeMath.sol) pragma solidity ^0.8.0; // CAUTION // This version of SafeMath should only be used with Solidity 0.8 or later, // because it relies on the compiler's built in overflow checks. /** * @dev Wrappers over Solidity's arithmetic operations. * * NOTE: `SafeMath` is generally not needed starting with Solidity 0.8, since the compiler * now has built in overflow checking. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryAdd(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { uint256 c = a + b; if (c < a) return (false, 0); return (true, c); } } /** * @dev Returns the subtraction of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function trySub(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b > a) return (false, 0); return (true, a - b); } } /** * @dev Returns the multiplication of two unsigned integers, with an overflow flag. * * _Available since v3.4._ */ function tryMul(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { // Gas optimization: this is cheaper than requiring 'a' not being zero, but the // benefit is lost if 'b' is also tested. // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522 if (a == 0) return (true, 0); uint256 c = a * b; if (c / a != b) return (false, 0); return (true, c); } } /** * @dev Returns the division of two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryDiv(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a / b); } } /** * @dev Returns the remainder of dividing two unsigned integers, with a division by zero flag. * * _Available since v3.4._ */ function tryMod(uint256 a, uint256 b) internal pure returns (bool, uint256) { unchecked { if (b == 0) return (false, 0); return (true, a % b); } } /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { return a + b; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return a - b; } /** * @dev Returns the multiplication of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(uint256 a, uint256 b) internal pure returns (uint256) { return a * b; } /** * @dev Returns the integer division of two unsigned integers, reverting on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return a / b; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return a % b; } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {trySub}. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b <= a, errorMessage); return a - b; } } /** * @dev Returns the integer division of two unsigned integers, reverting with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opcode (which leaves remaining gas untouched) while Solidity * uses an invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a / b; } } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * reverting with custom message when dividing by zero. * * CAUTION: This function is deprecated because it requires allocating memory for the error * message unnecessarily. For custom revert reasons use {tryMod}. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opcode (which leaves remaining gas untouched) while Solidity uses an * invalid opcode to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod( uint256 a, uint256 b, string memory errorMessage ) internal pure returns (uint256) { unchecked { require(b > 0, errorMessage); return a % b; } } }
pragma solidity >=0.5.0; import "./AggregatorInterface.sol"; import "./AggregatorV3Interface.sol"; /** * @title The V2 & V3 Aggregator Interface * @notice Solidity V0.5 does not allow interfaces to inherit from other * interfaces so this contract is a combination of v0.5 AggregatorInterface.sol * and v0.5 AggregatorV3Interface.sol. */ interface AggregatorV2V3Interface { // // V2 Interface: // function latestAnswer() external view returns (int256); function latestTimestamp() external view returns (uint256); function latestRound() external view returns (uint256); function getAnswer(uint256 roundId) external view returns (int256); function getTimestamp(uint256 roundId) external view returns (uint256); event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); // // V3 Interface: // function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity >=0.5.0; import './pool/IUniswapV3PoolImmutables.sol'; import './pool/IUniswapV3PoolState.sol'; import './pool/IUniswapV3PoolDerivedState.sol'; import './pool/IUniswapV3PoolActions.sol'; import './pool/IUniswapV3PoolOwnerActions.sol'; import './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, IUniswapV3PoolEvents { }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Address.sol) pragma solidity ^0.8.0; /** * @dev Collection of functions related to the address type */ library AddressUpgradeable { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // 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 assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
pragma solidity >=0.5.0; interface AggregatorInterface { function latestAnswer() external view returns (int256); function latestTimestamp() external view returns (uint256); function latestRound() external view returns (uint256); function getAnswer(uint256 roundId) external view returns (int256); function getTimestamp(uint256 roundId) external view returns (uint256); event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt); }
pragma solidity >=0.5.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
// 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 /// tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return _liquidity The amount of liquidity in the position, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 _liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); }
// 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 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); }
{ "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"AddressChangedETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"AddressChangedwETH","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"aggregator","type":"address"}],"name":"AggregatorAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"aggregator","type":"address"}],"name":"AggregatorRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"LastTickForTWAPChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldOwner","type":"address"},{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnerNominated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"address","name":"pool","type":"address"}],"name":"PoolRemoved","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"indexed":false,"internalType":"uint216","name":"rate","type":"uint216"},{"indexed":false,"internalType":"uint256","name":"timestamp","type":"uint256"}],"name":"SetStaticPricePerAsset","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int56","name":"twapInterval","type":"int56"}],"name":"TwapIntervalChanged","type":"event"},{"inputs":[],"name":"_ETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"_wETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"acceptOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"address","name":"aggregatorAddress","type":"address"}],"name":"addAggregator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"address","name":"currencyAddress","type":"address"},{"internalType":"address","name":"poolAddress","type":"address"}],"name":"addPool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"aggregatorKeys","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"aggregators","outputs":[{"internalType":"contract AggregatorV2V3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"currencyKeyDecimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"currencyKeys","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getCurrencies","outputs":[{"internalType":"bytes32[]","name":"","type":"bytes32[]"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRates","outputs":[{"internalType":"uint256[]","name":"rates","type":"uint256[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"nominateNewOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"nominatedOwner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"pools","outputs":[{"internalType":"contract IUniswapV3Pool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"rateAndUpdatedTime","outputs":[{"internalType":"uint256","name":"rate","type":"uint256"},{"internalType":"uint256","name":"time","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"rateForCurrency","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"removeAggregator","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"}],"name":"removePool","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"setETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_currencyKey","type":"bytes32"}],"name":"setLastTickForTWAP","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"}],"name":"setOwner","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"currencyKey","type":"bytes32"},{"internalType":"uint216","name":"rate","type":"uint216"}],"name":"setStaticPricePerAsset","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"int56","name":"_twapInterval","type":"int56"}],"name":"setTwapInterval","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"setWETH","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"staticPricePerAsset","outputs":[{"internalType":"uint216","name":"rate","type":"uint216"},{"internalType":"uint40","name":"time","type":"uint40"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"transferCurrencyKeys","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"proxyAddress","type":"address"}],"name":"transferOwnershipAtInit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"twapInterval","outputs":[{"internalType":"int56","name":"","type":"int56"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"useLastTickForTWAP","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b50612e24806100206000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c806379ba50971161010f578063b295ad34116100a2578063c3b83f5f11610071578063c3b83f5f146104c1578063c4d66de8146104d4578063e4d8f8a6146104e7578063e69bd3fa146104fa57600080fd5b8063b295ad341461043d578063b40ee76d14610472578063b5217bb414610485578063c0c7df6f146104ae57600080fd5b80639accab55116100de5780639accab55146103b1578063a0f3087f146103b9578063a80a23ee146103cc578063ac82f6081461042a57600080fd5b806379ba50971461036a5780637a5a2a98146103725780638da5cb5b1461038557806399a440f61461039e57600080fd5b80634308a94f116101875780635b769f3c116101565780635b769f3c146102ff5780635db99af21461031257806361c661de1461032c5780637103353e1461034157600080fd5b80634308a94f1461028357806346461240146102ab5780634f72def6146102b357806353a47bb7146102d457600080fd5b80632fe8c239116101c35780632fe8c239146102255780633b824b8c146102385780633c1d5df01461024b5780633f0e084f1461027057600080fd5b806313af4035146101ea5780631627540c146101ff5780632bed9e0c14610212575b600080fd5b6101fd6101f836600461271b565b61052d565b005b6101fd61020d36600461271b565b61066d565b6101fd610220366004612819565b6106c3565b6101fd6102333660046128a1565b6107b9565b6101fd610246366004612860565b6108db565b6007546102589060060b81565b60405160069190910b81526020015b60405180910390f35b6101fd61027e366004612831565b610d38565b610296610291366004612819565b610fbb565b60408051928352602083019190915201610267565b6101fd610fee565b6102c66102c1366004612819565b6110c1565b604051908152602001610267565b6001546102e7906001600160a01b031681565b6040516001600160a01b039091168152602001610267565b6101fd61030d36600461271b565b6110e2565b6007546102e790600160381b90046001600160a01b031681565b610334611138565b6040516102679190612a3e565b6102e761034f366004612819565b6002602052600090815260409020546001600160a01b031681565b6101fd611190565b6101fd61038036600461271b565b61128d565b6000546102e7906201000090046001600160a01b031681565b6102c66103ac366004612819565b6112f3565b610334611303565b6101fd6103c7366004612819565b6113fc565b6104056103da366004612819565b600a602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b604080516001600160d81b03909316835264ffffffffff909116602083015201610267565b6102c6610438366004612819565b611454565b61046061044b366004612819565b60036020526000908152604090205460ff1681565b60405160ff9091168152602001610267565b6101fd6104803660046128d0565b61146f565b6102e7610493366004612819565b6006602052600090815260409020546001600160a01b031681565b6008546102e7906001600160a01b031681565b6101fd6104cf36600461271b565b6114cc565b6101fd6104e236600461271b565b6115e5565b6101fd6104f5366004612819565b6116bc565b61051d610508366004612819565b60096020526000908152604090205460ff1681565b6040519015158152602001610267565b6001600160a01b0381166105885760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600154600160a01b900460ff16156105f45760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b606482015260840161057f565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b61067561178f565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610662565b6106cb61178f565b6000818152600260205260409020546001600160a01b0316806107305760405162461bcd60e51b815260206004820152601c60248201527f4e6f2061676772656761746f722065786973747320666f72206b657900000000604482015260640161057f565b600082815260026020908152604080832080546001600160a01b031916905560039091528120805460ff19169055610769836005611809565b905080156107b457604080518481526001600160a01b03841660208201527fec70e890fc7db7de4059b114c9093a1f41283d18ffcfbcac45566feea4d4f77791015b60405180910390a15b505050565b6107c161178f565b6000805b60055481101561081d5783600582815481106107f157634e487b7160e01b600052603260045260246000fd5b9060005260206000200154141561080b576001915061081d565b8061081581612d1e565b9150506107c5565b508061085957600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018390555b6040805180820182526001600160d81b038481168083524264ffffffffff818116602080870191825260008b8152600a82528890209651915191909516600160d81b919092160217909355835187815291820152918201527f45a5dfd13ad550fffd0d98ed586d6503f837825acd38ef54e8c56d40ea1fd047906060016107ab565b6108e361178f565b6000838152600260205260409020546001600160a01b031680156109535760405162461bcd60e51b815260206004820152602160248201527f41676772656761746f7220616c72656164792065786973747320666f72206b656044820152607960f81b606482015260840161057f565b60008290506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561099357600080fd5b505afa1580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cb9190612737565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0857600080fd5b505afa158015610a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a409190612737565b6008549091506000906001600160a01b0384811691161480610a7657506007546001600160a01b03848116600160381b90920416145b6008549091506000906001600160a01b0384811691161480610aac57506007546001600160a01b03848116600160381b90920416145b90508180610ab75750805b610b0f5760405162461bcd60e51b815260206004820152602360248201527f506f6f6c206e6f742076616c69643a20455448206973206e6f7420616e2061736044820152621cd95d60ea1b606482015260840161057f565b836001600160a01b0316886001600160a01b03161480610b405750826001600160a01b0316886001600160a01b0316145b610b9d5760405162461bcd60e51b815260206004820152602860248201527f506f6f6c206e6f742076616c69643a2063757272656e6379206973206e6f7420604482015267185b88185cdcd95d60c21b606482015260840161057f565b6000856001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610bd857600080fd5b505afa158015610bec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1091906128ec565b50505050505090506000816001600160a01b031611610c625760405162461bcd60e51b815260206004820152600e60248201526d141bdbdb081b9bdd081d985b1a5960921b604482015260640161057f565b60008a8152600660205260409020546001600160a01b0316610cb457600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018a90555b60008a815260066020908152604080832080546001600160a01b038b166001600160a01b031990911681179091556003835292819020805460ff1916601217905580518d8152918201929092527ffd0fa7919fbe3857a4236750e8d3e42ac691881d2f31c50ebe4cfc2a7705ee80910160405180910390a150505050505050505050565b610d4061178f565b60008190506000816001600160a01b031663668a0f026040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8057600080fd5b505afa158015610d94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db89190612984565b1015610e065760405162461bcd60e51b815260206004820152601b60248201527f476976656e2041676772656761746f7220697320696e76616c69640000000000604482015260640161057f565b6000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4157600080fd5b505afa158015610e55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7991906129eb565b905060128160ff161115610eea5760405162461bcd60e51b815260206004820152603260248201527f41676772656761746f7220646563696d616c732073686f756c64206265206c6f6044820152710eecae440dee440cae2eac2d840e8de4062760731b606482015260840161057f565b6000848152600260205260409020546001600160a01b0316610f3c57600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018490555b600084815260026020908152604080832080546001600160a01b0319166001600160a01b0387169081179091556003835292819020805460ff191660ff86161790558051878152918201929092527f0bcae573430f69c5361e5d76534d3f61d2d803958778680cd74be9dc6299bc63910160405180910390a150505050565b6000806000610fc984611936565b80516020909101516001600160d81b039091169564ffffffffff909116945092505050565b610ff661178f565b600554156110465760405162461bcd60e51b815260206004820152601a60248201527f43757272656e6379206b657973206973206e6f7420656d707479000000000000604482015260640161057f565b60005b6004548110156110be576004818154811061107457634e487b7160e01b600052603260045260246000fd5b9060005260206000200154600582815481106110a057634e487b7160e01b600052603260045260246000fd5b600091825260209091200155806110b681612d1e565b915050611049565b50565b600481815481106110d157600080fd5b600091825260209091200154905081565b6110ea61178f565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f8121e397d1abdd9a4231e6d2a3da170b653b62342667c1ed8697d07f560836eb90602001610662565b6060600580548060200260200160405190810160405280929190818152602001828054801561118657602002820191906000526020600020905b815481526020019060010190808311611172575b5050505050905090565b6001546001600160a01b031633146112085760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b606482015260840161057f565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b61129561178f565b60078054670100000000000000600160d81b031916600160381b6001600160a01b038416908102919091179091556040519081527f9869fd5d75bcb7e8ecd63be9bdc2491f03bf7773f4f978ae21d550598f89a5ca90602001610662565b600581815481106110d157600080fd5b60055460609060009067ffffffffffffffff81111561133257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561135b578160200160208202803683370190505b50915060005b6005548110156113f75760006005828154811061138e57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490506113a481611936565b516001600160d81b031684846113b981612d1e565b9550815181106113d957634e487b7160e01b600052603260045260246000fd5b602090810291909101015250806113ef81612d1e565b915050611361565b505090565b61140461178f565b60008181526009602052604090819020805460ff19811660ff90911615179055517fb3708876f7f03a1f6c8e5c502b558d87faab81782c2e8562ed2cd5b87f63f99b906106629083815260200190565b600061145f82611936565b516001600160d81b031692915050565b61147761178f565b6007805466ffffffffffffff191666ffffffffffffff600684900b908116919091179091556040519081527f2350458cc43fccffd5931a35a5cceaa703560f40edc555814faf87d39214750590602001610662565b6114d461178f565b6001600160a01b03811661151c5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161057f565b600154600160a81b900460ff161561156c5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b604482015260640161057f565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610662565b600054610100900460ff166116005760005460ff1615611604565b303b155b6116675760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161057f565b600054610100900460ff16158015611689576000805461ffff19166101011790555b6116928261052d565b6007805466ffffffffffffff191661012c17905580156116b8576000805461ff00191690555b5050565b6116c461178f565b6000818152600660205260409020546001600160a01b0316806117225760405162461bcd60e51b81526020600482015260166024820152754e6f20706f6f6c2065786973747320666f72206b657960501b604482015260640161057f565b600082815260066020526040812080546001600160a01b0319169055611749836005611809565b905080156107b457604080518481526001600160a01b03841660208201527fec6c5a212891ee59cd0846cf5c9bb92c3cb05e7dc0191e73abec1ac38822b97391016107ab565b6000546201000090046001600160a01b031633146118075760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b606482015260840161057f565b565b6000805b825481101561192a578383828154811061183757634e487b7160e01b600052603260045260246000fd5b906000526020600020015414156119185782818154811061186857634e487b7160e01b600052603260045260246000fd5b60009182526020822001558254839061188390600190612d07565b815481106118a157634e487b7160e01b600052603260045260246000fd5b90600052602060002001548382815481106118cc57634e487b7160e01b600052603260045260246000fd5b9060005260206000200181905550828054806118f857634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590556001915050611930565b8061192281612d1e565b91505061180d565b50600090505b92915050565b60408051808201909152600080825260208201526000828152600a60205260409020546001600160d81b0316156119a457506000908152600a60209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff169082015290565b6000828152600260209081526040808320546006909252909120546001600160a01b039182169116811515806119e257506001600160a01b03811615155b611a3a5760405162461bcd60e51b8152602060048201526024808201527f4e6f2061676772656761746f72206f7220706f6f6c2065786973747320666f72604482015263206b657960e01b606482015260840161057f565b6001600160a01b03821615611a5b57611a538285611c65565b949350505050565b6208aa8960eb1b60005260026020527fd9402e47e68a5154d8f9cdc9d4ffcf4a300546026372c3b04224fbe62656c601546001600160a01b0316611ae15760405162461bcd60e51b815260206004820152601c60248201527f507269636520666f722045544820646f6573206e6f7420657869737400000000604482015260640161057f565b6000611af5611af08387611d7f565b611fd3565b6208aa8960eb1b600081815260026020527fd9402e47e68a5154d8f9cdc9d4ffcf4a300546026372c3b04224fbe62656c6015492935091611b41916001600160a01b0390911690611c65565b51611b5490670de0b6b3a7640000612c6a565b6001600160d81b031690506000836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611b9a57600080fd5b505afa158015611bae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd29190612737565b6007549091506000906001600160a01b03808416600160381b909204161480611c0857506008546001600160a01b038381169116145b15611c1e57611c178484612b6b565b9050611c2b565b611c288484612c99565b90505b6040518060400160405280611c408a8461200e565b6001600160d81b0316815264ffffffffff421660209091015298975050505050505050565b604080518082019091526000808252602082015260408051600481526024810182526020810180516001600160e01b0316633fabe5a360e21b179052905160009081906001600160a01b03871690611cbe908590612a05565b600060405180830381855afa9150503d8060008114611cf9576040519150601f19603f3d011682016040523d82523d6000602084013e611cfe565b606091505b50915091508115611d615760008082806020019051810190611d20919061299c565b509350509250506040518060400160405280611d3c898561200e565b6001600160d81b031681526020018264ffffffffff1681525095505050505050611930565b50506040805180820190915260008082526020820152949350505050565b600754600090600690810b900b1580611da6575060008281526009602052604090205460ff165b15611e2b57826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015611de457600080fd5b505afa158015611df8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1c91906128ec565b50949550611930945050505050565b6040805160028082526060820183526000926020830190803683375050600754825192935060060b91839150600090611e7457634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff1681525050600081600181518110611eb157634e487b7160e01b600052603260045260246000fd5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526000906001600160a01b0386169063883bdbfd90611ef5908590600401612a82565b60006040518083038186803b158015611f0d57600080fd5b505afa158015611f21573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f499190810190612753565b509050611fca600760009054906101000a900460060b82600081518110611f8057634e487b7160e01b600052603260045260246000fd5b602002602001015183600181518110611fa957634e487b7160e01b600052603260045260246000fd5b6020026020010151611fbb9190612cb8565b611fc59190612b2d565b6120ba565b95945050505050565b600080611fee6001600160a01b03841680600160601b6124cf565b905061200781670de0b6b3a7640000600160601b6124cf565b9392505050565b6000808212156120605760405162461bcd60e51b815260206004820152601b60248201527f4e656761746976652072617465206e6f7420737570706f727465640000000000604482015260640161057f565b60008381526003602052604090205460ff16156120b4576000838152600360205260408120546120959060129060ff16612649565b6120a090600a612bc2565b90506120ac8382612655565b915050611930565b50919050565b60008060008360020b126120d1578260020b6120de565b8260020b6120de90612d6e565b90506120ed620d89e719612d4d565b60020b8111156121235760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640161057f565b60006001821661213757600160801b612149565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612188576080612183826ffff97272373d413259a46990580e213a612c99565b901c90505b60048216156121b25760806121ad826ffff2e50f5f656932ef12357cf3c7fdcc612c99565b901c90505b60088216156121dc5760806121d7826fffe5caca7e10e4e61c3624eaa0941cd0612c99565b901c90505b6010821615612206576080612201826fffcb9843d60f6159c9db58835c926644612c99565b901c90505b602082161561223057608061222b826fff973b41fa98c081472e6896dfb254c0612c99565b901c90505b604082161561225a576080612255826fff2ea16466c96a3843ec78b326b52861612c99565b901c90505b608082161561228457608061227f826ffe5dee046a99a2a811c461f1969c3053612c99565b901c90505b6101008216156122af5760806122aa826ffcbe86c7900a88aedcffc83b479aa3a4612c99565b901c90505b6102008216156122da5760806122d5826ff987a7253ac413176f2b074cf7815e54612c99565b901c90505b610400821615612305576080612300826ff3392b0822b70005940c7a398e4b70f3612c99565b901c90505b61080082161561233057608061232b826fe7159475a2c29b7443b29c7fa6e889d9612c99565b901c90505b61100082161561235b576080612356826fd097f3bdfd2022b8845ad8f792aa5825612c99565b901c90505b612000821615612386576080612381826fa9f746462d870fdf8a65dc1f90e061e5612c99565b901c90505b6140008216156123b15760806123ac826f70d869a156d2a1b890bb3df62baf32f7612c99565b901c90505b6180008216156123dc5760806123d7826f31be135f97d08fd981231505542fcfa6612c99565b901c90505b62010000821615612408576080612403826f09aa508b5b7a84e1c677de54f3e99bc9612c99565b901c90505b6202000082161561243357608061242e826e5d6af8dedb81196699c329225ee604612c99565b901c90505b6204000082161561245d576080612458826d2216e584f5fa1ea926041bedfe98612c99565b901c90505b62080000821615612485576080612480826b048a170391f7dc42444e8fa2612c99565b901c90505b60008460020b13156124a05761249d81600019612b6b565b90505b6124af64010000000082612d39565b156124bb5760016124be565b60005b611a539060ff16602083901c612b15565b60008080600019858709858702925082811083820303915050806000141561250957600084116124fe57600080fd5b508290049050612007565b80841161251557600080fd5b600084868809808403938111909203919050600061253586196001612b15565b86169586900495938490049360008190030460010190506125568184612c99565b909317926000612567876003612c99565b60021890506125768188612c99565b612581906002612d07565b61258b9082612c99565b90506125978188612c99565b6125a2906002612d07565b6125ac9082612c99565b90506125b88188612c99565b6125c3906002612d07565b6125cd9082612c99565b90506125d98188612c99565b6125e4906002612d07565b6125ee9082612c99565b90506125fa8188612c99565b612605906002612d07565b61260f9082612c99565b905061261b8188612c99565b612626906002612d07565b6126309082612c99565b905061263c8186612c99565b9998505050505050505050565b60006120078284612d07565b60006120078284612c99565b600082601f830112612671578081fd5b8151602061268661268183612af1565b612ac0565b80838252828201915082860187848660051b89010111156126a5578586fd5b855b858110156126cc5781516126ba81612dca565b845292840192908401906001016126a7565b5090979650505050505050565b805161ffff811681146126eb57600080fd5b919050565b805169ffffffffffffffffffff811681146126eb57600080fd5b805160ff811681146126eb57600080fd5b60006020828403121561272c578081fd5b813561200781612dca565b600060208284031215612748578081fd5b815161200781612dca565b60008060408385031215612765578081fd5b825167ffffffffffffffff8082111561277c578283fd5b818501915085601f83011261278f578283fd5b8151602061279f61268183612af1565b8083825282820191508286018a848660051b89010111156127be578788fd5b8796505b848710156127e95780516127d581612ddf565b8352600196909601959183019183016127c2565b5091880151919650909350505080821115612802578283fd5b5061280f85828601612661565b9150509250929050565b60006020828403121561282a578081fd5b5035919050565b60008060408385031215612843578182fd5b82359150602083013561285581612dca565b809150509250929050565b600080600060608486031215612874578081fd5b83359250602084013561288681612dca565b9150604084013561289681612dca565b809150509250925092565b600080604083850312156128b3578182fd5b8235915060208301356001600160d81b0381168114612855578182fd5b6000602082840312156128e1578081fd5b813561200781612ddf565b600080600080600080600060e0888a031215612906578485fd5b875161291181612dca565b8097505060208801518060020b8114612928578586fd5b9550612936604089016126d9565b9450612944606089016126d9565b9350612952608089016126d9565b925061296060a0890161270a565b915060c08801518015158114612974578182fd5b8091505092959891949750929550565b600060208284031215612995578081fd5b5051919050565b600080600080600060a086880312156129b3578283fd5b6129bc866126f0565b94506020860151935060408601519250606086015191506129df608087016126f0565b90509295509295909350565b6000602082840312156129fc578081fd5b6120078261270a565b60008251815b81811015612a255760208186018101518583015201612a0b565b81811115612a335782828501525b509190910192915050565b6020808252825182820181905260009190848201906040850190845b81811015612a7657835183529284019291840191600101612a5a565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612a7657835163ffffffff1683529284019291840191600101612a9e565b604051601f8201601f1916810167ffffffffffffffff81118282101715612ae957612ae9612db4565b604052919050565b600067ffffffffffffffff821115612b0b57612b0b612db4565b5060051b60200190565b60008219821115612b2857612b28612d88565b500190565b60008160060b8360060b80612b4457612b44612d9e565b667fffffffffffff19821460001982141615612b6257612b62612d88565b90059392505050565b600082612b7a57612b7a612d9e565b500490565b600181815b80851115612bba578160001904821115612ba057612ba0612d88565b80851615612bad57918102915b93841c9390800290612b84565b509250929050565b60006120078383600082612bd857506001611930565b81612be557506000611930565b8160018114612bfb5760028114612c0557612c21565b6001915050611930565b60ff841115612c1657612c16612d88565b50506001821b611930565b5060208310610133831016604e8410600b8410161715612c44575081810a611930565b612c4e8383612b7f565b8060001904821115612c6257612c62612d88565b029392505050565b60006001600160d81b0382811684821681151582840482111615612c9057612c90612d88565b02949350505050565b6000816000190483118215151615612cb357612cb3612d88565b500290565b60008160060b8360060b82811281667fffffffffffff1901831281151615612ce257612ce2612d88565b81667fffffffffffff018313811615612cfd57612cfd612d88565b5090039392505050565b600082821015612d1957612d19612d88565b500390565b6000600019821415612d3257612d32612d88565b5060010190565b600082612d4857612d48612d9e565b500690565b60008160020b627fffff19811415612d6757612d67612d88565b9003919050565b6000600160ff1b821415612d8457612d84612d88565b0390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146110be57600080fd5b8060060b81146110be57600080fdfea26469706673582212207afb62044df578c4d49ba75886ea3612d91b7b3444e53fbc665414d4650dd8c264736f6c63430008040033
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106101e55760003560e01c806379ba50971161010f578063b295ad34116100a2578063c3b83f5f11610071578063c3b83f5f146104c1578063c4d66de8146104d4578063e4d8f8a6146104e7578063e69bd3fa146104fa57600080fd5b8063b295ad341461043d578063b40ee76d14610472578063b5217bb414610485578063c0c7df6f146104ae57600080fd5b80639accab55116100de5780639accab55146103b1578063a0f3087f146103b9578063a80a23ee146103cc578063ac82f6081461042a57600080fd5b806379ba50971461036a5780637a5a2a98146103725780638da5cb5b1461038557806399a440f61461039e57600080fd5b80634308a94f116101875780635b769f3c116101565780635b769f3c146102ff5780635db99af21461031257806361c661de1461032c5780637103353e1461034157600080fd5b80634308a94f1461028357806346461240146102ab5780634f72def6146102b357806353a47bb7146102d457600080fd5b80632fe8c239116101c35780632fe8c239146102255780633b824b8c146102385780633c1d5df01461024b5780633f0e084f1461027057600080fd5b806313af4035146101ea5780631627540c146101ff5780632bed9e0c14610212575b600080fd5b6101fd6101f836600461271b565b61052d565b005b6101fd61020d36600461271b565b61066d565b6101fd610220366004612819565b6106c3565b6101fd6102333660046128a1565b6107b9565b6101fd610246366004612860565b6108db565b6007546102589060060b81565b60405160069190910b81526020015b60405180910390f35b6101fd61027e366004612831565b610d38565b610296610291366004612819565b610fbb565b60408051928352602083019190915201610267565b6101fd610fee565b6102c66102c1366004612819565b6110c1565b604051908152602001610267565b6001546102e7906001600160a01b031681565b6040516001600160a01b039091168152602001610267565b6101fd61030d36600461271b565b6110e2565b6007546102e790600160381b90046001600160a01b031681565b610334611138565b6040516102679190612a3e565b6102e761034f366004612819565b6002602052600090815260409020546001600160a01b031681565b6101fd611190565b6101fd61038036600461271b565b61128d565b6000546102e7906201000090046001600160a01b031681565b6102c66103ac366004612819565b6112f3565b610334611303565b6101fd6103c7366004612819565b6113fc565b6104056103da366004612819565b600a602052600090815260409020546001600160d81b03811690600160d81b900464ffffffffff1682565b604080516001600160d81b03909316835264ffffffffff909116602083015201610267565b6102c6610438366004612819565b611454565b61046061044b366004612819565b60036020526000908152604090205460ff1681565b60405160ff9091168152602001610267565b6101fd6104803660046128d0565b61146f565b6102e7610493366004612819565b6006602052600090815260409020546001600160a01b031681565b6008546102e7906001600160a01b031681565b6101fd6104cf36600461271b565b6114cc565b6101fd6104e236600461271b565b6115e5565b6101fd6104f5366004612819565b6116bc565b61051d610508366004612819565b60096020526000908152604090205460ff1681565b6040519015158152602001610267565b6001600160a01b0381166105885760405162461bcd60e51b815260206004820152601960248201527f4f776e657220616464726573732063616e6e6f7420626520300000000000000060448201526064015b60405180910390fd5b600154600160a01b900460ff16156105f45760405162461bcd60e51b815260206004820152602960248201527f416c726561647920696e697469616c697a65642c20757365206e6f6d696e617460448201526832a732bba7bbb732b960b91b606482015260840161057f565b6001805460ff60a01b1916600160a01b179055600080546001600160a01b03831662010000810262010000600160b01b03199092169190911782556040805192835260208301919091527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c91015b60405180910390a150565b61067561178f565b600180546001600160a01b0319166001600160a01b0383169081179091556040519081527f906a1c6bd7e3091ea86693dd029a831c19049ce77f1dce2ce0bab1cacbabce2290602001610662565b6106cb61178f565b6000818152600260205260409020546001600160a01b0316806107305760405162461bcd60e51b815260206004820152601c60248201527f4e6f2061676772656761746f722065786973747320666f72206b657900000000604482015260640161057f565b600082815260026020908152604080832080546001600160a01b031916905560039091528120805460ff19169055610769836005611809565b905080156107b457604080518481526001600160a01b03841660208201527fec70e890fc7db7de4059b114c9093a1f41283d18ffcfbcac45566feea4d4f77791015b60405180910390a15b505050565b6107c161178f565b6000805b60055481101561081d5783600582815481106107f157634e487b7160e01b600052603260045260246000fd5b9060005260206000200154141561080b576001915061081d565b8061081581612d1e565b9150506107c5565b508061085957600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018390555b6040805180820182526001600160d81b038481168083524264ffffffffff818116602080870191825260008b8152600a82528890209651915191909516600160d81b919092160217909355835187815291820152918201527f45a5dfd13ad550fffd0d98ed586d6503f837825acd38ef54e8c56d40ea1fd047906060016107ab565b6108e361178f565b6000838152600260205260409020546001600160a01b031680156109535760405162461bcd60e51b815260206004820152602160248201527f41676772656761746f7220616c72656164792065786973747320666f72206b656044820152607960f81b606482015260840161057f565b60008290506000816001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b15801561099357600080fd5b505afa1580156109a7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109cb9190612737565b90506000826001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b158015610a0857600080fd5b505afa158015610a1c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a409190612737565b6008549091506000906001600160a01b0384811691161480610a7657506007546001600160a01b03848116600160381b90920416145b6008549091506000906001600160a01b0384811691161480610aac57506007546001600160a01b03848116600160381b90920416145b90508180610ab75750805b610b0f5760405162461bcd60e51b815260206004820152602360248201527f506f6f6c206e6f742076616c69643a20455448206973206e6f7420616e2061736044820152621cd95d60ea1b606482015260840161057f565b836001600160a01b0316886001600160a01b03161480610b405750826001600160a01b0316886001600160a01b0316145b610b9d5760405162461bcd60e51b815260206004820152602860248201527f506f6f6c206e6f742076616c69643a2063757272656e6379206973206e6f7420604482015267185b88185cdcd95d60c21b606482015260840161057f565b6000856001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015610bd857600080fd5b505afa158015610bec573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c1091906128ec565b50505050505090506000816001600160a01b031611610c625760405162461bcd60e51b815260206004820152600e60248201526d141bdbdb081b9bdd081d985b1a5960921b604482015260640161057f565b60008a8152600660205260409020546001600160a01b0316610cb457600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018a90555b60008a815260066020908152604080832080546001600160a01b038b166001600160a01b031990911681179091556003835292819020805460ff1916601217905580518d8152918201929092527ffd0fa7919fbe3857a4236750e8d3e42ac691881d2f31c50ebe4cfc2a7705ee80910160405180910390a150505050505050505050565b610d4061178f565b60008190506000816001600160a01b031663668a0f026040518163ffffffff1660e01b815260040160206040518083038186803b158015610d8057600080fd5b505afa158015610d94573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610db89190612984565b1015610e065760405162461bcd60e51b815260206004820152601b60248201527f476976656e2041676772656761746f7220697320696e76616c69640000000000604482015260640161057f565b6000816001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b158015610e4157600080fd5b505afa158015610e55573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7991906129eb565b905060128160ff161115610eea5760405162461bcd60e51b815260206004820152603260248201527f41676772656761746f7220646563696d616c732073686f756c64206265206c6f6044820152710eecae440dee440cae2eac2d840e8de4062760731b606482015260840161057f565b6000848152600260205260409020546001600160a01b0316610f3c57600580546001810182556000919091527f036b6384b5eca791c62761152d0c79bb0604c104a5fb6f4eb0703f3154bb3db0018490555b600084815260026020908152604080832080546001600160a01b0319166001600160a01b0387169081179091556003835292819020805460ff191660ff86161790558051878152918201929092527f0bcae573430f69c5361e5d76534d3f61d2d803958778680cd74be9dc6299bc63910160405180910390a150505050565b6000806000610fc984611936565b80516020909101516001600160d81b039091169564ffffffffff909116945092505050565b610ff661178f565b600554156110465760405162461bcd60e51b815260206004820152601a60248201527f43757272656e6379206b657973206973206e6f7420656d707479000000000000604482015260640161057f565b60005b6004548110156110be576004818154811061107457634e487b7160e01b600052603260045260246000fd5b9060005260206000200154600582815481106110a057634e487b7160e01b600052603260045260246000fd5b600091825260209091200155806110b681612d1e565b915050611049565b50565b600481815481106110d157600080fd5b600091825260209091200154905081565b6110ea61178f565b600880546001600160a01b0319166001600160a01b0383169081179091556040519081527f8121e397d1abdd9a4231e6d2a3da170b653b62342667c1ed8697d07f560836eb90602001610662565b6060600580548060200260200160405190810160405280929190818152602001828054801561118657602002820191906000526020600020905b815481526020019060010190808311611172575b5050505050905090565b6001546001600160a01b031633146112085760405162461bcd60e51b815260206004820152603560248201527f596f75206d757374206265206e6f6d696e61746564206265666f726520796f7560448201527402063616e20616363657074206f776e65727368697605c1b606482015260840161057f565b60005460015460408051620100009093046001600160a01b03908116845290911660208301527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c910160405180910390a1600180546000805462010000600160b01b0319166001600160a01b03831662010000021790556001600160a01b0319169055565b61129561178f565b60078054670100000000000000600160d81b031916600160381b6001600160a01b038416908102919091179091556040519081527f9869fd5d75bcb7e8ecd63be9bdc2491f03bf7773f4f978ae21d550598f89a5ca90602001610662565b600581815481106110d157600080fd5b60055460609060009067ffffffffffffffff81111561133257634e487b7160e01b600052604160045260246000fd5b60405190808252806020026020018201604052801561135b578160200160208202803683370190505b50915060005b6005548110156113f75760006005828154811061138e57634e487b7160e01b600052603260045260246000fd5b906000526020600020015490506113a481611936565b516001600160d81b031684846113b981612d1e565b9550815181106113d957634e487b7160e01b600052603260045260246000fd5b602090810291909101015250806113ef81612d1e565b915050611361565b505090565b61140461178f565b60008181526009602052604090819020805460ff19811660ff90911615179055517fb3708876f7f03a1f6c8e5c502b558d87faab81782c2e8562ed2cd5b87f63f99b906106629083815260200190565b600061145f82611936565b516001600160d81b031692915050565b61147761178f565b6007805466ffffffffffffff191666ffffffffffffff600684900b908116919091179091556040519081527f2350458cc43fccffd5931a35a5cceaa703560f40edc555814faf87d39214750590602001610662565b6114d461178f565b6001600160a01b03811661151c5760405162461bcd60e51b815260206004820152600f60248201526e496e76616c6964206164647265737360881b604482015260640161057f565b600154600160a81b900460ff161561156c5760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481d1c985b9cd9995c9c9959606a1b604482015260640161057f565b600080546001600160a01b038381166201000081810262010000600160b01b031990941693909317938490556001805460ff60a81b1916600160a81b1790556040805193909404909116825260208201527fb532073b38c83145e3e5135377a08bf9aab55bc0fd7c1179cd4fb995d2a5159c9101610662565b600054610100900460ff166116005760005460ff1615611604565b303b155b6116675760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161057f565b600054610100900460ff16158015611689576000805461ffff19166101011790555b6116928261052d565b6007805466ffffffffffffff191661012c17905580156116b8576000805461ff00191690555b5050565b6116c461178f565b6000818152600660205260409020546001600160a01b0316806117225760405162461bcd60e51b81526020600482015260166024820152754e6f20706f6f6c2065786973747320666f72206b657960501b604482015260640161057f565b600082815260066020526040812080546001600160a01b0319169055611749836005611809565b905080156107b457604080518481526001600160a01b03841660208201527fec6c5a212891ee59cd0846cf5c9bb92c3cb05e7dc0191e73abec1ac38822b97391016107ab565b6000546201000090046001600160a01b031633146118075760405162461bcd60e51b815260206004820152602f60248201527f4f6e6c792074686520636f6e7472616374206f776e6572206d6179207065726660448201526e37b936903a3434b99030b1ba34b7b760891b606482015260840161057f565b565b6000805b825481101561192a578383828154811061183757634e487b7160e01b600052603260045260246000fd5b906000526020600020015414156119185782818154811061186857634e487b7160e01b600052603260045260246000fd5b60009182526020822001558254839061188390600190612d07565b815481106118a157634e487b7160e01b600052603260045260246000fd5b90600052602060002001548382815481106118cc57634e487b7160e01b600052603260045260246000fd5b9060005260206000200181905550828054806118f857634e487b7160e01b600052603160045260246000fd5b600190038181906000526020600020016000905590556001915050611930565b8061192281612d1e565b91505061180d565b50600090505b92915050565b60408051808201909152600080825260208201526000828152600a60205260409020546001600160d81b0316156119a457506000908152600a60209081526040918290208251808401909352546001600160d81b0381168352600160d81b900464ffffffffff169082015290565b6000828152600260209081526040808320546006909252909120546001600160a01b039182169116811515806119e257506001600160a01b03811615155b611a3a5760405162461bcd60e51b8152602060048201526024808201527f4e6f2061676772656761746f72206f7220706f6f6c2065786973747320666f72604482015263206b657960e01b606482015260840161057f565b6001600160a01b03821615611a5b57611a538285611c65565b949350505050565b6208aa8960eb1b60005260026020527fd9402e47e68a5154d8f9cdc9d4ffcf4a300546026372c3b04224fbe62656c601546001600160a01b0316611ae15760405162461bcd60e51b815260206004820152601c60248201527f507269636520666f722045544820646f6573206e6f7420657869737400000000604482015260640161057f565b6000611af5611af08387611d7f565b611fd3565b6208aa8960eb1b600081815260026020527fd9402e47e68a5154d8f9cdc9d4ffcf4a300546026372c3b04224fbe62656c6015492935091611b41916001600160a01b0390911690611c65565b51611b5490670de0b6b3a7640000612c6a565b6001600160d81b031690506000836001600160a01b0316630dfe16816040518163ffffffff1660e01b815260040160206040518083038186803b158015611b9a57600080fd5b505afa158015611bae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bd29190612737565b6007549091506000906001600160a01b03808416600160381b909204161480611c0857506008546001600160a01b038381169116145b15611c1e57611c178484612b6b565b9050611c2b565b611c288484612c99565b90505b6040518060400160405280611c408a8461200e565b6001600160d81b0316815264ffffffffff421660209091015298975050505050505050565b604080518082019091526000808252602082015260408051600481526024810182526020810180516001600160e01b0316633fabe5a360e21b179052905160009081906001600160a01b03871690611cbe908590612a05565b600060405180830381855afa9150503d8060008114611cf9576040519150601f19603f3d011682016040523d82523d6000602084013e611cfe565b606091505b50915091508115611d615760008082806020019051810190611d20919061299c565b509350509250506040518060400160405280611d3c898561200e565b6001600160d81b031681526020018264ffffffffff1681525095505050505050611930565b50506040805180820190915260008082526020820152949350505050565b600754600090600690810b900b1580611da6575060008281526009602052604090205460ff165b15611e2b57826001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e06040518083038186803b158015611de457600080fd5b505afa158015611df8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e1c91906128ec565b50949550611930945050505050565b6040805160028082526060820183526000926020830190803683375050600754825192935060060b91839150600090611e7457634e487b7160e01b600052603260045260246000fd5b602002602001019063ffffffff16908163ffffffff1681525050600081600181518110611eb157634e487b7160e01b600052603260045260246000fd5b63ffffffff9092166020928302919091019091015260405163883bdbfd60e01b81526000906001600160a01b0386169063883bdbfd90611ef5908590600401612a82565b60006040518083038186803b158015611f0d57600080fd5b505afa158015611f21573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052611f499190810190612753565b509050611fca600760009054906101000a900460060b82600081518110611f8057634e487b7160e01b600052603260045260246000fd5b602002602001015183600181518110611fa957634e487b7160e01b600052603260045260246000fd5b6020026020010151611fbb9190612cb8565b611fc59190612b2d565b6120ba565b95945050505050565b600080611fee6001600160a01b03841680600160601b6124cf565b905061200781670de0b6b3a7640000600160601b6124cf565b9392505050565b6000808212156120605760405162461bcd60e51b815260206004820152601b60248201527f4e656761746976652072617465206e6f7420737570706f727465640000000000604482015260640161057f565b60008381526003602052604090205460ff16156120b4576000838152600360205260408120546120959060129060ff16612649565b6120a090600a612bc2565b90506120ac8382612655565b915050611930565b50919050565b60008060008360020b126120d1578260020b6120de565b8260020b6120de90612d6e565b90506120ed620d89e719612d4d565b60020b8111156121235760405162461bcd60e51b81526020600482015260016024820152601560fa1b604482015260640161057f565b60006001821661213757600160801b612149565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615612188576080612183826ffff97272373d413259a46990580e213a612c99565b901c90505b60048216156121b25760806121ad826ffff2e50f5f656932ef12357cf3c7fdcc612c99565b901c90505b60088216156121dc5760806121d7826fffe5caca7e10e4e61c3624eaa0941cd0612c99565b901c90505b6010821615612206576080612201826fffcb9843d60f6159c9db58835c926644612c99565b901c90505b602082161561223057608061222b826fff973b41fa98c081472e6896dfb254c0612c99565b901c90505b604082161561225a576080612255826fff2ea16466c96a3843ec78b326b52861612c99565b901c90505b608082161561228457608061227f826ffe5dee046a99a2a811c461f1969c3053612c99565b901c90505b6101008216156122af5760806122aa826ffcbe86c7900a88aedcffc83b479aa3a4612c99565b901c90505b6102008216156122da5760806122d5826ff987a7253ac413176f2b074cf7815e54612c99565b901c90505b610400821615612305576080612300826ff3392b0822b70005940c7a398e4b70f3612c99565b901c90505b61080082161561233057608061232b826fe7159475a2c29b7443b29c7fa6e889d9612c99565b901c90505b61100082161561235b576080612356826fd097f3bdfd2022b8845ad8f792aa5825612c99565b901c90505b612000821615612386576080612381826fa9f746462d870fdf8a65dc1f90e061e5612c99565b901c90505b6140008216156123b15760806123ac826f70d869a156d2a1b890bb3df62baf32f7612c99565b901c90505b6180008216156123dc5760806123d7826f31be135f97d08fd981231505542fcfa6612c99565b901c90505b62010000821615612408576080612403826f09aa508b5b7a84e1c677de54f3e99bc9612c99565b901c90505b6202000082161561243357608061242e826e5d6af8dedb81196699c329225ee604612c99565b901c90505b6204000082161561245d576080612458826d2216e584f5fa1ea926041bedfe98612c99565b901c90505b62080000821615612485576080612480826b048a170391f7dc42444e8fa2612c99565b901c90505b60008460020b13156124a05761249d81600019612b6b565b90505b6124af64010000000082612d39565b156124bb5760016124be565b60005b611a539060ff16602083901c612b15565b60008080600019858709858702925082811083820303915050806000141561250957600084116124fe57600080fd5b508290049050612007565b80841161251557600080fd5b600084868809808403938111909203919050600061253586196001612b15565b86169586900495938490049360008190030460010190506125568184612c99565b909317926000612567876003612c99565b60021890506125768188612c99565b612581906002612d07565b61258b9082612c99565b90506125978188612c99565b6125a2906002612d07565b6125ac9082612c99565b90506125b88188612c99565b6125c3906002612d07565b6125cd9082612c99565b90506125d98188612c99565b6125e4906002612d07565b6125ee9082612c99565b90506125fa8188612c99565b612605906002612d07565b61260f9082612c99565b905061261b8188612c99565b612626906002612d07565b6126309082612c99565b905061263c8186612c99565b9998505050505050505050565b60006120078284612d07565b60006120078284612c99565b600082601f830112612671578081fd5b8151602061268661268183612af1565b612ac0565b80838252828201915082860187848660051b89010111156126a5578586fd5b855b858110156126cc5781516126ba81612dca565b845292840192908401906001016126a7565b5090979650505050505050565b805161ffff811681146126eb57600080fd5b919050565b805169ffffffffffffffffffff811681146126eb57600080fd5b805160ff811681146126eb57600080fd5b60006020828403121561272c578081fd5b813561200781612dca565b600060208284031215612748578081fd5b815161200781612dca565b60008060408385031215612765578081fd5b825167ffffffffffffffff8082111561277c578283fd5b818501915085601f83011261278f578283fd5b8151602061279f61268183612af1565b8083825282820191508286018a848660051b89010111156127be578788fd5b8796505b848710156127e95780516127d581612ddf565b8352600196909601959183019183016127c2565b5091880151919650909350505080821115612802578283fd5b5061280f85828601612661565b9150509250929050565b60006020828403121561282a578081fd5b5035919050565b60008060408385031215612843578182fd5b82359150602083013561285581612dca565b809150509250929050565b600080600060608486031215612874578081fd5b83359250602084013561288681612dca565b9150604084013561289681612dca565b809150509250925092565b600080604083850312156128b3578182fd5b8235915060208301356001600160d81b0381168114612855578182fd5b6000602082840312156128e1578081fd5b813561200781612ddf565b600080600080600080600060e0888a031215612906578485fd5b875161291181612dca565b8097505060208801518060020b8114612928578586fd5b9550612936604089016126d9565b9450612944606089016126d9565b9350612952608089016126d9565b925061296060a0890161270a565b915060c08801518015158114612974578182fd5b8091505092959891949750929550565b600060208284031215612995578081fd5b5051919050565b600080600080600060a086880312156129b3578283fd5b6129bc866126f0565b94506020860151935060408601519250606086015191506129df608087016126f0565b90509295509295909350565b6000602082840312156129fc578081fd5b6120078261270a565b60008251815b81811015612a255760208186018101518583015201612a0b565b81811115612a335782828501525b509190910192915050565b6020808252825182820181905260009190848201906040850190845b81811015612a7657835183529284019291840191600101612a5a565b50909695505050505050565b6020808252825182820181905260009190848201906040850190845b81811015612a7657835163ffffffff1683529284019291840191600101612a9e565b604051601f8201601f1916810167ffffffffffffffff81118282101715612ae957612ae9612db4565b604052919050565b600067ffffffffffffffff821115612b0b57612b0b612db4565b5060051b60200190565b60008219821115612b2857612b28612d88565b500190565b60008160060b8360060b80612b4457612b44612d9e565b667fffffffffffff19821460001982141615612b6257612b62612d88565b90059392505050565b600082612b7a57612b7a612d9e565b500490565b600181815b80851115612bba578160001904821115612ba057612ba0612d88565b80851615612bad57918102915b93841c9390800290612b84565b509250929050565b60006120078383600082612bd857506001611930565b81612be557506000611930565b8160018114612bfb5760028114612c0557612c21565b6001915050611930565b60ff841115612c1657612c16612d88565b50506001821b611930565b5060208310610133831016604e8410600b8410161715612c44575081810a611930565b612c4e8383612b7f565b8060001904821115612c6257612c62612d88565b029392505050565b60006001600160d81b0382811684821681151582840482111615612c9057612c90612d88565b02949350505050565b6000816000190483118215151615612cb357612cb3612d88565b500290565b60008160060b8360060b82811281667fffffffffffff1901831281151615612ce257612ce2612d88565b81667fffffffffffff018313811615612cfd57612cfd612d88565b5090039392505050565b600082821015612d1957612d19612d88565b500390565b6000600019821415612d3257612d32612d88565b5060010190565b600082612d4857612d48612d9e565b500690565b60008160020b627fffff19811415612d6757612d67612d88565b9003919050565b6000600160ff1b821415612d8457612d84612d88565b0390565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052601260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6001600160a01b03811681146110be57600080fd5b8060060b81146110be57600080fdfea26469706673582212207afb62044df578c4d49ba75886ea3612d91b7b3444e53fbc665414d4650dd8c264736f6c63430008040033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 29 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.