@@ -267,6 +267,18 @@ async fn set_fee() {
267
267
} ] )
268
268
. await
269
269
. unwrap ( ) ;
270
+
271
+ // warp to first normal slot to easily calculate epochs
272
+ let epoch_schedule = context. context . lock ( ) . await . genesis_config ( ) . epoch_schedule ;
273
+ let first_normal_slot = epoch_schedule. first_normal_slot ;
274
+ let slots_per_epoch = epoch_schedule. slots_per_epoch ;
275
+ context
276
+ . context
277
+ . lock ( )
278
+ . await
279
+ . warp_to_slot ( first_normal_slot)
280
+ . unwrap ( ) ;
281
+
270
282
let token = context. token_context . unwrap ( ) . token ;
271
283
272
284
// set to something new, old fee not touched
@@ -315,9 +327,43 @@ async fn set_fee() {
315
327
) ;
316
328
assert_eq ! ( extension. older_transfer_fee, newer_transfer_fee) ;
317
329
318
- // warp forward one epoch, new fee becomes old fee during set
330
+ // warp forward one epoch, old fee still not touched when set
331
+ let new_transfer_fee_basis_points = 10 ;
332
+ let new_maximum_fee = 10 ;
333
+ context
334
+ . context
335
+ . lock ( )
336
+ . await
337
+ . warp_to_slot ( first_normal_slot + slots_per_epoch)
338
+ . unwrap ( ) ;
339
+ token
340
+ . set_transfer_fee (
341
+ & transfer_fee_config_authority,
342
+ new_transfer_fee_basis_points,
343
+ new_maximum_fee,
344
+ )
345
+ . await
346
+ . unwrap ( ) ;
347
+ let state = token. get_mint_info ( ) . await . unwrap ( ) ;
348
+ let extension = state. get_extension :: < TransferFeeConfig > ( ) . unwrap ( ) ;
349
+ assert_eq ! (
350
+ extension. newer_transfer_fee. transfer_fee_basis_points,
351
+ new_transfer_fee_basis_points. into( )
352
+ ) ;
353
+ assert_eq ! (
354
+ extension. newer_transfer_fee. maximum_fee,
355
+ new_maximum_fee. into( )
356
+ ) ;
357
+ assert_eq ! ( extension. older_transfer_fee, newer_transfer_fee) ;
358
+
359
+ // warp forward two epochs, old fee is replaced on set
319
360
let newer_transfer_fee = extension. newer_transfer_fee ;
320
- context. context . lock ( ) . await . warp_to_slot ( 10_000 ) . unwrap ( ) ;
361
+ context
362
+ . context
363
+ . lock ( )
364
+ . await
365
+ . warp_to_slot ( first_normal_slot + 3 * slots_per_epoch)
366
+ . unwrap ( ) ;
321
367
let new_transfer_fee_basis_points = MAX_FEE_BASIS_POINTS ;
322
368
let new_maximum_fee = u64:: MAX ;
323
369
token
0 commit comments