add_liquidity

Call v290 → current #1

Adds liquidity to a subnet 's pool within a specified price range.

View calls on chain

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

Part of: Concentrated Liquidity

Input Parameters

#NameTypeDescription
0
hotkey
AccountId Hot wallet address (active operations) (hex -> SS58)
1
netuid
u16 Subnet/network identifier (0-65535)
2
tick_low
TickIndex tick_low (TickIndex) (price = 1.0001^tick)
3
tick_high
TickIndex tick_high (TickIndex) (price = 1.0001^tick)
4
liquidity
u64 liquidity (u64)

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

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