AlphaSqrtPrice

Storage Map v290 → current

Current sqrt price of Alpha per subnet .

Explore chain
Queried by: developersanalyticswallets

The Big Picture

sqrt(price) format enables efficient tick math.

Use Cases

  • Calculate swap outputs
  • Display current price

From Chain Metadata

Storage for the square root price of Alpha token for each subnet.

Purpose & Usage

Purpose

Core price state for concentrated liquidity.

Common Query Patterns

  • Query by netuid
Part of: Concentrated Liquidity

Query Keys

#NameTypeDescription
1
key1
u16 key1 (u16)

Stored Value

value (FixedU128)

Code Examples

import { ApiPromise, WsProvider } from "@polkadot/api";
import { stringCamelCase } from "@polkadot/util";

const provider = new WsProvider("wss://entrypoint-finney.opentensor.ai:443");
const api = await ApiPromise.create({ provider });

// Query AlphaSqrtPrice storage
const key1 = 0;

const result = await api.query
  [stringCamelCase("Swap")]
  [stringCamelCase("AlphaSqrtPrice")](
  key1
);

console.log("AlphaSqrtPrice:", result.toHuman());

Runtime Info

View Source
Pallet
Swap
Storage Kind
Map
First Version
v290
Current Version
v393