BasketTradingEnabled

Storage Plain v464 → current

Master switch for validator basket trading (swap_basket).

Explore chain
Queried by: validatorsdeveloperswallets

The Big Picture

The first gate in do_swap_basket (staking/basket_trade.rs at v467).

Why This Matters

When false, every swap_basket fails with BasketTradingDisabled regardless of the trade.

Example Scenario

A wallet reads false and hides the rebalance button; it subscribes to BasketTradingToggled to reveal it.

Use Cases

  • Show or hide the trade action
  • Record when basket trading first opened

From Chain Metadata

Master switch for `swap_basket` (validator-directed basket rebalancing). Defaults to OFF. Flipped on via `AdminUtils::sudo_set_basket_trading_enabled`. Gates only the trade path: deposits, claims, dividend accrual, and all read paths are unaffected.

Purpose & Usage

Purpose

Gates the trade path only. Deposits, claims, dividend accrual and reads are unaffected.

Common Query Patterns

  • Query before offering swap_basket in tooling

Notes

  • First appears at runtime v464. Defaults to false, so trading shipped closed.
  • Written only by sudo_set_basket_trading_enabled; the change emits BasketTradingToggled.

Stored Value

value (bool)

Default Value

false 0x00

Absent keys read as this value — querying a key that has never been written returns this default, not an error or empty result.

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Query BasketTradingEnabled storage (no keys - plain value)
const result = await api.query.SubtensorModule.BasketTradingEnabled.getValue();
console.log("BasketTradingEnabled:", result);

Runtime Info

View Source
Pallet
SubtensorModule
Storage Kind
Plain
First Version
v464
Current Version
v472