Skip to content

Commit 2dfdf37

Browse files
committed
use new args
1 parent ad43ed6 commit 2dfdf37

File tree

1 file changed

+23
-14
lines changed

1 file changed

+23
-14
lines changed

pallets/subtensor/src/rpc_info/stake_info.rs

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,21 +116,30 @@ impl<T: Config> Pallet<T> {
116116

117117
pub fn get_stake_fee(
118118
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,
122122
amount: u64,
123123
) -> 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+
)
135144
}
136145
}

0 commit comments

Comments
 (0)