Skip to main content
44 votes
Accepted

How can I transfer assets using XCM?

There are two main ways in which assets are transferred between consensus systems in XCM. They are namely via Asset Teleportation or via Reserve Asset Transfers. First of all, a preamble -- XCM ...
Keith Yeung's user avatar
  • 2,121
16 votes
Accepted

When should I use Balances Pallet and when should I use Assets Pallet?

The balances pallet is designed to be used as the blockchain's underlying currency. It is extremely optimized for balance movements and transfers, which ensures that the fees that users pay to ...
Bruno's user avatar
  • 8,315
13 votes
Accepted

Can the destroyed assets be recovered after the XCM teleporting failed?

In general, destroyed assets cannot be recovered, so it's crucial to preplan your XCM to actually work. However there are two main fail-safe mechanisms that were introduced in XCMv2 which can help you ...
Gav's user avatar
  • 2,681
11 votes

How to manage native tokens in Substrate?

For a native token on a Substrate chain you should use the Balances Pallet, not the Assets Pallet. The balances pallet is specially optimized to minimize its computational and storage footprint. This ...
Shawn Tabrizi's user avatar
  • 16.1k
9 votes

How to pay transaction fees using the custom token created by using pallet_assets?

In order to do this you will need in your runtime the pallet_asset_tx_payment pallet. Here's an example of the configuration. (the pallet would need to be added into the construct_runtime! etc. See ...
Squirrel's user avatar
  • 3,849
9 votes
Accepted

<T::Lookup as StaticLookup>::Source vs T::AccountId?

Shawn has explained a lot. Let me give you a real example. I've implemented a custom AccoundIdLookup for Darwinia, which allows transfer from Substrate address to EVM address directly. https://github....
AurevoirXavier's user avatar
  • 10.7k
8 votes
Accepted

How to withdraw KSM tokens from Karura without using the Karura Bridge graphical interface?

You can withdraw the assets by submitting an XCM extrinsic directly to the Karura parachain (this applies to any parachain that uses the xtokens pallet: xtokens). This can be done from the command ...
Dcompoze's user avatar
  • 620
7 votes

<T::Lookup as StaticLookup>::Source vs T::AccountId?

You can start by looking at the trait: /// Means of changing one type into another in a manner dependent on the source type. /// This variant is different to `Lookup` in that it doesn't (can cannot) ...
Shawn Tabrizi's user avatar
  • 16.1k
6 votes
Accepted

panic!() and assert!() in runtime

And yeah debug_assert! might also be worth keeping in mind. However, you can also do something like: macro_rules! test_only_assert { ($cond:expr $(,)?) => {{ #[cfg(test)] assert!...
Sudip Ghimire's user avatar
4 votes
Accepted

When using pallet-assets in another pallet: how to make pallet-assets calls private?

You can create a call filter in your runtime which prevents any calls to your pallet: See a similar question here: Is it possible to disable new validators from joining? Something like: /// Use this ...
Shawn Tabrizi's user avatar
  • 16.1k
4 votes
Accepted

What does #[pallet::compact] do?

https://paritytech.github.io/substrate/master/frame_support/pallet_macros/attr.compact.html Compact encoding for arguments can be achieved via #[pallet::compact]. The function must return a ...
AurevoirXavier's user avatar
  • 10.7k
4 votes
Accepted

orml-tokens vs pallet-assets

Is using orml-tokens required to use all the other orml features like x-tokens? No. Every ORML pallets are designed to be modularized. You can use whatever pallet combination you want. It would be ...
Bryan Chen's user avatar
4 votes
Accepted

How to transfer wrapped DOT from Astar to Polkadot using XCM

To transfer DOT back to Polkadot, you can use orml-xtokens pallet in Astar:
Shaun's user avatar
  • 111
4 votes
Accepted

How to create wrapped DOT asset on local setup

To my knowledge this has to do with not being able to pay for fees. Yes. To configure any customized asset to pay XCM fees, you must set the fee payment unit per second with xcAssetConfig....
Shaun's user avatar
  • 111
3 votes

How to pay transaction fees using the custom token created by using pallet_assets?

We do this at Encointer, the full code including a client that can pay in the custom asset can be found at https://github.com/encointer/encointer-node. I highlight the most important things here: ...
clangenb's user avatar
  • 141
3 votes

How to make a stable coin on substrate?

This is no trivial undertaking. A good resource to learn about the different types of stable coins is https://101blockchains.com/types-of-stablecoins. For crypto-backed stablecoins and algorithmic ...
cmichi's user avatar
  • 2,800
3 votes

How to create and mint assets in benchmarks

This could be a good use for feature flags since you have the following requirement: Depend on a trait only in benchmarking. You can see this multiple times already being used for example in the ...
Oliver Tale-Yazdi's user avatar
3 votes
Accepted

How to import a token from Parachain X to my Parachain Y

This is a slightly more complex subject than it sounds. The reason is that while Polkadot guarantees the correct execution of each parachain's logic, it does not guarantee that the logic does ...
Gav's user avatar
  • 2,681
3 votes
Accepted

If Sufficiency of a Statemint asset is revoked, what happens to the accounts holding only that asset?

Nothing would happen to the accounts holding the assets (it would be a potentially huge storage op to iterate through all accounts on chain and check which ones only exist due to a sufficient asset). ...
joepetrowski's user avatar
  • 2,955
3 votes

How to solve the issue"Element "asset_id" of struct is missing in given value" when I send a token transaction

Are you sure you have the latest version of packages substrate-interface==1.2.2 and scalecodec==1.0.34? Because I can remember older versions of scalecodec don't have the 'signed_extensions' support ...
Arjan's user avatar
  • 151
3 votes

How to get the token balance(rmrk) by py-substrate?

from substrateinterface import SubstrateInterface ASSET_ID = 8 # RMRK.app ACCOUNT = '<<YOUR_ACCOUNT>>' substrate = SubstrateInterface(url='wss://statemine-rpc.polkadot.io') account_info ...
Artur Gontijo's user avatar
3 votes
Accepted

Assets pallet token and democracy pallet

It's not possible right now, but will be after there's a fungibles::Lockable implementation for Assets (https://github.com/paritytech/substrate/issues/11446)
joepetrowski's user avatar
  • 2,955
3 votes

"Account cannot be created" when trying to transfer statemine token to sibling parachain

There's an referendum open for make USDT sufficient in statemint: https://polkadot.polkassembly.io/referendum/80 The referendum passed, there's 28 days delay to the change be applied
Lohann Paterno Coutinho Ferrei's user avatar
3 votes

List of assets on Statemint

Using PolkadotJS you can get the list of assets with this script: const wsProvider = new WsProvider('wss://statemint.api.onfinality.io/public-ws'); const api = await ApiPromise.create({ ...
Alex Bean's user avatar
  • 5,757
3 votes

orml-tokens vs pallet-assets

I used to ask myself similar questions. Not long ago I wrote a pallet that was loosely coupled with pallet-assets. Then, we integrated it into GMorDie, which uses an ORML approach instead. This ...
Bernardo Rodrigues's user avatar
3 votes

FailedToTransactAsset error while sending assets from local Statemint(AssetHub) to other Parachain

If you are running in local I suppose you are using zombie-net. can you add xcm logs to your config. It will displays which FailedToTransactAsset it is: args = [ "-l=xcm=trace" ] On ...
P.Ossun's user avatar
  • 1,219
2 votes
Accepted

How to store a list of allowable assets for a pallet extrinsic?

I think for this specific scenario, something like a StorageMap to the unit type makes sense. But... it really depends more on your overall usage scenario. Simplifying, your concerns should be, in ...
Shawn Tabrizi's user avatar
  • 16.1k
2 votes

How to manage native tokens in Substrate?

The Balance pallet is designed to handle a native token of a chain and would count towards existential deposit (if you choose to have that concept in your chain). The asset pallet is designed to ...
Squirrel's user avatar
  • 3,849
2 votes

How to access Statemint/Statemine assets in a parachain?

(Not financial advice) If your question is about how to bring liquidity from stablecoins like USDT into Polkadot and Kusama ecosystem? Currently it is available with Bitfinex withdrawals to Statemint ...
Josh's user avatar
  • 425
2 votes

Does DOT and KSM have Currency AssetId?

Here is a previous answer that details the differences between assets and balances. At this point a currency is not the same as an asset, so doesn't have an assetid inside the assets environment.
Werner S's user avatar
  • 629

Only top scored, non community-wiki answers of a minimum length are eligible