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:
- Their free balance > deposit, 100 tokens in this case
- 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.
- 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?