Queried by: stakersdeveloperswallets
The Big Picture
Each position has tick range and liquidity. Multiple positions per user allowed.
Use Cases
- Display LP positions
- Calculate position value
From Chain Metadata
Storage for user positions, using subnet ID and account ID as keys The value is a bounded vector of Position structs with details about the liquidity positions
Purpose & Usage
Purpose
Stores all LP positions per user per subnet.
Common Query Patterns
- Query by (netuid, account, position_id)
- Iterate by account
Query Keys
| # | Name | Type | Description |
|---|---|---|---|
| 1 | key1 | u16 | key1 (u16) |
| 2 | key2 | AccountId | key2 (AccountId) (hex -> SS58) |
| 3 | key3 | PositionId | key3 (PositionId) |
Stored Value
value (Position)
Relationships
Modified By
Related Events
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 Positions storage
const key1 = 0;
const key2 = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const key3 = 0 as any /* PositionId */;
const result = await api.query
[stringCamelCase("Swap")]
[stringCamelCase("Positions")](
key1,
key2,
key3
);
console.log("Positions:", result.toHuman());On-Chain Activity
Write Frequency
●●●○○○ Low 10K–100K est. writes
10K–100K estimated writes
#48 most written storage item
Write Source User Extrinsics
Modified via user-submitted extrinsics
As of block 7,429,232
Runtime Info
View Source- Pallet
- Swap
- Storage Kind
- Map
- First Version
- v290
- Current Version
- v393