Polygon Sponsored slots available. Book your slot here!
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 1,134 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Prefetch Daily V... | 29617938 | 907 days ago | IN | 0 POL | 0.06320937 | ||||
Prefetch Daily P... | 29617935 | 907 days ago | IN | 0 POL | 0.01000049 | ||||
Prefetch Sample | 29590230 | 908 days ago | IN | 0 POL | 0.03603736 | ||||
Prefetch Daily V... | 29577636 | 908 days ago | IN | 0 POL | 0.061893 | ||||
Prefetch Daily P... | 29577634 | 908 days ago | IN | 0 POL | 0.0055826 | ||||
Prefetch Daily P... | 29577631 | 908 days ago | IN | 0 POL | 0.0098024 | ||||
Prefetch Sample | 29549832 | 909 days ago | IN | 0 POL | 0.01416984 | ||||
Prefetch Daily V... | 29536922 | 909 days ago | IN | 0 POL | 0.06787794 | ||||
Prefetch Daily P... | 29536919 | 909 days ago | IN | 0 POL | 0.01085005 | ||||
Prefetch Sample | 29509750 | 910 days ago | IN | 0 POL | 0.04955013 | ||||
Prefetch Daily V... | 29496730 | 910 days ago | IN | 0 POL | 0.07919911 | ||||
Prefetch Daily P... | 29496727 | 910 days ago | IN | 0 POL | 0.01285071 | ||||
Prefetch Sample | 29469220 | 911 days ago | IN | 0 POL | 0.0076705 | ||||
Prefetch Daily V... | 29456234 | 911 days ago | IN | 0 POL | 0.061893 | ||||
Prefetch Daily P... | 29456231 | 911 days ago | IN | 0 POL | 0.0098024 | ||||
Prefetch Sample | 29428153 | 912 days ago | IN | 0 POL | 0.0076705 | ||||
Prefetch Daily V... | 29415112 | 912 days ago | IN | 0 POL | 0.061893 | ||||
Prefetch Daily P... | 29415109 | 912 days ago | IN | 0 POL | 0.0098024 | ||||
Prefetch Sample | 29387621 | 913 days ago | IN | 0 POL | 0.0076705 | ||||
Prefetch Daily V... | 29375657 | 913 days ago | IN | 0 POL | 0.06189838 | ||||
Prefetch Daily P... | 29375655 | 913 days ago | IN | 0 POL | 0.00980309 | ||||
Prefetch Sample | 29348285 | 914 days ago | IN | 0 POL | 0.0076705 | ||||
Prefetch Daily V... | 29335643 | 914 days ago | IN | 0 POL | 0.061893 | ||||
Prefetch Daily P... | 29335640 | 914 days ago | IN | 0 POL | 0.0098024 | ||||
Prefetch Sample | 29308123 | 915 days ago | IN | 0 POL | 0.0076705 |
Loading...
Loading
Contract Name:
ChainlinkFeed
Compiler Version
v0.6.0+commit.26b70077
Optimization Enabled:
Yes with 100 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
pragma solidity >=0.6.0; import "../interfaces/AggregatorV3Interface.sol"; import "../interfaces/TimeProvider.sol"; import "../interfaces/UnderlyingFeed.sol"; import "../utils/MoreMath.sol"; import "../utils/SafeCast.sol"; import "../utils/SafeMath.sol"; import "../utils/SignedSafeMath.sol"; contract ChainlinkFeed is UnderlyingFeed { using SafeCast for int; using SafeCast for uint; using SafeMath for uint; using SignedSafeMath for int; struct Sample { uint32 timestamp; int128 price; } AggregatorV3Interface private aggregator; TimeProvider private time; mapping(uint => Sample) private dailyPrices; mapping(uint => mapping(uint => uint)) private dailyVolatilities; string private _symbol; address private udlAddr; Sample[] private samples; uint private offset; int private priceN; int private priceD; constructor( string memory _sb, address _udlAddr, address _aggregator, address _time, uint _offset, uint[] memory _timestamps, int[] memory _prices ) public { _symbol = _sb; udlAddr = _udlAddr; aggregator = AggregatorV3Interface(_aggregator); time = TimeProvider(_time); offset = _offset; initialize(_timestamps, _prices); } function initialize(uint[] memory _timestamps, int[] memory _prices) public { require(samples.length == 0, "already initialized"); initializeDecimals(); initializeSamples(_timestamps, _prices); } function symbol() override external view returns (string memory) { return _symbol; } function getUnderlyingAddr() override external view returns (address) { return udlAddr; } function getLatestPrice() override external view returns (uint timestamp, int price) { (, price,, timestamp,) = aggregator.latestRoundData(); price = int(rescalePrice(price)); } function getPrice(uint position) override external view returns (uint timestamp, int price) { (timestamp, price,) = getPriceCached(position); } function getPriceCached(uint position) public view returns (uint timestamp, int price, bool cached) { if ((position.mod(1 days) == 0) && (dailyPrices[position].timestamp != 0)) { timestamp = position; price = dailyPrices[position].price; cached = true; } else { uint len = samples.length; require(len > 0, "no sample"); require( samples[0].timestamp <= position && samples[len - 1].timestamp >= position, string(abi.encodePacked("invalid position: ", MoreMath.toString(position))) ); uint start = 0; uint end = len - 1; while (true) { uint m = (start.add(end).add(1)).div(2); Sample memory s = samples[m]; if ((s.timestamp == position) || (end == m)) { if (samples[start].timestamp == position) { s = samples[start]; } timestamp = s.timestamp; price = s.price; break; } if (s.timestamp > position) end = m; else start = m; } } } function getDailyVolatility(uint timespan) override external view returns (uint vol) { (vol, ) = getDailyVolatilityCached(timespan); } function getDailyVolatilityCached(uint timespan) public view returns (uint vol, bool cached) { uint period = timespan.div(1 days); timespan = period.mul(1 days); int[] memory array = new int[](period.sub(1)); if (dailyVolatilities[timespan][today()] == 0) { int prev; int pBase = 1e9; for (uint i = 0; i < period; i++) { uint position = today().sub(timespan).add(i.add(1).mul(1 days)); (, int price,) = getPriceCached(position); if (i > 0) { array[i.sub(1)] = price.mul(pBase).div(prev); } prev = price; } vol = MoreMath.std(array).mul(uint(prev)).div(uint(pBase)); } else { vol = decodeValue(dailyVolatilities[timespan][today()]); cached = true; } } function calcLowerVolatility(uint vol) override external view returns (uint lowerVol) { lowerVol = vol.mul(3).div(2); } function calcUpperVolatility(uint vol) override external view returns (uint upperVol) { upperVol = vol.mul(3); } function prefetchSample() external { (, int price,, uint timestamp,) = aggregator.latestRoundData(); price = rescalePrice(price); require(timestamp > samples[samples.length - 1].timestamp, "already up to date"); samples.push(Sample(timestamp.toUint32(), price.toInt128())); } function prefetchDailyPrice(uint roundId) external { int price; uint timestamp; if (roundId == 0) { (, price,, timestamp,) = aggregator.latestRoundData(); } else { (, price,, timestamp,) = aggregator.getRoundData(uint80(roundId)); } price = rescalePrice(price); uint key = timestamp.div(1 days).mul(1 days); Sample memory s = Sample(timestamp.toUint32(), price.toInt128()); require( dailyPrices[key].timestamp == 0 || dailyPrices[key].timestamp > s.timestamp, "price already set" ); dailyPrices[key] = s; if (samples.length == 0 || samples[samples.length - 1].timestamp < s.timestamp) { samples.push(s); } } function prefetchDailyVolatility(uint timespan) external { require(timespan.mod(1 days) == 0, "invalid timespan"); if (dailyVolatilities[timespan][today()] == 0) { (uint vol, bool cached) = getDailyVolatilityCached(timespan); require(!cached, "already cached"); dailyVolatilities[timespan][today()] = encodeValue(vol); } } function initializeDecimals() private { int exchangeDecimals = 18; int diff = exchangeDecimals.sub(int(aggregator.decimals())); require(-18 <= diff && diff <= 18, "invalid decimals"); if (diff > 0) { priceN = int(10 ** uint(diff)); priceD = 1; } else { priceN = 1; priceD = int(10 ** uint(-diff)); } } function initializeSamples(uint[] memory _timestamps, int[] memory _prices) private { require(_timestamps.length == _prices.length, "length mismatch"); uint lastTimestamp = 0; for (uint i = 0; i < _timestamps.length; i++) { uint ts = _timestamps[i]; require(ts > lastTimestamp, "ascending order required"); lastTimestamp = ts; int pc = _prices[i]; Sample memory s = Sample(ts.toUint32(), pc.toInt128()); if (ts.mod(1 days) == 0) { dailyPrices[ts] = s; } samples.push(s); } } function rescalePrice(int price) private view returns (int128) { return price.mul(priceN).div(priceD).toInt128(); } function encodeValue(uint v) private pure returns (uint) { return v | (uint(1) << 255); } function decodeValue(uint v) private pure returns (uint) { return v & (~(uint(1) << 255)); } function today() private view returns(uint) { return time.getNow().sub(offset).div(1 days).mul(1 days); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @title SignedSafeMath * @dev Signed math operations with safety checks that revert on error. */ library SignedSafeMath { int256 constant private _INT256_MIN = -2**255; /** * @dev Returns the multiplication of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `*` operator. * * Requirements: * * - Multiplication cannot overflow. */ function mul(int256 a, int256 b) internal pure returns (int256) { // 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 0; } require(!(a == -1 && b == _INT256_MIN), "SignedSafeMath: multiplication overflow"); int256 c = a * b; require(c / a == b, "SignedSafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two signed integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opsymbol (which leaves remaining gas untouched) while Solidity * uses an invalid opsymbol to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(int256 a, int256 b) internal pure returns (int256) { require(b != 0, "SignedSafeMath: division by zero"); require(!(b == -1 && a == _INT256_MIN), "SignedSafeMath: division overflow"); int256 c = a / b; return c; } /** * @dev Returns the subtraction of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(int256 a, int256 b) internal pure returns (int256) { int256 c = a - b; require((b >= 0 && c <= a) || (b < 0 && c > a), "SignedSafeMath: subtraction overflow"); return c; } /** * @dev Returns the addition of two signed integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(int256 a, int256 b) internal pure returns (int256) { int256 c = a + b; require((b >= 0 && c >= a) || (b < 0 && c < a), "SignedSafeMath: addition overflow"); return c; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.8.0; /** * @dev Wrappers over Solidity's arithmetic operations with added overflow * checks. * * Arithmetic operations in Solidity wrap on overflow. This can easily result * in bugs, because programmers usually assume that an overflow raises an * error, which is the standard behavior in high level programming languages. * `SafeMath` restores this intuition by reverting the transaction when an * operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. */ library SafeMath { /** * @dev Returns the addition of two unsigned integers, reverting on * overflow. * * Counterpart to Solidity's `+` operator. * * Requirements: * * - Addition cannot overflow. */ function add(uint256 a, uint256 b) internal pure returns (uint256) { uint256 c = a + b; require(c >= a, "SafeMath: addition overflow"); return c; } /** * @dev Returns the subtraction of two unsigned integers, reverting on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b) internal pure returns (uint256) { return sub(a, b, "SafeMath: subtraction overflow"); } /** * @dev Returns the subtraction of two unsigned integers, reverting with custom message on * overflow (when the result is negative). * * Counterpart to Solidity's `-` operator. * * Requirements: * * - Subtraction cannot overflow. */ function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b <= a, errorMessage); uint256 c = a - b; return c; } /** * @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) { // 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 0; } uint256 c = a * b; require(c / a == b, "SafeMath: multiplication overflow"); return c; } /** * @dev Returns the integer division of two unsigned integers. Reverts on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opsymbol (which leaves remaining gas untouched) while Solidity * uses an invalid opsymbol to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b) internal pure returns (uint256) { return div(a, b, "SafeMath: division by zero"); } /** * @dev Returns the integer division of two unsigned integers. Reverts with custom message on * division by zero. The result is rounded towards zero. * * Counterpart to Solidity's `/` operator. Note: this function uses a * `revert` opsymbol (which leaves remaining gas untouched) while Solidity * uses an invalid opsymbol to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b > 0, errorMessage); uint256 c = a / b; // assert(a == b * c + a % b); // There is no case in which this doesn't hold return c; } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opsymbol (which leaves remaining gas untouched) while Solidity uses an * invalid opsymbol to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b) internal pure returns (uint256) { return mod(a, b, "SafeMath: modulo by zero"); } /** * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo), * Reverts with custom message when dividing by zero. * * Counterpart to Solidity's `%` operator. This function uses a `revert` * opsymbol (which leaves remaining gas untouched) while Solidity uses an * invalid opsymbol to revert (consuming all remaining gas). * * Requirements: * * - The divisor cannot be zero. */ function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) { require(b != 0, errorMessage); return a % b; } }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits */ function toUint128(uint256 value) internal pure returns (uint128) { require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits */ function toUint120(uint256 value) internal pure returns (uint120) { require(value < 2**120, "SafeCast: value doesn\'t fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits */ function toUint64(uint256 value) internal pure returns (uint64) { require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits */ function toUint32(uint256 value) internal pure returns (uint32) { require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits */ function toUint16(uint256 value) internal pure returns (uint16) { require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits. */ function toUint8(uint256 value) internal pure returns (uint8) { require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128) { require(value >= -2**127 && value < 2**127, "SafeCast: value doesn\'t fit in 128 bits"); return int128(value); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64) { require(value >= -2**63 && value < 2**63, "SafeCast: value doesn\'t fit in 64 bits"); return int64(value); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32) { require(value >= -2**31 && value < 2**31, "SafeCast: value doesn\'t fit in 32 bits"); return int32(value); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16) { require(value >= -2**15 && value < 2**15, "SafeCast: value doesn\'t fit in 16 bits"); return int16(value); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits. * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8) { require(value >= -2**7 && value < 2**7, "SafeCast: value doesn\'t fit in 8 bits"); return int8(value); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. */ function toInt256(uint256 value) internal pure returns (int256) { require(value < 2**255, "SafeCast: value doesn't fit in an int256"); return int256(value); } }
pragma solidity >=0.6.0; import "./SafeMath.sol"; import "./SignedSafeMath.sol"; library MoreMath { using SafeMath for uint; using SignedSafeMath for int; // rounds "v" considering a base "b" function round(uint v, uint b) internal pure returns (uint) { return v.div(b).add((v % b) >= b.div(2) ? 1 : 0); } // calculates {[(n/d)^e]*f} function powAndMultiply(uint n, uint d, uint e, uint f) internal pure returns (uint) { if (e == 0) { return 1; } else if (e == 1) { return f.mul(n).div(d); } else { uint p = powAndMultiply(n, d, e.div(2), f); p = p.mul(p).div(f); if (e.mod(2) == 1) { p = p.mul(n).div(d); } return p; } } // calculates (n^e) function pow(uint n, uint e) internal pure returns (uint) { if (e == 0) { return 1; } else if (e == 1) { return n; } else { uint p = pow(n, e.div(2)); p = p.mul(p); if (e.mod(2) == 1) { p = p.mul(n); } return p; } } // calculates {n^(e/b)} function powDecimal(uint n, uint e, uint b) internal pure returns (uint v) { if (e == 0) { return b; } if (e > b) { return n.mul(powDecimal(n, e.sub(b), b)).div(b); } v = b; uint f = b; uint aux = 0; uint rootN = n; uint rootB = sqrt(b); while (f > 1) { f = f.div(2); rootN = sqrt(rootN).mul(rootB); if (aux.add(f) < e) { aux = aux.add(f); v = v.mul(rootN).div(b); } } } // calculates ceil(n/d) function divCeil(uint n, uint d) internal pure returns (uint v) { v = n.div(d); if (n.mod(d) > 0) { v = v.add(1); } } // calculates the square root of "x" and multiplies it by "f" function sqrtAndMultiply(uint x, uint f) internal pure returns (uint y) { y = sqrt(x.mul(1e18)).mul(f).div(1e9); } // calculates the square root of "x" function sqrt(uint x) internal pure returns (uint y) { uint z = (x.div(2)).add(1); y = x; while (z < y) { y = z; z = (x.div(z).add(z)).div(2); } } // calculates the standard deviation function std(int[] memory array) internal pure returns (uint _std) { int avg = sum(array).div(int(array.length)); uint x2 = 0; for (uint i = 0; i < array.length; i++) { int p = array[i].sub(avg); x2 = x2.add(uint(p.mul(p))); } _std = sqrt(x2 / array.length); } function sum(int[] memory array) internal pure returns (int _sum) { for (uint i = 0; i < array.length; i++) { _sum = _sum.add(array[i]); } } function abs(int a) internal pure returns (uint) { return uint(a < 0 ? -a : a); } function max(int a, int b) internal pure returns (int) { return a > b ? a : b; } function max(uint a, uint b) internal pure returns (uint) { return a > b ? a : b; } function min(int a, int b) internal pure returns (int) { return a < b ? a : b; } function min(uint a, uint b) internal pure returns (uint) { return a < b ? a : b; } function toString(uint v) internal pure returns (string memory str) { str = toString(v, true); } function toString(uint v, bool scientific) internal pure returns (string memory str) { if (v == 0) { return "0"; } uint maxlength = 100; bytes memory reversed = new bytes(maxlength); uint i = 0; while (v != 0) { uint remainder = v % 10; v = v / 10; reversed[i++] = byte(uint8(48 + remainder)); } uint zeros = 0; if (scientific) { for (uint k = 0; k < i; k++) { if (reversed[k] == '0') { zeros++; } else { break; } } } uint len = i - (zeros > 2 ? zeros : 0); bytes memory s = new bytes(len); for (uint j = 0; j < len; j++) { s[j] = reversed[i - j - 1]; } str = string(s); if (scientific && zeros > 2) { str = string(abi.encodePacked(s, "e", toString(zeros, false))); } } }
pragma solidity >=0.6.0; interface UnderlyingFeed { function symbol() external view returns (string memory); function getUnderlyingAddr() external view returns (address); function getLatestPrice() external view returns (uint timestamp, int price); function getPrice(uint position) external view returns (uint timestamp, int price); function getDailyVolatility(uint timespan) external view returns (uint vol); function calcLowerVolatility(uint vol) external view returns (uint lowerVol); function calcUpperVolatility(uint vol) external view returns (uint upperVol); }
pragma solidity >=0.6.0; interface TimeProvider { function getNow() external view returns (uint); }
// SPDX-License-Identifier: MIT pragma solidity >=0.6.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 ); }
{ "remappings": [], "optimizer": { "enabled": true, "runs": 100 }, "evmVersion": "istanbul", "libraries": {}, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"string","name":"_sb","type":"string"},{"internalType":"address","name":"_udlAddr","type":"address"},{"internalType":"address","name":"_aggregator","type":"address"},{"internalType":"address","name":"_time","type":"address"},{"internalType":"uint256","name":"_offset","type":"uint256"},{"internalType":"uint256[]","name":"_timestamps","type":"uint256[]"},{"internalType":"int256[]","name":"_prices","type":"int256[]"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"uint256","name":"vol","type":"uint256"}],"name":"calcLowerVolatility","outputs":[{"internalType":"uint256","name":"lowerVol","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"vol","type":"uint256"}],"name":"calcUpperVolatility","outputs":[{"internalType":"uint256","name":"upperVol","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timespan","type":"uint256"}],"name":"getDailyVolatility","outputs":[{"internalType":"uint256","name":"vol","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"timespan","type":"uint256"}],"name":"getDailyVolatilityCached","outputs":[{"internalType":"uint256","name":"vol","type":"uint256"},{"internalType":"bool","name":"cached","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getLatestPrice","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"int256","name":"price","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"position","type":"uint256"}],"name":"getPrice","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"int256","name":"price","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"position","type":"uint256"}],"name":"getPriceCached","outputs":[{"internalType":"uint256","name":"timestamp","type":"uint256"},{"internalType":"int256","name":"price","type":"int256"},{"internalType":"bool","name":"cached","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getUnderlyingAddr","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256[]","name":"_timestamps","type":"uint256[]"},{"internalType":"int256[]","name":"_prices","type":"int256[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"prefetchDailyPrice","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"timespan","type":"uint256"}],"name":"prefetchDailyVolatility","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"prefetchSample","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b50604051620028a7380380620028a7833981810160405260e08110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b9083019060208201858111156200006e57600080fd5b82516401000000008111828201881017156200008957600080fd5b82525081516020918201929091019080838360005b83811015620000b85781810151838201526020016200009e565b50505050905090810190601f168015620000e65780820380516001836020036101000a031916815260200191505b5060408181526020830151908301516060840151608085015160a090950180519397929691959493846401000000008211156200012257600080fd5b9083019060208201858111156200013857600080fd5b82518660208202830111640100000000821117156200015657600080fd5b82525081516020918201928201910280838360005b83811015620001855781810151838201526020016200016b565b5050505090500160405260200180516040519392919084640100000000821115620001af57600080fd5b908301906020820185811115620001c557600080fd5b8251866020820283011164010000000082111715620001e357600080fd5b82525081516020918201928201910280838360005b8381101562000212578181015183820152602001620001f8565b5050505091909101604052505088516200023692506004915060208a019062000888565b50600580546001600160a01b038089166001600160a01b03199283161790925560008054888416908316179055600180549287169290911691909117905560078390556200028e82826001600160e01b036200029b16565b5050505050505062000940565b60065415620002f1576040805162461bcd60e51b815260206004820152601360248201527f616c726561647920696e697469616c697a656400000000000000000000000000604482015290519081900360640190fd5b620003046001600160e01b036200031d16565b6200031982826001600160e01b036200044516565b5050565b6000601290506000620003bc6000809054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156200037757600080fd5b505afa1580156200038c573d6000803e3d6000fd5b505050506040513d6020811015620003a357600080fd5b5051839060ff1662000683602090811b62001bed17901c565b90508060111913158015620003d2575060128113155b62000417576040805162461bcd60e51b815260206004820152601060248201526f696e76616c696420646563696d616c7360801b604482015290519081900360640190fd5b60008113156200043457600a81900a600855600160095562000319565b6001600855600003600a0a60095550565b80518251146200048e576040805162461bcd60e51b815260206004820152600f60248201526e0d8cadccee8d040dad2e6dac2e8c6d608b1b604482015290519081900360640190fd5b6000805b83518110156200067d576000848281518110620004ab57fe5b602002602001015190508281116200050a576040805162461bcd60e51b815260206004820152601860248201527f617363656e64696e67206f726465722072657175697265640000000000000000604482015290519081900360640190fd5b80925060008483815181106200051c57fe5b602002602001015190506200053062000909565b60405180604001604052806200055185620006f460201b6200152d1760201c565b63ffffffff16815260200162000572846200073f60201b620015751760201c565b600f0b81525090506200059762015180846200079a60201b620010a01790919060201c565b620005f15760008381526002602090815260409091208251815492840151600f0b6001600160801b031664010000000002600160201b600160a01b031963ffffffff90921663ffffffff1990941693909317169190911790555b600680546001818101835560009290925282517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f9091018054602090940151600f0b6001600160801b031664010000000002600160201b600160a01b031963ffffffff90931663ffffffff19909516949094179190911692909217909155929092019150620004929050565b50505050565b6000818303818312801590620006995750838113155b80620006b05750600083128015620006b057508381135b620006ed5760405162461bcd60e51b8152600401808060200182810382526024815260200180620028836024913960400191505060405180910390fd5b9392505050565b600064010000000082106200073b5760405162461bcd60e51b81526004018080602001828103825260268152602001806200285d6026913960400191505060405180910390fd5b5090565b600060016001607f1b031982121580156200075d57506001607f1b82125b6200073b5760405162461bcd60e51b8152600401808060200182810382526027815260200180620028366027913960400191505060405180910390fd5b6000620006ed83836040518060400160405280601881526020017f536166654d6174683a206d6f64756c6f206279207a65726f0000000000000000815250620007e460201b60201c565b60008183620008745760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015620008385781810151838201526020016200081e565b50505050905090810190601f168015620008665780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b508284816200087f57fe5b06949350505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620008cb57805160ff1916838001178555620008fb565b82800160010185558215620008fb579182015b82811115620008fb578251825591602001919060010190620008de565b506200073b92915062000920565b604080518082019091526000808252602082015290565b6200093d91905b808211156200073b576000815560010162000927565b90565b611ee680620009506000396000f3fe608060405234801561001057600080fd5b50600436106100bf5760003560e01c8063990c11d81161007c578063990c11d8146102e9578063acaec60214610318578063be1eb6de1461033c578063c26802c914610372578063d2cc49a11461038f578063e7572230146103ac578063e89dd84e146103c9576100bf565b80630464c13c146100c45780630d774510146101015780632d9e1047146102265780638e15f4731461024357806392e436aa1461026457806395d89b411461026c575b600080fd5b6100e1600480360360208110156100da57600080fd5b50356103e6565b604080519384526020840192909252151582820152519081900360600190f35b6102246004803603604081101561011757600080fd5b810190602081018135600160201b81111561013157600080fd5b82018360208201111561014357600080fd5b803590602001918460208302840111600160201b8311171561016457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156101b357600080fd5b8201836020820111156101c557600080fd5b803590602001918460208302840111600160201b831117156101e657600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061074b945050505050565b005b6102246004803603602081101561023c57600080fd5b50356107ac565b61024b610ad4565b6040805192835260208301919091528051918290030190f35b610224610b65565b610274610ced565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102ae578181015183820152602001610296565b50505050905090810190601f1680156102db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610306600480360360208110156102ff57600080fd5b5035610d83565b60408051918252519081900360200190f35b610320610d95565b604080516001600160a01b039092168252519081900360200190f35b6103596004803603602081101561035257600080fd5b5035610da4565b6040805192835290151560208301528051918290030190f35b6103066004803603602081101561038857600080fd5b5035610f47565b610306600480360360208110156103a557600080fd5b5035610f60565b61024b600480360360208110156103c257600080fd5b5035610f78565b610224600480360360208110156103df57600080fd5b5035610f8f565b600080806103fd846201518063ffffffff6110a016565b15801561041d575060008481526002602052604090205463ffffffff1615155b1561044b575050506000818152600260205260409020548190600160201b9004600f90810b900b6001610744565b6006548061048c576040805162461bcd60e51b81526020600482015260096024820152686e6f2073616d706c6560b81b604482015290519081900360640190fd5b84600660008154811061049b57fe5b60009182526020909120015463ffffffff16118015906104dc575084600660018303815481106104c757fe5b60009182526020909120015463ffffffff1610155b6104e5866110e4565b604051602001808071034b73b30b634b2103837b9b4ba34b7b71d160751b81525060120182805190602001908083835b602083106105345780518252601f199092019160209182019101610515565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052906105f15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156105b657818101518382015260200161059e565b50505050905090810190601f1680156105e35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600060001982015b600061062e60026106226001610616878763ffffffff6110f116565b9063ffffffff6110f116565b9063ffffffff61114b16565b9050610638611d9e565b6006828154811061064557fe5b60009182526020918290206040805180820190915291015463ffffffff8116808352600160201b909104600f90810b810b900b92820192909252915089148061068d57508183145b1561071e5788600685815481106106a057fe5b60009182526020909120015463ffffffff16141561070057600684815481106106c557fe5b60009182526020918290206040805180820190915291015463ffffffff81168252600160201b9004600f90810b810b900b9181019190915290505b806000015163ffffffff1697508060200151600f0b96505050610740565b805163ffffffff1689101561073557819250610739565b8193505b50506105fa565b5050505b9193909250565b60065415610796576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b61079e61118d565b6107a882826112a6565b5050565b60008082610841576000809054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561080157600080fd5b505afa158015610815573d6000803e3d6000fd5b505050506040513d60a081101561082b57600080fd5b50602081015160609091015190925090506108d4565b60005460408051639a6fc8f560e01b815269ffffffffffffffffffff8616600482015290516001600160a01b0390921691639a6fc8f59160248082019260a092909190829003018186803b15801561089857600080fd5b505afa1580156108ac573d6000803e3d6000fd5b505050506040513d60a08110156108c257600080fd5b50602081015160609091015190925090505b6108dd826114af565b600f0b91506000610907620151806108fb848263ffffffff61114b16565b9063ffffffff6114d416565b9050610911611d9e565b60405180604001604052806109258561152d565b63ffffffff16815260200161093986611575565b600f0b905260008381526002602052604090205490915063ffffffff16158061097a5750805160008381526002602052604090205463ffffffff9182169116115b6109bf576040805162461bcd60e51b81526020600482015260116024820152701c1c9a58d948185b1c9958591e481cd95d607a1b604482015290519081900360640190fd5b60008281526002602090815260409091208251815492840151600f0b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90921663ffffffff1990941693909317169190911790556006541580610a4d575080516006805463ffffffff909216916000198101908110610a3957fe5b60009182526020909120015463ffffffff16105b15610acd576006805460018101825560009190915281517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f90910180546020840151600f0b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90941663ffffffff1990921691909117929092169190911790555b5050505050565b6000805460408051633fabe5a360e21b8152905183926001600160a01b03169163feaf968c9160048083019260a0929190829003018186803b158015610b1957600080fd5b505afa158015610b2d573d6000803e3d6000fd5b505050506040513d60a0811015610b4357600080fd5b50602081015160609091015192509050610b5c816114af565b600f0b90509091565b6000805460408051633fabe5a360e21b8152905183926001600160a01b03169163feaf968c9160048083019260a0929190829003018186803b158015610baa57600080fd5b505afa158015610bbe573d6000803e3d6000fd5b505050506040513d60a0811015610bd457600080fd5b5060208101516060909101519092509050610bee826114af565b600f0b9150600660016006805490500381548110610c0857fe5b60009182526020909120015463ffffffff168111610c62576040805162461bcd60e51b8152602060048201526012602482015271616c726561647920757020746f206461746560701b604482015290519081900360640190fd5b60066040518060400160405280610c788461152d565b63ffffffff168152602001610c8c85611575565b600f90810b90915282546001810184556000938452602093849020835191018054939094015190910b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90921663ffffffff1990931692909217161790555050565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d795780601f10610d4e57610100808354040283529160200191610d79565b820191906000526020600020905b815481529060010190602001808311610d5c57829003601f168201915b5050505050905090565b6000610d8e82610da4565b5092915050565b6005546001600160a01b031690565b60008080610dbb846201518063ffffffff61114b16565b9050610dd0816201518063ffffffff6114d416565b93506060610de582600163ffffffff6115cd16565b604051908082528060200260200182016040528015610e0e578160200160208202803883390190505b506000868152600360205260408120919250610e2861160f565b81526020019081526020016000205460001415610f0b576000633b9aca00815b84811015610ef0576000610e85610e6d620151806108fb85600163ffffffff6110f116565b6106168b610e7961160f565b9063ffffffff6115cd16565b90506000610e92826103e6565b509150508215610ee557610ebc85610eb0838763ffffffff6116b016565b9063ffffffff61175916565b86610ece85600163ffffffff6115cd16565b81518110610ed857fe5b6020026020010181815250505b935050600101610e48565b50610f0281610622846108fb87611811565b95505050610f40565b6000858152600360205260408120610f3991610f2561160f565b8152602001908152602001600020546118a2565b9350600192505b5050915091565b6000610f5a82600363ffffffff6114d416565b92915050565b6000610f5a600261062284600363ffffffff6114d416565b600080610f84836103e6565b509094909350915050565b610fa2816201518063ffffffff6110a016565b15610fe7576040805162461bcd60e51b815260206004820152601060248201526f34b73b30b634b2103a34b6b2b9b830b760811b604482015290519081900360640190fd5b600081815260036020526040812090610ffe61160f565b8152602001908152602001600020546000141561109d5760008061102183610da4565b915091508015611069576040805162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e4818d858da195960921b604482015290519081900360640190fd5b611072826118ae565b60008481526003602052604081209061108961160f565b815260208101919091526040016000205550505b50565b60006110dd838360405180604001604052806018815260200177536166654d6174683a206d6f64756c6f206279207a65726f60401b8152506118b7565b9392505050565b6060610f5a826001611919565b6000828201838110156110dd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006110dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b88565b60006012905060006112216000809054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156111e557600080fd5b505afa1580156111f9573d6000803e3d6000fd5b505050506040513d602081101561120f57600080fd5b5051839060ff1663ffffffff611bed16565b90508060111913158015611236575060128113155b61127a576040805162461bcd60e51b815260206004820152601060248201526f696e76616c696420646563696d616c7360801b604482015290519081900360640190fd5b600081131561129557600a81900a60085560016009556107a8565b6001600855600003600a0a60095550565b80518251146112ee576040805162461bcd60e51b815260206004820152600f60248201526e0d8cadccee8d040dad2e6dac2e8c6d608b1b604482015290519081900360640190fd5b6000805b83518110156114a957600084828151811061130957fe5b60200260200101519050828111611362576040805162461bcd60e51b8152602060048201526018602482015277185cd8d95b991a5b99c81bdc99195c881c995c5d5a5c995960421b604482015290519081900360640190fd5b809250600084838151811061137357fe5b60200260200101519050611385611d9e565b60405180604001604052806113998561152d565b63ffffffff1681526020016113ad84611575565b600f0b905290506113c7836201518063ffffffff6110a016565b61141f5760008381526002602090815260409091208251815492840151600f0b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90921663ffffffff1990941693909317169190911790555b600680546001818101835560009290925282517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f9091018054602090940151600f0b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90931663ffffffff199095169490941791909116929092179091559290920191506112f29050565b50505050565b6000610f5a6114cf600954610eb0600854866116b090919063ffffffff16565b611575565b6000826114e357506000610f5a565b828202828482816114f057fe5b04146110dd5760405162461bcd60e51b8152600401808060200182810382526021815260200180611e1f6021913960400191505060405180910390fd5b6000600160201b82106115715760405162461bcd60e51b8152600401808060200182810382526026815260200180611e676026913960400191505060405180910390fd5b5090565b600060016001607f1b0319821215801561159257506001607f1b82125b6115715760405162461bcd60e51b8152600401808060200182810382526027815260200180611db66027913960400191505060405180910390fd5b60006110dd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c52565b60006116ab620151806108fb62015180610622600754600160009054906101000a90046001600160a01b03166001600160a01b031663bbe4fd506040518163ffffffff1660e01b815260040160206040518083038186803b15801561167357600080fd5b505afa158015611687573d6000803e3d6000fd5b505050506040513d602081101561169d57600080fd5b50519063ffffffff6115cd16565b905090565b6000826116bf57506000610f5a565b826000191480156116d35750600160ff1b82145b1561170f5760405162461bcd60e51b8152600401808060200182810382526027815260200180611e406027913960400191505060405180910390fd5b8282028284828161171c57fe5b05146110dd5760405162461bcd60e51b8152600401808060200182810382526027815260200180611e406027913960400191505060405180910390fd5b6000816117ad576040805162461bcd60e51b815260206004820181905260248201527f5369676e6564536166654d6174683a206469766973696f6e206279207a65726f604482015290519081900360640190fd5b816000191480156117c15750600160ff1b83145b156117fd5760405162461bcd60e51b8152600401808060200182810382526021815260200180611dfe6021913960400191505060405180910390fd5b600082848161180857fe5b05949350505050565b6000806118228351610eb085611cac565b90506000805b84518110156118865760006118598487848151811061184357fe5b6020026020010151611bed90919063ffffffff16565b905061187b61186e828063ffffffff6116b016565b849063ffffffff6110f116565b925050600101611828565b5061189a8451828161189457fe5b04611cef565b949350505050565b6001600160ff1b031690565b600160ff1b1790565b600081836119065760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156105b657818101518382015260200161059e565b5082848161191057fe5b06949350505050565b60608261193e57506040805180820190915260018152600360fc1b6020820152610f5a565b60408051606480825260a082019092526060908260208201818038833901905050905060005b85156119aa578151600a808804976001840193919006916030830160f81b918591811061198d57fe5b60200101906001600160f81b031916908160001a90535050611964565b600085156119fe5760005b828110156119fc578381815181106119c957fe5b6020910101516001600160f81b031916600360fc1b14156119ef576001909101906119f4565b6119fc565b6001016119b5565b505b600060028211611a0f576000611a11565b815b830390506060816040519080825280601f01601f191660200182016040528015611a42576020820181803883390190505b50905060005b82811015611a97578560018287030381518110611a6157fe5b602001015160f81c60f81b828281518110611a7857fe5b60200101906001600160f81b031916908160001a905350600101611a48565b50809650878015611aa85750600283115b15611b7c5780611ab9846000611919565b6040516020018083805190602001908083835b60208310611aeb5780518252601f199092019160209182019101611acc565b6001836020036101000a03801982511681845116808217855250505050505090500180606560f81b81525060010182805190602001908083835b60208310611b445780518252601f199092019160209182019101611b25565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405296505b50505050505092915050565b60008183611bd75760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156105b657818101518382015260200161059e565b506000838581611be357fe5b0495945050505050565b6000818303818312801590611c025750838113155b80611c175750600083128015611c1757508381135b6110dd5760405162461bcd60e51b8152600401808060200182810382526024815260200180611e8d6024913960400191505060405180910390fd5b60008184841115611ca45760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156105b657818101518382015260200161059e565b505050900390565b6000805b8251811015611ce957611cdf838281518110611cc857fe5b602002602001015183611d3990919063ffffffff16565b9150600101611cb0565b50919050565b600080611d08600161061685600263ffffffff61114b16565b90508291505b81811015611ce957905080611d32600261062283610616878263ffffffff61114b16565b9050611d0e565b6000828201818312801590611d4e5750838112155b80611d635750600083128015611d6357508381125b6110dd5760405162461bcd60e51b8152600401808060200182810382526021815260200180611ddd6021913960400191505060405180910390fd5b60408051808201909152600080825260208201529056fe53616665436173743a2076616c756520646f65736e27742066697420696e2031323820626974735369676e6564536166654d6174683a206164646974696f6e206f766572666c6f775369676e6564536166654d6174683a206469766973696f6e206f766572666c6f77536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775369676e6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7753616665436173743a2076616c756520646f65736e27742066697420696e20333220626974735369676e6564536166654d6174683a207375627472616374696f6e206f766572666c6f77a26469706673582212208303c489905edf252d0bbdbf4036e288ad3e5db99b8ee70233756f51473d315464736f6c6343000600003353616665436173743a2076616c756520646f65736e27742066697420696e20313238206269747353616665436173743a2076616c756520646f65736e27742066697420696e20333220626974735369676e6564536166654d6174683a207375627472616374696f6e206f766572666c6f7700000000000000000000000000000000000000000000000000000000000000e00000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000f9680d99d6c9589e2a93a78a04a279e509205945000000000000000000000000b82d1e2fc0777b4bff77a4d1e0ddd7e0941c43950000000000000000000000000000000000000000000000000000000000002a300000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000074554482f5553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100bf5760003560e01c8063990c11d81161007c578063990c11d8146102e9578063acaec60214610318578063be1eb6de1461033c578063c26802c914610372578063d2cc49a11461038f578063e7572230146103ac578063e89dd84e146103c9576100bf565b80630464c13c146100c45780630d774510146101015780632d9e1047146102265780638e15f4731461024357806392e436aa1461026457806395d89b411461026c575b600080fd5b6100e1600480360360208110156100da57600080fd5b50356103e6565b604080519384526020840192909252151582820152519081900360600190f35b6102246004803603604081101561011757600080fd5b810190602081018135600160201b81111561013157600080fd5b82018360208201111561014357600080fd5b803590602001918460208302840111600160201b8311171561016457600080fd5b9190808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152509295949360208101935035915050600160201b8111156101b357600080fd5b8201836020820111156101c557600080fd5b803590602001918460208302840111600160201b831117156101e657600080fd5b91908080602002602001604051908101604052809392919081815260200183836020028082843760009201919091525092955061074b945050505050565b005b6102246004803603602081101561023c57600080fd5b50356107ac565b61024b610ad4565b6040805192835260208301919091528051918290030190f35b610224610b65565b610274610ced565b6040805160208082528351818301528351919283929083019185019080838360005b838110156102ae578181015183820152602001610296565b50505050905090810190601f1680156102db5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610306600480360360208110156102ff57600080fd5b5035610d83565b60408051918252519081900360200190f35b610320610d95565b604080516001600160a01b039092168252519081900360200190f35b6103596004803603602081101561035257600080fd5b5035610da4565b6040805192835290151560208301528051918290030190f35b6103066004803603602081101561038857600080fd5b5035610f47565b610306600480360360208110156103a557600080fd5b5035610f60565b61024b600480360360208110156103c257600080fd5b5035610f78565b610224600480360360208110156103df57600080fd5b5035610f8f565b600080806103fd846201518063ffffffff6110a016565b15801561041d575060008481526002602052604090205463ffffffff1615155b1561044b575050506000818152600260205260409020548190600160201b9004600f90810b900b6001610744565b6006548061048c576040805162461bcd60e51b81526020600482015260096024820152686e6f2073616d706c6560b81b604482015290519081900360640190fd5b84600660008154811061049b57fe5b60009182526020909120015463ffffffff16118015906104dc575084600660018303815481106104c757fe5b60009182526020909120015463ffffffff1610155b6104e5866110e4565b604051602001808071034b73b30b634b2103837b9b4ba34b7b71d160751b81525060120182805190602001908083835b602083106105345780518252601f199092019160209182019101610515565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051602081830303815290604052906105f15760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156105b657818101518382015260200161059e565b50505050905090810190601f1680156105e35780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b50600060001982015b600061062e60026106226001610616878763ffffffff6110f116565b9063ffffffff6110f116565b9063ffffffff61114b16565b9050610638611d9e565b6006828154811061064557fe5b60009182526020918290206040805180820190915291015463ffffffff8116808352600160201b909104600f90810b810b900b92820192909252915089148061068d57508183145b1561071e5788600685815481106106a057fe5b60009182526020909120015463ffffffff16141561070057600684815481106106c557fe5b60009182526020918290206040805180820190915291015463ffffffff81168252600160201b9004600f90810b810b900b9181019190915290505b806000015163ffffffff1697508060200151600f0b96505050610740565b805163ffffffff1689101561073557819250610739565b8193505b50506105fa565b5050505b9193909250565b60065415610796576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b61079e61118d565b6107a882826112a6565b5050565b60008082610841576000809054906101000a90046001600160a01b03166001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b15801561080157600080fd5b505afa158015610815573d6000803e3d6000fd5b505050506040513d60a081101561082b57600080fd5b50602081015160609091015190925090506108d4565b60005460408051639a6fc8f560e01b815269ffffffffffffffffffff8616600482015290516001600160a01b0390921691639a6fc8f59160248082019260a092909190829003018186803b15801561089857600080fd5b505afa1580156108ac573d6000803e3d6000fd5b505050506040513d60a08110156108c257600080fd5b50602081015160609091015190925090505b6108dd826114af565b600f0b91506000610907620151806108fb848263ffffffff61114b16565b9063ffffffff6114d416565b9050610911611d9e565b60405180604001604052806109258561152d565b63ffffffff16815260200161093986611575565b600f0b905260008381526002602052604090205490915063ffffffff16158061097a5750805160008381526002602052604090205463ffffffff9182169116115b6109bf576040805162461bcd60e51b81526020600482015260116024820152701c1c9a58d948185b1c9958591e481cd95d607a1b604482015290519081900360640190fd5b60008281526002602090815260409091208251815492840151600f0b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90921663ffffffff1990941693909317169190911790556006541580610a4d575080516006805463ffffffff909216916000198101908110610a3957fe5b60009182526020909120015463ffffffff16105b15610acd576006805460018101825560009190915281517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f90910180546020840151600f0b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90941663ffffffff1990921691909117929092169190911790555b5050505050565b6000805460408051633fabe5a360e21b8152905183926001600160a01b03169163feaf968c9160048083019260a0929190829003018186803b158015610b1957600080fd5b505afa158015610b2d573d6000803e3d6000fd5b505050506040513d60a0811015610b4357600080fd5b50602081015160609091015192509050610b5c816114af565b600f0b90509091565b6000805460408051633fabe5a360e21b8152905183926001600160a01b03169163feaf968c9160048083019260a0929190829003018186803b158015610baa57600080fd5b505afa158015610bbe573d6000803e3d6000fd5b505050506040513d60a0811015610bd457600080fd5b5060208101516060909101519092509050610bee826114af565b600f0b9150600660016006805490500381548110610c0857fe5b60009182526020909120015463ffffffff168111610c62576040805162461bcd60e51b8152602060048201526012602482015271616c726561647920757020746f206461746560701b604482015290519081900360640190fd5b60066040518060400160405280610c788461152d565b63ffffffff168152602001610c8c85611575565b600f90810b90915282546001810184556000938452602093849020835191018054939094015190910b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90921663ffffffff1990931692909217161790555050565b60048054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610d795780601f10610d4e57610100808354040283529160200191610d79565b820191906000526020600020905b815481529060010190602001808311610d5c57829003601f168201915b5050505050905090565b6000610d8e82610da4565b5092915050565b6005546001600160a01b031690565b60008080610dbb846201518063ffffffff61114b16565b9050610dd0816201518063ffffffff6114d416565b93506060610de582600163ffffffff6115cd16565b604051908082528060200260200182016040528015610e0e578160200160208202803883390190505b506000868152600360205260408120919250610e2861160f565b81526020019081526020016000205460001415610f0b576000633b9aca00815b84811015610ef0576000610e85610e6d620151806108fb85600163ffffffff6110f116565b6106168b610e7961160f565b9063ffffffff6115cd16565b90506000610e92826103e6565b509150508215610ee557610ebc85610eb0838763ffffffff6116b016565b9063ffffffff61175916565b86610ece85600163ffffffff6115cd16565b81518110610ed857fe5b6020026020010181815250505b935050600101610e48565b50610f0281610622846108fb87611811565b95505050610f40565b6000858152600360205260408120610f3991610f2561160f565b8152602001908152602001600020546118a2565b9350600192505b5050915091565b6000610f5a82600363ffffffff6114d416565b92915050565b6000610f5a600261062284600363ffffffff6114d416565b600080610f84836103e6565b509094909350915050565b610fa2816201518063ffffffff6110a016565b15610fe7576040805162461bcd60e51b815260206004820152601060248201526f34b73b30b634b2103a34b6b2b9b830b760811b604482015290519081900360640190fd5b600081815260036020526040812090610ffe61160f565b8152602001908152602001600020546000141561109d5760008061102183610da4565b915091508015611069576040805162461bcd60e51b815260206004820152600e60248201526d185b1c9958591e4818d858da195960921b604482015290519081900360640190fd5b611072826118ae565b60008481526003602052604081209061108961160f565b815260208101919091526040016000205550505b50565b60006110dd838360405180604001604052806018815260200177536166654d6174683a206d6f64756c6f206279207a65726f60401b8152506118b7565b9392505050565b6060610f5a826001611919565b6000828201838110156110dd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b60006110dd83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250611b88565b60006012905060006112216000809054906101000a90046001600160a01b03166001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156111e557600080fd5b505afa1580156111f9573d6000803e3d6000fd5b505050506040513d602081101561120f57600080fd5b5051839060ff1663ffffffff611bed16565b90508060111913158015611236575060128113155b61127a576040805162461bcd60e51b815260206004820152601060248201526f696e76616c696420646563696d616c7360801b604482015290519081900360640190fd5b600081131561129557600a81900a60085560016009556107a8565b6001600855600003600a0a60095550565b80518251146112ee576040805162461bcd60e51b815260206004820152600f60248201526e0d8cadccee8d040dad2e6dac2e8c6d608b1b604482015290519081900360640190fd5b6000805b83518110156114a957600084828151811061130957fe5b60200260200101519050828111611362576040805162461bcd60e51b8152602060048201526018602482015277185cd8d95b991a5b99c81bdc99195c881c995c5d5a5c995960421b604482015290519081900360640190fd5b809250600084838151811061137357fe5b60200260200101519050611385611d9e565b60405180604001604052806113998561152d565b63ffffffff1681526020016113ad84611575565b600f0b905290506113c7836201518063ffffffff6110a016565b61141f5760008381526002602090815260409091208251815492840151600f0b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90921663ffffffff1990941693909317169190911790555b600680546001818101835560009290925282517ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f9091018054602090940151600f0b6001600160801b0316600160201b02600160201b600160a01b031963ffffffff90931663ffffffff199095169490941791909116929092179091559290920191506112f29050565b50505050565b6000610f5a6114cf600954610eb0600854866116b090919063ffffffff16565b611575565b6000826114e357506000610f5a565b828202828482816114f057fe5b04146110dd5760405162461bcd60e51b8152600401808060200182810382526021815260200180611e1f6021913960400191505060405180910390fd5b6000600160201b82106115715760405162461bcd60e51b8152600401808060200182810382526026815260200180611e676026913960400191505060405180910390fd5b5090565b600060016001607f1b0319821215801561159257506001607f1b82125b6115715760405162461bcd60e51b8152600401808060200182810382526027815260200180611db66027913960400191505060405180910390fd5b60006110dd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250611c52565b60006116ab620151806108fb62015180610622600754600160009054906101000a90046001600160a01b03166001600160a01b031663bbe4fd506040518163ffffffff1660e01b815260040160206040518083038186803b15801561167357600080fd5b505afa158015611687573d6000803e3d6000fd5b505050506040513d602081101561169d57600080fd5b50519063ffffffff6115cd16565b905090565b6000826116bf57506000610f5a565b826000191480156116d35750600160ff1b82145b1561170f5760405162461bcd60e51b8152600401808060200182810382526027815260200180611e406027913960400191505060405180910390fd5b8282028284828161171c57fe5b05146110dd5760405162461bcd60e51b8152600401808060200182810382526027815260200180611e406027913960400191505060405180910390fd5b6000816117ad576040805162461bcd60e51b815260206004820181905260248201527f5369676e6564536166654d6174683a206469766973696f6e206279207a65726f604482015290519081900360640190fd5b816000191480156117c15750600160ff1b83145b156117fd5760405162461bcd60e51b8152600401808060200182810382526021815260200180611dfe6021913960400191505060405180910390fd5b600082848161180857fe5b05949350505050565b6000806118228351610eb085611cac565b90506000805b84518110156118865760006118598487848151811061184357fe5b6020026020010151611bed90919063ffffffff16565b905061187b61186e828063ffffffff6116b016565b849063ffffffff6110f116565b925050600101611828565b5061189a8451828161189457fe5b04611cef565b949350505050565b6001600160ff1b031690565b600160ff1b1790565b600081836119065760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156105b657818101518382015260200161059e565b5082848161191057fe5b06949350505050565b60608261193e57506040805180820190915260018152600360fc1b6020820152610f5a565b60408051606480825260a082019092526060908260208201818038833901905050905060005b85156119aa578151600a808804976001840193919006916030830160f81b918591811061198d57fe5b60200101906001600160f81b031916908160001a90535050611964565b600085156119fe5760005b828110156119fc578381815181106119c957fe5b6020910101516001600160f81b031916600360fc1b14156119ef576001909101906119f4565b6119fc565b6001016119b5565b505b600060028211611a0f576000611a11565b815b830390506060816040519080825280601f01601f191660200182016040528015611a42576020820181803883390190505b50905060005b82811015611a97578560018287030381518110611a6157fe5b602001015160f81c60f81b828281518110611a7857fe5b60200101906001600160f81b031916908160001a905350600101611a48565b50809650878015611aa85750600283115b15611b7c5780611ab9846000611919565b6040516020018083805190602001908083835b60208310611aeb5780518252601f199092019160209182019101611acc565b6001836020036101000a03801982511681845116808217855250505050505090500180606560f81b81525060010182805190602001908083835b60208310611b445780518252601f199092019160209182019101611b25565b6001836020036101000a0380198251168184511680821785525050505050509050019250505060405160208183030381529060405296505b50505050505092915050565b60008183611bd75760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156105b657818101518382015260200161059e565b506000838581611be357fe5b0495945050505050565b6000818303818312801590611c025750838113155b80611c175750600083128015611c1757508381135b6110dd5760405162461bcd60e51b8152600401808060200182810382526024815260200180611e8d6024913960400191505060405180910390fd5b60008184841115611ca45760405162461bcd60e51b81526020600482018181528351602484015283519092839260449091019190850190808383600083156105b657818101518382015260200161059e565b505050900390565b6000805b8251811015611ce957611cdf838281518110611cc857fe5b602002602001015183611d3990919063ffffffff16565b9150600101611cb0565b50919050565b600080611d08600161061685600263ffffffff61114b16565b90508291505b81811015611ce957905080611d32600261062283610616878263ffffffff61114b16565b9050611d0e565b6000828201818312801590611d4e5750838112155b80611d635750600083128015611d6357508381125b6110dd5760405162461bcd60e51b8152600401808060200182810382526021815260200180611ddd6021913960400191505060405180910390fd5b60408051808201909152600080825260208201529056fe53616665436173743a2076616c756520646f65736e27742066697420696e2031323820626974735369676e6564536166654d6174683a206164646974696f6e206f766572666c6f775369676e6564536166654d6174683a206469766973696f6e206f766572666c6f77536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f775369676e6564536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7753616665436173743a2076616c756520646f65736e27742066697420696e20333220626974735369676e6564536166654d6174683a207375627472616374696f6e206f766572666c6f77a26469706673582212208303c489905edf252d0bbdbf4036e288ad3e5db99b8ee70233756f51473d315464736f6c63430006000033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000000000000000000000000000000000000000000e00000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619000000000000000000000000f9680d99d6c9589e2a93a78a04a279e509205945000000000000000000000000b82d1e2fc0777b4bff77a4d1e0ddd7e0941c43950000000000000000000000000000000000000000000000000000000000002a300000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000000074554482f5553440000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : _sb (string): ETH/USD
Arg [1] : _udlAddr (address): 0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619
Arg [2] : _aggregator (address): 0xF9680D99D6C9589e2a93a78A04A279e509205945
Arg [3] : _time (address): 0xB82D1E2Fc0777B4bff77A4d1e0ddD7E0941c4395
Arg [4] : _offset (uint256): 10800
-----Encoded View---------------
11 Constructor Arguments found :
Arg [0] : 00000000000000000000000000000000000000000000000000000000000000e0
Arg [1] : 0000000000000000000000007ceb23fd6bc0add59e62ac25578270cff1b9f619
Arg [2] : 000000000000000000000000f9680d99d6c9589e2a93a78a04a279e509205945
Arg [3] : 000000000000000000000000b82d1e2fc0777b4bff77a4d1e0ddd7e0941c4395
Arg [4] : 0000000000000000000000000000000000000000000000000000000000002a30
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000120
Arg [6] : 0000000000000000000000000000000000000000000000000000000000000140
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000007
Arg [8] : 4554482f55534400000000000000000000000000000000000000000000000000
Arg [9] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.