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
18 changes: 10 additions & 8 deletions pallets/swap/src/pallet/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -880,10 +880,12 @@ impl<T: Config> Pallet<T> {
// ---------------- USER: refund τ and convert α → stake ----------------

// 1) Refund τ principal directly.
if rm.tao > TaoCurrency::ZERO {
T::BalanceOps::increase_balance(&owner, rm.tao);
user_refunded_tao = user_refunded_tao.saturating_add(rm.tao);
T::TaoReserve::decrease_provided(netuid, rm.tao);
let tao_total_from_pool: TaoCurrency = rm.tao.saturating_add(rm.fee_tao);
if tao_total_from_pool > TaoCurrency::ZERO {
T::BalanceOps::increase_balance(&owner, tao_total_from_pool);
user_refunded_tao =
user_refunded_tao.saturating_add(tao_total_from_pool);
T::TaoReserve::decrease_provided(netuid, tao_total_from_pool);
}

// 2) Stake ALL withdrawn α (principal + fees) to the best permitted validator.
Expand Down Expand Up @@ -967,17 +969,17 @@ impl<T: Config> Pallet<T> {
Ok(rm) => {
let alpha_total_from_pool: AlphaCurrency =
rm.alpha.saturating_add(rm.fee_alpha);
let tao = rm.tao;
let tao_total_from_pool: TaoCurrency = rm.tao.saturating_add(rm.fee_tao);

if tao > TaoCurrency::ZERO {
burned_tao = burned_tao.saturating_add(tao);
if tao_total_from_pool > TaoCurrency::ZERO {
burned_tao = burned_tao.saturating_add(tao_total_from_pool);
}
if alpha_total_from_pool > AlphaCurrency::ZERO {
burned_alpha = burned_alpha.saturating_add(alpha_total_from_pool);
}

log::debug!(
"clear_protocol_liquidity: burned protocol pos: netuid={netuid:?}, pos_id={pos_id:?}, τ={tao:?}, α_total={alpha_total_from_pool:?}"
"clear_protocol_liquidity: burned protocol pos: netuid={netuid:?}, pos_id={pos_id:?}, τ={tao_total_from_pool:?}, α_total={alpha_total_from_pool:?}"
);
}
Err(e) => {
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: 350,
spec_version: 351,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down
Loading