@@ -8,6 +8,7 @@ mod test {
8
8
use motsu:: prelude:: * ;
9
9
use pythnet_sdk:: wire:: v1:: { AccumulatorUpdateData , Proof } ;
10
10
use std:: time:: Duration ;
11
+ use stylus_sdk:: types:: AddressVM ;
11
12
use wormhole_contract:: WormholeContract ;
12
13
13
14
const PYTHNET_CHAIN_ID : u16 = 26 ;
@@ -106,8 +107,12 @@ mod test {
106
107
let result = pyth_contract
107
108
. sender_and_value ( alice, update_fee)
108
109
. update_price_feeds ( update_data) ;
110
+
109
111
assert ! ( result. is_ok( ) ) ;
110
112
113
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
114
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
115
+
111
116
let price_result = pyth_contract
112
117
. sender ( alice)
113
118
. get_price_unsafe ( ban_usd_feed_id ( ) ) ;
@@ -157,11 +162,17 @@ mod test {
157
162
. update_price_feeds ( update_data1) ;
158
163
assert ! ( result1. is_ok( ) ) ;
159
164
165
+ assert_eq ! ( alice. balance( ) , update_fee2) ;
166
+ assert_eq ! ( pyth_contract. balance( ) , update_fee1) ;
167
+
160
168
let result2 = pyth_contract
161
169
. sender_and_value ( alice, update_fee2)
162
170
. update_price_feeds ( update_data2) ;
163
171
assert ! ( result2. is_ok( ) ) ;
164
172
173
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
174
+ assert_eq ! ( pyth_contract. balance( ) , update_fee1 + update_fee2) ;
175
+
165
176
let price_result = pyth_contract
166
177
. sender ( alice)
167
178
. get_price_unsafe ( ban_usd_feed_id ( ) ) ;
@@ -231,6 +242,9 @@ mod test {
231
242
. update_price_feeds ( update_data) ;
232
243
assert ! ( result. is_ok( ) ) ;
233
244
245
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
246
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
247
+
234
248
let price_result = pyth_contract
235
249
. sender ( alice)
236
250
. get_price_no_older_than ( btc_usd_feed_id ( ) , u64:: MAX ) ;
@@ -257,6 +271,9 @@ mod test {
257
271
. update_price_feeds ( update_data) ;
258
272
assert ! ( result. is_ok( ) ) ;
259
273
274
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
275
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
276
+
260
277
let price_result = pyth_contract
261
278
. sender ( alice)
262
279
. get_price_no_older_than ( btc_usd_feed_id ( ) , 1 ) ;
@@ -286,6 +303,9 @@ mod test {
286
303
. update_price_feeds ( update_data) ;
287
304
assert ! ( result. is_ok( ) ) ;
288
305
306
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
307
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
308
+
289
309
let first_price_result = pyth_contract
290
310
. sender ( alice)
291
311
. get_price_unsafe ( ban_usd_feed_id ( ) ) ;
@@ -327,6 +347,9 @@ mod test {
327
347
. update_price_feeds ( update_data) ;
328
348
assert ! ( result. is_ok( ) ) ;
329
349
350
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
351
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
352
+
330
353
assert ! ( pyth_contract
331
354
. sender( alice)
332
355
. price_feed_exists( ban_usd_feed_id( ) ) ) ;
@@ -368,6 +391,9 @@ mod test {
368
391
. sender_and_value ( alice, update_fee)
369
392
. update_price_feeds ( update_data) ;
370
393
394
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
395
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
396
+
371
397
assert ! ( result. is_ok( ) ) ;
372
398
373
399
let price_result = pyth_contract
@@ -395,6 +421,9 @@ mod test {
395
421
. sender_and_value ( alice, update_fee)
396
422
. update_price_feeds ( update_data) ;
397
423
424
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
425
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
426
+
398
427
assert ! ( result. is_ok( ) ) ;
399
428
400
429
let price_result1 = pyth_contract
0 commit comments