modify_position
Call v290 → current #3Adds or removes liquidity from an existing position and claims fees.
View calls on chainCall Workflow
This diagram shows the call execution flow: starting with modify_position, passing through validation
(signature, nonce, mortality, fee payment), then pre-dispatch checks, followed by dispatch which emits events: LiquidityModified and modifies storage: Positions, Ticks, CurrentLiquidity, TickIndexBitmapWords, and finally post-dispatch where ExtrinsicSuccess is emitted and fees are settled.
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
Click items to navigate. Pan and zoom to explore.
Used by: stakersdeveloperswallets
The Big Picture
Flexible position management: add, remove, or just harvest fees.
Use Cases
- Compound fees
- Partial exit
- Claim fees (delta=0)
From Chain Metadata
Modify a liquidity position. Parameters: origin: The origin of the transaction netuid: Subnet ID position_id: ID of the position to remove liquidity_delta: Liquidity to add (if positive) or remove (if negative) Emits `Event::LiquidityRemoved` on success
Input Parameters
| # | Name | Type | Description |
|---|---|---|---|
| 0 | hotkey | AccountId | Hot wallet address (active operations) (hex -> SS58) |
| 1 | netuid | u16 | Subnet/network identifier (0-65535) |
| 2 | position_id | PositionId | position_id (PositionId) |
| 3 | liquidity_delta | i64 | liquidity_delta (i64) |
Permissions
Origin
Unknown
Required Role
Permission data inferred from metadata. May be incomplete.
Requirements
- Position exists
- Sufficient balance if adding
- Sufficient liquidity if removing
Effects
Events Emitted
Storage Modified
Postconditions
- Position liquidity adjusted
- Fees claimed
Side Effects
- Emits LiquidityModified event
- Fees always claimed on modify
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 });
// Build modify_position call
const hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const netuid = 1;
const position_id = 0 as any /* PositionId */;
const liquidity_delta = 0;
const call = api.tx[stringCamelCase("Swap")][stringCamelCase("modify_position")](
hotkey,
netuid,
position_id,
liquidity_delta
);Runtime Info
View Source- Pallet Index
- 28
- Call Index
- 3
- First Version
- v290
- Current Version
- v393