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

Commit

Permalink
Fixed create_pool for benchmark with LocalAndForeignAssets (finally f…
Browse files Browse the repository at this point in the history
…ound it)
  • Loading branch information
bkontur committed Jul 14, 2023
1 parent 5e404f3 commit b8f86cf
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions parachains/runtimes/assets/common/src/local_and_foreign_assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,34 @@ where
ForeignAssets::set_total_issuance(asset, amount)
}
}

fn decrease_balance(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance,
precision: Precision,
preservation: Preservation,
force: Fortitude,
) -> Result<Self::Balance, DispatchError> {
if let Some(asset) = LocalAssetIdConverter::convert(&asset) {
Assets::decrease_balance(asset, who, amount, precision, preservation, force)
} else {
ForeignAssets::decrease_balance(asset, who, amount, precision, preservation, force)
}
}

fn increase_balance(
asset: Self::AssetId,
who: &AccountId,
amount: Self::Balance,
precision: Precision,
) -> Result<Self::Balance, DispatchError> {
if let Some(asset) = LocalAssetIdConverter::convert(&asset) {
Assets::increase_balance(asset, who, amount, precision)
} else {
ForeignAssets::increase_balance(asset, who, amount, precision)
}
}
}

impl<Assets, LocalAssetIdConverter, ForeignAssets> Inspect<AccountId>
Expand Down

0 comments on commit b8f86cf

Please sign in to comment.