Questions tagged [balances]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
25 views

`Currency::create_deposit` of `pallet_balance` fail on actual runtime but passes on mock rutime

The benchmark is written as: one_extrinsic { let caller: <T as frame_system::Config>::AccountId = make_account::<T>(1); assert_eq!( <T as crate::Config&...
1 vote
1 answer
61 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); ...
1 vote
0 answers
22 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
89 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 ...
6 votes
1 answer
83 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", "...
1 vote
0 answers
62 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 ...
0 votes
2 answers
21 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 ...
1 vote
1 answer
37 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 {...
0 votes
2 answers
63 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
43 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 ...
1 vote
1 answer
33 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 ...
4 votes
1 answer
126 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
118 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, ...
2 votes
1 answer
89 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 ...
0 votes
2 answers
48 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, ...
3 votes
1 answer
103 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 ...
4 votes
1 answer
250 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
88 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 ...
5 votes
1 answer
143 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 ...
4 votes
1 answer
208 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
85 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, ...
3 votes
1 answer
82 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 ...
0 votes
1 answer
49 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 ...
2 votes
1 answer
71 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
77 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 ...
0 votes
1 answer
46 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 ...
0 votes
1 answer
55 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 ...
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 ...
3 votes
1 answer
165 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?
1 vote
0 answers
54 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 ...
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= ...
3 votes
1 answer
124 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
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 ...
1 vote
1 answer
124 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 ...
6 votes
1 answer
107 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
157 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 ...
1 vote
1 answer
144 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 ...
6 votes
2 answers
82 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 ...
3 votes
1 answer
162 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?
5 votes
3 answers
99 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?
3 votes
1 answer
49 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
66 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
58 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 ...
-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 ...
7 votes
1 answer
331 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?
0 votes
1 answer
55 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.
3 votes
1 answer
218 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 ...
2 votes
1 answer
73 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 ...
3 votes
1 answer
59 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 ...
5 votes
2 answers
193 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 ...