Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Repot frame_support::traits; introduce some new currency stuff #8435

Merged
merged 22 commits into from
Mar 27, 2021

Conversation

gavofyork
Copy link
Member

@gavofyork gavofyork commented Mar 23, 2021

Repots everything from frame_support::traits. Remains backwards compatible though.

Introduces some new traits which should close the gap between the Assets pallet style Fungibles and the Balances pallet style Currency.

TODO:

  • Full docs
  • Proper errors

Tracking issue: paritytech/polkadot-sdk#327

@gavofyork gavofyork added A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit. labels Mar 23, 2021
@gavofyork gavofyork changed the title Reservable, Transferrable Fungible(s), plus adapters. Repot frame_support::traits; introduce some new currency stuff Mar 24, 2021
@xlc
Copy link
Contributor

xlc commented Mar 24, 2021

Why do we need to deprecate Balances pallet?

@gavofyork
Copy link
Member Author

We don't really. It's a possibility since Assets should be a functionally complete replacement, however I removed the action item since I think Balances will always be a bit faster owing to being able to amalgamate the storage accesses of the system nonce with the balance.

Copy link
Member

@shawntabrizi shawntabrizi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note the issues above, but all in all, very good.

Asset::<T>::get(asset).map(|x| x.supply).unwrap_or_else(Zero::zero)
}

fn minimum_balance(asset: Self::AssetId) -> Self::Balance {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning None here makes sense... It is possible that the fungibles trait should use options?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what will be the difference between no minimum balance vs zero minimum balance?

@gavofyork gavofyork merged commit 0f6b573 into master Mar 27, 2021
@gavofyork gavofyork deleted the gav-fungibles-traits branch March 27, 2021 13:37
@shawntabrizi
Copy link
Member

🚀

ordian added a commit that referenced this pull request Mar 31, 2021
* master: (84 commits)
  Duplicate logging to stdout (#8495)
  Fix sync restart (#8497)
  client: fix justifications migration (#8489)
  helper macro to create storage types on the fly (#8456)
  Make `BlockImport` and `Verifier` async (#8472)
  Get rid of `test-helpers` feature in sc-consensus-babe (#8486)
  Enhancement on Substrate Node Template (#8473)
  Add Social Network (#8065)
  Prepare UI tests for Rust 1.51 & new CI image (#8474)
  Benchmarking pallet-example (#8301)
  Use pathbuf for remote externalities (#8480)
  Bring back the on_finalize weight of staking. (#8463)
  Implement `fungible::*` for Balances (#8454)
  make types within `generate_solution_type` macro explicit (#8447)
  [pallet-staking] Refund unused weight for `payout_stakers` (#8458)
  Use `async_trait` in sc-consensus-slots (#8461)
  Repot frame_support::traits; introduce some new currency stuff (#8435)
  Fix &mut self -> &self in add_known_address (#8468)
  Add NetworkService::add_known_address (#8467)
  Fix companion check (#8464)
  ...
hirschenberger pushed a commit to hirschenberger/substrate that referenced this pull request Apr 14, 2021
…ytech#8435)

* Reservable, Transferrable Fungible(s), plus adapters.

* Repot into new dir

* Imbalances for Fungibles

* Repot and balanced fungible.

* Clean up names and bridge-over Imbalanced.

* Repot frame_support::trait. Finally.

* Make build.

* Docs

* Good errors

* Fix tests. Implement fungible::Inspect for Balances.

* Implement additional traits for Balances.

* Revert UI test "fixes"

* Fix UI error

* Fix UI test

* Fixes

* Update lock

* Grumbles

* Grumbles

* Fixes

Co-authored-by: Bastian Köcher <info@kchr.de>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A0-please_review Pull request needs code review. B0-silent Changes should not be mentioned in any release notes C1-low PR touches the given topic and has a low impact on builders. D2-notlive 💤 PR contains changes in a runtime directory that is not deployed to a chain that requires an audit.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants