LiquidityModified
Event v290 → v292, v297 → v298, v301 → v385, v391 → current #4Emitted when a user modifies an existing liquidity position .
View events on chainUseful for: stakersdevelopersanalyticswallets
The Big Picture
Modifications allow LPs to adjust without full exit. Zero delta just claims fees.
Use Cases
- Track position changes
- Monitor fee claims
- Analyze LP strategies
From Chain Metadata
Event emitted when a liquidity position is modified in a subnet's liquidity pool. Modifying causes the fees to be claimed.
Triggers
Emitted by
Preconditions
- Position exists
- User owns the position
Effects
Storage Modified
Postconditions
- Position liquidity changed
- Fees claimed
Side Effects
- Fees always claimed on modification
- May affect pool liquidity
Event Data
| # | Name | Type | Description |
|---|---|---|---|
| 0 | coldkey | AccountId | Coldkey of the liquidity provider (hex -> SS58) |
| 1 | hotkey | AccountId | Hotkey associated with the liquidity provider (hex -> SS58) |
| 2 | netuid | u16 NetUid | Subnet ID for the liquidity pool |
| 3 | position_id | PositionId | Unique identifier of the modified position |
| 4 | liquidity → liquidity_delta | i64 | Signed change in liquidity (i64; positive = added, negative = removed) |
| 5 | tao → tao_delta | i64 | Signed change in TAO position (i64 RAO) |
| 6 | alpha → alpha_delta | i64 | Signed change in Alpha position (i64 alpha-RAO) |
| 7 | fee_tao | u64 TaoBalance | Accumulated TAO fees collected at modification time (RAO -> TAO (/ 10^9)) |
| 8 | fee_alpha | u64 AlphaBalance | Accumulated Alpha fees collected at modification time (RAO -> TAO (/ 10^9)) |
| 9 | tick_low | TickIndex | Lower tick boundary after modification (price = 1.0001^tick) |
| 10 | tick_high | TickIndex | Upper tick boundary after modification (price = 1.0001^tick) |
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 LiquidityModified events
client.finalizedBlock$.subscribe(async (block) => {
const events = await api.event.Swap.LiquidityModified.get(block.hash);
for (const evt of events) {
console.log("LiquidityModified:", evt.payload);
}
});Version History
v290 block 5,947,548 11 args
v297 block 6,067,943 11 args
v301 block 6,205,194 11 args
v391 block 7,782,857 11 args Current
Runtime Info
View Source- Pallet Index
- 28
- Event Index
- 4
- First Version
- v290
- Current Version
- v411