Dex pallet
Derived from live runtime metadata on TRN root (pallet index 16, captured 2026-05-02). For prose-style documentation see Dex on the curated reference side.
- Pallet index
16- Calls
- 7
- Events
- 8
- Errors
- 23
- Storage items
- 5
- Constants
- 5
Calls (extrinsics)
Dex.set_fee_to
See [
Pallet::set_fee_to].
api.tx.dex.set_fee_to(fee_to: Option<SeedPrimitivesSignatureAccountId20>)| Argument | Type | Doc |
|---|---|---|
fee_to | Option<SeedPrimitivesSignatureAccountId20> | Option<T::AccountId> |
Call index: 0
Dex.swap_with_exact_supply
See [
Pallet::swap_with_exact_supply].
api.tx.dex.swap_with_exact_supply(amount_in: Compact<u128>, amount_out_min: Compact<u128>, path: Vec<u32>, to: Option<SeedPrimitivesSignatureAccountId20>, deadline: Option<u32>)| Argument | Type | Doc |
|---|---|---|
amount_in | Compact<u128> | Balance |
amount_out_min | Compact<u128> | Balance |
path | Vec<u32> | Vec<AssetId> |
to | Option<SeedPrimitivesSignatureAccountId20> | Option<T::AccountId> |
deadline | Option<u32> | Option<BlockNumberFor<T>> |
Call index: 1
Dex.swap_with_exact_target
See [
Pallet::swap_with_exact_target].
api.tx.dex.swap_with_exact_target(amount_out: Compact<u128>, amount_in_max: Compact<u128>, path: Vec<u32>, to: Option<SeedPrimitivesSignatureAccountId20>, deadline: Option<u32>)| Argument | Type | Doc |
|---|---|---|
amount_out | Compact<u128> | Balance |
amount_in_max | Compact<u128> | Balance |
path | Vec<u32> | Vec<AssetId> |
to | Option<SeedPrimitivesSignatureAccountId20> | Option<T::AccountId> |
deadline | Option<u32> | Option<BlockNumberFor<T>> |
Call index: 2
Dex.add_liquidity
See [
Pallet::add_liquidity].
api.tx.dex.add_liquidity(token_a: u32, token_b: u32, amount_a_desired: Compact<u128>, amount_b_desired: Compact<u128>, amount_a_min: Compact<u128>, amount_b_min: Compact<u128>, to: Option<SeedPrimitivesSignatureAccountId20>, deadline: Option<u32>)| Argument | Type | Doc |
|---|---|---|
token_a | u32 | AssetId |
token_b | u32 | AssetId |
amount_a_desired | Compact<u128> | Balance |
amount_b_desired | Compact<u128> | Balance |
amount_a_min | Compact<u128> | Balance |
amount_b_min | Compact<u128> | Balance |
to | Option<SeedPrimitivesSignatureAccountId20> | Option<T::AccountId> |
deadline | Option<u32> | Option<BlockNumberFor<T>> |
Call index: 3
Dex.remove_liquidity
See [
Pallet::remove_liquidity].
api.tx.dex.remove_liquidity(token_a: u32, token_b: u32, liquidity: Compact<u128>, amount_a_min: Compact<u128>, amount_b_min: Compact<u128>, to: Option<SeedPrimitivesSignatureAccountId20>, deadline: Option<u32>)| Argument | Type | Doc |
|---|---|---|
token_a | u32 | AssetId |
token_b | u32 | AssetId |
liquidity | Compact<u128> | Balance |
amount_a_min | Compact<u128> | Balance |
amount_b_min | Compact<u128> | Balance |
to | Option<SeedPrimitivesSignatureAccountId20> | Option<T::AccountId> |
deadline | Option<u32> | Option<BlockNumberFor<T>> |
Call index: 4
Dex.reenable_trading_pair
See [
Pallet::reenable_trading_pair].
api.tx.dex.reenable_trading_pair(token_a: u32, token_b: u32)| Argument | Type | Doc |
|---|---|---|
token_a | u32 | AssetId |
token_b | u32 | AssetId |
Call index: 5
Dex.disable_trading_pair
See [
Pallet::disable_trading_pair].
api.tx.dex.disable_trading_pair(token_a: u32, token_b: u32)| Argument | Type | Doc |
|---|---|---|
token_a | u32 | AssetId |
token_b | u32 | AssetId |
Call index: 6
Events
Dex.FeeToSet
Set FeeTo account success. [fee_to]
| Field | Type | Doc |
|---|---|---|
Option<T::AccountId> | Option<SeedPrimitivesSignatureAccountId20> |
Dex.AddProvision
Add provision success. [who, asset_id_0, contribution_0, asset_id_1, contribution_1]
| Field | Type | Doc |
|---|---|---|
T::AccountId | [u8;20] | |
AssetId | u32 | |
Balance | u128 | |
AssetId | u32 | |
Balance | u128 |
Dex.AddLiquidity
Add liquidity success. [who, asset_id_0, reserve_0_increment, asset_id_1, reserve_1_increment, share_increment, to]
| Field | Type | Doc |
|---|---|---|
T::AccountId | [u8;20] | |
AssetId | u32 | |
Balance | u128 | |
AssetId | u32 | |
Balance | u128 | |
Balance | u128 | |
T::AccountId | [u8;20] |
Dex.RemoveLiquidity
Remove liquidity from the trading pool success. [who, asset_id_0, reserve_0_decrement, asset_id_1, reserve_1_decrement, share_decrement, to]
| Field | Type | Doc |
|---|---|---|
T::AccountId | [u8;20] | |
AssetId | u32 | |
Balance | u128 | |
AssetId | u32 | |
Balance | u128 | |
Balance | u128 | |
T::AccountId | [u8;20] |
Dex.Swap
Use supply Asset to swap target Asset. [trader, trading_path, supply_Asset_amount, target_Asset_amount, to]
| Field | Type | Doc |
|---|---|---|
T::AccountId | [u8;20] | |
Vec<AssetId> | Vec<u32> | |
Balance | u128 | |
Balance | u128 | |
T::AccountId | [u8;20] |
Dex.EnableTradingPair
Enable trading pair. [trading_pair]
| Field | Type | Doc |
|---|---|---|
TradingPair | (u32,u32) |
Dex.DisableTradingPair
Disable trading pair. [trading_pair]
| Field | Type | Doc |
|---|---|---|
TradingPair | (u32,u32) |
Dex.ProvisioningToEnabled
Provisioning trading pair convert to Enabled. [trading_pair, pool_0_amount, pool_1_amount, total_share_amount]
| Field | Type | Doc |
|---|---|---|
TradingPair | (u32,u32) | |
Balance | u128 | |
Balance | u128 | |
Balance | u128 |
Errors
Dex.MustBeEnabled
Trading pair must be in Enabled status
Dex.MustBeNotEnabled
Trading pair must be in NotEnabled status
Dex.InsufficientInputAmount
Insufficient input amount
Dex.InvalidInputAmounts
Must provide non-zero amount of liquidity
Dex.InsufficientAmount
Insufficent amount
Dex.InsufficientAmountA
Insufficient asset_a liquidity amount
Dex.InsufficientAmountB
Insufficient asset_b liquidity amount
Dex.InsufficientLiquidityBurnt
Insufficient liquidity burnt
Dex.InsufficientWithdrawnAmountA
Insufficient withdraw amount for token A
Dex.InsufficientWithdrawnAmountB
Insufficient withdraw amount for token B
Dex.InsufficientOutputAmount
Insufficient output amount
Dex.InvalidLiquidityIncrement
The increment of liquidity is invalid
Dex.InvalidConstantProduct
Invalid constant product K
Dex.IdenticalTokenAddress
Dex.InvalidAssetId
Invalid Asset id
Dex.InvalidTradingPathLength
Invalid trading path length
Dex.InsufficientTargetAmount
Target amount is less to min_target_amount
Dex.ExcessiveSupplyAmount
Supply amount is more than max_supply_amount
Dex.InsufficientLiquidity
Liquidity is not enough
Dex.ZeroSupplyAmount
The supply amount is zero
Dex.ZeroTargetAmount
The target amount is zero
Dex.LiquidityProviderTokenNotCreated
The Liquidity Provider token does not exist
Dex.ExpiredDeadline
The deadline has been missed
Storage
Dex.FeeTo
FeeTo account where network fees are deposited
await api.query.dex.feeTo()Returns: Option<SeedPrimitivesSignatureAccountId20>
Modifier: Default
Dex.TradingPairLPToken
await api.query.dex.tradingPairLPToken(key1)- Key:
(u32,u32)(hasher: Twox64Concat) - Returns:
Option<u32>
Modifier: Default
Dex.LiquidityPool
await api.query.dex.liquidityPool(key1)- Key:
(u32,u32)(hasher: Twox64Concat) - Returns:
(u128,u128)
Modifier: Default
Dex.LiquidityPoolLastK
await api.query.dex.liquidityPoolLastK(key1)- Key:
u32(hasher: Twox64Concat) - Returns:
U256
Modifier: Default
Dex.TradingPairStatuses
await api.query.dex.tradingPairStatuses(key1)- Key:
(u32,u32)(hasher: Twox64Concat) - Returns:
{"_enum":["NotEnabled","Enabled"]}
Modifier: Default
Constants
Dex.GetExchangeFee
Trading fee rate The first item of the tuple is the numerator of the fee rate, second item is the denominator, fee_rate = numerator / denominator, use (u32, u32) over
Ratetype to minimize internal division operation.
Type: (u32,u32)
SCALE-encoded value: 0x03000000e8030000
Dex.TradingPathLimit
The limit for length of trading path
Type: u32
SCALE-encoded value: 0x03000000
Dex.DEXBurnPalletId
The DEX's burn id, to provide for a redundant, unredeemable minter/burner address.
Type: [u8;8]
SCALE-encoded value: 0x6275726e2f646578
Dex.LPTokenDecimals
Liquidity pair default token decimals
Type: u8
SCALE-encoded value: 0x12
Dex.DefaultFeeTo
The default FeeTo account
Type: Option<FrameSupportPalletId>
SCALE-encoded value: 0x017478666565706f74
wss://root.rootnet.live/archive/ws · captured 2026-05-02