BasketLiquidityUsed
Storage Map v466 → currentAlpha a fund bought into a subnet within the current refill window, decaying to zero.
Explore chainThe Big Picture
Added two runtimes after basket trading to close a gap the standing-position check left open.
Why This Matters
Selling a holding back does not restore the allowance to buy it again straight away.
Example Scenario
A fund buys 8,000 alpha of subnet 7 and sells it all. For the next 7200 blocks its buy allowance on subnet 7 is reduced by a decaying share of 8,000.
Use Cases
- Explain BasketLiquidityCapExceeded on a pool the fund no longer holds
- Measure buy pressure a fund put on a pool
From Chain Metadata
MAP ( validator_hotkey, netuid ) --> `(alpha_bought, last_block)` of destination-pool flow used by `swap_basket` in the current refill window. The standing-position liquidity cap resets when the fund sells the holding back to zero. This map does not: it accumulates alpha bought into `netuid` and decays to zero over [`crate::BASKET_TRADE_REFILL_BLOCKS`], so accumulate/unwind cycles cannot spend the turnover budget as band slack. Follows the fund on hotkey swap (higher used, later block).
Purpose & Usage
Purpose
Keeps accumulate-and-unwind cycles from spending BasketLiquidityCap repeatedly: the standing cap resets when a holding is sold to zero, this counter does not.
Common Query Patterns
- Query (validator_hotkey, netuid) before sizing a buy into a pool the fund recently bought
Notes
- First appears at runtime v466.
- Value is (alpha_bought, last_block). The effective used amount decays linearly to zero over 7200 blocks from last_block (staking/basket_trade.rs basket_liquidity_used_at at v467).
- Credited on every swap_basket buy into the subnet; checked against BasketLiquidityCap of SubnetAlphaIn.
Query Keys
Stored Value
`(alpha_bought, ((u64, u64))
Default Value
Optional storage: querying a key that has never been written returns no value (None) — do not assume a zero default.
Relationships
Modified By
Related Events
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 BasketLiquidityUsed storage
const validator_hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const netuid = 1;
const result = await api.query.SubtensorModule.BasketLiquidityUsed.getValue(validator_hotkey, netuid);
console.log("BasketLiquidityUsed:", result);Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v466
- Current Version
- v472