@@ -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 ;
@@ -118,8 +119,12 @@ mod test {
118
119
let result = pyth_contract
119
120
. sender_and_value ( alice, update_fee)
120
121
. update_price_feeds ( update_data) ;
122
+
121
123
assert ! ( result. is_ok( ) ) ;
122
124
125
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
126
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
127
+
123
128
let price_result = pyth_contract
124
129
. sender ( alice)
125
130
. get_price_unsafe ( ban_usd_feed_id ( ) ) ;
@@ -169,11 +174,17 @@ mod test {
169
174
. update_price_feeds ( update_data1) ;
170
175
assert ! ( result1. is_ok( ) ) ;
171
176
177
+ assert_eq ! ( alice. balance( ) , update_fee2) ;
178
+ assert_eq ! ( pyth_contract. balance( ) , update_fee1) ;
179
+
172
180
let result2 = pyth_contract
173
181
. sender_and_value ( alice, update_fee2)
174
182
. update_price_feeds ( update_data2) ;
175
183
assert ! ( result2. is_ok( ) ) ;
176
184
185
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
186
+ assert_eq ! ( pyth_contract. balance( ) , update_fee1 + update_fee2) ;
187
+
177
188
let price_result = pyth_contract
178
189
. sender ( alice)
179
190
. get_price_unsafe ( ban_usd_feed_id ( ) ) ;
@@ -243,6 +254,9 @@ mod test {
243
254
. update_price_feeds ( update_data) ;
244
255
assert ! ( result. is_ok( ) ) ;
245
256
257
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
258
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
259
+
246
260
let price_result = pyth_contract
247
261
. sender ( alice)
248
262
. get_price_no_older_than ( btc_usd_feed_id ( ) , u64:: MAX ) ;
@@ -269,6 +283,9 @@ mod test {
269
283
. update_price_feeds ( update_data) ;
270
284
assert ! ( result. is_ok( ) ) ;
271
285
286
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
287
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
288
+
272
289
let price_result = pyth_contract
273
290
. sender ( alice)
274
291
. get_price_no_older_than ( btc_usd_feed_id ( ) , 1 ) ;
@@ -298,6 +315,9 @@ mod test {
298
315
. update_price_feeds ( update_data) ;
299
316
assert ! ( result. is_ok( ) ) ;
300
317
318
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
319
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
320
+
301
321
let first_price_result = pyth_contract
302
322
. sender ( alice)
303
323
. get_price_unsafe ( ban_usd_feed_id ( ) ) ;
@@ -339,6 +359,9 @@ mod test {
339
359
. update_price_feeds ( update_data) ;
340
360
assert ! ( result. is_ok( ) ) ;
341
361
362
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
363
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
364
+
342
365
assert ! ( pyth_contract
343
366
. sender( alice)
344
367
. price_feed_exists( ban_usd_feed_id( ) ) ) ;
@@ -380,6 +403,9 @@ mod test {
380
403
. sender_and_value ( alice, update_fee)
381
404
. update_price_feeds ( update_data) ;
382
405
406
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
407
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
408
+
383
409
assert ! ( result. is_ok( ) ) ;
384
410
385
411
let price_result = pyth_contract
@@ -407,6 +433,9 @@ mod test {
407
433
. sender_and_value ( alice, update_fee)
408
434
. update_price_feeds ( update_data) ;
409
435
436
+ assert_eq ! ( alice. balance( ) , U256 :: ZERO ) ;
437
+ assert_eq ! ( pyth_contract. balance( ) , update_fee) ;
438
+
410
439
assert ! ( result. is_ok( ) ) ;
411
440
412
441
let price_result1 = pyth_contract
0 commit comments