set_fee_rate
Call v290 → current #0Sets the swap fee rate for a specific subnet 's liquidity pool.
View calls on chainCall Workflow
This diagram shows the call execution flow: starting with set_fee_rate, passing through validation
(signature, nonce, mortality, fee payment), then pre-dispatch checks, followed by dispatch which emits events: FeeRateSet and modifies storage: FeeRate, and finally post-dispatch where ExtrinsicSuccess is emitted and fees are settled.
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.
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
Input Parameters
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