FeeRate

Storage Map v290 → current

Swap fee rate per subnet , encoded as u16. Fraction = value / u16::MAX (i.e. value / 65535). NOT basis points or percent.

Explore chain
Queried by: stakersdevelopersanalytics

The Big Picture

Fee rates determine LP earnings. ~196 = 0.3%. Higher rates = more LP income.

Use Cases

  • Calculate expected fees
  • Compare subnet LP yields
  • Display fee rates

From Chain Metadata

The fee rate applied to swaps per subnet, normalized value between 0 and u16::MAX

Purpose & Usage

Purpose

Determines the fee fraction taken from each swap. Per source: `normalized value between 0 and u16::MAX`.

Common Query Patterns

  • Query by netuid
  • Divide by 65535 to get fraction
  • Iterate to compare subnets
Part of: Concentrated Liquidity

Query Keys

#NameTypeDescription
1
netuid netuid
raw: key1
u16 key1 (u16)

Stored Value

value (u16)

Decoding the value

u16 (normalised: value / u16::MAX = fraction)

Same encoding as SubnetOwnerCut and ChildkeyTake.

Common bug
Dividing by 10000 (bps) or 100 (percent) yields fees ~6.55x larger than reality.
const fraction = (value as number) / 65535;

Relationships

Modified By

Related Events

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);

// Query FeeRate storage
const key1 = 0;

const result = await api.query.Swap.FeeRate.getValue(key1);
console.log("FeeRate:", result);

Runtime Info

View Source
Pallet
Swap
Storage Kind
Map
First Version
v290
Current Version
v411