@@ -45,6 +45,7 @@ mod root;
4545mod serving;
4646mod staking;
4747mod swap;
48+ mod swap_hotkey;
4849mod uids;
4950mod utils;
5051mod weights;
@@ -272,7 +273,7 @@ pub mod pallet {
272273 }
273274
274275 #[ pallet:: storage]
275- pub ( super ) type SenateRequiredStakePercentage < T > =
276+ pub type SenateRequiredStakePercentage < T > =
276277 StorageValue < _ , u64 , ValueQuery , DefaultSenateRequiredStakePercentage < T > > ;
277278
278279 /// ============================
@@ -367,7 +368,7 @@ pub mod pallet {
367368 pub type TotalColdkeyStake < T : Config > =
368369 StorageMap < _ , Identity , T :: AccountId , u64 , ValueQuery , DefaultAccountTake < T > > ;
369370 #[ pallet:: storage]
370- /// MAP (hot, cold) --> stake | Returns a tuple (u64: stakes, u64: block_number)
371+ /// MAP (hot, cold) --> u64, u64) | Returns a tuple (u64: stakes, u64: block_number)
371372 pub type TotalHotkeyColdkeyStakesThisInterval < T : Config > = StorageDoubleMap <
372373 _ ,
373374 Identity ,
@@ -796,15 +797,15 @@ pub mod pallet {
796797 }
797798
798799 #[ pallet:: storage] // --- ITEM ( tx_rate_limit )
799- pub ( super ) type TxRateLimit < T > = StorageValue < _ , u64 , ValueQuery , DefaultTxRateLimit < T > > ;
800+ pub type TxRateLimit < T > = StorageValue < _ , u64 , ValueQuery , DefaultTxRateLimit < T > > ;
800801 #[ pallet:: storage] // --- ITEM ( tx_rate_limit )
801- pub ( super ) type TxDelegateTakeRateLimit < T > =
802+ pub type TxDelegateTakeRateLimit < T > =
802803 StorageValue < _ , u64 , ValueQuery , DefaultTxDelegateTakeRateLimit < T > > ;
803804 #[ pallet:: storage] // --- MAP ( key ) --> last_block
804805 pub type LastTxBlock < T : Config > =
805806 StorageMap < _ , Identity , T :: AccountId , u64 , ValueQuery , DefaultLastTxBlock < T > > ;
806807 #[ pallet:: storage] // --- MAP ( key ) --> last_block
807- pub ( super ) type LastTxBlockDelegateTake < T : Config > =
808+ pub type LastTxBlockDelegateTake < T : Config > =
808809 StorageMap < _ , Identity , T :: AccountId , u64 , ValueQuery , DefaultLastTxBlock < T > > ;
809810
810811 /// Default value for serving rate limit.
@@ -1084,41 +1085,39 @@ pub mod pallet {
10841085 StorageMap < _ , Identity , u16 , Vec < ( T :: AccountId , u64 , u64 ) > , OptionQuery > ;
10851086
10861087 #[ pallet:: storage] // --- DMAP ( netuid ) --> active
1087- pub ( super ) type Active < T : Config > =
1088+ pub type Active < T : Config > =
10881089 StorageMap < _ , Identity , u16 , Vec < bool > , ValueQuery , EmptyBoolVec < T > > ;
10891090 #[ pallet:: storage] // --- DMAP ( netuid ) --> rank
1090- pub ( super ) type Rank < T : Config > =
1091- StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1091+ pub type Rank < T : Config > = StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
10921092 #[ pallet:: storage] // --- DMAP ( netuid ) --> trust
1093- pub ( super ) type Trust < T : Config > =
1094- StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
1093+ pub type Trust < T : Config > = StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
10951094 #[ pallet:: storage] // --- DMAP ( netuid ) --> consensus
1096- pub ( super ) type Consensus < T : Config > =
1095+ pub type Consensus < T : Config > =
10971096 StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
10981097 #[ pallet:: storage] // --- DMAP ( netuid ) --> incentive
1099- pub ( super ) type Incentive < T : Config > =
1098+ pub type Incentive < T : Config > =
11001099 StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
11011100 #[ pallet:: storage] // --- DMAP ( netuid ) --> dividends
1102- pub ( super ) type Dividends < T : Config > =
1101+ pub type Dividends < T : Config > =
11031102 StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
11041103 #[ pallet:: storage] // --- DMAP ( netuid ) --> emission
1105- pub ( super ) type Emission < T : Config > =
1104+ pub type Emission < T : Config > =
11061105 StorageMap < _ , Identity , u16 , Vec < u64 > , ValueQuery , EmptyU64Vec < T > > ;
11071106 #[ pallet:: storage] // --- DMAP ( netuid ) --> last_update
1108- pub ( super ) type LastUpdate < T : Config > =
1107+ pub type LastUpdate < T : Config > =
11091108 StorageMap < _ , Identity , u16 , Vec < u64 > , ValueQuery , EmptyU64Vec < T > > ;
11101109 #[ pallet:: storage] // --- DMAP ( netuid ) --> validator_trust
1111- pub ( super ) type ValidatorTrust < T : Config > =
1110+ pub type ValidatorTrust < T : Config > =
11121111 StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
11131112 #[ pallet:: storage] // --- DMAP ( netuid ) --> pruning_scores
1114- pub ( super ) type PruningScores < T : Config > =
1113+ pub type PruningScores < T : Config > =
11151114 StorageMap < _ , Identity , u16 , Vec < u16 > , ValueQuery , EmptyU16Vec < T > > ;
11161115 #[ pallet:: storage] // --- DMAP ( netuid ) --> validator_permit
1117- pub ( super ) type ValidatorPermit < T : Config > =
1116+ pub type ValidatorPermit < T : Config > =
11181117 StorageMap < _ , Identity , u16 , Vec < bool > , ValueQuery , EmptyBoolVec < T > > ;
11191118
11201119 #[ pallet:: storage] // --- DMAP ( netuid, uid ) --> weights
1121- pub ( super ) type Weights < T : Config > = StorageDoubleMap <
1120+ pub type Weights < T : Config > = StorageDoubleMap <
11221121 _ ,
11231122 Identity ,
11241123 u16 ,
@@ -1129,7 +1128,7 @@ pub mod pallet {
11291128 DefaultWeights < T > ,
11301129 > ;
11311130 #[ pallet:: storage] // --- DMAP ( netuid, uid ) --> bonds
1132- pub ( super ) type Bonds < T : Config > = StorageDoubleMap <
1131+ pub type Bonds < T : Config > = StorageDoubleMap <
11331132 _ ,
11341133 Identity ,
11351134 u16 ,
@@ -2066,17 +2065,17 @@ pub mod pallet {
20662065 }
20672066
20682067 /// The extrinsic for user to change its hotkey
2069- /// #[pallet::call_index(70)]
2070- /// #[pallet::weight((Weight::from_parts(1_940_000_000, 0)
2071- /// .saturating_add(T::DbWeight::get().reads(272))
2072- /// .saturating_add(T::DbWeight::get().writes(527)), DispatchClass::Operational, Pays::No))]
2073- /// pub fn swap_hotkey(
2074- /// origin: OriginFor<T>,
2075- /// hotkey: T::AccountId,
2076- /// new_hotkey: T::AccountId,
2077- /// ) -> DispatchResultWithPostInfo {
2078- /// Self::do_swap_hotkey(origin, &hotkey, &new_hotkey)
2079- /// }
2068+ #[ pallet:: call_index( 70 ) ]
2069+ #[ pallet:: weight( ( Weight :: from_parts( 1_940_000_000 , 0 )
2070+ . saturating_add( T :: DbWeight :: get( ) . reads( 272 ) )
2071+ . saturating_add( T :: DbWeight :: get( ) . writes( 527 ) ) , DispatchClass :: Operational , Pays :: No ) ) ]
2072+ pub fn swap_hotkey (
2073+ origin : OriginFor < T > ,
2074+ hotkey : T :: AccountId ,
2075+ new_hotkey : T :: AccountId ,
2076+ ) -> DispatchResultWithPostInfo {
2077+ Self :: do_swap_hotkey ( origin, & hotkey, & new_hotkey)
2078+ }
20802079
20812080 /// The extrinsic for user to change the coldkey associated with their account.
20822081 ///
0 commit comments