BasketTradeBucket
Storage Map v464 → currentPer-fund swap_basket turnover bucket: TAO available and the block it was last refilled.
Explore chainThe Big Picture
The state behind BasketTurnoverBudgetExceeded.
Why This Matters
This is how much a fund may still move today.
Example Scenario
(3 TAO, block N) with a 100 TAO budget: 100 blocks later the bucket holds about 4.4 TAO.
Use Cases
- Size the next trade
- Reconstruct turnover use from BasketSwapped events
From Chain Metadata
MAP ( validator_hotkey ) --> `(tao_available, last_refill_block)` of the fund's `swap_basket` turnover bucket. A missing row is a full bucket (a new fund starts full). On each trade the bucket is refilled for the blocks elapsed since `last_refill_block` at `budget / BASKET_TRADE_REFILL_BLOCKS` per block, clamped to one budget (NAV at that moment), then the TAO through the middle of the swap is taken out. Follows the fund on hotkey swap (lower level, later refill block).
Purpose & Usage
Purpose
Meters the TAO through the middle of each trade against BasketDailyTurnoverCap of NAV.
Common Query Patterns
- Query by validator hotkey to see current allowance and project the refill
- A missing row is a full bucket
Notes
- First appears at runtime v464.
- Value is (tao_available, last_refill_block) in rao and block number.
- On each trade the bucket is refilled for the blocks since last_refill_block at budget / 7200 per block, clamped to one budget (NAV at that moment), then debited by tao_mid (staking/basket_trade.rs consume_basket_trade_budget at v467).
- Written only by trades; there is no per-block refill write.
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | validator_hotkey | AccountId [u8; 32] | validator_hotkey (AccountId, hashed key component) (hex -> SS58) |
Stored Value
`(tao_available, ((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 BasketTradeBucket storage
const validator_hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const result = await api.query.SubtensorModule.BasketTradeBucket.getValue(validator_hotkey);
console.log("BasketTradeBucket:", result);Runtime Info
View Source- Pallet
- SubtensorModule
- Storage Kind
- Map
- First Version
- v464
- Current Version
- v472