-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathOracle.json
421 lines (421 loc) · 56.3 KB
/
Oracle.json
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
{
"address": "0x090faD896CeE0D770fAF02d90D05e017d85f51F2",
"abi": [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "PERIOD",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
},
{
"internalType": "uint256",
"name": "amountIn",
"type": "uint256"
}
],
"name": "consult",
"outputs": [
{
"internalType": "uint256",
"name": "amountOut",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "factory",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "price0Average",
"outputs": [
{
"internalType": "uint224",
"name": "_x",
"type": "uint224"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "price1Average",
"outputs": [
{
"internalType": "uint224",
"name": "_x",
"type": "uint224"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "tokenA",
"type": "address"
},
{
"internalType": "address",
"name": "tokenB",
"type": "address"
}
],
"name": "setNewTokenInfo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address[]",
"name": "tokensA",
"type": "address[]"
},
{
"internalType": "address[]",
"name": "tokensB",
"type": "address[]"
}
],
"name": "setNewTokensInfo",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "amount",
"type": "uint256"
}
],
"name": "setPERIOD",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "tokenInfoList",
"outputs": [
{
"internalType": "contract IUniswapV2Pair",
"name": "pair",
"type": "address"
},
{
"internalType": "address",
"name": "token0",
"type": "address"
},
{
"internalType": "address",
"name": "token1",
"type": "address"
},
{
"internalType": "uint256",
"name": "price0CumulativeLast",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "price1CumulativeLast",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "blockTimestampLast",
"type": "uint32"
},
{
"components": [
{
"internalType": "uint224",
"name": "_x",
"type": "uint224"
}
],
"internalType": "struct FixedPoint.uq112x112",
"name": "price0Average",
"type": "tuple"
},
{
"components": [
{
"internalType": "uint224",
"name": "_x",
"type": "uint224"
}
],
"internalType": "struct FixedPoint.uq112x112",
"name": "price1Average",
"type": "tuple"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "token",
"type": "address"
}
],
"name": "update",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
],
"transactionHash": "0xa4e761bf3e792b5164c3244f8633044d39d9cc605ef19f9aae556f2d3186c495",
"receipt": {
"to": null,
"from": "0x595b85b4A418e3B8df897D02F5BD49167D00862F",
"contractAddress": "0x090faD896CeE0D770fAF02d90D05e017d85f51F2",
"transactionIndex": 1,
"gasUsed": "1183722",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xb63bf984fcbcfe6f0226ae257c6b9be2096a0aada7493139b3a271c7d87efacf",
"transactionHash": "0xa4e761bf3e792b5164c3244f8633044d39d9cc605ef19f9aae556f2d3186c495",
"logs": [],
"blockNumber": 8091149,
"cumulativeGasUsed": "1235212",
"status": 1,
"byzantium": true
},
"args": [],
"numDeployments": 1,
"solcInputHash": "93d99761d7918f39b88570d3022a882e",
"metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"inputs\":[],\"name\":\"PERIOD\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amountIn\",\"type\":\"uint256\"}],\"name\":\"consult\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"amountOut\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"factory\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price0Average\",\"outputs\":[{\"internalType\":\"uint224\",\"name\":\"_x\",\"type\":\"uint224\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"price1Average\",\"outputs\":[{\"internalType\":\"uint224\",\"name\":\"_x\",\"type\":\"uint224\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"tokenA\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"tokenB\",\"type\":\"address\"}],\"name\":\"setNewTokenInfo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"tokensA\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"tokensB\",\"type\":\"address[]\"}],\"name\":\"setNewTokensInfo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"setPERIOD\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenInfoList\",\"outputs\":[{\"internalType\":\"contract IUniswapV2Pair\",\"name\":\"pair\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token0\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"token1\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"price0CumulativeLast\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"price1CumulativeLast\",\"type\":\"uint256\"},{\"internalType\":\"uint32\",\"name\":\"blockTimestampLast\",\"type\":\"uint32\"},{\"components\":[{\"internalType\":\"uint224\",\"name\":\"_x\",\"type\":\"uint224\"}],\"internalType\":\"struct FixedPoint.uq112x112\",\"name\":\"price0Average\",\"type\":\"tuple\"},{\"components\":[{\"internalType\":\"uint224\",\"name\":\"_x\",\"type\":\"uint224\"}],\"internalType\":\"struct FixedPoint.uq112x112\",\"name\":\"price1Average\",\"type\":\"tuple\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"}],\"name\":\"update\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/deploy/Oracle.sol\":\"Oracle\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":20},\"remappings\":[]},\"sources\":{\"contracts/deploy/Oracle.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity 0.6.12;\\n\\ninterface IUniswapV2Factory {\\n event PairCreated(address indexed token0, address indexed token1, address pair, uint);\\n\\n function feeTo() external view returns (address);\\n\\n function feeToSetter() external view returns (address);\\n\\n function getPair(address tokenA, address tokenB) external view returns (address pair);\\n\\n function allPairs(uint) external view returns (address pair);\\n\\n function allPairsLength() external view returns (uint);\\n\\n function createPair(address tokenA, address tokenB) external returns (address pair);\\n\\n function setFeeTo(address) external;\\n\\n function setFeeToSetter(address) external;\\n}\\npragma solidity 0.6.12;\\n\\ninterface IUniswapV2Pair {\\n event Approval(address indexed owner, address indexed spender, uint value);\\n event Transfer(address indexed from, address indexed to, uint value);\\n\\n function name() external pure returns (string memory);\\n\\n function symbol() external pure returns (string memory);\\n\\n function decimals() external pure returns (uint8);\\n\\n function totalSupply() external view returns (uint);\\n\\n function balanceOf(address owner) external view returns (uint);\\n\\n function allowance(address owner, address spender) external view returns (uint);\\n\\n function approve(address spender, uint value) external returns (bool);\\n\\n function transfer(address to, uint value) external returns (bool);\\n\\n function transferFrom(\\n address from,\\n address to,\\n uint value\\n ) external returns (bool);\\n\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n\\n function PERMIT_TYPEHASH() external pure returns (bytes32);\\n\\n function nonces(address owner) external view returns (uint);\\n\\n function permit(\\n address owner,\\n address spender,\\n uint value,\\n uint deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n event Mint(address indexed sender, uint amount0, uint amount1);\\n event Burn(address indexed sender, uint amount0, uint amount1, address indexed to);\\n event Swap(address indexed sender, uint amount0In, uint amount1In, uint amount0Out, uint amount1Out, address indexed to);\\n event Sync(uint112 reserve0, uint112 reserve1);\\n\\n function MINIMUM_LIQUIDITY() external pure returns (uint);\\n\\n function factory() external view returns (address);\\n\\n function token0() external view returns (address);\\n\\n function token1() external view returns (address);\\n\\n function getReserves()\\n external\\n view\\n returns (\\n uint112 reserve0,\\n uint112 reserve1,\\n uint32 blockTimestampLast\\n );\\n\\n function price0CumulativeLast() external view returns (uint);\\n\\n function price1CumulativeLast() external view returns (uint);\\n\\n function kLast() external view returns (uint);\\n\\n function mint(address to) external returns (uint liquidity);\\n\\n function burn(address to) external returns (uint amount0, uint amount1);\\n\\n function swap(\\n uint amount0Out,\\n uint amount1Out,\\n address to,\\n bytes calldata data\\n ) external;\\n\\n function skim(address to) external;\\n\\n function sync() external;\\n\\n function initialize(address, address) external;\\n}\\n\\npragma solidity 0.6.12;\\n\\nlibrary Babylonian {\\n function sqrt(uint y) internal pure returns (uint z) {\\n if (y > 3) {\\n z = y;\\n uint x = y / 2 + 1;\\n while (x < z) {\\n z = x;\\n x = (y / x + x) / 2;\\n }\\n } else if (y != 0) {\\n z = 1;\\n }\\n // else z = 0\\n }\\n}\\n\\npragma solidity 0.6.12;\\n\\n/**\\n * @dev Wrappers over Solidity's arithmetic operations with added overflow\\n * checks.\\n *\\n * Arithmetic operations in Solidity wrap on overflow. This can easily result\\n * in bugs, because programmers usually assume that an overflow raises an\\n * error, which is the standard behavior in high level programming languages.\\n * `SafeMath` restores this intuition by reverting the transaction when an\\n * operation overflows.\\n *\\n * Using this library instead of the unchecked operations eliminates an entire\\n * class of bugs, so it's recommended to use it always.\\n */\\nlibrary SafeMath {\\n /**\\n * @dev Returns the addition of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `+` operator.\\n *\\n * Requirements:\\n *\\n * - Addition cannot overflow.\\n */\\n function add(uint a, uint b) internal pure returns (uint) {\\n uint c = a + b;\\n require(c >= a, \\\"SafeMath: addition overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(uint a, uint b) internal pure returns (uint) {\\n return sub(a, b, \\\"SafeMath: subtraction overflow\\\");\\n }\\n\\n /**\\n * @dev Returns the subtraction of two unsigned integers, reverting with custom message on\\n * overflow (when the result is negative).\\n *\\n * Counterpart to Solidity's `-` operator.\\n *\\n * Requirements:\\n *\\n * - Subtraction cannot overflow.\\n */\\n function sub(\\n uint a,\\n uint b,\\n string memory errorMessage\\n ) internal pure returns (uint) {\\n require(b <= a, errorMessage);\\n uint c = a - b;\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the multiplication of two unsigned integers, reverting on\\n * overflow.\\n *\\n * Counterpart to Solidity's `*` operator.\\n *\\n * Requirements:\\n *\\n * - Multiplication cannot overflow.\\n */\\n function mul(uint a, uint b) internal pure returns (uint) {\\n // Gas optimization: this is cheaper than requiring 'a' not being zero, but the\\n // benefit is lost if 'b' is also tested.\\n // See: https://github.com/OpenZeppelin/openzeppelin-contracts/pull/522\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint c = a * b;\\n require(c / a == b, \\\"SafeMath: multiplication overflow\\\");\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(uint a, uint b) internal pure returns (uint) {\\n return div(a, b, \\\"SafeMath: division by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the integer division of two unsigned integers. Reverts with custom message on\\n * division by zero. The result is rounded towards zero.\\n *\\n * Counterpart to Solidity's `/` operator. Note: this function uses a\\n * `revert` opcode (which leaves remaining gas untouched) while Solidity\\n * uses an invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function div(\\n uint a,\\n uint b,\\n string memory errorMessage\\n ) internal pure returns (uint) {\\n require(b > 0, errorMessage);\\n uint c = a / b;\\n // assert(a == b * c + a % b); // There is no case in which this doesn't hold\\n\\n return c;\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(uint a, uint b) internal pure returns (uint) {\\n return mod(a, b, \\\"SafeMath: modulo by zero\\\");\\n }\\n\\n /**\\n * @dev Returns the remainder of dividing two unsigned integers. (unsigned integer modulo),\\n * Reverts with custom message when dividing by zero.\\n *\\n * Counterpart to Solidity's `%` operator. This function uses a `revert`\\n * opcode (which leaves remaining gas untouched) while Solidity uses an\\n * invalid opcode to revert (consuming all remaining gas).\\n *\\n * Requirements:\\n *\\n * - The divisor cannot be zero.\\n */\\n function mod(\\n uint a,\\n uint b,\\n string memory errorMessage\\n ) internal pure returns (uint) {\\n require(b != 0, errorMessage);\\n return a % b;\\n }\\n}\\n\\npragma solidity 0.6.12;\\n\\n// a library for handling binary fixed point numbers (https://en.wikipedia.org/wiki/Q_(number_format))\\nlibrary FixedPoint {\\n // range: [0, 2**112 - 1]\\n // resolution: 1 / 2**112\\n struct uq112x112 {\\n uint224 _x;\\n }\\n\\n // range: [0, 2**144 - 1]\\n // resolution: 1 / 2**112\\n struct uq144x112 {\\n uint _x;\\n }\\n\\n uint8 private constant RESOLUTION = 112;\\n uint private constant Q112 = uint(1) << RESOLUTION;\\n uint private constant Q224 = Q112 << RESOLUTION;\\n\\n // encode a uint112 as a UQ112x112\\n function encode(uint112 x) internal pure returns (uq112x112 memory) {\\n return uq112x112(uint224(x) << RESOLUTION);\\n }\\n\\n // encodes a uint144 as a UQ144x112\\n function encode144(uint144 x) internal pure returns (uq144x112 memory) {\\n return uq144x112(uint(x) << RESOLUTION);\\n }\\n\\n // divide a UQ112x112 by a uint112, returning a UQ112x112\\n function div(uq112x112 memory self, uint112 x) internal pure returns (uq112x112 memory) {\\n require(x != 0, \\\"FixedPoint: DIV_BY_ZERO\\\");\\n return uq112x112(self._x / uint224(x));\\n }\\n\\n // multiply a UQ112x112 by a uint, returning a UQ144x112\\n // reverts on overflow\\n function mul(uq112x112 memory self, uint y) internal pure returns (uq144x112 memory) {\\n uint z;\\n require(y == 0 || (z = uint(self._x) * y) / y == uint(self._x), \\\"FixedPoint: MULTIPLICATION_OVERFLOW\\\");\\n return uq144x112(z);\\n }\\n\\n // returns a UQ112x112 which represents the ratio of the numerator to the denominator\\n // equivalent to encode(numerator).div(denominator)\\n function fraction(uint112 numerator, uint112 denominator) internal pure returns (uq112x112 memory) {\\n require(denominator > 0, \\\"FixedPoint: DIV_BY_ZERO\\\");\\n return uq112x112((uint224(numerator) << RESOLUTION) / denominator);\\n }\\n\\n // decode a UQ112x112 into a uint112 by truncating after the radix point\\n function decode(uq112x112 memory self) internal pure returns (uint112) {\\n return uint112(self._x >> RESOLUTION);\\n }\\n\\n // decode a UQ144x112 into a uint144 by truncating after the radix point\\n function decode144(uq144x112 memory self) internal pure returns (uint144) {\\n return uint144(self._x >> RESOLUTION);\\n }\\n\\n // take the reciprocal of a UQ112x112\\n function reciprocal(uq112x112 memory self) internal pure returns (uq112x112 memory) {\\n require(self._x != 0, \\\"FixedPoint: ZERO_RECIPROCAL\\\");\\n return uq112x112(uint224(Q224 / self._x));\\n }\\n\\n // square root of a UQ112x112\\n function sqrt(uq112x112 memory self) internal pure returns (uq112x112 memory) {\\n return uq112x112(uint224(Babylonian.sqrt(uint(self._x)) << 56));\\n }\\n}\\npragma solidity >=0.5.0;\\n\\n// library with helper methods for oracles that are concerned with computing average prices\\nlibrary UniswapV2OracleLibrary {\\n using FixedPoint for *;\\n\\n // helper function that returns the current block timestamp within the range of uint32, i.e. [0, 2**32 - 1]\\n function currentBlockTimestamp() internal view returns (uint32) {\\n return uint32(block.timestamp % 2**32);\\n }\\n\\n // produces the cumulative price using counterfactuals to save gas and avoid a call to sync.\\n function currentCumulativePrices(address pair)\\n internal\\n view\\n returns (\\n uint price0Cumulative,\\n uint price1Cumulative,\\n uint32 blockTimestamp\\n )\\n {\\n blockTimestamp = currentBlockTimestamp();\\n price0Cumulative = IUniswapV2Pair(pair).price0CumulativeLast();\\n price1Cumulative = IUniswapV2Pair(pair).price1CumulativeLast();\\n\\n // if time has elapsed since the last update on the pair, mock the accumulated price values\\n (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast) = IUniswapV2Pair(pair).getReserves();\\n if (blockTimestampLast != blockTimestamp) {\\n // subtraction overflow is desired\\n uint32 timeElapsed = blockTimestamp - blockTimestampLast;\\n // addition overflow is desired\\n // counterfactual\\n price0Cumulative += uint(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;\\n // counterfactual\\n price1Cumulative += uint(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;\\n }\\n }\\n}\\n\\npragma solidity 0.6.12;\\n\\nlibrary UniswapV2Library {\\n using SafeMath for uint;\\n\\n // returns sorted token addresses, used to handle return values from pairs sorted in this order\\n function sortTokens(address tokenA, address tokenB) internal pure returns (address token0, address token1) {\\n require(tokenA != tokenB, \\\"UniswapV2Library: IDENTICAL_ADDRESSES\\\");\\n (token0, token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA);\\n require(token0 != address(0), \\\"UniswapV2Library: ZERO_ADDRESS\\\");\\n }\\n\\n // calculates the CREATE2 address for a pair without making any external calls\\n function pairFor(\\n address factory,\\n address tokenA,\\n address tokenB\\n ) internal pure returns (address pair) {\\n (address token0, address token1) = sortTokens(tokenA, tokenB);\\n pair = address(\\n uint(\\n keccak256(\\n abi.encodePacked(\\n hex\\\"ff\\\",\\n factory,\\n keccak256(abi.encodePacked(token0, token1)),\\n hex\\\"96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f\\\" // init code hash\\n )\\n )\\n )\\n );\\n }\\n\\n // fetches and sorts the reserves for a pair\\n function getReserves(\\n address factory,\\n address tokenA,\\n address tokenB\\n ) internal view returns (uint reserveA, uint reserveB) {\\n (address token0, ) = sortTokens(tokenA, tokenB);\\n (uint reserve0, uint reserve1, ) = IUniswapV2Pair(pairFor(factory, tokenA, tokenB)).getReserves();\\n (reserveA, reserveB) = tokenA == token0 ? (reserve0, reserve1) : (reserve1, reserve0);\\n }\\n\\n // given some amount of an asset and pair reserves, returns an equivalent amount of the other asset\\n function quote(\\n uint amountA,\\n uint reserveA,\\n uint reserveB\\n ) internal pure returns (uint amountB) {\\n require(amountA > 0, \\\"UniswapV2Library: INSUFFICIENT_AMOUNT\\\");\\n require(reserveA > 0 && reserveB > 0, \\\"UniswapV2Library: INSUFFICIENT_LIQUIDITY\\\");\\n amountB = amountA.mul(reserveB) / reserveA;\\n }\\n\\n // given an input amount of an asset and pair reserves, returns the maximum output amount of the other asset\\n function getAmountOut(\\n uint amountIn,\\n uint reserveIn,\\n uint reserveOut\\n ) internal pure returns (uint amountOut) {\\n require(amountIn > 0, \\\"UniswapV2Library: INSUFFICIENT_INPUT_AMOUNT\\\");\\n require(reserveIn > 0 && reserveOut > 0, \\\"UniswapV2Library: INSUFFICIENT_LIQUIDITY\\\");\\n uint amountInWithFee = amountIn.mul(997);\\n uint numerator = amountInWithFee.mul(reserveOut);\\n uint denominator = reserveIn.mul(1000).add(amountInWithFee);\\n amountOut = numerator / denominator;\\n }\\n\\n // given an output amount of an asset and pair reserves, returns a required input amount of the other asset\\n function getAmountIn(\\n uint amountOut,\\n uint reserveIn,\\n uint reserveOut\\n ) internal pure returns (uint amountIn) {\\n require(amountOut > 0, \\\"UniswapV2Library: INSUFFICIENT_OUTPUT_AMOUNT\\\");\\n require(reserveIn > 0 && reserveOut > 0, \\\"UniswapV2Library: INSUFFICIENT_LIQUIDITY\\\");\\n uint numerator = reserveIn.mul(amountOut).mul(1000);\\n uint denominator = reserveOut.sub(amountOut).mul(997);\\n amountIn = (numerator / denominator).add(1);\\n }\\n\\n // performs chained getAmountOut calculations on any number of pairs\\n function getAmountsOut(\\n address factory,\\n uint amountIn,\\n address[] memory path\\n ) internal view returns (uint[] memory amounts) {\\n require(path.length >= 2, \\\"UniswapV2Library: INVALID_PATH\\\");\\n amounts = new uint[](path.length);\\n amounts[0] = amountIn;\\n for (uint i; i < path.length - 1; i++) {\\n (uint reserveIn, uint reserveOut) = getReserves(factory, path[i], path[i + 1]);\\n amounts[i + 1] = getAmountOut(amounts[i], reserveIn, reserveOut);\\n }\\n }\\n\\n // performs chained getAmountIn calculations on any number of pairs\\n function getAmountsIn(\\n address factory,\\n uint amountOut,\\n address[] memory path\\n ) internal view returns (uint[] memory amounts) {\\n require(path.length >= 2, \\\"UniswapV2Library: INVALID_PATH\\\");\\n amounts = new uint[](path.length);\\n amounts[amounts.length - 1] = amountOut;\\n for (uint i = path.length - 1; i > 0; i--) {\\n (uint reserveIn, uint reserveOut) = getReserves(factory, path[i - 1], path[i]);\\n amounts[i - 1] = getAmountIn(amounts[i], reserveIn, reserveOut);\\n }\\n }\\n}\\n\\npragma solidity 0.6.12;\\npragma experimental ABIEncoderV2;\\n\\n// fixed window oracle that recomputes the average price for the entire period once every period\\n// note that the price average is only guaranteed to be over at least 1 period, but may be over a longer period\\ncontract Oracle {\\n using FixedPoint for *;\\n address dev_address;\\n uint public PERIOD = 1 hours;\\n\\n struct tokenInfo {\\n IUniswapV2Pair pair;\\n address token0;\\n address token1;\\n uint price0CumulativeLast;\\n uint price1CumulativeLast;\\n uint32 blockTimestampLast;\\n FixedPoint.uq112x112 price0Average;\\n FixedPoint.uq112x112 price1Average;\\n }\\n mapping(address => tokenInfo) public tokenInfoList;\\n FixedPoint.uq112x112 public price0Average;\\n FixedPoint.uq112x112 public price1Average;\\n address public factory = 0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f;\\n\\n constructor() public {\\n dev_address = msg.sender;\\n }\\n\\n function setNewTokensInfo(address[] memory tokensA, address[] memory tokensB) public onlyOwner{\\n require(tokensA.length == tokensB.length,\\\"ERR_LENGTH_NOT_MATCH\\\");\\n for(uint i;i < tokensA.length; i++){\\n setNewTokenInfo(tokensA[i],tokensB[i]);\\n }\\n }\\n\\n function setNewTokenInfo(address tokenA, address tokenB) public onlyOwner {\\n IUniswapV2Pair _pair = IUniswapV2Pair(UniswapV2Library.pairFor(factory, tokenA, tokenB));\\n //find tokenA price\\n tokenInfo storage info = tokenInfoList[tokenA];\\n info.pair = _pair;\\n info.token0 = _pair.token0();\\n info.token1 = _pair.token1();\\n info.price0CumulativeLast = _pair.price0CumulativeLast();\\n info.price1CumulativeLast = _pair.price1CumulativeLast();\\n uint112 reserve0;\\n uint112 reserve1;\\n (reserve0, reserve1, info.blockTimestampLast) = _pair.getReserves();\\n require(reserve0 != 0 && reserve1 != 0, \\\"ExampleOracleSimple: NO_RESERVES\\\");\\n }\\n\\n modifier onlyOwner() {\\n require(dev_address == msg.sender, \\\"Ownable: caller is not the ererer\\\");\\n _;\\n }\\n\\n function update(address token) external {\\n tokenInfo storage info = tokenInfoList[token];\\n require(address(info.pair) != address(0), \\\"token is not init success\\\");\\n (uint price0Cumulative, uint price1Cumulative, uint32 blockTimestamp) = UniswapV2OracleLibrary.currentCumulativePrices(address(info.pair));\\n uint32 timeElapsed = blockTimestamp - info.blockTimestampLast; // overflow is desired\\n\\n // ensure that at least one full period has passed since the last update\\n require(timeElapsed >= PERIOD, \\\"ExampleOracleSimple: PERIOD_NOT_ELAPSED\\\");\\n\\n // overflow is desired, casting never truncates\\n // cumulative price is in (uq112x112 price * seconds) units so we simply wrap it after division by time elapsed\\n info.price0Average = FixedPoint.uq112x112(uint224((price0Cumulative - info.price0CumulativeLast) / timeElapsed));\\n info.price1Average = FixedPoint.uq112x112(uint224((price1Cumulative - info.price1CumulativeLast) / timeElapsed));\\n\\n info.price0CumulativeLast = price0Cumulative;\\n info.price1CumulativeLast = price1Cumulative;\\n info.blockTimestampLast = blockTimestamp;\\n }\\n\\n // note this will always return 0 before update has been called successfully for the first time.\\n function consult(address token, uint amountIn) external view returns (uint amountOut) {\\n tokenInfo memory info = tokenInfoList[token];\\n require(address(info.pair) != address(0), \\\"token is not init success\\\");\\n if (token == info.token0) {\\n amountOut = info.price0Average.mul(amountIn).decode144();\\n } else {\\n require(token == info.token1, \\\"ExampleOracleSimple: INVALID_TOKEN\\\");\\n amountOut = info.price1Average.mul(amountIn).decode144();\\n }\\n }\\n\\n function setPERIOD(uint amount) public onlyOwner {\\n PERIOD = (1 hours) * (amount);\\n }\\n}\\n\",\"keccak256\":\"0xa60f7cee711649140b5f53c78bbacc1923a09453067f669e0f87350389bf9c4a\",\"license\":\"MIT\"}},\"version\":1}",
"bytecode": "0x6080604052610e10600155600580546001600160a01b031916735c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f17905534801561003c57600080fd5b50600080546001600160a01b0319163317905561133a8061005e6000396000f3fe608060405234801561001057600080fd5b506004361061008e5760003560e01c80630173d100146100935780630a109ec3146100a85780631c1b8772146100d85780633ddac953146100eb5780635e6aaf2c1461010b5780636ca94aac14610120578063a6bb453914610133578063b4d1d7951461013b578063c45a015514610143578063fa4277a814610158575b600080fd5b6100a66100a1366004610e43565b61016b565b005b6100bb6100b6366004610e04565b6104e1565b6040516100cf989796959493929190611011565b60405180910390f35b6100a66100e6366004610e04565b61055d565b6100fe6100f9366004610e7b565b6106ae565b6040516100cf91906112ce565b61011361081a565b6040516100cf91906112ba565b6100a661012e366004610ea6565b610829565b6101136108bd565b6100fe6108cc565b61014b6108d2565b6040516100cf9190610ffd565b6100a6610166366004610f5a565b6108e1565b6000546001600160a01b0316331461019e5760405162461bcd60e51b8152600401610195906110e4565b60405180910390fd5b6005546000906101b8906001600160a01b03168484610914565b6001600160a01b0384811660009081526002602090815260409182902080546001600160a01b03191693851693841781558251630dfe168160e01b8152925194955093630dfe1681926004808201939291829003018186803b15801561021d57600080fd5b505afa158015610231573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102559190610e27565b8160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156102b657600080fd5b505afa1580156102ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ee9190610e27565b8160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561034f57600080fd5b505afa158015610363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103879190610f72565b8160030181905550816001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b1580156103c857600080fd5b505afa1580156103dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104009190610f72565b8160040181905550600080836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561044457600080fd5b505afa158015610458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c9190610f06565b60058601805463ffffffff191663ffffffff9290921691909117905590925090506001600160701b038216158015906104bd57506001600160701b03811615155b6104d95760405162461bcd60e51b8152600401610195906110af565b505050505050565b600260208181526000928352604092839020805460018201549382015460038301546004840154600585015488518088018a5260068701546001600160e01b0390811682528a51988901909a5260079096015490981686526001600160a01b0393841697968416969290931694909363ffffffff909216919088565b6001600160a01b03808216600090815260026020526040902080549091166105975760405162461bcd60e51b81526004016101959061121f565b8054600090819081906105b2906001600160a01b0316610984565b6005870154600154939650919450925063ffffffff90811683039190821610156105ee5760405162461bcd60e51b815260040161019590611167565b60405180602001604052808263ffffffff16876003015487038161060e57fe5b046001600160e01b0390811690915290516006870180546001600160e01b0319169190921617905560408051602081019091526004860154819063ffffffff84169086038161065957fe5b046001600160e01b0390811690915290516007870180546001600160e01b0319169190921617905550600384019290925560048301556005909101805463ffffffff191663ffffffff90921691909117905550565b60006106b8610cc9565b506001600160a01b038084166000908152600260208181526040928390208351610100810185528154861681526001820154861681840152928101548516838501526003810154606084015260048101546080840152600581015463ffffffff1660a08401528351808301855260068201546001600160e01b03908116825260c0850191909152845192830190945260070154909216825260e081019190915280519091166107795760405162461bcd60e51b81526004016101959061121f565b80602001516001600160a01b0316846001600160a01b031614156107bf5760c08101516107af906107aa9085610b59565b610bba565b6001600160901b03169150610813565b80604001516001600160a01b0316846001600160a01b0316146107f45760405162461bcd60e51b815260040161019590611125565b60e0810151610807906107aa9085610b59565b6001600160901b031691505b5092915050565b6004546001600160e01b031681565b6000546001600160a01b031633146108535760405162461bcd60e51b8152600401610195906110e4565b80518251146108745760405162461bcd60e51b8152600401610195906111ae565b60005b82518110156108b8576108b083828151811061088f57fe5b60200260200101518383815181106108a357fe5b602002602001015161016b565b600101610877565b505050565b6003546001600160e01b031681565b60015481565b6005546001600160a01b031681565b6000546001600160a01b0316331461090b5760405162461bcd60e51b8152600401610195906110e4565b610e1002600155565b60008060006109238585610bc1565b9150915085828260405160200161093b929190610f8a565b60405160208183030381529060405280519060200120604051602001610962929190610fac565b60408051601f1981840301815291905280516020909101209695505050505050565b6000806000610991610c4b565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156109cc57600080fd5b505afa1580156109e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a049190610f72565b9250836001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3f57600080fd5b505afa158015610a53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a779190610f72565b91506000806000866001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610ab757600080fd5b505afa158015610acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aef9190610f06565b9250925092508363ffffffff168163ffffffff1614610b4f5780840363ffffffff8116610b1c8486610c55565b516001600160e01b031602969096019563ffffffff8116610b3d8585610c55565b516001600160e01b0316029590950194505b5050509193909250565b610b61610d3a565b6000821580610b8757505082516001600160e01b031682810290838281610b8457fe5b04145b610ba35760405162461bcd60e51b8152600401610195906111dc565b604080516020810190915290815290505b92915050565b5160701c90565b600080826001600160a01b0316846001600160a01b03161415610bf65760405162461bcd60e51b81526004016101959061106a565b826001600160a01b0316846001600160a01b031610610c16578284610c19565b83835b90925090506001600160a01b038216610c445760405162461bcd60e51b815260040161019590611252565b9250929050565b63ffffffff421690565b610c5d610d4d565b6000826001600160701b031611610c865760405162461bcd60e51b815260040161019590611289565b6040805160208101909152806001600160701b038416600160701b600160e01b03607087901b1681610cb457fe5b046001600160e01b0316815250905092915050565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001600063ffffffff168152602001610d28610d4d565b8152602001610d35610d4d565b905290565b6040518060200160405280600081525090565b60408051602081019091526000815290565b8035610bb4816112d7565b600082601f830112610d7a578081fd5b81356001600160401b0380821115610d90578283fd5b602080830260405182828201018181108582111715610dad578687fd5b604052848152945081850192508582018187018301881015610dce57600080fd5b600091505b84821015610df957610de58882610d5f565b845292820192600191909101908201610dd3565b505050505092915050565b600060208284031215610e15578081fd5b8135610e20816112d7565b9392505050565b600060208284031215610e38578081fd5b8151610e20816112d7565b60008060408385031215610e55578081fd5b8235610e60816112d7565b91506020830135610e70816112d7565b809150509250929050565b60008060408385031215610e8d578182fd5b8235610e98816112d7565b946020939093013593505050565b60008060408385031215610eb8578182fd5b82356001600160401b0380821115610ece578384fd5b610eda86838701610d6a565b93506020850135915080821115610eef578283fd5b50610efc85828601610d6a565b9150509250929050565b600080600060608486031215610f1a578081fd5b8351610f25816112ef565b6020850151909350610f36816112ef565b604085015190925063ffffffff81168114610f4f578182fd5b809150509250925092565b600060208284031215610f6b578081fd5b5035919050565b600060208284031215610f83578081fd5b5051919050565b6001600160601b0319606093841b811682529190921b16601482015260280190565b6001600160f81b0319815260609290921b6001600160601b031916600183015260158201527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f603582015260550190565b6001600160a01b0391909116815260200190565b6001600160a01b03988916815296881660208801529490961660408601526060850192909252608084015263ffffffff1660a083015291516001600160e01b0390811660c0830152915190911660e08201526101000190565b60208082526025908201527f556e697377617056324c6962726172793a204944454e544943414c5f41444452604082015264455353455360d81b606082015260800190565b6020808252818101527f4578616d706c654f7261636c6553696d706c653a204e4f5f5245534552564553604082015260600190565b60208082526021908201527f4f776e61626c653a2063616c6c6572206973206e6f74207468652065726572656040820152603960f91b606082015260800190565b60208082526022908201527f4578616d706c654f7261636c6553696d706c653a20494e56414c49445f544f4b60408201526122a760f11b606082015260800190565b60208082526027908201527f4578616d706c654f7261636c6553696d706c653a20504552494f445f4e4f545f6040820152661153105414d15160ca1b606082015260800190565b60208082526014908201527308aa4a4be988a9c8ea890be9c9ea8be9a82a886960631b604082015260600190565b60208082526023908201527f4669786564506f696e743a204d554c5449504c49434154494f4e5f4f564552466040820152624c4f5760e81b606082015260800190565b602080825260199082015278746f6b656e206973206e6f7420696e6974207375636365737360381b604082015260600190565b6020808252601e908201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604082015260600190565b6020808252601790820152764669786564506f696e743a204449565f42595f5a45524f60481b604082015260600190565b6001600160e01b0391909116815260200190565b90815260200190565b6001600160a01b03811681146112ec57600080fd5b50565b6001600160701b03811681146112ec57600080fdfea2646970667358221220b848ff5706ba4e418c31a3e0869ab20a03d4dda5aa6d8598ad43e2371203fdb364736f6c634300060c0033",
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061008e5760003560e01c80630173d100146100935780630a109ec3146100a85780631c1b8772146100d85780633ddac953146100eb5780635e6aaf2c1461010b5780636ca94aac14610120578063a6bb453914610133578063b4d1d7951461013b578063c45a015514610143578063fa4277a814610158575b600080fd5b6100a66100a1366004610e43565b61016b565b005b6100bb6100b6366004610e04565b6104e1565b6040516100cf989796959493929190611011565b60405180910390f35b6100a66100e6366004610e04565b61055d565b6100fe6100f9366004610e7b565b6106ae565b6040516100cf91906112ce565b61011361081a565b6040516100cf91906112ba565b6100a661012e366004610ea6565b610829565b6101136108bd565b6100fe6108cc565b61014b6108d2565b6040516100cf9190610ffd565b6100a6610166366004610f5a565b6108e1565b6000546001600160a01b0316331461019e5760405162461bcd60e51b8152600401610195906110e4565b60405180910390fd5b6005546000906101b8906001600160a01b03168484610914565b6001600160a01b0384811660009081526002602090815260409182902080546001600160a01b03191693851693841781558251630dfe168160e01b8152925194955093630dfe1681926004808201939291829003018186803b15801561021d57600080fd5b505afa158015610231573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102559190610e27565b8160010160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b031663d21220a76040518163ffffffff1660e01b815260040160206040518083038186803b1580156102b657600080fd5b505afa1580156102ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102ee9190610e27565b8160020160006101000a8154816001600160a01b0302191690836001600160a01b03160217905550816001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b15801561034f57600080fd5b505afa158015610363573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103879190610f72565b8160030181905550816001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b1580156103c857600080fd5b505afa1580156103dc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104009190610f72565b8160040181905550600080836001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b15801561044457600080fd5b505afa158015610458573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061047c9190610f06565b60058601805463ffffffff191663ffffffff9290921691909117905590925090506001600160701b038216158015906104bd57506001600160701b03811615155b6104d95760405162461bcd60e51b8152600401610195906110af565b505050505050565b600260208181526000928352604092839020805460018201549382015460038301546004840154600585015488518088018a5260068701546001600160e01b0390811682528a51988901909a5260079096015490981686526001600160a01b0393841697968416969290931694909363ffffffff909216919088565b6001600160a01b03808216600090815260026020526040902080549091166105975760405162461bcd60e51b81526004016101959061121f565b8054600090819081906105b2906001600160a01b0316610984565b6005870154600154939650919450925063ffffffff90811683039190821610156105ee5760405162461bcd60e51b815260040161019590611167565b60405180602001604052808263ffffffff16876003015487038161060e57fe5b046001600160e01b0390811690915290516006870180546001600160e01b0319169190921617905560408051602081019091526004860154819063ffffffff84169086038161065957fe5b046001600160e01b0390811690915290516007870180546001600160e01b0319169190921617905550600384019290925560048301556005909101805463ffffffff191663ffffffff90921691909117905550565b60006106b8610cc9565b506001600160a01b038084166000908152600260208181526040928390208351610100810185528154861681526001820154861681840152928101548516838501526003810154606084015260048101546080840152600581015463ffffffff1660a08401528351808301855260068201546001600160e01b03908116825260c0850191909152845192830190945260070154909216825260e081019190915280519091166107795760405162461bcd60e51b81526004016101959061121f565b80602001516001600160a01b0316846001600160a01b031614156107bf5760c08101516107af906107aa9085610b59565b610bba565b6001600160901b03169150610813565b80604001516001600160a01b0316846001600160a01b0316146107f45760405162461bcd60e51b815260040161019590611125565b60e0810151610807906107aa9085610b59565b6001600160901b031691505b5092915050565b6004546001600160e01b031681565b6000546001600160a01b031633146108535760405162461bcd60e51b8152600401610195906110e4565b80518251146108745760405162461bcd60e51b8152600401610195906111ae565b60005b82518110156108b8576108b083828151811061088f57fe5b60200260200101518383815181106108a357fe5b602002602001015161016b565b600101610877565b505050565b6003546001600160e01b031681565b60015481565b6005546001600160a01b031681565b6000546001600160a01b0316331461090b5760405162461bcd60e51b8152600401610195906110e4565b610e1002600155565b60008060006109238585610bc1565b9150915085828260405160200161093b929190610f8a565b60405160208183030381529060405280519060200120604051602001610962929190610fac565b60408051601f1981840301815291905280516020909101209695505050505050565b6000806000610991610c4b565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b815260040160206040518083038186803b1580156109cc57600080fd5b505afa1580156109e0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a049190610f72565b9250836001600160a01b0316635a3d54936040518163ffffffff1660e01b815260040160206040518083038186803b158015610a3f57600080fd5b505afa158015610a53573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a779190610f72565b91506000806000866001600160a01b0316630902f1ac6040518163ffffffff1660e01b815260040160606040518083038186803b158015610ab757600080fd5b505afa158015610acb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aef9190610f06565b9250925092508363ffffffff168163ffffffff1614610b4f5780840363ffffffff8116610b1c8486610c55565b516001600160e01b031602969096019563ffffffff8116610b3d8585610c55565b516001600160e01b0316029590950194505b5050509193909250565b610b61610d3a565b6000821580610b8757505082516001600160e01b031682810290838281610b8457fe5b04145b610ba35760405162461bcd60e51b8152600401610195906111dc565b604080516020810190915290815290505b92915050565b5160701c90565b600080826001600160a01b0316846001600160a01b03161415610bf65760405162461bcd60e51b81526004016101959061106a565b826001600160a01b0316846001600160a01b031610610c16578284610c19565b83835b90925090506001600160a01b038216610c445760405162461bcd60e51b815260040161019590611252565b9250929050565b63ffffffff421690565b610c5d610d4d565b6000826001600160701b031611610c865760405162461bcd60e51b815260040161019590611289565b6040805160208101909152806001600160701b038416600160701b600160e01b03607087901b1681610cb457fe5b046001600160e01b0316815250905092915050565b60405180610100016040528060006001600160a01b0316815260200160006001600160a01b0316815260200160006001600160a01b031681526020016000815260200160008152602001600063ffffffff168152602001610d28610d4d565b8152602001610d35610d4d565b905290565b6040518060200160405280600081525090565b60408051602081019091526000815290565b8035610bb4816112d7565b600082601f830112610d7a578081fd5b81356001600160401b0380821115610d90578283fd5b602080830260405182828201018181108582111715610dad578687fd5b604052848152945081850192508582018187018301881015610dce57600080fd5b600091505b84821015610df957610de58882610d5f565b845292820192600191909101908201610dd3565b505050505092915050565b600060208284031215610e15578081fd5b8135610e20816112d7565b9392505050565b600060208284031215610e38578081fd5b8151610e20816112d7565b60008060408385031215610e55578081fd5b8235610e60816112d7565b91506020830135610e70816112d7565b809150509250929050565b60008060408385031215610e8d578182fd5b8235610e98816112d7565b946020939093013593505050565b60008060408385031215610eb8578182fd5b82356001600160401b0380821115610ece578384fd5b610eda86838701610d6a565b93506020850135915080821115610eef578283fd5b50610efc85828601610d6a565b9150509250929050565b600080600060608486031215610f1a578081fd5b8351610f25816112ef565b6020850151909350610f36816112ef565b604085015190925063ffffffff81168114610f4f578182fd5b809150509250925092565b600060208284031215610f6b578081fd5b5035919050565b600060208284031215610f83578081fd5b5051919050565b6001600160601b0319606093841b811682529190921b16601482015260280190565b6001600160f81b0319815260609290921b6001600160601b031916600183015260158201527f96e8ac4277198ff8b6f785478aa9a39f403cb768dd02cbee326c3e7da348845f603582015260550190565b6001600160a01b0391909116815260200190565b6001600160a01b03988916815296881660208801529490961660408601526060850192909252608084015263ffffffff1660a083015291516001600160e01b0390811660c0830152915190911660e08201526101000190565b60208082526025908201527f556e697377617056324c6962726172793a204944454e544943414c5f41444452604082015264455353455360d81b606082015260800190565b6020808252818101527f4578616d706c654f7261636c6553696d706c653a204e4f5f5245534552564553604082015260600190565b60208082526021908201527f4f776e61626c653a2063616c6c6572206973206e6f74207468652065726572656040820152603960f91b606082015260800190565b60208082526022908201527f4578616d706c654f7261636c6553696d706c653a20494e56414c49445f544f4b60408201526122a760f11b606082015260800190565b60208082526027908201527f4578616d706c654f7261636c6553696d706c653a20504552494f445f4e4f545f6040820152661153105414d15160ca1b606082015260800190565b60208082526014908201527308aa4a4be988a9c8ea890be9c9ea8be9a82a886960631b604082015260600190565b60208082526023908201527f4669786564506f696e743a204d554c5449504c49434154494f4e5f4f564552466040820152624c4f5760e81b606082015260800190565b602080825260199082015278746f6b656e206973206e6f7420696e6974207375636365737360381b604082015260600190565b6020808252601e908201527f556e697377617056324c6962726172793a205a45524f5f414444524553530000604082015260600190565b6020808252601790820152764669786564506f696e743a204449565f42595f5a45524f60481b604082015260600190565b6001600160e01b0391909116815260200190565b90815260200190565b6001600160a01b03811681146112ec57600080fd5b50565b6001600160701b03811681146112ec57600080fdfea2646970667358221220b848ff5706ba4e418c31a3e0869ab20a03d4dda5aa6d8598ad43e2371203fdb364736f6c634300060c0033",
"libraries": {},
"devdoc": {
"kind": "dev",
"methods": {},
"version": 1
},
"userdoc": {
"kind": "user",
"methods": {},
"version": 1
},
"storageLayout": {
"storage": [
{
"astId": 1372,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "dev_address",
"offset": 0,
"slot": "0",
"type": "t_address"
},
{
"astId": 1375,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "PERIOD",
"offset": 0,
"slot": "1",
"type": "t_uint256"
},
{
"astId": 1396,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "tokenInfoList",
"offset": 0,
"slot": "2",
"type": "t_mapping(t_address,t_struct(tokenInfo)1392_storage)"
},
{
"astId": 1398,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "price0Average",
"offset": 0,
"slot": "3",
"type": "t_struct(uq112x112)558_storage"
},
{
"astId": 1400,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "price1Average",
"offset": 0,
"slot": "4",
"type": "t_struct(uq112x112)558_storage"
},
{
"astId": 1403,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "factory",
"offset": 0,
"slot": "5",
"type": "t_address"
}
],
"types": {
"t_address": {
"encoding": "inplace",
"label": "address",
"numberOfBytes": "20"
},
"t_contract(IUniswapV2Pair)303": {
"encoding": "inplace",
"label": "contract IUniswapV2Pair",
"numberOfBytes": "20"
},
"t_mapping(t_address,t_struct(tokenInfo)1392_storage)": {
"encoding": "mapping",
"key": "t_address",
"label": "mapping(address => struct Oracle.tokenInfo)",
"numberOfBytes": "32",
"value": "t_struct(tokenInfo)1392_storage"
},
"t_struct(tokenInfo)1392_storage": {
"encoding": "inplace",
"label": "struct Oracle.tokenInfo",
"members": [
{
"astId": 1377,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "pair",
"offset": 0,
"slot": "0",
"type": "t_contract(IUniswapV2Pair)303"
},
{
"astId": 1379,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "token0",
"offset": 0,
"slot": "1",
"type": "t_address"
},
{
"astId": 1381,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "token1",
"offset": 0,
"slot": "2",
"type": "t_address"
},
{
"astId": 1383,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "price0CumulativeLast",
"offset": 0,
"slot": "3",
"type": "t_uint256"
},
{
"astId": 1385,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "price1CumulativeLast",
"offset": 0,
"slot": "4",
"type": "t_uint256"
},
{
"astId": 1387,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "blockTimestampLast",
"offset": 0,
"slot": "5",
"type": "t_uint32"
},
{
"astId": 1389,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "price0Average",
"offset": 0,
"slot": "6",
"type": "t_struct(uq112x112)558_storage"
},
{
"astId": 1391,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "price1Average",
"offset": 0,
"slot": "7",
"type": "t_struct(uq112x112)558_storage"
}
],
"numberOfBytes": "256"
},
"t_struct(uq112x112)558_storage": {
"encoding": "inplace",
"label": "struct FixedPoint.uq112x112",
"members": [
{
"astId": 557,
"contract": "contracts/deploy/Oracle.sol:Oracle",
"label": "_x",
"offset": 0,
"slot": "0",
"type": "t_uint224"
}
],
"numberOfBytes": "32"
},
"t_uint224": {
"encoding": "inplace",
"label": "uint224",
"numberOfBytes": "28"
},
"t_uint256": {
"encoding": "inplace",
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint32": {
"encoding": "inplace",
"label": "uint32",
"numberOfBytes": "4"
}
}
}
}