Swap::Call
Variant 365 v393pallet_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)
| Index | Name | Fields | Docs |
|---|---|---|---|
| 0 | set_fee_rate | 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 | |
| 4 | toggle_user_liquidity | 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. | |
| 1 | add_liquidity | 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 | |
| 2 | remove_liquidity | 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 | |
| 3 | modify_position | 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 | |
| 5 | disable_lp | none | Disable 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_ratefield 0 netuid: u16field 1 rate: u16add_liquidity = add_liquidity(hotkey, netuid, tick_low, tick_high, liquidity)
0x01<field0><field1><field2><field3><field4>01 Variant index 1 = add_liquidityfield 0 hotkey: AccountIdfield 1 netuid: u16field 2 tick_low: TickIndexfield 3 tick_high: TickIndexfield 4 liquidity: u64remove_liquidity = remove_liquidity(hotkey, netuid, position_id)
0x02<field0><field1><field2>02 Variant index 2 = remove_liquidityfield 0 hotkey: AccountIdfield 1 netuid: u16field 2 position_id: PositionIdCode 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)
#123 RuntimeCall via System#123 RuntimeCall via Timestamp#123 RuntimeCall via Grandpa#123 RuntimeCall via Balances#123 RuntimeCall via SubtensorModule#123 RuntimeCall via Utility#123 RuntimeCall via Sudo#123 RuntimeCall via Multisig#123 RuntimeCall via Preimage#123 RuntimeCall via Scheduler#123 RuntimeCall via Proxy#123 RuntimeCall via Registry#123 RuntimeCall via Commitments#123 RuntimeCall via AdminUtils#123 RuntimeCall via SafeMode#123 RuntimeCall via Ethereum#123 RuntimeCall via EVM#123 RuntimeCall via BaseFee#123 RuntimeCall via Drand#123 RuntimeCall via Crowdloan
and 3 more...
Also See
Type Information
- Type ID
- 365
- Kind
- Variant
- Path
- pallet_subtensor_swap::pallet::pallet::Call
- Runtime
- v393