@@ -137,20 +137,19 @@ abstract contract Pyth is PythGetters, PythSetters, AbstractPyth {
137
137
priceId = encoded.toBytes32 (index + attestationIndex);
138
138
attestationIndex += 32 ;
139
139
140
- info.price.price = int64 (encoded.toUint64 (index + attestationIndex));
140
+ info.price = int64 (encoded.toUint64 (index + attestationIndex));
141
141
attestationIndex += 8 ;
142
142
143
- info.price. conf = encoded.toUint64 (index + attestationIndex);
143
+ info.conf = encoded.toUint64 (index + attestationIndex);
144
144
attestationIndex += 8 ;
145
145
146
- info.price.expo = int32 (encoded.toUint32 (index + attestationIndex));
147
- info.emaPrice.expo = info.price.expo;
146
+ info.expo = int32 (encoded.toUint32 (index + attestationIndex));
148
147
attestationIndex += 4 ;
149
148
150
- info.emaPrice.price = int64 (encoded.toUint64 (index + attestationIndex));
149
+ info.emaPrice = int64 (encoded.toUint64 (index + attestationIndex));
151
150
attestationIndex += 8 ;
152
151
153
- info.emaPrice.conf = encoded.toUint64 (index + attestationIndex);
152
+ info.emaConf = encoded.toUint64 (index + attestationIndex);
154
153
attestationIndex += 8 ;
155
154
156
155
{
@@ -171,8 +170,7 @@ abstract contract Pyth is PythGetters, PythSetters, AbstractPyth {
171
170
// Unused uint64 attestationTime
172
171
attestationIndex += 8 ;
173
172
174
- info.price.publishTime = encoded.toUint64 (index + attestationIndex);
175
- info.emaPrice.publishTime = info.price.publishTime;
173
+ info.publishTime = encoded.toUint64 (index + attestationIndex);
176
174
attestationIndex += 8 ;
177
175
178
176
if (status == 1 ) { // status == TRADING
@@ -182,20 +180,16 @@ abstract contract Pyth is PythGetters, PythSetters, AbstractPyth {
182
180
// the previous price info that are passed here.
183
181
184
182
// Previous publish time
185
- info.price. publishTime = encoded.toUint64 (index + attestationIndex);
183
+ info.publishTime = encoded.toUint64 (index + attestationIndex);
186
184
attestationIndex += 8 ;
187
185
188
186
// Previous price
189
- info.price.price = int64 (encoded.toUint64 (index + attestationIndex));
187
+ info.price = int64 (encoded.toUint64 (index + attestationIndex));
190
188
attestationIndex += 8 ;
191
189
192
190
// Previous confidence
193
- info.price. conf = encoded.toUint64 (index + attestationIndex);
191
+ info.conf = encoded.toUint64 (index + attestationIndex);
194
192
attestationIndex += 8 ;
195
-
196
- // The EMA is last updated when the aggregate had trading status,
197
- // so, we use previous publish time here too.
198
- info.emaPrice.publishTime = info.price.publishTime;
199
193
}
200
194
}
201
195
@@ -209,14 +203,14 @@ abstract contract Pyth is PythGetters, PythSetters, AbstractPyth {
209
203
uint64 latestPublishTime = latestPriceInfoPublishTime (priceId);
210
204
211
205
bool fresh = false ;
212
- if (info.price. publishTime > latestPublishTime) {
206
+ if (info.publishTime > latestPublishTime) {
213
207
freshPrices += 1 ;
214
208
fresh = true ;
215
209
setLatestPriceInfo (priceId, info);
216
210
}
217
211
218
212
emit PriceFeedUpdate (priceId, fresh, vm.emitterChainId, vm.sequence, latestPublishTime,
219
- info.price. publishTime, info.price.price , info.price .conf);
213
+ info.publishTime, info.price, info.conf);
220
214
}
221
215
222
216
@@ -227,18 +221,18 @@ abstract contract Pyth is PythGetters, PythSetters, AbstractPyth {
227
221
function queryPriceFeed (bytes32 id ) public view override returns (PythStructs.PriceFeed memory priceFeed ){
228
222
// Look up the latest price info for the given ID
229
223
PythInternalStructs.PriceInfo memory info = latestPriceInfo (id);
230
- require (info.price. publishTime != 0 , "price feed for the given id is not pushed or does not exist " );
224
+ require (info.publishTime != 0 , "price feed for the given id is not pushed or does not exist " );
231
225
232
226
priceFeed.id = id;
233
- priceFeed.price.price = info.price.price ;
234
- priceFeed.price.conf = info.price. conf;
235
- priceFeed.price.expo = info.price. expo;
236
- priceFeed.price.publishTime = uint (info.price. publishTime);
237
-
238
- priceFeed.emaPrice.price = info.emaPrice.price ;
239
- priceFeed.emaPrice.conf = info.emaPrice.conf ;
240
- priceFeed.emaPrice.expo = info.emaPrice. expo;
241
- priceFeed.emaPrice.publishTime = uint (info.emaPrice. publishTime);
227
+ priceFeed.price.price = info.price;
228
+ priceFeed.price.conf = info.conf;
229
+ priceFeed.price.expo = info.expo;
230
+ priceFeed.price.publishTime = uint (info.publishTime);
231
+
232
+ priceFeed.emaPrice.price = info.emaPrice;
233
+ priceFeed.emaPrice.conf = info.emaConf ;
234
+ priceFeed.emaPrice.expo = info.expo;
235
+ priceFeed.emaPrice.publishTime = uint (info.publishTime);
242
236
}
243
237
244
238
function priceFeedExists (bytes32 id ) public override view returns (bool ) {
0 commit comments