Skip to content

Commit 5ceba80

Browse files
committed
add origin/dest hk and ck
1 parent 72127ea commit 5ceba80

File tree

3 files changed

+9
-7
lines changed

3 files changed

+9
-7
lines changed

pallets/subtensor/runtime-api/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ sp_api::decl_runtime_apis! {
4646
fn get_stake_info_for_coldkey( coldkey_account: AccountId32 ) -> Vec<StakeInfo<AccountId32>>;
4747
fn get_stake_info_for_coldkeys( coldkey_accounts: Vec<AccountId32> ) -> Vec<(AccountId32, Vec<StakeInfo<AccountId32>>)>;
4848
fn get_stake_info_for_hotkey_coldkey_netuid( hotkey_account: AccountId32, coldkey_account: AccountId32, netuid: u16 ) -> Option<StakeInfo<AccountId32>>;
49-
fn get_stake_fee_for_hotkey_coldkey_netuid( hotkey_account: AccountId32, coldkey_account: AccountId32, origin_netuid: u16, destination_netuid: u16, amount: i64 ) -> u64;
49+
fn get_stake_fee( origin_hotkey_account: AccountId32, origin_coldkey_account: AccountId32, destination_hotkey_account: AccountId32, destination_coldkey_account: AccountId32, origin_netuid: Option<u16>, destination_netuid: Option<u16>, amount: i64 ) -> u64;
5050
}
5151

5252
pub trait SubnetRegistrationRuntimeApi {

pallets/subtensor/src/rpc_info/stake_info.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,11 @@ impl<T: Config> Pallet<T> {
115115
})
116116
}
117117

118-
pub fn get_stake_fee_for_hotkey_coldkey_netuid(
119-
hotkey_account: T::AccountId,
120-
_coldkey_account: T::AccountId,
118+
pub fn get_stake_fee(
119+
origin_hotkey_account: T::AccountId,
120+
_origin_coldkey_account: T::AccountId,
121+
_destination_hotkey_account: T::AccountId,
122+
_destination_coldkey_account: T::AccountId,
121123
origin_netuid: Option<u16>,
122124
_destination_netuid: Option<u16>,
123125
amount: i64,
@@ -129,7 +131,7 @@ impl<T: Config> Pallet<T> {
129131
// Calculate fee for unstake (negative amount)
130132
Self::calculate_staking_fee(
131133
origin_netuid.unwrap_or(Self::get_root_netuid()),
132-
&hotkey_account,
134+
&origin_hotkey_account,
133135
I96F32::saturating_from_num(amount.neg()),
134136
)
135137
}

runtime/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2067,8 +2067,8 @@ impl_runtime_apis! {
20672067
SubtensorModule::get_stake_info_for_hotkey_coldkey_netuid( hotkey_account, coldkey_account, netuid )
20682068
}
20692069

2070-
fn get_stake_fee_for_hotkey_coldkey_netuid( hotkey_account: AccountId32, coldkey_account: AccountId32, origin_netuid: Option<u16>, destination_netuid: Option<u16>, amount: i64 ) -> u64 {
2071-
SubtensorModule::get_stake_fee_for_hotkey_coldkey_netuid( hotkey_account, coldkey_account, origin_netuid, destination_netuid, amount )
2070+
fn get_stake_fee( origin_hotkey_account: AccountId32, origin_coldkey_account: AccountId32, destination_hotkey_account: AccountId32, destination_coldkey_account: AccountId32, origin_netuid: Option<u16>, destination_netuid: Option<u16>, amount: i64 ) -> u64 {
2071+
SubtensorModule::get_stake_fee( origin_hotkey_account, origin_coldkey_account, destination_hotkey_account, destination_coldkey_account, origin_netuid, destination_netuid, amount )
20722072
}
20732073
}
20742074

0 commit comments

Comments
 (0)