@@ -116,21 +116,30 @@ impl<T: Config> Pallet<T> {
116
116
117
117
pub fn get_stake_fee (
118
118
origin : Option < ( T :: AccountId , u16 ) > ,
119
- _origin_coldkey_account : T :: AccountId ,
120
- _destination : Option < ( T :: AccountId , u16 ) > ,
121
- _destination_coldkey_account : T :: AccountId ,
119
+ origin_coldkey_account : T :: AccountId ,
120
+ destination : Option < ( T :: AccountId , u16 ) > ,
121
+ destination_coldkey_account : T :: AccountId ,
122
122
amount : u64 ,
123
123
) -> u64 {
124
- match origin {
125
- Some ( ( origin_hotkey_account, origin_netuid) ) => Self :: calculate_staking_fee (
126
- origin_netuid,
127
- & origin_hotkey_account,
128
- I96F32 :: saturating_from_num ( amount) ,
129
- ) ,
130
- None => {
131
- // Adding stake (comes from no netuid)
132
- DefaultStakingFee :: < T > :: get ( )
133
- }
134
- }
124
+ let origin_: Option < ( & T :: AccountId , u16 ) > =
125
+ if let Some ( ( ref origin_hotkey, origin_netuid) ) = origin {
126
+ Some ( ( origin_hotkey, origin_netuid) )
127
+ } else {
128
+ None
129
+ } ;
130
+
131
+ let destination_ = if let Some ( ( ref destination_hotkey, destination_netuid) ) = destination {
132
+ Some ( ( destination_hotkey, destination_netuid) )
133
+ } else {
134
+ None
135
+ } ;
136
+
137
+ Self :: calculate_staking_fee (
138
+ origin_,
139
+ & origin_coldkey_account,
140
+ destination_,
141
+ & destination_coldkey_account,
142
+ I96F32 :: saturating_from_num ( amount) ,
143
+ )
135
144
}
136
145
}
0 commit comments