-
Notifications
You must be signed in to change notification settings - Fork 707
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pallet-asset-conversion: Decoupling Native Currency Dependancy #2031
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…rsion-credit-swap
Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
…rsion-credit-swap
bkontur
added a commit
to bkontur/runtimes
that referenced
this pull request
Jan 29, 2024
ahmadkaouk
pushed a commit
to moonbeam-foundation/polkadot-sdk
that referenced
this pull request
Jan 29, 2024
…paritytech#2033) Introduces `UnionOf` types, crafted to merge `fungible` and `fungibles` implementations or two `fungibles` implementations into a single type implementing `fungibles`. This also addresses an issue where `ItemOf` initiates a double drop for an imbalance type, leading to inaccurate total issuance accounting. Find the application of these types in this PR - [link](paritytech#2031), places in code - [1](https://github.com/paritytech/polkadot-sdk/blob/4ec7496fa2632385b08fae860fcf28a523a7b5de/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs#L327), [2](https://github.com/paritytech/polkadot-sdk/blob/4ec7496fa2632385b08fae860fcf28a523a7b5de/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs#L343). --------- Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: joepetrowski <joe@parity.io> (cherry picked from commit 0b74812)
bkontur
added a commit
to bkontur/runtimes
that referenced
this pull request
Jan 29, 2024
bkontur
added a commit
to bkontur/runtimes
that referenced
this pull request
Jan 30, 2024
bkontur
added a commit
to bkontur/runtimes
that referenced
this pull request
Feb 3, 2024
bkontur
added a commit
to bkontur/runtimes
that referenced
this pull request
Feb 3, 2024
bkontur
added a commit
to bkontur/runtimes
that referenced
this pull request
Feb 6, 2024
bgallois
pushed a commit
to duniter/duniter-polkadot-sdk
that referenced
this pull request
Mar 25, 2024
…paritytech#2033) Introduces `UnionOf` types, crafted to merge `fungible` and `fungibles` implementations or two `fungibles` implementations into a single type implementing `fungibles`. This also addresses an issue where `ItemOf` initiates a double drop for an imbalance type, leading to inaccurate total issuance accounting. Find the application of these types in this PR - [link](paritytech#2031), places in code - [1](https://github.com/paritytech/polkadot-sdk/blob/4ec7496fa2632385b08fae860fcf28a523a7b5de/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs#L327), [2](https://github.com/paritytech/polkadot-sdk/blob/4ec7496fa2632385b08fae860fcf28a523a7b5de/cumulus/parachains/runtimes/assets/asset-hub-kusama/src/lib.rs#L343). --------- Co-authored-by: Liam Aharon <liam.aharon@hotmail.com> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Oliver Tale-Yazdi <oliver.tale-yazdi@parity.io> Co-authored-by: joepetrowski <joe@parity.io>
bgallois
pushed a commit
to duniter/duniter-polkadot-sdk
that referenced
this pull request
Mar 25, 2024
…ytech#2031) closes paritytech#1842 Decoupling Pallet from the Concept of Native Currency Currently, the pallet is intrinsically linked with the concept of native currency, requiring users to provide implementations of the `fungible::*` and `fungibles::*` traits to interact with native and non native assets. This incapsulates some non-related to the pallet complexity and makes it less adaptable in contexts where the native currency concept is absent. With this PR, the dependence on `fungible::*` for liquidity-supplying assets has been removed. Instead, the native and non-native currencies' handling is now overseen by a single type that implements the `fungibles::*` traits. To simplify this integration, types have been introduced to facilitate the creation of a union between `fungible::*` and `fungibles::*` implementations, producing a unified `fungibles::*` type. One of the reasons driving these changes is the ambition to create a more user-friendly API for the `SwapCredit` implementation. Given that it interacts with two distinct credit types from `fungible` and `fungibles`, a unified type was introduced. Clients now manage potential conversion failures for those credit types. In certain contexts, it's vital to guarantee that operations are fail-safe, like in this impl - [PR](paritytech#1845), place in [code](https://github.com/paritytech/polkadot-sdk/blob/20b85a5fada8f55c98ba831964f5866ffeadf4da/cumulus/primitives/utility/src/lib.rs#L429). Additional Updates: - abstracted the pool ID and its account derivation logic via trait bounds, along with common implementation offerings; - removed `inc_providers` on a pool creation for the pool account; - benchmarks: -- swap complexity is N, not const; -- removed `From<u128> + Into<u128>` bound from `T::Balance`; -- removed swap/liquidity/.. amount constants, resolve them dynamically based on pallet configuration; -- migrated to v2 API; - `OnUnbalanced` handler for the pool creation fee, replacing direct transfers to a specified account ID; - renamed `MultiAssetId` to `AssetKind` aligning with naming across frame crates; related PRs: - (depends) paritytech#1677 - (caused) paritytech#2033 - (caused) paritytech#1876 --------- Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> Co-authored-by: Liam Aharon <liam.aharon@hotmail.com>
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Mar 26, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Mar 27, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 8, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 8, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 8, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 8, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 8, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 9, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 10, 2024
serban300
pushed a commit
to serban300/polkadot-sdk
that referenced
this pull request
Apr 10, 2024
bkchr
pushed a commit
that referenced
this pull request
Apr 10, 2024
This was referenced Jun 5, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
closes #1842
Decoupling Pallet from the Concept of Native Currency
Currently, the pallet is intrinsically linked with the concept of native currency, requiring users to provide implementations of the
fungible::*
andfungibles::*
traits to interact with native and non native assets. This incapsulates some non-related to the pallet complexity and makes it less adaptable in contexts where the native currency concept is absent.With this PR, the dependence on
fungible::*
for liquidity-supplying assets has been removed. Instead, the native and non-native currencies' handling is now overseen by a single type that implements thefungibles::*
traits. To simplify this integration, types have been introduced to facilitate the creation of a union betweenfungible::*
andfungibles::*
implementations, producing a unifiedfungibles::*
type.One of the reasons driving these changes is the ambition to create a more user-friendly API for the
SwapCredit
implementation. Given that it interacts with two distinct credit types fromfungible
andfungibles
, a unified type was introduced. Clients now manage potential conversion failures for those credit types. In certain contexts, it's vital to guarantee that operations are fail-safe, like in this impl - PR, place in code.Additional Updates:
inc_providers
on a pool creation for the pool account;-- swap complexity is N, not const;
-- removed
From<u128> + Into<u128>
bound fromT::Balance
;-- removed swap/liquidity/.. amount constants, resolve them dynamically based on pallet configuration;
-- migrated to v2 API;
OnUnbalanced
handler for the pool creation fee, replacing direct transfers to a specified account ID;MultiAssetId
toAssetKind
aligning with naming across frame crates;related PRs:
UnionOf
types for mergedfungible
andfungibles
implementations #2033OnUnbalanced
trait #1876