Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pallets/subtensor/src/staking/stake_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@ impl<T: Config> Pallet<T> {
let protocol_tao_after = Self::get_protocol_tao(netuid);
// This should decrease as we are removing TAO from the protocol.
let protocol_tao_delta: TaoCurrency = protocol_tao.saturating_sub(protocol_tao_after);
// Use max to overstate the TAO flow from the protocol.
let tao_flow = protocol_tao_delta.max(swap_result.amount_paid_out.into());

// Refund the unused alpha (in case if limit price is hit)
let refund = actual_alpha_decrease.saturating_sub(
Expand Down Expand Up @@ -734,7 +736,7 @@ impl<T: Config> Pallet<T> {
// }

// Record TAO outflow
Self::record_tao_outflow(netuid, protocol_tao_delta);
Self::record_tao_outflow(netuid, tao_flow);

LastColdkeyHotkeyStakeBlock::<T>::insert(coldkey, hotkey, Self::get_current_block_as_u64());

Expand Down Expand Up @@ -784,6 +786,8 @@ impl<T: Config> Pallet<T> {

// This should increase as we are adding TAO to the protocol.
let protocol_tao_delta: TaoCurrency = protocol_tao_after.saturating_sub(protocol_tao);
// Use min to understate the TAO flow into the protocol.
let tao_flow = protocol_tao_delta.min(tao);

ensure!(
!swap_result.amount_paid_out.is_zero(),
Expand Down Expand Up @@ -820,7 +824,7 @@ impl<T: Config> Pallet<T> {
}

// Record TAO inflow
Self::record_tao_inflow(netuid, protocol_tao_delta);
Self::record_tao_inflow(netuid, tao_flow);

LastColdkeyHotkeyStakeBlock::<T>::insert(coldkey, hotkey, Self::get_current_block_as_u64());

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 346,
spec_version: 347,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
Loading