@@ -2,7 +2,7 @@ use frame_benchmarking::v2::*;
22use frame_support:: {
33 pallet_prelude:: * ,
44 sp_runtime:: traits:: { IdentifyAccount , StaticLookup , Verify } ,
5- traits:: { Currency , VestedTransfer } ,
5+ traits:: Currency ,
66} ;
77use frame_system:: RawOrigin ;
88use sp_std:: prelude:: * ;
@@ -24,10 +24,9 @@ mod benches {
2424
2525 // helper inside the benchmark module so `T` is injected by the macro
2626 fn mint_to < T : Config > ( who : & T :: AccountId , amount : BalanceFor < T > ) {
27- let _ = <<< T as crate :: Config > :: VestedTransferer as VestedTransfer < T :: AccountId > > :: Currency as Currency < T :: AccountId > >:: deposit_into_existing ( who, amount) ;
27+ let _ = <T :: Currency as Currency < T :: AccountId > >:: deposit_into_existing ( who, amount) ;
2828 }
2929
30- /// convert
3130 #[ benchmark]
3231 fn claim ( ) -> Result < ( ) , BenchmarkError > {
3332 let caller: T :: AccountId = account ( "origin" , 0 , 0 ) ;
@@ -38,10 +37,34 @@ mod benches {
3837 let amount: BalanceFor < T > = 100_000_000_000_000u128 . into ( ) ;
3938 let proof = ClaimProofFor :: < T > :: new ( amount, T :: BenchmarkHelper :: dummy_signature ( ) ) ;
4039
41- // measured extrinsic call — **bare** call expression, first arg must be origin
4240 #[ extrinsic_call]
4341 _ ( RawOrigin :: Signed ( caller. clone ( ) ) , proof, caller. clone ( ) . into ( ) . into ( ) ) ;
4442
4543 Ok ( ( ) )
4644 }
45+
46+ #[ benchmark]
47+ fn vest ( ) -> Result < ( ) , BenchmarkError > {
48+ let caller: T :: AccountId = account ( "origin" , 0 , 0 ) ;
49+ let initial_funds: BalanceFor < T > = 1_000_000_000_000_000u128 . into ( ) ;
50+
51+ mint_to :: < T > ( & T :: Funder :: get ( ) , initial_funds) ;
52+
53+ // First create a claim to set up vesting
54+ let amount: BalanceFor < T > = 100_000_000_000_000u128 . into ( ) ;
55+ let proof = ClaimProofFor :: < T > :: new ( amount, T :: BenchmarkHelper :: dummy_signature ( ) ) ;
56+ Pallet :: < T > :: claim (
57+ RawOrigin :: Signed ( caller. clone ( ) ) . into ( ) ,
58+ proof,
59+ caller. clone ( ) . into ( ) . into ( ) ,
60+ ) ?;
61+
62+ // Move forward in time to have something to vest
63+ frame_system:: Pallet :: < T > :: set_block_number ( 1000u32 . into ( ) ) ;
64+
65+ #[ extrinsic_call]
66+ _ ( RawOrigin :: Signed ( caller. clone ( ) ) , None , None ) ;
67+
68+ Ok ( ( ) )
69+ }
4770}
0 commit comments