set_fee_rate

Call v290 → current #0

Sets the swap fee rate for a specific subnet 's liquidity pool.

View calls on chain

Click items to navigate. Pan and zoom to explore.

Used by: subnet ownersdevelopersanalytics

The Big Picture

Swap fees compensate liquidity providers for impermanent loss risk.

Use Cases

  • Adjust swap fees
  • Configure fees for new subnets

From Chain Metadata

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

Part of: Concentrated Liquidity

Input Parameters

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

Permissions

Origin
Unknown
Required Role

Permission data inferred from metadata. May be incomplete.

Requirements

  • Caller has admin/sudo privileges
  • Subnet exists
  • Fee rate within MaxFeeRate

Effects

Events Emitted

Storage Modified

Postconditions

  • FeeRate storage updated
  • Future swaps use new fee rate

Side Effects

  • Emits FeeRateSet 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 set_fee_rate call
const netuid = 1;
const rate = 0;

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

Runtime Info

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