mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-08 07:47:21 +00:00
UnionOf types for merged fungible and fungibles implementations (#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](https://github.com/paritytech/polkadot-sdk/pull/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>
This commit is contained in:
@@ -1170,17 +1170,26 @@ impl<Hash> PreimageRecipient<Hash> for () {
|
||||
fn unnote_preimage(_: &Hash) {}
|
||||
}
|
||||
|
||||
/// Trait for creating an asset account with a deposit taken from a designated depositor specified
|
||||
/// by the client.
|
||||
/// Trait for touching/creating an asset account with a deposit taken from a designated depositor
|
||||
/// specified by the client.
|
||||
///
|
||||
/// Ensures that transfers to the touched account will succeed without being denied by the account
|
||||
/// creation requirements. For example, it is useful for the account creation of non-sufficient
|
||||
/// assets when its system account may not have the free consumer reference required for it. If
|
||||
/// there is no risk of failing to meet those requirements, the touch operation can be a no-op, as
|
||||
/// is common for native assets.
|
||||
pub trait AccountTouch<AssetId, AccountId> {
|
||||
/// The type for currency units of the deposit.
|
||||
type Balance;
|
||||
|
||||
/// The deposit amount of a native currency required for creating an account of the `asset`.
|
||||
/// The deposit amount of a native currency required for touching an account of the `asset`.
|
||||
fn deposit_required(asset: AssetId) -> Self::Balance;
|
||||
|
||||
/// Check if an account for a given asset should be touched to meet the existence requirements.
|
||||
fn should_touch(asset: AssetId, who: &AccountId) -> bool;
|
||||
|
||||
/// Create an account for `who` of the `asset` with a deposit taken from the `depositor`.
|
||||
fn touch(asset: AssetId, who: AccountId, depositor: AccountId) -> DispatchResult;
|
||||
fn touch(asset: AssetId, who: &AccountId, depositor: &AccountId) -> DispatchResult;
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
Reference in New Issue
Block a user