Here's what I am making: A pallet which "reserves" or "locks" some funds, incrementally each time a function X is called from an account. If I call X, 10 times, and my deposit fee is 100 tokens, I expect 1000 tokens to be "bonded" by the end of the transaction(s). For this I need some checks in place and here's what I came up with:

  1. Their free balance > deposit, 100 tokens in this case
  2. If they already have some deposit, say 400 tokens are bonded from this account, go ahead and bond 100 more, making the total 500 tokens.
  3. Create a function unreserve that when called, could unreserve an arbitrary amount from their bonded tokens so far.

I've considered, NamedReservableCurrency, LockableCurrency and ReservableCurrency, and I am debating which one should I go for.

I've also thought of maintaining a map from AccountId to Balance in which the map deals with the bond amount, and I simply call extend_lock from LockableCurrency to extend the bonded amount.

Which one among the three that I've listed fits better to this purpose and why?

  • Can you edit your question so that it shows your working code if possible? Apr 5, 2022 at 13:15

1 Answer 1


The only decision you need to make here is whether you want these funds to be usable by other pallets / logic.

Reserved balances are independent of one another, that is if you ask to reserve 10 DOT, it will always take a new 10 DOT of balance from the free balance and move it to the reserved balance.

On the other hand, locked balances are overlapping, such that if one user already has 100 DOT locked, and you have a different pallet ask to lock 10 DOT, nothing new will be locked, since 100 DOT are already locked, and that is already enough to satisfy the 10 DOT we wish to lock. But do note that the 10 DOT lock will still exist in storage, for tracking purposes.

So in this case, if you want a user to use this balance for things like Staking or Voting in governance, then you should use a locked balance.

If you don't want that, then you should use a reserved balance.

  • It does appear to me that ReservableCurrency is the best fit for my purpose. I believe that NamedReservableCurrency will allow me better cross pallet functions because it also adds an id to the currency. Apr 30, 2022 at 10:48
  • Yes, NamedReservableCurrency is the best choice.
    – Shawn Tabrizi
    Apr 30, 2022 at 12:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.