File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -659,6 +659,40 @@ fn unstake_all_alpha_success_moves_stake_to_root() {
659659 } ) ;
660660}
661661
662+ #[ test]
663+ fn add_proxy_success_creates_proxy_relationship ( ) {
664+ mock:: new_test_ext ( 1 ) . execute_with ( || {
665+ let delegator = U256 :: from ( 6001 ) ;
666+ let delegate = U256 :: from ( 6002 ) ;
667+
668+ pallet_subtensor:: Pallet :: < mock:: Test > :: add_balance_to_coldkey_account (
669+ & delegator,
670+ 1_000_000_000 ,
671+ ) ;
672+
673+ assert_eq ! (
674+ pallet_subtensor_proxy:: Proxies :: <mock:: Test >:: get( delegator)
675+ . 0
676+ . len( ) ,
677+ 0
678+ ) ;
679+
680+ let mut env = MockEnv :: new ( FunctionId :: AddProxyV1 , delegator, delegate. encode ( ) ) ;
681+
682+ let ret = SubtensorChainExtension :: < mock:: Test > :: dispatch ( & mut env) . unwrap ( ) ;
683+ assert_success ( ret) ;
684+
685+ let proxies = pallet_subtensor_proxy:: Proxies :: < mock:: Test > :: get ( delegator) . 0 ;
686+ assert_eq ! ( proxies. len( ) , 1 ) ;
687+ assert_eq ! ( proxies[ 0 ] . delegate, delegate) ;
688+ assert_eq ! (
689+ proxies[ 0 ] . proxy_type,
690+ subtensor_runtime_common:: ProxyType :: Staking
691+ ) ;
692+ assert_eq ! ( proxies[ 0 ] . delay, 0u64 ) ;
693+ } ) ;
694+ }
695+
662696impl MockEnv {
663697 fn new ( func_id : FunctionId , caller : AccountId , input : Vec < u8 > ) -> Self {
664698 Self {
You can’t perform that action at this time.
0 commit comments