UserLiquidityToggled

Event v290 → current #1

Emitted when user liquidity is enabled or disabled for a subnet .

View events on chain
Useful for: subnet ownersstakersdevelopersanalytics

The Big Picture

Signals that a subnet has transitioned to V3 concentrated liquidity mode.

Use Cases

  • Detect when LP is available
  • Track V2->V3 upgrade events
  • Monitor LP availability

From Chain Metadata

Event emitted when user liquidity operations are enabled for a subnet. First enable even indicates a switch from V2 to V3 swap.

Part of: Concentrated Liquidity

Triggers

Preconditions

  • Admin/sudo or subnet owner call succeeded
  • Subnet has subtoken enabled

Effects

Storage Modified

Postconditions

  • EnabledUserLiquidity updated
  • V3 mode activated if first enable

Side Effects

  • Permanent V3 mode if first enable

Event Data

#NameTypeDescription
0
netuid
u16 NetUidSubnet ID for the liquidity pool
1
enable
bool Whether user-provided liquidity is now enabled

Code Examples

import { createClient, Binary } from "polkadot-api";
import { getWsProvider } from "polkadot-api/ws";
import { sub } from "@polkadot-api/descriptors"; // generated by: npx papi add sub -w wss://entrypoint-finney.opentensor.ai:443

const client = createClient(getWsProvider("wss://entrypoint-finney.opentensor.ai:443"));
const api = client.getTypedApi(sub);

// Subscribe to UserLiquidityToggled events
client.finalizedBlock$.subscribe(async (block) => {
  const events = await api.event.Swap.UserLiquidityToggled.get(block.hash);
  for (const evt of events) {
    console.log("UserLiquidityToggled:", evt.payload);
  }
});

Runtime Info

View Source
Pallet Index
28
Event Index
1
First Version
v290
Current Version
v411