@@ -130,22 +130,17 @@ pub trait PriceAggregator:
130
130
self . require_not_paused ( ) ;
131
131
self . require_is_oracle ( ) ;
132
132
133
- let current_timestamp = self . blockchain ( ) . get_block_timestamp ( ) ;
134
- require ! (
135
- submission_timestamp <= current_timestamp,
136
- "Timestamp is from the future"
137
- ) ;
133
+ self . require_valid_submission_timestamp ( submission_timestamp) ;
138
134
139
135
self . check_decimals ( & from, & to, decimals) ;
140
136
141
- self . submit_unchecked ( from, to, submission_timestamp , price, decimals) ;
137
+ self . submit_unchecked ( from, to, price, decimals) ;
142
138
}
143
139
144
140
fn submit_unchecked (
145
141
& self ,
146
142
from : ManagedBuffer ,
147
143
to : ManagedBuffer ,
148
- submission_timestamp : u64 ,
149
144
price : BigUint ,
150
145
decimals : u8 ,
151
146
) {
@@ -206,7 +201,7 @@ pub trait PriceAggregator:
206
201
self . emit_discard_submission_event (
207
202
& token_pair,
208
203
round_id,
209
- submission_timestamp ,
204
+ current_timestamp ,
210
205
first_submission_timestamp,
211
206
has_caller_already_submitted,
212
207
) ;
@@ -220,7 +215,8 @@ pub trait PriceAggregator:
220
215
} ) ;
221
216
}
222
217
223
- fn require_valid_submission_timestamp ( & self , submission_timestamp : u64 , current_timestamp : u64 ) {
218
+ fn require_valid_submission_timestamp ( & self , submission_timestamp : u64 ) {
219
+ let current_timestamp = self . blockchain ( ) . get_block_timestamp ( ) ;
224
220
require ! (
225
221
submission_timestamp <= current_timestamp,
226
222
"Timestamp is from the future"
@@ -239,16 +235,15 @@ pub trait PriceAggregator:
239
235
self . require_not_paused ( ) ;
240
236
self . require_is_oracle ( ) ;
241
237
242
- let current_timestamp = self . blockchain ( ) . get_block_timestamp ( ) ;
243
238
for ( from, to, submission_timestamp, price, decimals) in submissions
244
239
. into_iter ( )
245
240
. map ( |submission| submission. into_tuple ( ) )
246
241
{
247
- self . require_valid_submission_timestamp ( submission_timestamp, current_timestamp ) ;
242
+ self . require_valid_submission_timestamp ( submission_timestamp) ;
248
243
249
244
self . check_decimals ( & from, & to, decimals) ;
250
245
251
- self . submit_unchecked ( from, to, submission_timestamp , price, decimals) ;
246
+ self . submit_unchecked ( from, to, price, decimals) ;
252
247
}
253
248
}
254
249
0 commit comments