@@ -2435,5 +2435,85 @@ mod dispatches {
2435
2435
allow_partial,
2436
2436
)
2437
2437
}
2438
+
2439
+ /// move_stake with EVM origin
2440
+ #[ pallet:: call_index( 127 ) ]
2441
+ #[ pallet:: weight( ( Weight :: from_parts( 157_100_000 , 0 )
2442
+ . saturating_add( T :: DbWeight :: get( ) . reads( 15_u64 ) )
2443
+ . saturating_add( T :: DbWeight :: get( ) . writes( 7_u64 ) ) , DispatchClass :: Operational , Pays :: Yes ) ) ]
2444
+ pub fn move_stake_evm (
2445
+ origin : OriginFor < T > ,
2446
+ origin_hotkey : T :: AccountId ,
2447
+ destination_hotkey : T :: AccountId ,
2448
+ origin_netuid : NetUid ,
2449
+ destination_netuid : NetUid ,
2450
+ alpha_amount : AlphaCurrency ,
2451
+ ) -> DispatchResult {
2452
+ let account_id = crate :: ensure_evm_origin ( <T as Config >:: RuntimeOrigin :: from ( origin) ) ?;
2453
+ let verified_evm_origin = RawOrigin :: Signed ( account_id) ;
2454
+
2455
+ Self :: do_move_stake (
2456
+ verified_evm_origin. into ( ) ,
2457
+ origin_hotkey,
2458
+ destination_hotkey,
2459
+ origin_netuid,
2460
+ destination_netuid,
2461
+ alpha_amount,
2462
+ )
2463
+ }
2464
+
2465
+ /// transfer_stake with EVM origin
2466
+ #[ pallet:: call_index( 128 ) ]
2467
+ #[ pallet:: weight( ( Weight :: from_parts( 154_800_000 , 0 )
2468
+ . saturating_add( T :: DbWeight :: get( ) . reads( 13_u64 ) )
2469
+ . saturating_add( T :: DbWeight :: get( ) . writes( 6_u64 ) ) , DispatchClass :: Operational , Pays :: Yes ) ) ]
2470
+ pub fn transfer_stake_evm (
2471
+ origin : OriginFor < T > ,
2472
+ destination_coldkey : T :: AccountId ,
2473
+ hotkey : T :: AccountId ,
2474
+ origin_netuid : NetUid ,
2475
+ destination_netuid : NetUid ,
2476
+ alpha_amount : AlphaCurrency ,
2477
+ ) -> DispatchResult {
2478
+ let account_id = crate :: ensure_evm_origin ( <T as Config >:: RuntimeOrigin :: from ( origin) ) ?;
2479
+ let verified_evm_origin = RawOrigin :: Signed ( account_id) ;
2480
+
2481
+ Self :: do_transfer_stake (
2482
+ verified_evm_origin. into ( ) ,
2483
+ destination_coldkey,
2484
+ hotkey,
2485
+ origin_netuid,
2486
+ destination_netuid,
2487
+ alpha_amount,
2488
+ )
2489
+ }
2490
+
2491
+ /// swap_stake with EVM origin
2492
+ #[ pallet:: call_index( 129 ) ]
2493
+ #[ pallet:: weight( (
2494
+ Weight :: from_parts( 351_300_000 , 0 )
2495
+ . saturating_add( T :: DbWeight :: get( ) . reads( 32 ) )
2496
+ . saturating_add( T :: DbWeight :: get( ) . writes( 17 ) ) ,
2497
+ DispatchClass :: Operational ,
2498
+ Pays :: Yes
2499
+ ) ) ]
2500
+ pub fn swap_stake (
2501
+ origin : OriginFor < T > ,
2502
+ hotkey : T :: AccountId ,
2503
+ origin_netuid : NetUid ,
2504
+ destination_netuid : NetUid ,
2505
+ alpha_amount : AlphaCurrency ,
2506
+ ) -> DispatchResult {
2507
+ let account_id = crate :: ensure_evm_origin ( <T as Config >:: RuntimeOrigin :: from ( origin) ) ?;
2508
+ let verified_evm_origin = RawOrigin :: Signed ( account_id) ;
2509
+
2510
+ Self :: do_swap_stake (
2511
+ verified_evm_origin. into ( ) ,
2512
+ hotkey,
2513
+ origin_netuid,
2514
+ destination_netuid,
2515
+ alpha_amount,
2516
+ )
2517
+ }
2438
2518
}
2439
2519
}
0 commit comments