Questions tagged [balances]

A question that refers to the balances pallet, or anything to do with balance transfers.

Filter by
Sorted by
Tagged with
4 votes
1 answer
220 views

How to manage storage when a pallet is instantiated more than once?

I am working on an exercise involving liquid staking, where two different tokens are managed. It was suggested to me that I might try instantiating the Balances pallet twice, following the pattern of ...
user avatar
1 vote
1 answer
39 views

Why is `reserve` restricted for locked balances?

I read the answer of Shawn about locked and reserved balances. What is the difference between Free Balance, Reserved Balance, Locked Balance, Vesting Balance, etc...? He pointed out, that locked funds ...
user avatar
  • 43
4 votes
1 answer
45 views

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

At the moment the transaction fee is payed as the native token in the substrate node template. When I create a new asset_id(say BAT) a fungible asset using pallet_assets, How can I now pay the ...
user avatar
1 vote
1 answer
42 views

Using Polkadot-JS to have third party wallet pay for dot transaction fee

I am currently trying to use the polkadot-js sdk in order to transfer money between DOT wallets. I can successfully transfer money between two wallets using the api.tx.balances.transfer(destination, ...
user avatar
4 votes
1 answer
74 views

How does a Substrate chain set the max total supply?

How does a Substrate chain set the max total supply? Looking at the staking module, each era will increase the total_issuance through the issue. In the issue function, Self::Balance::max_value() is ...
user avatar
  • 41
3 votes
1 answer
61 views

Balance transfer fails when sending to the AccountIndex

I wanted to try out AccountIndex feature on Westend: https://wiki.polkadot.network/docs/learn-accounts#indices and claimed an index: https://westend.subscan.io/extrinsic/11590551-2 When I try to do ...
user avatar
  • 752
2 votes
0 answers
34 views

Convert from asset balance to currency balance?

Context: I'm creating a pallet with a simple DEX (decentralised exchange) functionality. I need to perform some arithmetic operations on balances for liquidity pools. Problem: How can I convert from ...
user avatar
0 votes
1 answer
19 views

Why does my multisig `approve_as_multi` extrinsic has failed with `InsufficientBalance` error?

In this link you can find my multisig approve_as_multi extrinsic and see the InsufficientBalance error. Does the balance error here refers to the sender (signatory) balance or the multisig address ...
user avatar
  • 867
2 votes
1 answer
41 views

Collator reward and inflation

What would be the recommended approach to introduce inflation for block production/collator reward? Is NegativeImbalance a good place for this, or implementing a separate pallet that schedules ...
user avatar
0 votes
1 answer
26 views

Error in currency transfer

I have currency configuration as follows use frame_support::traits::{Currency}; and in frame config type Currency: Currency<Self::AccountId>; Then in an extrincis function, I am trying to do a ...
user avatar
0 votes
1 answer
22 views

freeze(account, balance) for pallet-assets, how do I freeze X amount of a certain asset?

Does anyone know if there is a way to freeze (pallet-)asset's similar to how you can "lock"/freeze regular balance with T::Currency::freeze(AccountId, Balance)? seems like there is no easy ...
user avatar
  • 101
1 vote
1 answer
24 views

Does DOT and KSM have Currency AssetId?

I believed that Substrate-based tokens have its own assetId Question is, does relay chain tokens like "DOT" and "KSM" have their assetId too? I tried to find out where it is ...
user avatar
1 vote
0 answers
43 views

Access To Withdrawal Reason in Withdraw Event

I am developing a pallet that uses an off-chain worker to aggregate and store transaction fee data on a per-block basis. To do this, the most reasonable implementation looks to be using Withdraw ...
user avatar
  • 31
3 votes
1 answer
67 views

How to calculate the reducible balance of a user?

I would like to ask question about free balance on Kusama when we execute the query await api.query.system.account('some address') then the output is this { nonce: 1 consumers: 0 providers: 1 ...
user avatar
0 votes
1 answer
30 views

Locked Balance of an Account in Acala

Is it possible to retrieve the locked balance of an account from the account data queried from api.query.system.account? If not, what is the right way to do so? I'm looking for the stash locked in ...
user avatar
0 votes
0 answers
35 views

How to fix "DepositFailed" on orml_currencies while benchmarking?

I try to benchmark one extrinsic. I use the MultiReservableCurrency of orml_currencies. GetNativeCurrencyId is T::BaseAsset::get(). orml_currencies is T::Currencies. Consider the following in ...
user avatar
  • 43
0 votes
1 answer
34 views

How to rebase tokens using balance pallet?

I want to reduce the balance of everyone say by 5% after say every 10 million blocks. It's not possible to loop over all balances, as that will be inefficient. AMPL solves it with using Gons tokens= ...
user avatar
1 vote
1 answer
49 views

How to get a percent portion of a balance?

I would like to divide a Balance into two parts. One is 10% of value and another part is 90% of the value. BalanceOf<T> is the Balance of a pallet. type Balance: AtLeast32BitUnsigned ...
user avatar
  • 43
5 votes
1 answer
55 views

Influence of Existential Deposits on account assets

Statemint has an Existential Deposit threshold of 0.1 DOT. Say an account holds some amount of asset X, and transfers away all its DOT so that it goes below the ED. What happens to its holdings of ...
user avatar
4 votes
1 answer
121 views

About some balance terminology

Background when reading the code about pallet balance and some low-level code.I notice some terminology about balance. terminology Burn Slash Reserve Lock Withdraw deposit What is the meaning and ...
user avatar
  • 303
1 vote
1 answer
23 views

Is it possible to give Balance for transactions?

I know that transactions require certain fees to ensure the correctness of the network, but i was wondering if it is possible to do the reverse operation. I want to give users that send transactions ...
user avatar
  • 801
1 vote
1 answer
117 views

Need help understanding deposit event

At block 9987733, 1zugcacYFxX3HveFpJVUShjfb3KyaomfVqMTFoxYuUWCdD8 received 11.0711047073 DOT as signaled by a balances/Deposit event (event link). I don't understand why that account received that ...
user avatar
  • 113
3 votes
1 answer
64 views

How we can check the balance of the account in any pallet?

I am developing a pallet in which I need to check the balance of the account that is making the transaction. How can I check that?
user avatar
3 votes
1 answer
42 views

How can I intercept a transaction in pallet_balance?

In what way can I intercept a transfer in pallet_balance? For example, I would like to check that the user has an identity in pallet_identity before completing a transfer with pallet_balance.
user avatar
  • 31
3 votes
1 answer
66 views

How to transfer funds via Currency(Balance Pallet) in ink! smart contract?

In ink! smart contract, we usually use AccountID and save the balances in array using mapping or HashMap. This is the traditional way of ERC20 smart contract. I am now developing on my local chain, ...
user avatar
6 votes
1 answer
51 views

How to accurately add extrinsic balance transfer values

Is there a simpler way to add balance transfer values without converting them to BN or Unit value first? For example, say I want to add "0x00000000000000001bc16d674ec80000", "...
user avatar
  • 335
5 votes
3 answers
70 views

How to track token issuance

How would I track the token issuance of a parachain, using either the polkadot api or on-chain data? Does anyone have a simple example?
user avatar
4 votes
1 answer
49 views

How to deal with multiple currencies ED?

If I understand correctly, once anyone of the currency drop-down below the ED then the account will be killed.
user avatar
3 votes
1 answer
44 views

What criteria do blockchains consider when deciding on Existential Deposit?

At the time of asking this question, the ED on Polkadot is 1 DOT and Kusama is 0.0000333333 KSM. Polkadot, and most Substrate-based chains, use an existential deposit (ED) to prevent dust accounts ...
user avatar
  • 752
-1 votes
1 answer
19 views

Can I transfer the balance to the same address on Polkadot?

Can I send a balance when my from address and to address are the same? The reason for asking these questions is to deal with exceptions during development. Of course, I can test it myself, but I don't ...
user avatar
  • 415
6 votes
1 answer
132 views

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

When is Assets pallet useful & when is Balances pallet used? Is Assets pallet similar to an ERC 20 token but implementation at runtime level?
user avatar
  • 63
6 votes
2 answers
59 views

Purpose of `WithdrawReasons` when locking funds

I'm trying to implement a feature where users who lock tokens for a certain period of time are granted some rewards. I'm using pallet-balances along with the LockableCurrency trait for this purpose. I ...
user avatar
0 votes
1 answer
46 views

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

I want to get the token balance of RMRK in the chain statemine with py-substrate.
user avatar
  • 11
2 votes
1 answer
80 views

How to format balance?

I tried using @polkadot/util's formatBalance function to get the formatted balance of the account. But it doesn't make sense. I believe unit conversion is not working properly and I wonder what I am ...
user avatar
  • 603
3 votes
1 answer
37 views

Difference between ReservableCurrency and NamedReservableCurrency?

The docs on the traits ReservableCurrency and NamedReservableCurrency currency are the same, although they clearly have subtle differences between them. When should someone use ReservableCurrency vs ...
user avatar
  • 110
1 vote
1 answer
56 views

How does `pallet-bags-list` account for total issuance?

In the docs for CurrencyToVote it says the total issuance being passed in implies that the implementation must be aware of the fact that its values can affect the outcome. This implies that if the ...
user avatar
  • 11
3 votes
1 answer
85 views

Where do the transaction fees go to?

Whenever I submit an extrinsic, there's a small transaction fee applied to the sender. Where does it go to?
user avatar
3 votes
1 answer
44 views

What is the best practices to add new token to an account?

So I'm trying to make a faucet for my blockchain. What I'm doing is creating a faucet account with a lot of balances (with the set_balance method from the sudo pallet). When there's a drip request, I ...
user avatar
3 votes
2 answers
176 views

How to enable units for currencies in polkadot-js

Currently, polkadot-js doesn't allow me to select a unit when specifying balances in the Developer > Extrinsics section, which means that all balances must be specified in the smallest unit (10^12 ...
user avatar
  • 294
3 votes
1 answer
105 views

How do I change my token symbol on substrate-node-template?

I am running the substrate-node-template and I notice that the token symbol is UNIT and under the accounts tab in polkadot{.js} it shows up as MUNIT. How can I change my token symbol?
user avatar
  • 3,840
4 votes
2 answers
142 views

How to overwrite endowed account balances using additional accounts and balances from a JSON file for genesis block inclusion?

My goal is to allocate a balance in the genesis block to both: A list of endowed accounts already included in the chain specification chain_spec.rs A list of further accounts and balances included in ...
user avatar
  • 1,290
4 votes
1 answer
90 views

Can you use floating point numbers or math in the Runtime?

I would like to do some basic operations in the runtime like: let new_balance = .5 * old_balance; Or save a percentage value in the runtime storage. Or represent the balance of a user like: 3.141592 ...
user avatar
  • 11.4k
4 votes
1 answer
43 views

How Does FRAME Account Data Work?

The FRAME system for runtime development defines an AccountData type, which is coupled with data from the Balances Pallet in the Polkadot runtime. What other types of data could be tracked using this ...
user avatar
10 votes
2 answers
90 views

How to manage native tokens in Substrate?

Which pallet would be good to manage native tokens? Is it Asset Pallet or Balance Pallet? We can transfer funds against any token using Asset Pallet. But would it make sense to use Asset Pallet for ...
user avatar
7 votes
1 answer
60 views

What is the difference between Free Balance, Reserved Balance, Locked Balance, Vesting Balance, etc...?

In the Substrate blockchain development framework, the FRAME Balances pallet references 4 different kinds of balance: Free Balance Reserved Balance Locked Balance Vesting Balance What are the ...
user avatar
  • 11.4k