toggle_user_liquidity

Call v290 → current #4

Enables or disables user liquidity operations for a subnet .

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: subnet ownersdevelopersstakers

The Big Picture

Controls transition between V2 and V3 concentrated liquidity modes.

Use Cases

  • Upgrade from V2 to V3 swap mode
  • Pause LP additions

From Chain Metadata

Enable user liquidity operations for a specific subnet. This switches the subnet from V2 to V3 swap mode. Thereafter, adding new user liquidity can be disabled by toggling this flag to false, but the swap mode will remain V3 because of existing user liquidity until all users withdraw their liquidity. Only sudo or subnet owner can enable user liquidity. Only sudo can disable user liquidity.

Part of: Concentrated Liquidity

Input Parameters

#NameTypeDescription
0
netuid
u16 Subnet/network identifier (0-65535)
1
enable
bool enable (bool)

Permissions

Origin
Unknown
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Caller is sudo or subnet owner
  • Subnet exists with subtoken enabled

Effects

Events Emitted

Storage Modified

Postconditions

  • EnabledUserLiquidity updated
  • If first enable: V3 swap mode active

Side Effects

  • Emits UserLiquidityToggled event

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 toggle_user_liquidity call
const netuid = 1;
const enable = true;

const call = api.tx[stringCamelCase("Swap")][stringCamelCase("toggle_user_liquidity")](
  netuid,
  enable
);

Runtime Info

View Source
Pallet Index
28
Call Index
4
First Version
v290
Current Version
v393