add_liquidity
Call v290 â current #1Adds liquidity to a subnet 's pool within a specified price range.
View calls on chainCall Workflow
This diagram shows the call execution flow: starting with add_liquidity, passing through validation
(signature, nonce, mortality, fee payment), then pre-dispatch checks, followed by dispatch which emits events: LiquidityAdded and modifies storage: Positions, LastPositionId, Ticks, CurrentLiquidity, 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: stakersdevelopersanalytics
The Big Picture
Users provide TAO/Alpha in price ranges to enable swaps and earn fees.
Use Cases
- Earn swap fees
- Provide concentrated liquidity
From Chain Metadata
Add liquidity to a specific price range for a subnet. Parameters: origin: The origin of the transaction netuid: Subnet ID tick_low: Lower bound of the price range tick_high: Upper bound of the price range liquidity: Amount of liquidity to add Emits `Event::LiquidityAdded` on success
Input Parameters
Permissions
Origin
Unknown
Required Role
Permission data inferred from metadata. May be incomplete.
Requirements
- V3 mode enabled
- Sufficient TAO/Alpha balance
- Valid tick range
- Liquidity >= MinimumLiquidity
Effects
Events Emitted
Storage Modified
Postconditions
- Position created
- Balances decreased
- Pool liquidity increased
Side Effects
- Emits LiquidityAdded event
- Updates tick state
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 add_liquidity call
const hotkey = "5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY";
const netuid = 1;
const tick_low = 0 as any /* TickIndex */;
const tick_high = 0 as any /* TickIndex */;
const liquidity = 1_000_000_000n;
const call = api.tx[stringCamelCase("Swap")][stringCamelCase("add_liquidity")](
hotkey,
netuid,
tick_low,
tick_high,
liquidity
);On-Chain Activity
Usage Frequency
ââââââ Moderate 10Kâ100K extrinsics
Occasional use
#42 most used call
Success Rate Reliable
80â95% of submissions succeed
As of block 7,429,232
Runtime Info
View Source- Pallet Index
- 28
- Call Index
- 1
- First Version
- v290
- Current Version
- v393