@venusprotocol/oracle 1.3.2 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/artifacts/build-info/2fde13baf96aae3a4a0595eaa19cc540.json +1 -0
- package/artifacts/build-info/99d7aae43e9eacb55ec69b3cd6d3a70b.json +1 -0
- package/artifacts/contracts/PriceOracle.sol/PriceOracle.dbg.json +1 -1
- package/artifacts/contracts/PriceOracle.sol/PriceOracle.json +0 -6
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.dbg.json +1 -1
- package/artifacts/contracts/ResilientOracle.sol/ResilientOracle.json +10 -10
- package/contracts/PriceOracle.sol +4 -4
- package/contracts/ResilientOracle.sol +27 -24
- package/deploy/{oracles.d.ts → 1-deploy-oracles.d.ts} +1 -1
- package/deploy/1-deploy-oracles.d.ts.map +1 -0
- package/deploy/{oracles.js → 1-deploy-oracles.js} +22 -8
- package/deploy/1-deploy-oracles.js.map +1 -0
- package/deploy/2-configure-feeds.d.ts +4 -0
- package/deploy/2-configure-feeds.d.ts.map +1 -0
- package/deploy/2-configure-feeds.js +90 -0
- package/deploy/2-configure-feeds.js.map +1 -0
- package/deployments/bsctestnet/.chainId +1 -0
- package/deployments/bsctestnet/BinanceOracle.json +290 -0
- package/deployments/bsctestnet/BinanceOracle_Implementation.json +140 -0
- package/deployments/{localhost/ChainlinkOracle_Proxy.json → bsctestnet/BinanceOracle_Proxy.json} +36 -46
- package/deployments/{localhost → bsctestnet}/BoundValidator.json +40 -40
- package/deployments/{localhost → bsctestnet}/BoundValidator_Implementation.json +19 -19
- package/deployments/{localhost → bsctestnet}/BoundValidator_Proxy.json +39 -39
- package/deployments/{localhost/PivotTwapOracle.json → bsctestnet/ChainlinkOracle.json} +214 -61
- package/deployments/bsctestnet/ChainlinkOracle_Implementation.json +553 -0
- package/deployments/{localhost/PivotTwapOracle_Proxy.json → bsctestnet/ChainlinkOracle_Proxy.json} +39 -43
- package/deployments/{localhost → bsctestnet}/DefaultProxyAdmin.json +19 -19
- package/deployments/{localhost → bsctestnet}/PythOracle.json +178 -49
- package/deployments/{localhost → bsctestnet}/PythOracle_Implementation.json +247 -45
- package/deployments/{localhost → bsctestnet}/PythOracle_Proxy.json +53 -40
- package/deployments/{localhost → bsctestnet}/ResilientOracle.json +51 -51
- package/deployments/bsctestnet/ResilientOracle_Implementation.json +746 -0
- package/deployments/{localhost → bsctestnet}/ResilientOracle_Proxy.json +41 -41
- package/deployments/{localhost/BinanceOracle.json → bsctestnet/TwapOracle.json} +419 -53
- package/deployments/bsctestnet/TwapOracle_Implementation.json +842 -0
- package/deployments/{localhost/BinanceOracle_Proxy.json → bsctestnet/TwapOracle_Proxy.json} +41 -41
- package/deployments/bsctestnet/solcInputs/09bc2981019c6dcce653b90bac585fe0.json +81 -0
- package/deployments/{localhost → bsctestnet}/solcInputs/0e89febeebc7444140de8e67c9067d2c.json +0 -0
- package/deployments/{localhost/solcInputs/468ec7a31e2db8855c82fb8141193271.json → bsctestnet/solcInputs/5dedb37ab8105f1f71e53a3f865859c5.json} +7 -4
- package/deployments/{localhost/solcInputs/50629170e50dc9fec79dac585e95ac05.json → bsctestnet/solcInputs/bb71c6049f6b7b21a6581f40daf802bc.json} +31 -31
- package/package.json +2 -2
- package/artifacts/build-info/766f05630947fa6d366a667b66c1141b.json +0 -1
- package/deploy/oracles.d.ts.map +0 -1
- package/deploy/oracles.js.map +0 -1
- package/deployments/localhost/.chainId +0 -1
- package/deployments/localhost/BinanceOracle_Implementation.json +0 -305
- package/deployments/localhost/ChainlinkOracle.json +0 -370
- package/deployments/localhost/ChainlinkOracle_Implementation.json +0 -273
- package/deployments/localhost/PivotTwapOracle_Implementation.json +0 -304
- package/deployments/localhost/ResilientOracle_Implementation.json +0 -746
|
@@ -0,0 +1,842 @@
|
|
|
1
|
+
{
|
|
2
|
+
"address": "0x6C6d8723f2dF765431c0493D088974a482424030",
|
|
3
|
+
"abi": [
|
|
4
|
+
{
|
|
5
|
+
"anonymous": false,
|
|
6
|
+
"inputs": [
|
|
7
|
+
{
|
|
8
|
+
"indexed": true,
|
|
9
|
+
"internalType": "address",
|
|
10
|
+
"name": "asset",
|
|
11
|
+
"type": "address"
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"indexed": false,
|
|
15
|
+
"internalType": "uint256",
|
|
16
|
+
"name": "price",
|
|
17
|
+
"type": "uint256"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"indexed": false,
|
|
21
|
+
"internalType": "uint256",
|
|
22
|
+
"name": "oldTimestamp",
|
|
23
|
+
"type": "uint256"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"indexed": false,
|
|
27
|
+
"internalType": "uint256",
|
|
28
|
+
"name": "newTimestamp",
|
|
29
|
+
"type": "uint256"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"name": "AnchorPriceUpdated",
|
|
33
|
+
"type": "event"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"anonymous": false,
|
|
37
|
+
"inputs": [
|
|
38
|
+
{
|
|
39
|
+
"indexed": false,
|
|
40
|
+
"internalType": "uint8",
|
|
41
|
+
"name": "version",
|
|
42
|
+
"type": "uint8"
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"name": "Initialized",
|
|
46
|
+
"type": "event"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"anonymous": false,
|
|
50
|
+
"inputs": [
|
|
51
|
+
{
|
|
52
|
+
"indexed": true,
|
|
53
|
+
"internalType": "address",
|
|
54
|
+
"name": "previousOwner",
|
|
55
|
+
"type": "address"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"indexed": true,
|
|
59
|
+
"internalType": "address",
|
|
60
|
+
"name": "newOwner",
|
|
61
|
+
"type": "address"
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
"name": "OwnershipTransferred",
|
|
65
|
+
"type": "event"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
"anonymous": false,
|
|
69
|
+
"inputs": [
|
|
70
|
+
{
|
|
71
|
+
"indexed": true,
|
|
72
|
+
"internalType": "address",
|
|
73
|
+
"name": "asset",
|
|
74
|
+
"type": "address"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"indexed": true,
|
|
78
|
+
"internalType": "address",
|
|
79
|
+
"name": "pancakePool",
|
|
80
|
+
"type": "address"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"indexed": true,
|
|
84
|
+
"internalType": "uint256",
|
|
85
|
+
"name": "anchorPeriod",
|
|
86
|
+
"type": "uint256"
|
|
87
|
+
}
|
|
88
|
+
],
|
|
89
|
+
"name": "TokenConfigAdded",
|
|
90
|
+
"type": "event"
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"anonymous": false,
|
|
94
|
+
"inputs": [
|
|
95
|
+
{
|
|
96
|
+
"indexed": true,
|
|
97
|
+
"internalType": "address",
|
|
98
|
+
"name": "asset",
|
|
99
|
+
"type": "address"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"indexed": false,
|
|
103
|
+
"internalType": "uint256",
|
|
104
|
+
"name": "oldTimestamp",
|
|
105
|
+
"type": "uint256"
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"indexed": false,
|
|
109
|
+
"internalType": "uint256",
|
|
110
|
+
"name": "oldAcc",
|
|
111
|
+
"type": "uint256"
|
|
112
|
+
},
|
|
113
|
+
{
|
|
114
|
+
"indexed": false,
|
|
115
|
+
"internalType": "uint256",
|
|
116
|
+
"name": "newTimestamp",
|
|
117
|
+
"type": "uint256"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
"indexed": false,
|
|
121
|
+
"internalType": "uint256",
|
|
122
|
+
"name": "newAcc",
|
|
123
|
+
"type": "uint256"
|
|
124
|
+
}
|
|
125
|
+
],
|
|
126
|
+
"name": "TwapWindowUpdated",
|
|
127
|
+
"type": "event"
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"inputs": [],
|
|
131
|
+
"name": "WBNB",
|
|
132
|
+
"outputs": [
|
|
133
|
+
{
|
|
134
|
+
"internalType": "address",
|
|
135
|
+
"name": "",
|
|
136
|
+
"type": "address"
|
|
137
|
+
}
|
|
138
|
+
],
|
|
139
|
+
"stateMutability": "view",
|
|
140
|
+
"type": "function"
|
|
141
|
+
},
|
|
142
|
+
{
|
|
143
|
+
"inputs": [],
|
|
144
|
+
"name": "bnbBaseUnit",
|
|
145
|
+
"outputs": [
|
|
146
|
+
{
|
|
147
|
+
"internalType": "uint256",
|
|
148
|
+
"name": "",
|
|
149
|
+
"type": "uint256"
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"stateMutability": "view",
|
|
153
|
+
"type": "function"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
"inputs": [],
|
|
157
|
+
"name": "busdBaseUnit",
|
|
158
|
+
"outputs": [
|
|
159
|
+
{
|
|
160
|
+
"internalType": "uint256",
|
|
161
|
+
"name": "",
|
|
162
|
+
"type": "uint256"
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"stateMutability": "view",
|
|
166
|
+
"type": "function"
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
"inputs": [
|
|
170
|
+
{
|
|
171
|
+
"components": [
|
|
172
|
+
{
|
|
173
|
+
"internalType": "address",
|
|
174
|
+
"name": "asset",
|
|
175
|
+
"type": "address"
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"internalType": "uint256",
|
|
179
|
+
"name": "baseUnit",
|
|
180
|
+
"type": "uint256"
|
|
181
|
+
},
|
|
182
|
+
{
|
|
183
|
+
"internalType": "address",
|
|
184
|
+
"name": "pancakePool",
|
|
185
|
+
"type": "address"
|
|
186
|
+
},
|
|
187
|
+
{
|
|
188
|
+
"internalType": "bool",
|
|
189
|
+
"name": "isBnbBased",
|
|
190
|
+
"type": "bool"
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
"internalType": "bool",
|
|
194
|
+
"name": "isReversedPool",
|
|
195
|
+
"type": "bool"
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
"internalType": "uint256",
|
|
199
|
+
"name": "anchorPeriod",
|
|
200
|
+
"type": "uint256"
|
|
201
|
+
}
|
|
202
|
+
],
|
|
203
|
+
"internalType": "struct TokenConfig",
|
|
204
|
+
"name": "config",
|
|
205
|
+
"type": "tuple"
|
|
206
|
+
}
|
|
207
|
+
],
|
|
208
|
+
"name": "currentCumulativePrice",
|
|
209
|
+
"outputs": [
|
|
210
|
+
{
|
|
211
|
+
"internalType": "uint256",
|
|
212
|
+
"name": "",
|
|
213
|
+
"type": "uint256"
|
|
214
|
+
}
|
|
215
|
+
],
|
|
216
|
+
"stateMutability": "view",
|
|
217
|
+
"type": "function"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"inputs": [],
|
|
221
|
+
"name": "expScale",
|
|
222
|
+
"outputs": [
|
|
223
|
+
{
|
|
224
|
+
"internalType": "uint256",
|
|
225
|
+
"name": "",
|
|
226
|
+
"type": "uint256"
|
|
227
|
+
}
|
|
228
|
+
],
|
|
229
|
+
"stateMutability": "view",
|
|
230
|
+
"type": "function"
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
"inputs": [
|
|
234
|
+
{
|
|
235
|
+
"internalType": "address",
|
|
236
|
+
"name": "vToken",
|
|
237
|
+
"type": "address"
|
|
238
|
+
}
|
|
239
|
+
],
|
|
240
|
+
"name": "getUnderlyingPrice",
|
|
241
|
+
"outputs": [
|
|
242
|
+
{
|
|
243
|
+
"internalType": "uint256",
|
|
244
|
+
"name": "",
|
|
245
|
+
"type": "uint256"
|
|
246
|
+
}
|
|
247
|
+
],
|
|
248
|
+
"stateMutability": "view",
|
|
249
|
+
"type": "function"
|
|
250
|
+
},
|
|
251
|
+
{
|
|
252
|
+
"inputs": [
|
|
253
|
+
{
|
|
254
|
+
"internalType": "address",
|
|
255
|
+
"name": "WBNB_",
|
|
256
|
+
"type": "address"
|
|
257
|
+
}
|
|
258
|
+
],
|
|
259
|
+
"name": "initialize",
|
|
260
|
+
"outputs": [],
|
|
261
|
+
"stateMutability": "nonpayable",
|
|
262
|
+
"type": "function"
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
"inputs": [
|
|
266
|
+
{
|
|
267
|
+
"internalType": "address",
|
|
268
|
+
"name": "",
|
|
269
|
+
"type": "address"
|
|
270
|
+
}
|
|
271
|
+
],
|
|
272
|
+
"name": "newObservations",
|
|
273
|
+
"outputs": [
|
|
274
|
+
{
|
|
275
|
+
"internalType": "uint256",
|
|
276
|
+
"name": "timestamp",
|
|
277
|
+
"type": "uint256"
|
|
278
|
+
},
|
|
279
|
+
{
|
|
280
|
+
"internalType": "uint256",
|
|
281
|
+
"name": "acc",
|
|
282
|
+
"type": "uint256"
|
|
283
|
+
}
|
|
284
|
+
],
|
|
285
|
+
"stateMutability": "view",
|
|
286
|
+
"type": "function"
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
"inputs": [
|
|
290
|
+
{
|
|
291
|
+
"internalType": "address",
|
|
292
|
+
"name": "",
|
|
293
|
+
"type": "address"
|
|
294
|
+
}
|
|
295
|
+
],
|
|
296
|
+
"name": "oldObservations",
|
|
297
|
+
"outputs": [
|
|
298
|
+
{
|
|
299
|
+
"internalType": "uint256",
|
|
300
|
+
"name": "timestamp",
|
|
301
|
+
"type": "uint256"
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
"internalType": "uint256",
|
|
305
|
+
"name": "acc",
|
|
306
|
+
"type": "uint256"
|
|
307
|
+
}
|
|
308
|
+
],
|
|
309
|
+
"stateMutability": "view",
|
|
310
|
+
"type": "function"
|
|
311
|
+
},
|
|
312
|
+
{
|
|
313
|
+
"inputs": [],
|
|
314
|
+
"name": "owner",
|
|
315
|
+
"outputs": [
|
|
316
|
+
{
|
|
317
|
+
"internalType": "address",
|
|
318
|
+
"name": "",
|
|
319
|
+
"type": "address"
|
|
320
|
+
}
|
|
321
|
+
],
|
|
322
|
+
"stateMutability": "view",
|
|
323
|
+
"type": "function"
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
"inputs": [
|
|
327
|
+
{
|
|
328
|
+
"internalType": "address",
|
|
329
|
+
"name": "",
|
|
330
|
+
"type": "address"
|
|
331
|
+
}
|
|
332
|
+
],
|
|
333
|
+
"name": "prices",
|
|
334
|
+
"outputs": [
|
|
335
|
+
{
|
|
336
|
+
"internalType": "uint256",
|
|
337
|
+
"name": "",
|
|
338
|
+
"type": "uint256"
|
|
339
|
+
}
|
|
340
|
+
],
|
|
341
|
+
"stateMutability": "view",
|
|
342
|
+
"type": "function"
|
|
343
|
+
},
|
|
344
|
+
{
|
|
345
|
+
"inputs": [],
|
|
346
|
+
"name": "renounceOwnership",
|
|
347
|
+
"outputs": [],
|
|
348
|
+
"stateMutability": "nonpayable",
|
|
349
|
+
"type": "function"
|
|
350
|
+
},
|
|
351
|
+
{
|
|
352
|
+
"inputs": [
|
|
353
|
+
{
|
|
354
|
+
"components": [
|
|
355
|
+
{
|
|
356
|
+
"internalType": "address",
|
|
357
|
+
"name": "asset",
|
|
358
|
+
"type": "address"
|
|
359
|
+
},
|
|
360
|
+
{
|
|
361
|
+
"internalType": "uint256",
|
|
362
|
+
"name": "baseUnit",
|
|
363
|
+
"type": "uint256"
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
"internalType": "address",
|
|
367
|
+
"name": "pancakePool",
|
|
368
|
+
"type": "address"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
"internalType": "bool",
|
|
372
|
+
"name": "isBnbBased",
|
|
373
|
+
"type": "bool"
|
|
374
|
+
},
|
|
375
|
+
{
|
|
376
|
+
"internalType": "bool",
|
|
377
|
+
"name": "isReversedPool",
|
|
378
|
+
"type": "bool"
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
"internalType": "uint256",
|
|
382
|
+
"name": "anchorPeriod",
|
|
383
|
+
"type": "uint256"
|
|
384
|
+
}
|
|
385
|
+
],
|
|
386
|
+
"internalType": "struct TokenConfig",
|
|
387
|
+
"name": "config",
|
|
388
|
+
"type": "tuple"
|
|
389
|
+
}
|
|
390
|
+
],
|
|
391
|
+
"name": "setTokenConfig",
|
|
392
|
+
"outputs": [],
|
|
393
|
+
"stateMutability": "nonpayable",
|
|
394
|
+
"type": "function"
|
|
395
|
+
},
|
|
396
|
+
{
|
|
397
|
+
"inputs": [
|
|
398
|
+
{
|
|
399
|
+
"components": [
|
|
400
|
+
{
|
|
401
|
+
"internalType": "address",
|
|
402
|
+
"name": "asset",
|
|
403
|
+
"type": "address"
|
|
404
|
+
},
|
|
405
|
+
{
|
|
406
|
+
"internalType": "uint256",
|
|
407
|
+
"name": "baseUnit",
|
|
408
|
+
"type": "uint256"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
"internalType": "address",
|
|
412
|
+
"name": "pancakePool",
|
|
413
|
+
"type": "address"
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
"internalType": "bool",
|
|
417
|
+
"name": "isBnbBased",
|
|
418
|
+
"type": "bool"
|
|
419
|
+
},
|
|
420
|
+
{
|
|
421
|
+
"internalType": "bool",
|
|
422
|
+
"name": "isReversedPool",
|
|
423
|
+
"type": "bool"
|
|
424
|
+
},
|
|
425
|
+
{
|
|
426
|
+
"internalType": "uint256",
|
|
427
|
+
"name": "anchorPeriod",
|
|
428
|
+
"type": "uint256"
|
|
429
|
+
}
|
|
430
|
+
],
|
|
431
|
+
"internalType": "struct TokenConfig[]",
|
|
432
|
+
"name": "configs",
|
|
433
|
+
"type": "tuple[]"
|
|
434
|
+
}
|
|
435
|
+
],
|
|
436
|
+
"name": "setTokenConfigs",
|
|
437
|
+
"outputs": [],
|
|
438
|
+
"stateMutability": "nonpayable",
|
|
439
|
+
"type": "function"
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
"inputs": [
|
|
443
|
+
{
|
|
444
|
+
"internalType": "address",
|
|
445
|
+
"name": "",
|
|
446
|
+
"type": "address"
|
|
447
|
+
}
|
|
448
|
+
],
|
|
449
|
+
"name": "tokenConfigs",
|
|
450
|
+
"outputs": [
|
|
451
|
+
{
|
|
452
|
+
"internalType": "address",
|
|
453
|
+
"name": "asset",
|
|
454
|
+
"type": "address"
|
|
455
|
+
},
|
|
456
|
+
{
|
|
457
|
+
"internalType": "uint256",
|
|
458
|
+
"name": "baseUnit",
|
|
459
|
+
"type": "uint256"
|
|
460
|
+
},
|
|
461
|
+
{
|
|
462
|
+
"internalType": "address",
|
|
463
|
+
"name": "pancakePool",
|
|
464
|
+
"type": "address"
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
"internalType": "bool",
|
|
468
|
+
"name": "isBnbBased",
|
|
469
|
+
"type": "bool"
|
|
470
|
+
},
|
|
471
|
+
{
|
|
472
|
+
"internalType": "bool",
|
|
473
|
+
"name": "isReversedPool",
|
|
474
|
+
"type": "bool"
|
|
475
|
+
},
|
|
476
|
+
{
|
|
477
|
+
"internalType": "uint256",
|
|
478
|
+
"name": "anchorPeriod",
|
|
479
|
+
"type": "uint256"
|
|
480
|
+
}
|
|
481
|
+
],
|
|
482
|
+
"stateMutability": "view",
|
|
483
|
+
"type": "function"
|
|
484
|
+
},
|
|
485
|
+
{
|
|
486
|
+
"inputs": [
|
|
487
|
+
{
|
|
488
|
+
"internalType": "address",
|
|
489
|
+
"name": "newOwner",
|
|
490
|
+
"type": "address"
|
|
491
|
+
}
|
|
492
|
+
],
|
|
493
|
+
"name": "transferOwnership",
|
|
494
|
+
"outputs": [],
|
|
495
|
+
"stateMutability": "nonpayable",
|
|
496
|
+
"type": "function"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
"inputs": [
|
|
500
|
+
{
|
|
501
|
+
"internalType": "address",
|
|
502
|
+
"name": "vToken",
|
|
503
|
+
"type": "address"
|
|
504
|
+
}
|
|
505
|
+
],
|
|
506
|
+
"name": "updateTwap",
|
|
507
|
+
"outputs": [
|
|
508
|
+
{
|
|
509
|
+
"internalType": "uint256",
|
|
510
|
+
"name": "",
|
|
511
|
+
"type": "uint256"
|
|
512
|
+
}
|
|
513
|
+
],
|
|
514
|
+
"stateMutability": "nonpayable",
|
|
515
|
+
"type": "function"
|
|
516
|
+
}
|
|
517
|
+
],
|
|
518
|
+
"transactionHash": "0x1b110d4ef41bb027a839f5dc247332c6c11b8ccef78043cfb4afa77d6f1e926d",
|
|
519
|
+
"receipt": {
|
|
520
|
+
"to": null,
|
|
521
|
+
"from": "0x2Ce1d0ffD7E869D9DF33e28552b12DdDed326706",
|
|
522
|
+
"contractAddress": "0x6C6d8723f2dF765431c0493D088974a482424030",
|
|
523
|
+
"transactionIndex": 5,
|
|
524
|
+
"gasUsed": "1442162",
|
|
525
|
+
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
|
526
|
+
"blockHash": "0xde275c5eb3974cc9493a3645e019ee4ac6bed6d10d03bcd3575ffde47ac65697",
|
|
527
|
+
"transactionHash": "0x1b110d4ef41bb027a839f5dc247332c6c11b8ccef78043cfb4afa77d6f1e926d",
|
|
528
|
+
"logs": [],
|
|
529
|
+
"blockNumber": 24708545,
|
|
530
|
+
"cumulativeGasUsed": "1837175",
|
|
531
|
+
"status": 1,
|
|
532
|
+
"byzantium": true
|
|
533
|
+
},
|
|
534
|
+
"args": [],
|
|
535
|
+
"numDeployments": 1,
|
|
536
|
+
"solcInputHash": "bb71c6049f6b7b21a6581f40daf802bc",
|
|
537
|
+
"metadata": "{\"compiler\":{\"version\":\"0.8.13+commit.abaa5c0e\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"price\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTimestamp\",\"type\":\"uint256\"}],\"name\":\"AnchorPriceUpdated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"previousOwner\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"OwnershipTransferred\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"pancakePool\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"uint256\",\"name\":\"anchorPeriod\",\"type\":\"uint256\"}],\"name\":\"TokenConfigAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"oldAcc\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newTimestamp\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"newAcc\",\"type\":\"uint256\"}],\"name\":\"TwapWindowUpdated\",\"type\":\"event\"},{\"inputs\":[],\"name\":\"WBNB\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"bnbBaseUnit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"busdBaseUnit\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"baseUnit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"pancakePool\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isBnbBased\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isReversedPool\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"anchorPeriod\",\"type\":\"uint256\"}],\"internalType\":\"struct TokenConfig\",\"name\":\"config\",\"type\":\"tuple\"}],\"name\":\"currentCumulativePrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"expScale\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"vToken\",\"type\":\"address\"}],\"name\":\"getUnderlyingPrice\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"WBNB_\",\"type\":\"address\"}],\"name\":\"initialize\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"newObservations\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"acc\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"oldObservations\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"timestamp\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"acc\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"owner\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"prices\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"renounceOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"baseUnit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"pancakePool\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isBnbBased\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isReversedPool\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"anchorPeriod\",\"type\":\"uint256\"}],\"internalType\":\"struct TokenConfig\",\"name\":\"config\",\"type\":\"tuple\"}],\"name\":\"setTokenConfig\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"baseUnit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"pancakePool\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isBnbBased\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isReversedPool\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"anchorPeriod\",\"type\":\"uint256\"}],\"internalType\":\"struct TokenConfig[]\",\"name\":\"configs\",\"type\":\"tuple[]\"}],\"name\":\"setTokenConfigs\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"tokenConfigs\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"asset\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"baseUnit\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"pancakePool\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"isBnbBased\",\"type\":\"bool\"},{\"internalType\":\"bool\",\"name\":\"isReversedPool\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"anchorPeriod\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newOwner\",\"type\":\"address\"}],\"name\":\"transferOwnership\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"vToken\",\"type\":\"address\"}],\"name\":\"updateTwap\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"currentCumulativePrice((address,uint256,address,bool,bool,uint256))\":{\"returns\":{\"_0\":\"cumulative price of target token regardless of pair order\"}},\"getUnderlyingPrice(address)\":{\"params\":{\"vToken\":\"vToken address\"},\"returns\":{\"_0\":\"price in USD, with 18 decimals\"}},\"owner()\":{\"details\":\"Returns the address of the current owner.\"},\"renounceOwnership()\":{\"details\":\"Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner.\"},\"setTokenConfig((address,uint256,address,bool,bool,uint256))\":{\"params\":{\"config\":\"token config struct\"}},\"setTokenConfigs((address,uint256,address,bool,bool,uint256)[])\":{\"params\":{\"configs\":\"config array\"}},\"transferOwnership(address)\":{\"details\":\"Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner.\"}},\"version\":1},\"userdoc\":{\"events\":{\"AnchorPriceUpdated(address,uint256,uint256,uint256)\":{\"notice\":\"Emit this event when TWAP price is updated\"},\"TokenConfigAdded(address,address,uint256)\":{\"notice\":\"Emit this event when new token configs are added\"},\"TwapWindowUpdated(address,uint256,uint256,uint256,uint256)\":{\"notice\":\"Emit this event when TWAP window is updated\"}},\"kind\":\"user\",\"methods\":{\"WBNB()\":{\"notice\":\"WBNB address\"},\"bnbBaseUnit()\":{\"notice\":\"the base unit of WBNB and BUSD, which are the paired tokens for all assets\"},\"currentCumulativePrice((address,uint256,address,bool,bool,uint256))\":{\"notice\":\"Fetches the current token/WBNB and token/BUSD price accumulator from pancakeswap.\"},\"getUnderlyingPrice(address)\":{\"notice\":\"Get the underlying TWAP price of input vToken\"},\"newObservations(address)\":{\"notice\":\"The current price observation of TWAP. With old and current observations we can calculate the TWAP between this range\"},\"oldObservations(address)\":{\"notice\":\"The old price observation of TWAP\"},\"prices(address)\":{\"notice\":\"Stored price by token\"},\"setTokenConfig((address,uint256,address,bool,bool,uint256))\":{\"notice\":\"Add single token configs\"},\"setTokenConfigs((address,uint256,address,bool,bool,uint256)[])\":{\"notice\":\"Add multiple token configs at the same time\"},\"tokenConfigs(address)\":{\"notice\":\"Configs by token\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/oracles/TwapOracle.sol\":\"TwapOracle\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../utils/ContextUpgradeable.sol\\\";\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Contract module which provides a basic access control mechanism, where\\n * there is an account (an owner) that can be granted exclusive access to\\n * specific functions.\\n *\\n * By default, the owner account will be the one that deploys the contract. This\\n * can later be changed with {transferOwnership}.\\n *\\n * This module is used through inheritance. It will make available the modifier\\n * `onlyOwner`, which can be applied to your functions to restrict their use to\\n * the owner.\\n */\\nabstract contract OwnableUpgradeable is Initializable, ContextUpgradeable {\\n address private _owner;\\n\\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\\n\\n /**\\n * @dev Initializes the contract setting the deployer as the initial owner.\\n */\\n function __Ownable_init() internal onlyInitializing {\\n __Ownable_init_unchained();\\n }\\n\\n function __Ownable_init_unchained() internal onlyInitializing {\\n _transferOwnership(_msgSender());\\n }\\n\\n /**\\n * @dev Throws if called by any account other than the owner.\\n */\\n modifier onlyOwner() {\\n _checkOwner();\\n _;\\n }\\n\\n /**\\n * @dev Returns the address of the current owner.\\n */\\n function owner() public view virtual returns (address) {\\n return _owner;\\n }\\n\\n /**\\n * @dev Throws if the sender is not the owner.\\n */\\n function _checkOwner() internal view virtual {\\n require(owner() == _msgSender(), \\\"Ownable: caller is not the owner\\\");\\n }\\n\\n /**\\n * @dev Leaves the contract without owner. It will not be possible to call\\n * `onlyOwner` functions anymore. Can only be called by the current owner.\\n *\\n * NOTE: Renouncing ownership will leave the contract without an owner,\\n * thereby removing any functionality that is only available to the owner.\\n */\\n function renounceOwnership() public virtual onlyOwner {\\n _transferOwnership(address(0));\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Can only be called by the current owner.\\n */\\n function transferOwnership(address newOwner) public virtual onlyOwner {\\n require(newOwner != address(0), \\\"Ownable: new owner is the zero address\\\");\\n _transferOwnership(newOwner);\\n }\\n\\n /**\\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\\n * Internal function without access restriction.\\n */\\n function _transferOwnership(address newOwner) internal virtual {\\n address oldOwner = _owner;\\n _owner = newOwner;\\n emit OwnershipTransferred(oldOwner, newOwner);\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[49] private __gap;\\n}\\n\",\"keccak256\":\"0x247c62047745915c0af6b955470a72d1696ebad4352d7d3011aef1a2463cd888\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\n }\\n\\n /**\\n * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\\n * `recipient`, forwarding all available gas and reverting on errors.\\n *\\n * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\\n * of certain opcodes, possibly making contracts go over the 2300 gas limit\\n * imposed by `transfer`, making them unable to receive funds via\\n * `transfer`. {sendValue} removes this limitation.\\n *\\n * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\\n *\\n * IMPORTANT: because control is transferred to `recipient`, care must be\\n * taken to not create reentrancy vulnerabilities. Consider using\\n * {ReentrancyGuard} or the\\n * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\\n */\\n function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\\n\\npragma solidity ^0.8.0;\\nimport \\\"../proxy/utils/Initializable.sol\\\";\\n\\n/**\\n * @dev Provides information about the current execution context, including the\\n * sender of the transaction and its data. While these are generally available\\n * via msg.sender and msg.data, they should not be accessed in such a direct\\n * manner, since when dealing with meta-transactions the account sending and\\n * paying for execution may not be the actual sender (as far as an application\\n * is concerned).\\n *\\n * This contract is only required for intermediate, library-like contracts.\\n */\\nabstract contract ContextUpgradeable is Initializable {\\n function __Context_init() internal onlyInitializing {\\n }\\n\\n function __Context_init_unchained() internal onlyInitializing {\\n }\\n function _msgSender() internal view virtual returns (address) {\\n return msg.sender;\\n }\\n\\n function _msgData() internal view virtual returns (bytes calldata) {\\n return msg.data;\\n }\\n\\n /**\\n * @dev This empty reserved space is put in place to allow future versions to add new\\n * variables without shifting down storage in the inheritance chain.\\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\\n */\\n uint256[50] private __gap;\\n}\\n\",\"keccak256\":\"0x963ea7f0b48b032eef72fe3a7582edf78408d6f834115b9feadd673a4d5bd149\",\"license\":\"MIT\"},\"contracts/interfaces/BEP20Interface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\ninterface BEP20Interface {\\n /**\\n * @dev Returns the amount of tokens in existence.\\n */\\n function totalSupply() external view returns (uint256);\\n\\n /**\\n * @dev Returns the token decimals.\\n */\\n function decimals() external view returns (uint8);\\n\\n /**\\n * @dev Returns the token symbol.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the token name.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the bep token owner.\\n */\\n function getOwner() external view returns (address);\\n\\n /**\\n * @dev Returns the amount of tokens owned by `account`.\\n */\\n function balanceOf(address account) external view returns (uint256);\\n\\n /**\\n * @dev Moves `amount` tokens from the caller's account to `recipient`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address recipient, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Returns the remaining number of tokens that `spender` will be\\n * allowed to spend on behalf of `owner` through {transferFrom}. This is\\n * zero by default.\\n *\\n * This value changes when {approve} or {transferFrom} are called.\\n */\\n function allowance(address _owner, address spender) external view returns (uint256);\\n\\n /**\\n * @dev Sets `amount` as the allowance of `spender` over the caller's tokens.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * IMPORTANT: Beware that changing an allowance with this method brings the risk\\n * that someone may use both the old and the new allowance by unfortunate\\n * transaction ordering. One possible solution to mitigate this race\\n * condition is to first reduce the spender's allowance to 0 and set the\\n * desired value afterwards:\\n * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729\\n *\\n * Emits an {Approval} event.\\n */\\n function approve(address spender, uint256 amount) external returns (bool);\\n\\n /**\\n * @dev Moves `amount` tokens from `sender` to `recipient` using the\\n * allowance mechanism. `amount` is then deducted from the caller's\\n * allowance.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transferFrom(\\n address sender,\\n address recipient,\\n uint256 amount\\n ) external returns (bool);\\n\\n /**\\n * @dev Emitted when `value` tokens are moved from one account (`from`) to\\n * another (`to`).\\n *\\n * Note that `value` may be zero.\\n */\\n event Transfer(address indexed from, address indexed to, uint256 value);\\n\\n /**\\n * @dev Emitted when the allowance of a `spender` for an `owner` is set by\\n * a call to {approve}. `value` is the new allowance.\\n */\\n event Approval(address indexed owner, address indexed spender, uint256 value);\\n}\\n\",\"keccak256\":\"0x53aa6d0be81f26e962567f29e9a17f1b73205997c38c6c298e243ef923554c34\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/OracleInterface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\npragma experimental ABIEncoderV2;\\n\\ninterface OracleInterface {\\n function getUnderlyingPrice(address vToken) external view returns (uint256);\\n}\\n\\ninterface ResilientOracleInterface is OracleInterface {\\n function updatePrice(address vToken) external;\\n}\\n\\ninterface TwapInterface is OracleInterface {\\n function updateTwap(address vToken) external returns (uint256);\\n}\\n\\ninterface BoundValidatorInterface {\\n function validatePriceWithAnchorPrice(\\n address vToken,\\n uint256 reporterPrice,\\n uint256 anchorPrice\\n ) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x474f40570a75a85caa03217fdef1646e22361ad430b0a67f51b2c038668c3836\",\"license\":\"UNLICENSED\"},\"contracts/interfaces/VBep20Interface.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\nimport \\\"./BEP20Interface.sol\\\";\\n\\ninterface VBep20Interface is BEP20Interface {\\n /**\\n * @notice Underlying asset for this VToken\\n */\\n function underlying() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf65bba1e926855bbe2796e061755df640fbae160c0fcbcd996087a24d8049a81\",\"license\":\"UNLICENSED\"},\"contracts/libraries/PancakeLibrary.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\n\\nlibrary FixedPoint {\\n // range: [0, 2**112 - 1]\\n // resolution: 1 / 2**112\\n struct uq112x112 {\\n uint224 _x;\\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) << 112) / denominator);\\n }\\n\\n // decode a uq112x112 into a uint with 18 decimals of precision\\n function decode112with18(uq112x112 memory self) internal pure returns (uint256) {\\n // we only have 256 - 224 = 32 bits to spare, so scaling up by ~60 bits is dangerous\\n // instead, get close to:\\n // (x * 1e18) >> 112\\n // without risk of overflowing, e.g.:\\n // (x) / 2 ** (112 - lg(1e18))\\n return uint256(self._x) / 5192296858534827;\\n }\\n}\\n\\n// library with helper methods for oracles that are concerned with computing average prices\\nlibrary PancakeOracleLibrary {\\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 uint256 price0Cumulative,\\n uint256 price1Cumulative,\\n uint32 blockTimestamp\\n )\\n {\\n blockTimestamp = currentBlockTimestamp();\\n price0Cumulative = IPancakePair(pair).price0CumulativeLast();\\n price1Cumulative = IPancakePair(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) = IPancakePair(pair).getReserves();\\n if (blockTimestampLast != blockTimestamp) {\\n unchecked {\\n // subtraction overflow is desired\\n uint32 timeElapsed = blockTimestamp - blockTimestampLast;\\n // addition overflow is desired\\n // counterfactual\\n price0Cumulative += uint256(FixedPoint.fraction(reserve1, reserve0)._x) * timeElapsed;\\n // counterfactual\\n price1Cumulative += uint256(FixedPoint.fraction(reserve0, reserve1)._x) * timeElapsed;\\n }\\n }\\n }\\n}\\n\\ninterface IPancakePair {\\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 (uint256);\\n\\n function price1CumulativeLast() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4d2321303bb03aeb8eda73db2f04561ef89efb01ffb80019f1969b3c0c63de01\",\"license\":\"UNLICENSED\"},\"contracts/oracles/TwapOracle.sol\":{\"content\":\"// SPDX-License-Identifier: UNLICENSED\\npragma solidity ^0.8.0;\\npragma experimental ABIEncoderV2;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol\\\";\\nimport \\\"../libraries/PancakeLibrary.sol\\\";\\nimport \\\"../interfaces/OracleInterface.sol\\\";\\nimport \\\"../interfaces/BEP20Interface.sol\\\";\\nimport \\\"../interfaces/VBep20Interface.sol\\\";\\n\\nstruct Observation {\\n uint256 timestamp;\\n uint256 acc;\\n}\\n\\nstruct TokenConfig {\\n /// @notice asset address, which can't be zero address and can be used for existance check\\n address asset;\\n /// @notice Decimals of underlying asset\\n uint256 baseUnit;\\n /// @notice The address of pancake pair\\n address pancakePool;\\n /// @notice Whether the token is paired with WBNB\\n bool isBnbBased;\\n /// @notice A flag identifies whether the pancake pair is reversed\\n /// e.g. XVS-WBNB is not reversed, while WBNB-XVS is.\\n bool isReversedPool;\\n /// @notice TWAP update period in second, which is the minimum time in seconds required to update TWAP window\\n uint256 anchorPeriod;\\n}\\n\\ncontract TwapOracle is OwnableUpgradeable, TwapInterface {\\n using FixedPoint for *;\\n\\n /// @notice WBNB address\\n address public WBNB;\\n\\n /// @notice the base unit of WBNB and BUSD, which are the paired tokens for all assets\\n uint256 public constant bnbBaseUnit = 1e18;\\n uint256 public constant busdBaseUnit = 1e18;\\n\\n uint256 public constant expScale = 1e18;\\n\\n /// @notice Configs by token\\n mapping(address => TokenConfig) public tokenConfigs;\\n\\n /// @notice The current price observation of TWAP. With old and current observations\\n /// we can calculate the TWAP between this range\\n mapping(address => Observation) public newObservations;\\n\\n /// @notice The old price observation of TWAP\\n mapping(address => Observation) public oldObservations;\\n\\n /// @notice Stored price by token\\n mapping(address => uint256) public prices;\\n\\n /// @notice Emit this event when TWAP window is updated\\n event TwapWindowUpdated(\\n address indexed asset,\\n uint256 oldTimestamp,\\n uint256 oldAcc,\\n uint256 newTimestamp,\\n uint256 newAcc\\n );\\n\\n /// @notice Emit this event when TWAP price is updated\\n event AnchorPriceUpdated(address indexed asset, uint256 price, uint256 oldTimestamp, uint256 newTimestamp);\\n\\n /// @notice Emit this event when new token configs are added\\n event TokenConfigAdded(address indexed asset, address indexed pancakePool, uint256 indexed anchorPeriod);\\n\\n modifier notNullAddress(address someone) {\\n require(someone != address(0), \\\"can't be zero address\\\");\\n _;\\n }\\n\\n function initialize(address WBNB_) public initializer {\\n __Ownable_init();\\n require(WBNB_ != address(0), \\\"WBNB can't be zero address\\\");\\n WBNB = WBNB_;\\n }\\n\\n /**\\n * @notice Add multiple token configs at the same time\\n * @param configs config array\\n */\\n function setTokenConfigs(TokenConfig[] memory configs) external onlyOwner {\\n require(configs.length > 0, \\\"length can't be 0\\\");\\n for (uint8 i = 0; i < configs.length; i++) {\\n setTokenConfig(configs[i]);\\n }\\n }\\n\\n /**\\n * @notice Add single token configs\\n * @param config token config struct\\n */\\n function setTokenConfig(TokenConfig memory config)\\n public\\n onlyOwner\\n notNullAddress(config.asset)\\n notNullAddress(config.pancakePool)\\n {\\n require(config.anchorPeriod > 0, \\\"anchor period must be positive\\\");\\n require(config.baseUnit > 0, \\\"base unit must be positive\\\");\\n uint256 cumulativePrice = currentCumulativePrice(config);\\n\\n // Initialize observation data\\n oldObservations[config.asset].timestamp = block.timestamp;\\n newObservations[config.asset].timestamp = block.timestamp;\\n oldObservations[config.asset].acc = cumulativePrice;\\n newObservations[config.asset].acc = cumulativePrice;\\n tokenConfigs[config.asset] = config;\\n emit TokenConfigAdded(config.asset, config.pancakePool, config.anchorPeriod);\\n }\\n\\n /**\\n * @notice Get the underlying TWAP price of input vToken\\n * @param vToken vToken address\\n * @return price in USD, with 18 decimals\\n */\\n function getUnderlyingPrice(address vToken) external view override returns (uint256) {\\n address asset = VBep20Interface(vToken).underlying();\\n require(tokenConfigs[asset].asset != address(0), \\\"asset not exist\\\");\\n\\n uint256 price = prices[asset];\\n\\n // if price is 0, it means the price hasn't been updated yet and it's meaningless, revert\\n require(price > 0, \\\"TWAP price must be positive\\\");\\n\\n BEP20Interface underlyingToken = BEP20Interface(VBep20Interface(vToken).underlying());\\n return (price * (10**(18 - underlyingToken.decimals())));\\n }\\n\\n /**\\n * @notice Fetches the current token/WBNB and token/BUSD price accumulator from pancakeswap.\\n * @return cumulative price of target token regardless of pair order\\n */\\n function currentCumulativePrice(TokenConfig memory config) public view returns (uint256) {\\n (uint256 price0, uint256 price1, ) = PancakeOracleLibrary.currentCumulativePrices(config.pancakePool);\\n if (config.isReversedPool) {\\n return price1;\\n } else {\\n return price0;\\n }\\n }\\n\\n function updateTwap(address vToken) public returns (uint256) {\\n address asset = VBep20Interface(vToken).underlying();\\n require(tokenConfigs[asset].asset != address(0), \\\"asset not exist\\\");\\n // Update & fetch WBNB price first, so we can calculate the price of WBNB paired token\\n if (asset != WBNB && tokenConfigs[asset].isBnbBased) {\\n require(tokenConfigs[WBNB].asset != address(0), \\\"WBNB not exist\\\");\\n _updateTwapInternal(tokenConfigs[WBNB]);\\n }\\n return _updateTwapInternal(tokenConfigs[asset]);\\n }\\n\\n /**\\n * @notice Fetches the current token/BUSD price from PancakeSwap, with 18 decimals of precision.\\n * @return price in USD, with 18 decimals\\n */\\n function _updateTwapInternal(TokenConfig memory config) internal virtual returns (uint256) {\\n // pokeWindowValues already handled reversed pool cases,\\n // priceAverage will always be Token/BNB or Token/BUSD TWAP price.\\n (uint256 nowCumulativePrice, uint256 oldCumulativePrice, uint256 oldTimestamp) = pokeWindowValues(config);\\n\\n // This should be impossible, but better safe than sorry\\n require(block.timestamp > oldTimestamp, \\\"now must come after before\\\");\\n uint256 timeElapsed = block.timestamp - oldTimestamp;\\n\\n // Calculate Pancakge TWAP\\n FixedPoint.uq112x112 memory priceAverage = FixedPoint.uq112x112(\\n uint224((nowCumulativePrice - oldCumulativePrice) / timeElapsed)\\n );\\n // TWAP price with 1e18 decimal mantissa\\n uint256 priceAverageMantissa = priceAverage.decode112with18();\\n\\n // To cancel the decimals in cumulative price, we need to mulitply the average price with\\n // tokenBaseUnit / (wbnbBaseUnit or busdBaseUnit, which is 1e18)\\n uint256 pairedTokenBaseUnit = config.isBnbBased ? bnbBaseUnit : busdBaseUnit;\\n uint256 anchorPriceMantissa = (priceAverageMantissa * config.baseUnit) / pairedTokenBaseUnit;\\n\\n // if this token is paired with BNB, convert its price to USD\\n if (config.isBnbBased) {\\n uint256 bnbPrice = prices[WBNB];\\n require(bnbPrice != 0, \\\"bnb price is invalid\\\");\\n anchorPriceMantissa = (anchorPriceMantissa * bnbPrice) / bnbBaseUnit;\\n }\\n\\n require(anchorPriceMantissa != 0, \\\"twap price cannot be 0\\\");\\n\\n emit AnchorPriceUpdated(config.asset, anchorPriceMantissa, oldTimestamp, block.timestamp);\\n\\n // save anchor price, which is 1e18 decimals\\n prices[config.asset] = anchorPriceMantissa;\\n\\n return anchorPriceMantissa;\\n }\\n\\n /**\\n * @notice Update new and old observations of lagging window if period elapsed.\\n * @return cumulative price & old observation\\n */\\n function pokeWindowValues(TokenConfig memory config)\\n internal\\n returns (\\n uint256,\\n uint256,\\n uint256\\n )\\n {\\n uint256 cumulativePrice = currentCumulativePrice(config);\\n\\n Observation memory newObservation = newObservations[config.asset];\\n\\n // Update new and old observations if elapsed time is greater than or equal to anchor period\\n uint256 timeElapsed = block.timestamp - newObservation.timestamp;\\n if (timeElapsed >= config.anchorPeriod) {\\n oldObservations[config.asset].timestamp = newObservation.timestamp;\\n oldObservations[config.asset].acc = newObservation.acc;\\n\\n newObservations[config.asset].timestamp = block.timestamp;\\n newObservations[config.asset].acc = cumulativePrice;\\n emit TwapWindowUpdated(\\n config.asset,\\n newObservation.timestamp,\\n block.timestamp,\\n newObservation.acc,\\n cumulativePrice\\n );\\n }\\n return (cumulativePrice, oldObservations[config.asset].acc, oldObservations[config.asset].timestamp);\\n }\\n}\\n\",\"keccak256\":\"0x921d5016d8e1bb6bdc3bbce6de6045bd01d8af26a94260a9c0536f439a2adf28\",\"license\":\"UNLICENSED\"}},\"version\":1}",
|
|
538
|
+
"bytecode": "0x608060405234801561001057600080fd5b50611921806100206000396000f3fe608060405234801561001057600080fd5b506004361061010b5760003560e01c80638da5cb5b116100a2578063cbf6791911610071578063cbf6791914610296578063cfed246b146102a9578063f2fde38b146102c9578063fc57d4df146102dc578063fe16e80c146102ef57600080fd5b80638da5cb5b1461024b5780638dd9500214610270578063b8a8a626146101e5578063c4d66de81461028357600080fd5b806369aa3ac6116100de57806369aa3ac6146101e5578063715018a6146101f4578063725068a5146101fc5780638cea8c261461020f57600080fd5b80631b69dc5f14610110578063234a3446146101af5780632b9d9dea146101c4578063609f0f36146101e5575b600080fd5b61016861011e366004611408565b60666020526000908152604090208054600182015460028301546003909301546001600160a01b0392831693919282169160ff600160a01b8204811692600160a81b909204169086565b604080516001600160a01b03978816815260208101969096529390951692840192909252151560608301521515608082015260a081019190915260c0015b60405180910390f35b6101c26101bd366004611519565b610316565b005b6101d76101d23660046115c9565b6103b2565b6040519081526020016101a6565b6101d7670de0b6b3a764000081565b6101c26103e1565b6101d761020a366004611408565b6103f5565b61023661021d366004611408565b6067602052600090815260409020805460019091015482565b604080519283526020830191909152016101a6565b6033546001600160a01b03165b6040516001600160a01b0390911681526020016101a6565b606554610258906001600160a01b031681565b6101c2610291366004611408565b61065a565b6101c26102a43660046115c9565b6107dc565b6101d76102b7366004611408565b60696020526000908152604090205481565b6101c26102d7366004611408565b610a4b565b6101d76102ea366004611408565b610ac4565b6102366102fd366004611408565b6068602052600090815260409020805460019091015482565b61031e610cdc565b60008151116103685760405162461bcd60e51b815260206004820152601160248201527006c656e6774682063616e2774206265203607c1b60448201526064015b60405180910390fd5b60005b81518160ff1610156103ae5761039c828260ff168151811061038f5761038f6115e5565b60200260200101516107dc565b806103a681611611565b91505061036b565b5050565b60008060006103c48460400151610d36565b50915091508360800151156103da579392505050565b5092915050565b6103e9610cdc565b6103f36000610ede565b565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045a9190611630565b6001600160a01b03808216600090815260666020526040902054919250166104b65760405162461bcd60e51b815260206004820152600f60248201526e185cdcd95d081b9bdd08195e1a5cdd608a1b604482015260640161035f565b6065546001600160a01b038281169116148015906104f657506001600160a01b038116600090815260666020526040902060020154600160a01b900460ff165b156105d7576065546001600160a01b03908116600090815260666020526040902054166105565760405162461bcd60e51b815260206004820152600e60248201526d15d09390881b9bdd08195e1a5cdd60921b604482015260640161035f565b6065546001600160a01b03908116600090815260666020908152604091829020825160c08101845281548516815260018201549281019290925260028101549384169282019290925260ff600160a01b8404811615156060830152600160a81b909304909216151560808301526003015460a08201526105d590610f30565b505b6001600160a01b03808216600090815260666020908152604091829020825160c08101845281548516815260018201549281019290925260028101549384169282019290925260ff600160a01b8404811615156060830152600160a81b909304909216151560808301526003015460a082015261065390610f30565b9392505050565b600054610100900460ff161580801561067a5750600054600160ff909116105b806106945750303b158015610694575060005460ff166001145b6106f75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161035f565b6000805460ff19166001179055801561071a576000805461ff0019166101001790555b610722611170565b6001600160a01b0382166107785760405162461bcd60e51b815260206004820152601a60248201527f57424e422063616e2774206265207a65726f2061646472657373000000000000604482015260640161035f565b606580546001600160a01b0319166001600160a01b03841617905580156103ae576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6107e4610cdc565b80516001600160a01b0381166108345760405162461bcd60e51b815260206004820152601560248201527463616e2774206265207a65726f206164647265737360581b604482015260640161035f565b60408201516001600160a01b0381166108875760405162461bcd60e51b815260206004820152601560248201527463616e2774206265207a65726f206164647265737360581b604482015260640161035f565b60008360a00151116108db5760405162461bcd60e51b815260206004820152601e60248201527f616e63686f7220706572696f64206d75737420626520706f7369746976650000604482015260640161035f565b600083602001511161092f5760405162461bcd60e51b815260206004820152601a60248201527f6261736520756e6974206d75737420626520706f736974697665000000000000604482015260640161035f565b600061093a846103b2565b84516001600160a01b03908116600090815260686020818152604080842042908190558a51861685526067808452828620919091558a518616855292825280842060019081018790558a51861685529282528084208301869055895185168452606682528084208a5181549087166001600160a01b031990911681178255928b015193810193909355808a015160028401805460608d015160808e01511515600160a81b0260ff60a81b19911515600160a01b026001600160a81b03199093169490991693841791909117169690961790955560a08a0151600390930183905551949550909390917f3cc8d9cb9370a23a8b9ffa75efa24cecb65c4693980e58260841adc474983c5f91a450505050565b610a53610cdc565b6001600160a01b038116610ab85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161035f565b610ac181610ede565b50565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b299190611630565b6001600160a01b0380821660009081526066602052604090205491925016610b855760405162461bcd60e51b815260206004820152600f60248201526e185cdcd95d081b9bdd08195e1a5cdd608a1b604482015260640161035f565b6001600160a01b03811660009081526069602052604090205480610beb5760405162461bcd60e51b815260206004820152601b60248201527f54574150207072696365206d75737420626520706f7369746976650000000000604482015260640161035f565b6000846001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4f9190611630565b9050806001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb3919061164d565b610cbe906012611670565b610cc990600a611777565b610cd39083611786565b95945050505050565b6033546001600160a01b031633146103f35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161035f565b6000806000610d4361119f565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da791906117a5565b9250836001600160a01b0316635a3d54936040518163ffffffff1660e01b8152600401602060405180830381865afa158015610de7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0b91906117a5565b91506000806000866001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7491906117d5565b9250925092508363ffffffff168163ffffffff1614610ed45780840363ffffffff8116610ea184866111b5565b516001600160e01b031602969096019563ffffffff8116610ec285856111b5565b516001600160e01b0316029590950194505b5050509193909250565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080600080610f3f85611267565b925092509250804211610f945760405162461bcd60e51b815260206004820152601a60248201527f6e6f77206d75737420636f6d65206166746572206265666f7265000000000000604482015260640161035f565b6000610fa08242611825565b905060006040518060200160405280838688610fbc9190611825565b610fc69190611852565b6001600160e01b0316905290506000610fde826113a3565b905060008860600151610ff957670de0b6b3a7640000611003565b670de0b6b3a76400005b90506000818a60200151846110189190611786565b6110229190611852565b90508960600151156110b1576065546001600160a01b0316600090815260696020526040812054908190036110905760405162461bcd60e51b8152602060048201526014602482015273189b98881c1c9a58d9481a5cc81a5b9d985b1a5960621b604482015260640161035f565b670de0b6b3a76400006110a38284611786565b6110ad9190611852565b9150505b806000036110fa5760405162461bcd60e51b81526020600482015260166024820152750747761702070726963652063616e6e6f7420626520360541b604482015260640161035f565b89516040805183815260208101899052428183015290516001600160a01b03909216917f7d881580fb2bb7844e8ecf8df26510247c4bbea2735d40bf0d9ac33c0d9acd819181900360600190a298516001600160a01b031660009081526069602052604090208990555096979650505050505050565b600054610100900460ff166111975760405162461bcd60e51b815260040161035f90611866565b6103f36113c3565b60006111b0640100000000426118b1565b905090565b6040805160208101909152600081526000826001600160701b03161161121d5760405162461bcd60e51b815260206004820152601760248201527f4669786564506f696e743a204449565f42595f5a45524f000000000000000000604482015260640161035f565b6040805160208101909152806112536001600160701b0385166dffffffffffffffffffffffffffff60701b607088901b166118c5565b6001600160e01b0316905290505b92915050565b600080600080611276856103b2565b85516001600160a01b0316600090815260676020908152604080832081518083019092528054808352600190910154928201929092529293506112b99042611825565b90508660a00151811061136e57815187516001600160a01b0390811660009081526068602090815260408083209490945580860180518c51851684528584206001908101919091558c51851684526067835285842042908190558d518616855293869020018890558b5187519151865192835292820193909352938401526060830186905216907f87208a84ec7402c933c70c261e53b733a9f1c893d73e941a152435d58177a2649060800160405180910390a25b505084516001600160a01b03908116600090815260686020526040808220600101549751909216815220549095909350915050565b8051600090611261906612725dd1d243ab906001600160e01b0316611852565b600054610100900460ff166113ea5760405162461bcd60e51b815260040161035f90611866565b6103f333610ede565b6001600160a01b0381168114610ac157600080fd5b60006020828403121561141a57600080fd5b8135610653816113f3565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561146457611464611425565b604052919050565b8035801515811461147c57600080fd5b919050565b600060c0828403121561149357600080fd5b60405160c0810181811067ffffffffffffffff821117156114b6576114b6611425565b60405290508082356114c7816113f3565b81526020838101359082015260408301356114e1816113f3565b60408201526114f26060840161146c565b60608201526115036080840161146c565b608082015260a083013560a08201525092915050565b6000602080838503121561152c57600080fd5b823567ffffffffffffffff8082111561154457600080fd5b818501915085601f83011261155857600080fd5b81358181111561156a5761156a611425565b611578848260051b0161143b565b818152848101925060c091820284018501918883111561159757600080fd5b938501935b828510156115bd576115ae8986611481565b8452938401939285019261159c565b50979650505050505050565b600060c082840312156115db57600080fd5b6106538383611481565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8103611627576116276115fb565b60010192915050565b60006020828403121561164257600080fd5b8151610653816113f3565b60006020828403121561165f57600080fd5b815160ff8116811461065357600080fd5b600060ff821660ff84168082101561168a5761168a6115fb565b90039392505050565b600181815b808511156116ce5781600019048211156116b4576116b46115fb565b808516156116c157918102915b93841c9390800290611698565b509250929050565b6000826116e557506001611261565b816116f257506000611261565b816001811461170857600281146117125761172e565b6001915050611261565b60ff841115611723576117236115fb565b50506001821b611261565b5060208310610133831016604e8410600b8410161715611751575081810a611261565b61175b8383611693565b806000190482111561176f5761176f6115fb565b029392505050565b600061065360ff8416836116d6565b60008160001904831182151516156117a0576117a06115fb565b500290565b6000602082840312156117b757600080fd5b5051919050565b80516001600160701b038116811461147c57600080fd5b6000806000606084860312156117ea57600080fd5b6117f3846117be565b9250611801602085016117be565b9150604084015163ffffffff8116811461181a57600080fd5b809150509250925092565b600082821015611837576118376115fb565b500390565b634e487b7160e01b600052601260045260246000fd5b6000826118615761186161183c565b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000826118c0576118c061183c565b500690565b60006001600160e01b03838116806118df576118df61183c565b9216919091049291505056fea26469706673582212200a09a418732861daead22dd2fb3160185d565d9e6aef8995fc4fc61d520bd67964736f6c634300080d0033",
|
|
539
|
+
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061010b5760003560e01c80638da5cb5b116100a2578063cbf6791911610071578063cbf6791914610296578063cfed246b146102a9578063f2fde38b146102c9578063fc57d4df146102dc578063fe16e80c146102ef57600080fd5b80638da5cb5b1461024b5780638dd9500214610270578063b8a8a626146101e5578063c4d66de81461028357600080fd5b806369aa3ac6116100de57806369aa3ac6146101e5578063715018a6146101f4578063725068a5146101fc5780638cea8c261461020f57600080fd5b80631b69dc5f14610110578063234a3446146101af5780632b9d9dea146101c4578063609f0f36146101e5575b600080fd5b61016861011e366004611408565b60666020526000908152604090208054600182015460028301546003909301546001600160a01b0392831693919282169160ff600160a01b8204811692600160a81b909204169086565b604080516001600160a01b03978816815260208101969096529390951692840192909252151560608301521515608082015260a081019190915260c0015b60405180910390f35b6101c26101bd366004611519565b610316565b005b6101d76101d23660046115c9565b6103b2565b6040519081526020016101a6565b6101d7670de0b6b3a764000081565b6101c26103e1565b6101d761020a366004611408565b6103f5565b61023661021d366004611408565b6067602052600090815260409020805460019091015482565b604080519283526020830191909152016101a6565b6033546001600160a01b03165b6040516001600160a01b0390911681526020016101a6565b606554610258906001600160a01b031681565b6101c2610291366004611408565b61065a565b6101c26102a43660046115c9565b6107dc565b6101d76102b7366004611408565b60696020526000908152604090205481565b6101c26102d7366004611408565b610a4b565b6101d76102ea366004611408565b610ac4565b6102366102fd366004611408565b6068602052600090815260409020805460019091015482565b61031e610cdc565b60008151116103685760405162461bcd60e51b815260206004820152601160248201527006c656e6774682063616e2774206265203607c1b60448201526064015b60405180910390fd5b60005b81518160ff1610156103ae5761039c828260ff168151811061038f5761038f6115e5565b60200260200101516107dc565b806103a681611611565b91505061036b565b5050565b60008060006103c48460400151610d36565b50915091508360800151156103da579392505050565b5092915050565b6103e9610cdc565b6103f36000610ede565b565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610436573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061045a9190611630565b6001600160a01b03808216600090815260666020526040902054919250166104b65760405162461bcd60e51b815260206004820152600f60248201526e185cdcd95d081b9bdd08195e1a5cdd608a1b604482015260640161035f565b6065546001600160a01b038281169116148015906104f657506001600160a01b038116600090815260666020526040902060020154600160a01b900460ff165b156105d7576065546001600160a01b03908116600090815260666020526040902054166105565760405162461bcd60e51b815260206004820152600e60248201526d15d09390881b9bdd08195e1a5cdd60921b604482015260640161035f565b6065546001600160a01b03908116600090815260666020908152604091829020825160c08101845281548516815260018201549281019290925260028101549384169282019290925260ff600160a01b8404811615156060830152600160a81b909304909216151560808301526003015460a08201526105d590610f30565b505b6001600160a01b03808216600090815260666020908152604091829020825160c08101845281548516815260018201549281019290925260028101549384169282019290925260ff600160a01b8404811615156060830152600160a81b909304909216151560808301526003015460a082015261065390610f30565b9392505050565b600054610100900460ff161580801561067a5750600054600160ff909116105b806106945750303b158015610694575060005460ff166001145b6106f75760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840161035f565b6000805460ff19166001179055801561071a576000805461ff0019166101001790555b610722611170565b6001600160a01b0382166107785760405162461bcd60e51b815260206004820152601a60248201527f57424e422063616e2774206265207a65726f2061646472657373000000000000604482015260640161035f565b606580546001600160a01b0319166001600160a01b03841617905580156103ae576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15050565b6107e4610cdc565b80516001600160a01b0381166108345760405162461bcd60e51b815260206004820152601560248201527463616e2774206265207a65726f206164647265737360581b604482015260640161035f565b60408201516001600160a01b0381166108875760405162461bcd60e51b815260206004820152601560248201527463616e2774206265207a65726f206164647265737360581b604482015260640161035f565b60008360a00151116108db5760405162461bcd60e51b815260206004820152601e60248201527f616e63686f7220706572696f64206d75737420626520706f7369746976650000604482015260640161035f565b600083602001511161092f5760405162461bcd60e51b815260206004820152601a60248201527f6261736520756e6974206d75737420626520706f736974697665000000000000604482015260640161035f565b600061093a846103b2565b84516001600160a01b03908116600090815260686020818152604080842042908190558a51861685526067808452828620919091558a518616855292825280842060019081018790558a51861685529282528084208301869055895185168452606682528084208a5181549087166001600160a01b031990911681178255928b015193810193909355808a015160028401805460608d015160808e01511515600160a81b0260ff60a81b19911515600160a01b026001600160a81b03199093169490991693841791909117169690961790955560a08a0151600390930183905551949550909390917f3cc8d9cb9370a23a8b9ffa75efa24cecb65c4693980e58260841adc474983c5f91a450505050565b610a53610cdc565b6001600160a01b038116610ab85760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161035f565b610ac181610ede565b50565b600080826001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610b05573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b299190611630565b6001600160a01b0380821660009081526066602052604090205491925016610b855760405162461bcd60e51b815260206004820152600f60248201526e185cdcd95d081b9bdd08195e1a5cdd608a1b604482015260640161035f565b6001600160a01b03811660009081526069602052604090205480610beb5760405162461bcd60e51b815260206004820152601b60248201527f54574150207072696365206d75737420626520706f7369746976650000000000604482015260640161035f565b6000846001600160a01b0316636f307dc36040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c2b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c4f9190611630565b9050806001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610c8f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610cb3919061164d565b610cbe906012611670565b610cc990600a611777565b610cd39083611786565b95945050505050565b6033546001600160a01b031633146103f35760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161035f565b6000806000610d4361119f565b9050836001600160a01b0316635909c0d56040518163ffffffff1660e01b8152600401602060405180830381865afa158015610d83573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610da791906117a5565b9250836001600160a01b0316635a3d54936040518163ffffffff1660e01b8152600401602060405180830381865afa158015610de7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e0b91906117a5565b91506000806000866001600160a01b0316630902f1ac6040518163ffffffff1660e01b8152600401606060405180830381865afa158015610e50573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e7491906117d5565b9250925092508363ffffffff168163ffffffff1614610ed45780840363ffffffff8116610ea184866111b5565b516001600160e01b031602969096019563ffffffff8116610ec285856111b5565b516001600160e01b0316029590950194505b5050509193909250565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600080600080610f3f85611267565b925092509250804211610f945760405162461bcd60e51b815260206004820152601a60248201527f6e6f77206d75737420636f6d65206166746572206265666f7265000000000000604482015260640161035f565b6000610fa08242611825565b905060006040518060200160405280838688610fbc9190611825565b610fc69190611852565b6001600160e01b0316905290506000610fde826113a3565b905060008860600151610ff957670de0b6b3a7640000611003565b670de0b6b3a76400005b90506000818a60200151846110189190611786565b6110229190611852565b90508960600151156110b1576065546001600160a01b0316600090815260696020526040812054908190036110905760405162461bcd60e51b8152602060048201526014602482015273189b98881c1c9a58d9481a5cc81a5b9d985b1a5960621b604482015260640161035f565b670de0b6b3a76400006110a38284611786565b6110ad9190611852565b9150505b806000036110fa5760405162461bcd60e51b81526020600482015260166024820152750747761702070726963652063616e6e6f7420626520360541b604482015260640161035f565b89516040805183815260208101899052428183015290516001600160a01b03909216917f7d881580fb2bb7844e8ecf8df26510247c4bbea2735d40bf0d9ac33c0d9acd819181900360600190a298516001600160a01b031660009081526069602052604090208990555096979650505050505050565b600054610100900460ff166111975760405162461bcd60e51b815260040161035f90611866565b6103f36113c3565b60006111b0640100000000426118b1565b905090565b6040805160208101909152600081526000826001600160701b03161161121d5760405162461bcd60e51b815260206004820152601760248201527f4669786564506f696e743a204449565f42595f5a45524f000000000000000000604482015260640161035f565b6040805160208101909152806112536001600160701b0385166dffffffffffffffffffffffffffff60701b607088901b166118c5565b6001600160e01b0316905290505b92915050565b600080600080611276856103b2565b85516001600160a01b0316600090815260676020908152604080832081518083019092528054808352600190910154928201929092529293506112b99042611825565b90508660a00151811061136e57815187516001600160a01b0390811660009081526068602090815260408083209490945580860180518c51851684528584206001908101919091558c51851684526067835285842042908190558d518616855293869020018890558b5187519151865192835292820193909352938401526060830186905216907f87208a84ec7402c933c70c261e53b733a9f1c893d73e941a152435d58177a2649060800160405180910390a25b505084516001600160a01b03908116600090815260686020526040808220600101549751909216815220549095909350915050565b8051600090611261906612725dd1d243ab906001600160e01b0316611852565b600054610100900460ff166113ea5760405162461bcd60e51b815260040161035f90611866565b6103f333610ede565b6001600160a01b0381168114610ac157600080fd5b60006020828403121561141a57600080fd5b8135610653816113f3565b634e487b7160e01b600052604160045260246000fd5b604051601f8201601f1916810167ffffffffffffffff8111828210171561146457611464611425565b604052919050565b8035801515811461147c57600080fd5b919050565b600060c0828403121561149357600080fd5b60405160c0810181811067ffffffffffffffff821117156114b6576114b6611425565b60405290508082356114c7816113f3565b81526020838101359082015260408301356114e1816113f3565b60408201526114f26060840161146c565b60608201526115036080840161146c565b608082015260a083013560a08201525092915050565b6000602080838503121561152c57600080fd5b823567ffffffffffffffff8082111561154457600080fd5b818501915085601f83011261155857600080fd5b81358181111561156a5761156a611425565b611578848260051b0161143b565b818152848101925060c091820284018501918883111561159757600080fd5b938501935b828510156115bd576115ae8986611481565b8452938401939285019261159c565b50979650505050505050565b600060c082840312156115db57600080fd5b6106538383611481565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052601160045260246000fd5b600060ff821660ff8103611627576116276115fb565b60010192915050565b60006020828403121561164257600080fd5b8151610653816113f3565b60006020828403121561165f57600080fd5b815160ff8116811461065357600080fd5b600060ff821660ff84168082101561168a5761168a6115fb565b90039392505050565b600181815b808511156116ce5781600019048211156116b4576116b46115fb565b808516156116c157918102915b93841c9390800290611698565b509250929050565b6000826116e557506001611261565b816116f257506000611261565b816001811461170857600281146117125761172e565b6001915050611261565b60ff841115611723576117236115fb565b50506001821b611261565b5060208310610133831016604e8410600b8410161715611751575081810a611261565b61175b8383611693565b806000190482111561176f5761176f6115fb565b029392505050565b600061065360ff8416836116d6565b60008160001904831182151516156117a0576117a06115fb565b500290565b6000602082840312156117b757600080fd5b5051919050565b80516001600160701b038116811461147c57600080fd5b6000806000606084860312156117ea57600080fd5b6117f3846117be565b9250611801602085016117be565b9150604084015163ffffffff8116811461181a57600080fd5b809150509250925092565b600082821015611837576118376115fb565b500390565b634e487b7160e01b600052601260045260246000fd5b6000826118615761186161183c565b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b6000826118c0576118c061183c565b500690565b60006001600160e01b03838116806118df576118df61183c565b9216919091049291505056fea26469706673582212200a09a418732861daead22dd2fb3160185d565d9e6aef8995fc4fc61d520bd67964736f6c634300080d0033",
|
|
540
|
+
"devdoc": {
|
|
541
|
+
"kind": "dev",
|
|
542
|
+
"methods": {
|
|
543
|
+
"currentCumulativePrice((address,uint256,address,bool,bool,uint256))": {
|
|
544
|
+
"returns": {
|
|
545
|
+
"_0": "cumulative price of target token regardless of pair order"
|
|
546
|
+
}
|
|
547
|
+
},
|
|
548
|
+
"getUnderlyingPrice(address)": {
|
|
549
|
+
"params": {
|
|
550
|
+
"vToken": "vToken address"
|
|
551
|
+
},
|
|
552
|
+
"returns": {
|
|
553
|
+
"_0": "price in USD, with 18 decimals"
|
|
554
|
+
}
|
|
555
|
+
},
|
|
556
|
+
"owner()": {
|
|
557
|
+
"details": "Returns the address of the current owner."
|
|
558
|
+
},
|
|
559
|
+
"renounceOwnership()": {
|
|
560
|
+
"details": "Leaves the contract without owner. It will not be possible to call `onlyOwner` functions anymore. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby removing any functionality that is only available to the owner."
|
|
561
|
+
},
|
|
562
|
+
"setTokenConfig((address,uint256,address,bool,bool,uint256))": {
|
|
563
|
+
"params": {
|
|
564
|
+
"config": "token config struct"
|
|
565
|
+
}
|
|
566
|
+
},
|
|
567
|
+
"setTokenConfigs((address,uint256,address,bool,bool,uint256)[])": {
|
|
568
|
+
"params": {
|
|
569
|
+
"configs": "config array"
|
|
570
|
+
}
|
|
571
|
+
},
|
|
572
|
+
"transferOwnership(address)": {
|
|
573
|
+
"details": "Transfers ownership of the contract to a new account (`newOwner`). Can only be called by the current owner."
|
|
574
|
+
}
|
|
575
|
+
},
|
|
576
|
+
"version": 1
|
|
577
|
+
},
|
|
578
|
+
"userdoc": {
|
|
579
|
+
"events": {
|
|
580
|
+
"AnchorPriceUpdated(address,uint256,uint256,uint256)": {
|
|
581
|
+
"notice": "Emit this event when TWAP price is updated"
|
|
582
|
+
},
|
|
583
|
+
"TokenConfigAdded(address,address,uint256)": {
|
|
584
|
+
"notice": "Emit this event when new token configs are added"
|
|
585
|
+
},
|
|
586
|
+
"TwapWindowUpdated(address,uint256,uint256,uint256,uint256)": {
|
|
587
|
+
"notice": "Emit this event when TWAP window is updated"
|
|
588
|
+
}
|
|
589
|
+
},
|
|
590
|
+
"kind": "user",
|
|
591
|
+
"methods": {
|
|
592
|
+
"WBNB()": {
|
|
593
|
+
"notice": "WBNB address"
|
|
594
|
+
},
|
|
595
|
+
"bnbBaseUnit()": {
|
|
596
|
+
"notice": "the base unit of WBNB and BUSD, which are the paired tokens for all assets"
|
|
597
|
+
},
|
|
598
|
+
"currentCumulativePrice((address,uint256,address,bool,bool,uint256))": {
|
|
599
|
+
"notice": "Fetches the current token/WBNB and token/BUSD price accumulator from pancakeswap."
|
|
600
|
+
},
|
|
601
|
+
"getUnderlyingPrice(address)": {
|
|
602
|
+
"notice": "Get the underlying TWAP price of input vToken"
|
|
603
|
+
},
|
|
604
|
+
"newObservations(address)": {
|
|
605
|
+
"notice": "The current price observation of TWAP. With old and current observations we can calculate the TWAP between this range"
|
|
606
|
+
},
|
|
607
|
+
"oldObservations(address)": {
|
|
608
|
+
"notice": "The old price observation of TWAP"
|
|
609
|
+
},
|
|
610
|
+
"prices(address)": {
|
|
611
|
+
"notice": "Stored price by token"
|
|
612
|
+
},
|
|
613
|
+
"setTokenConfig((address,uint256,address,bool,bool,uint256))": {
|
|
614
|
+
"notice": "Add single token configs"
|
|
615
|
+
},
|
|
616
|
+
"setTokenConfigs((address,uint256,address,bool,bool,uint256)[])": {
|
|
617
|
+
"notice": "Add multiple token configs at the same time"
|
|
618
|
+
},
|
|
619
|
+
"tokenConfigs(address)": {
|
|
620
|
+
"notice": "Configs by token"
|
|
621
|
+
}
|
|
622
|
+
},
|
|
623
|
+
"version": 1
|
|
624
|
+
},
|
|
625
|
+
"storageLayout": {
|
|
626
|
+
"storage": [
|
|
627
|
+
{
|
|
628
|
+
"astId": 138,
|
|
629
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
630
|
+
"label": "_initialized",
|
|
631
|
+
"offset": 0,
|
|
632
|
+
"slot": "0",
|
|
633
|
+
"type": "t_uint8"
|
|
634
|
+
},
|
|
635
|
+
{
|
|
636
|
+
"astId": 141,
|
|
637
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
638
|
+
"label": "_initializing",
|
|
639
|
+
"offset": 1,
|
|
640
|
+
"slot": "0",
|
|
641
|
+
"type": "t_bool"
|
|
642
|
+
},
|
|
643
|
+
{
|
|
644
|
+
"astId": 693,
|
|
645
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
646
|
+
"label": "__gap",
|
|
647
|
+
"offset": 0,
|
|
648
|
+
"slot": "1",
|
|
649
|
+
"type": "t_array(t_uint256)50_storage"
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
"astId": 10,
|
|
653
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
654
|
+
"label": "_owner",
|
|
655
|
+
"offset": 0,
|
|
656
|
+
"slot": "51",
|
|
657
|
+
"type": "t_address"
|
|
658
|
+
},
|
|
659
|
+
{
|
|
660
|
+
"astId": 130,
|
|
661
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
662
|
+
"label": "__gap",
|
|
663
|
+
"offset": 0,
|
|
664
|
+
"slot": "52",
|
|
665
|
+
"type": "t_array(t_uint256)49_storage"
|
|
666
|
+
},
|
|
667
|
+
{
|
|
668
|
+
"astId": 6560,
|
|
669
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
670
|
+
"label": "WBNB",
|
|
671
|
+
"offset": 0,
|
|
672
|
+
"slot": "101",
|
|
673
|
+
"type": "t_address"
|
|
674
|
+
},
|
|
675
|
+
{
|
|
676
|
+
"astId": 6576,
|
|
677
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
678
|
+
"label": "tokenConfigs",
|
|
679
|
+
"offset": 0,
|
|
680
|
+
"slot": "102",
|
|
681
|
+
"type": "t_mapping(t_address,t_struct(TokenConfig)6551_storage)"
|
|
682
|
+
},
|
|
683
|
+
{
|
|
684
|
+
"astId": 6582,
|
|
685
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
686
|
+
"label": "newObservations",
|
|
687
|
+
"offset": 0,
|
|
688
|
+
"slot": "103",
|
|
689
|
+
"type": "t_mapping(t_address,t_struct(Observation)6532_storage)"
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
"astId": 6588,
|
|
693
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
694
|
+
"label": "oldObservations",
|
|
695
|
+
"offset": 0,
|
|
696
|
+
"slot": "104",
|
|
697
|
+
"type": "t_mapping(t_address,t_struct(Observation)6532_storage)"
|
|
698
|
+
},
|
|
699
|
+
{
|
|
700
|
+
"astId": 6593,
|
|
701
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
702
|
+
"label": "prices",
|
|
703
|
+
"offset": 0,
|
|
704
|
+
"slot": "105",
|
|
705
|
+
"type": "t_mapping(t_address,t_uint256)"
|
|
706
|
+
}
|
|
707
|
+
],
|
|
708
|
+
"types": {
|
|
709
|
+
"t_address": {
|
|
710
|
+
"encoding": "inplace",
|
|
711
|
+
"label": "address",
|
|
712
|
+
"numberOfBytes": "20"
|
|
713
|
+
},
|
|
714
|
+
"t_array(t_uint256)49_storage": {
|
|
715
|
+
"base": "t_uint256",
|
|
716
|
+
"encoding": "inplace",
|
|
717
|
+
"label": "uint256[49]",
|
|
718
|
+
"numberOfBytes": "1568"
|
|
719
|
+
},
|
|
720
|
+
"t_array(t_uint256)50_storage": {
|
|
721
|
+
"base": "t_uint256",
|
|
722
|
+
"encoding": "inplace",
|
|
723
|
+
"label": "uint256[50]",
|
|
724
|
+
"numberOfBytes": "1600"
|
|
725
|
+
},
|
|
726
|
+
"t_bool": {
|
|
727
|
+
"encoding": "inplace",
|
|
728
|
+
"label": "bool",
|
|
729
|
+
"numberOfBytes": "1"
|
|
730
|
+
},
|
|
731
|
+
"t_mapping(t_address,t_struct(Observation)6532_storage)": {
|
|
732
|
+
"encoding": "mapping",
|
|
733
|
+
"key": "t_address",
|
|
734
|
+
"label": "mapping(address => struct Observation)",
|
|
735
|
+
"numberOfBytes": "32",
|
|
736
|
+
"value": "t_struct(Observation)6532_storage"
|
|
737
|
+
},
|
|
738
|
+
"t_mapping(t_address,t_struct(TokenConfig)6551_storage)": {
|
|
739
|
+
"encoding": "mapping",
|
|
740
|
+
"key": "t_address",
|
|
741
|
+
"label": "mapping(address => struct TokenConfig)",
|
|
742
|
+
"numberOfBytes": "32",
|
|
743
|
+
"value": "t_struct(TokenConfig)6551_storage"
|
|
744
|
+
},
|
|
745
|
+
"t_mapping(t_address,t_uint256)": {
|
|
746
|
+
"encoding": "mapping",
|
|
747
|
+
"key": "t_address",
|
|
748
|
+
"label": "mapping(address => uint256)",
|
|
749
|
+
"numberOfBytes": "32",
|
|
750
|
+
"value": "t_uint256"
|
|
751
|
+
},
|
|
752
|
+
"t_struct(Observation)6532_storage": {
|
|
753
|
+
"encoding": "inplace",
|
|
754
|
+
"label": "struct Observation",
|
|
755
|
+
"members": [
|
|
756
|
+
{
|
|
757
|
+
"astId": 6529,
|
|
758
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
759
|
+
"label": "timestamp",
|
|
760
|
+
"offset": 0,
|
|
761
|
+
"slot": "0",
|
|
762
|
+
"type": "t_uint256"
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
"astId": 6531,
|
|
766
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
767
|
+
"label": "acc",
|
|
768
|
+
"offset": 0,
|
|
769
|
+
"slot": "1",
|
|
770
|
+
"type": "t_uint256"
|
|
771
|
+
}
|
|
772
|
+
],
|
|
773
|
+
"numberOfBytes": "64"
|
|
774
|
+
},
|
|
775
|
+
"t_struct(TokenConfig)6551_storage": {
|
|
776
|
+
"encoding": "inplace",
|
|
777
|
+
"label": "struct TokenConfig",
|
|
778
|
+
"members": [
|
|
779
|
+
{
|
|
780
|
+
"astId": 6535,
|
|
781
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
782
|
+
"label": "asset",
|
|
783
|
+
"offset": 0,
|
|
784
|
+
"slot": "0",
|
|
785
|
+
"type": "t_address"
|
|
786
|
+
},
|
|
787
|
+
{
|
|
788
|
+
"astId": 6538,
|
|
789
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
790
|
+
"label": "baseUnit",
|
|
791
|
+
"offset": 0,
|
|
792
|
+
"slot": "1",
|
|
793
|
+
"type": "t_uint256"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
"astId": 6541,
|
|
797
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
798
|
+
"label": "pancakePool",
|
|
799
|
+
"offset": 0,
|
|
800
|
+
"slot": "2",
|
|
801
|
+
"type": "t_address"
|
|
802
|
+
},
|
|
803
|
+
{
|
|
804
|
+
"astId": 6544,
|
|
805
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
806
|
+
"label": "isBnbBased",
|
|
807
|
+
"offset": 20,
|
|
808
|
+
"slot": "2",
|
|
809
|
+
"type": "t_bool"
|
|
810
|
+
},
|
|
811
|
+
{
|
|
812
|
+
"astId": 6547,
|
|
813
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
814
|
+
"label": "isReversedPool",
|
|
815
|
+
"offset": 21,
|
|
816
|
+
"slot": "2",
|
|
817
|
+
"type": "t_bool"
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
"astId": 6550,
|
|
821
|
+
"contract": "contracts/oracles/TwapOracle.sol:TwapOracle",
|
|
822
|
+
"label": "anchorPeriod",
|
|
823
|
+
"offset": 0,
|
|
824
|
+
"slot": "3",
|
|
825
|
+
"type": "t_uint256"
|
|
826
|
+
}
|
|
827
|
+
],
|
|
828
|
+
"numberOfBytes": "128"
|
|
829
|
+
},
|
|
830
|
+
"t_uint256": {
|
|
831
|
+
"encoding": "inplace",
|
|
832
|
+
"label": "uint256",
|
|
833
|
+
"numberOfBytes": "32"
|
|
834
|
+
},
|
|
835
|
+
"t_uint8": {
|
|
836
|
+
"encoding": "inplace",
|
|
837
|
+
"label": "uint8",
|
|
838
|
+
"numberOfBytes": "1"
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
}
|
|
842
|
+
}
|