Swap::Call

Variant 365 v393

pallet_subtensor_swap::pallet::pallet::Call

Contains a variant per dispatchable extrinsic that this pallet has.

About This Type

Call enum for the pallet pallet.

Contains all dispatchable functions (extrinsics) for the pallet pallet. Each variant represents a different callable function with its parameters.

Variants (6)

IndexNameFieldsDocs
0set_fee_rate
netuid: u16
rate: u16
Set the fee rate for swaps on a specific subnet (normalized value). For example, 0.3% is approximately 196. Only callable by the admin origin
4toggle_user_liquidity
netuid: u16
enable: bool
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.
1add_liquidity
hotkey: AccountId
netuid: u16
tick_low: TickIndex
tick_high: TickIndex
liquidity: u64
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
2remove_liquidity
hotkey: AccountId
netuid: u16
position_id: PositionId
Remove liquidity from a specific position. Parameters: - origin: The origin of the transaction - netuid: Subnet ID - position_id: ID of the position to remove Emits `Event::LiquidityRemoved` on success
3modify_position
hotkey: AccountId
netuid: u16
position_id: PositionId
liquidity_delta: i64
Modify a liquidity position. Parameters: - origin: The origin of the transaction - netuid: Subnet ID - position_id: ID of the position to remove - liquidity_delta: Liquidity to add (if positive) or remove (if negative) Emits `Event::LiquidityRemoved` on success
5disable_lpnoneDisable user liquidity in all subnets. Emits `Event::UserLiquidityToggled` on success

SCALE Encoding

Rule
1-byte variant index followed by variant-specific field data. 6 possible variants.
Size
variable (1+ bytes)

Examples

set_fee_rate = set_fee_rate(netuid, rate)
0x00<field0><field1>
00 Variant index 0 = set_fee_rate
field 0 netuid: u16
field 1 rate: u16
add_liquidity = add_liquidity(hotkey, netuid, tick_low, tick_high, liquidity)
0x01<field0><field1><field2><field3><field4>
01 Variant index 1 = add_liquidity
field 0 hotkey: AccountId
field 1 netuid: u16
field 2 tick_low: TickIndex
field 3 tick_high: TickIndex
field 4 liquidity: u64
remove_liquidity = remove_liquidity(hotkey, netuid, position_id)
0x02<field0><field1><field2>
02 Variant index 2 = remove_liquidity
field 0 hotkey: AccountId
field 1 netuid: u16
field 2 position_id: PositionId

Code Examples

import { TypeRegistry } from "@polkadot/types";

const registry = new TypeRegistry();

// Encode Swap::Call — variant "set_fee_rate"
const value = registry.createType("Swap::Call", { set_fee_rate: { netuid: 1, rate: 1 } });
console.log("Hex:", value.toHex());

Type Parameters

T

Referenced By (23)

and 3 more...

Also See

Type Information

Type ID
365
Kind
Variant
Path
pallet_subtensor_swap::pallet::pallet::Call
Runtime
v393