open-runtime-module-library icon indicating copy to clipboard operation
open-runtime-module-library copied to clipboard

Implement holds and freezes in orml-tokens.

Open TorstenStueber opened this issue 2 years ago • 6 comments

The latest Polkadot release (v0.9.42) added two new traits to the Fungibles family: hold and freeze (which has been added in https://github.com/paritytech/substrate/pull/12951).

It would be very helpful if the tokens pallet also implement this additional Fungibles traits. At least for the hold trait it should be possible to use the underlying reserve mechanism.

TorstenStueber avatar May 04 '23 14:05 TorstenStueber

Regarding holds and freezes: Will anything change for the interface of orml_currencies? Or is it completely abstracted away and we can use reserve_named and unreserve_named and set_lock, extend_lock and remove_lock in the future?

Chralt98 avatar Jul 05 '23 18:07 Chralt98

fungibles traits are implemented

Current interface is not impacted.

xlc avatar Jul 06 '23 00:07 xlc

fungibles traits are implemented

@xlc This issue is specifically about Fungibles::InspectFreeze, Fungibles::InspectHold, etc. (three more, see here).

To my knowledge they are not implemented yet.

TorstenStueber avatar Jul 13 '23 08:07 TorstenStueber

I'd like to add that the fn reducible_balance impl of orml-tokens seems to diverge from frame (both for fungible, i.e. pallet-balances as well as fungibles, i.e. pallet-assets:

For orml-tokens, the only case considering subtracting ED from the liquid funds is Preservation::Protect whereas in frame this can also occur for other preservations with Preservation::Preserve being the most protected one:

orml-tokens

https://github.com/open-web3-stack/open-runtime-module-library/blob/83a76c2bf66c0b1236c31077e6fb24bb760a3535/tokens/src/lib.rs#L1809

pallet-balances

https://github.com/paritytech/polkadot-sdk/blob/3ae86ae075ac5eb9b80f89f09bd7f4a63f97c582/substrate/frame/balances/src/impl_fungible.rs#L57-L67

pallet-assets

https://github.com/paritytech/polkadot-sdk/blob/3ae86ae075ac5eb9b80f89f09bd7f4a63f97c582/substrate/frame/assets/src/impl_fungibles.rs#L58-L59

wischli avatar Oct 31 '23 13:10 wischli

@xlc

orml-currencies still uses the Currency traits here: https://github.com/open-web3-stack/open-runtime-module-library/blob/9869331dff9027b3989c0fb0d5a4d817e4cb6040/currencies/src/lib.rs#L43

https://forum.polkadot.network/t/polkadot-release-analysis-v0-9-41-v0-9-42/2828#high-impact-7

https://github.com/paritytech/substrate/pull/12951

From the Upgrading section:

It is not crucial to get this done in any particular timeframe, however at some point in the future Currency traits, Locks and Reserves will be deprecated and removed, so it will need to happen before then.

So, I assume since the traits haven't been removed yet, the implementations using the Currency traits in orml-currencies won't change?

Chralt98 avatar Apr 08 '25 09:04 Chralt98

the current code works fine so there is no plan to change it unless absolutely necessary

xlc avatar Apr 08 '25 10:04 xlc