Questions tagged [balances]

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

Filter by
Sorted by
Tagged with
1 vote
0 answers
14 views

create a dev chainspec with specific test users

I'd like to use the Polkadot CLI to create a chainspec with specific user balances pre-seeded. I'd like to be able to do this for any of the dev runtimes. In the case of the polkadot dev runtime, I ...
2 votes
1 answer
82 views

Getting `insufficient funds for gas * price + value` error when performing transaction with another account than Alice

I'd like to use Substrate Frontier as a private blockchain for my current project. I have set up a project using a frontier-template-node build and I am now trying to adjust its settings. I am ...
1 vote
0 answers
45 views

Parsing Balance Transfer Data

I'm writing a client in Go that needs to scan balance transfers in Substrate chains - initially focused on Polkadot. My current objective is to determine all balance transfers in a given block, and to ...
  • 177
0 votes
2 answers
16 views

Fund transferred to smart contract address not showing in balances

I deploy an ink smart contract through a properly configured pallet_contracts (4.0.0-dev from the Substrate branch polkadot-v0.9.29) on chain. Then I use the unique address of that smart contract and ...
  • 303
1 vote
1 answer
25 views

Benchmark extra macro

What does the #[extra] macro do in benchmarks? I was looking at how benchmarks are being implemented on the Balances pallet. I notice the following benchmarks: benchmarks_instance_pallet { transfer {...
  • 664
0 votes
2 answers
55 views

incorrect balance response

I've created test address in westend network. Topped up it using faucet. https://westend.subscan.io/account/5FpS4PkRzLmJZcwvJM6jxPU3N3481nbnTe6nzFwwQUVvu9LF?tab=transfer. In explorer I see 1WND ...
0 votes
1 answer
37 views

What is the Token Standard used by the balances pallet to issue the native token for the chain in the substrate kitchen sink node?

We are using the kitchen sink substrate node with the standard balances pallet. No changes. The chain mints native tokens using the usual processes. My question is: what token standard is used in the ...
2 votes
1 answer
87 views

Is it possible to transfer balance from multiple accounts to the same receiver in a single Extrinsic?

I am working on a system that allows users to send and receive on the Polkadot network. The system tracks the amount of DOT controlled by a user, and this may be spread across multiple Polkadot ...
  • 177
6 votes
1 answer
100 views

How are the costs of XCM messages designed?

after playing with the Substrate Cumulus Parachain Template and the ping-pallet to get an idea of how to use XCM, I built a local Rococo testnet connected to two parachains. In my code, at some point, ...
1 vote
1 answer
50 views

Division operation in `u128` results false value

In my node, Balance type is u128. I have following variable let per_block = 100_000_000_000_000_000_u128; let total = 50_000_000_000_000_000_000_000_u128; let ratio = per_block.checked_div(total); ...
0 votes
2 answers
46 views

How do I mock `BalanceOf` for testing staking?

I'm trying to learn how to use the staking pallet in a game I'm building as a way to learn substrate, linked here, and I'd like to implement staking an amount when challenging another player. However, ...
4 votes
1 answer
243 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 ...
1 vote
1 answer
78 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 ...
  • 195
4 votes
1 answer
168 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 ...
1 vote
1 answer
74 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, ...
5 votes
1 answer
113 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 ...
  • 71
3 votes
1 answer
76 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 ...
  • 851
3 votes
1 answer
94 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 ...
0 votes
1 answer
46 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 ...
  • 1,168
2 votes
1 answer
68 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 ...
0 votes
1 answer
67 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 ...
  • 145
0 votes
1 answer
39 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 ...
  • 141
1 vote
1 answer
29 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 ...
1 vote
0 answers
50 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 ...
  • 45
3 votes
1 answer
104 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 ...
0 votes
1 answer
42 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 ...
0 votes
0 answers
41 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 ...
  • 195
1 vote
1 answer
43 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= ...
1 vote
1 answer
104 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 ...
  • 195
6 votes
1 answer
101 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 ...
5 votes
1 answer
153 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 ...
  • 313
1 vote
1 answer
32 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 ...
  • 1,014
1 vote
1 answer
141 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 ...
  • 113
3 votes
1 answer
133 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?
  • 1,071
3 votes
1 answer
48 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.
4 votes
1 answer
106 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, ...
6 votes
1 answer
77 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", "...
  • 345
5 votes
3 answers
90 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?
4 votes
1 answer
63 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.
4 votes
1 answer
56 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 ...
  • 851
-1 votes
1 answer
23 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 ...
  • 435
6 votes
1 answer
287 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?
  • 63
6 votes
2 answers
76 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 ...
0 votes
1 answer
53 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.
  • 11
3 votes
1 answer
164 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 ...
  • 691
3 votes
1 answer
54 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 ...
  • 324
2 votes
1 answer
68 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 ...
  • 21
3 votes
1 answer
113 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?
3 votes
1 answer
60 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 ...
5 votes
2 answers
184 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 ...
  • 308