mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-28 00:28:01 +00:00
Asset conversion get_pool_id fix (Ord does not count with is_native flag) (#14572)
* Asset conversion `get_pool_id` fix (`Ord` does not count with `is_native` flag) * Removed unnecessery clones + added `pool_account` to `PoolCreated` event * Fix bench compile * Fix bench * Improved `MultiAssetIdConverter::try_convert` * Removed `into_multiasset_id` from converter and moved to `BenchmarkHelper` * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_asset_conversion * Fixed doc * Typo * Removed `NativeOrAssetId` (test/mock) impl from types.rs to mock.rs... * Typo + 0u32 -> 0 * Update frame/asset-conversion/src/benchmarking.rs Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> * Typo * ".git/.scripts/commands/fmt/fmt.sh" * Fix from Jegor * Try to fix the other failing benchmark * ".git/.scripts/commands/bench/bench.sh" pallet dev pallet_asset_conversion * Update frame/asset-conversion/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update frame/asset-conversion/src/types.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update frame/transaction-payment/asset-conversion-tx-payment/src/mock.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update frame/asset-conversion/src/mock.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update bin/node/runtime/src/impls.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update frame/asset-conversion/src/lib.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Update bin/node/runtime/src/impls.rs Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com> * Reverted NativeOrAssetId --------- Co-authored-by: command-bot <> Co-authored-by: Jegor Sidorenko <5252494+jsidorenko@users.noreply.github.com> Co-authored-by: Jegor Sidorenko <jegor@parity.io> Co-authored-by: joe petrowski <25483142+joepetrowski@users.noreply.github.com>
This commit is contained in:
@@ -66,13 +66,8 @@ fn pool_assets() -> Vec<u32> {
|
||||
|
||||
fn create_tokens(owner: u128, tokens: Vec<NativeOrAssetId<u32>>) {
|
||||
for token_id in tokens {
|
||||
assert_ok!(Assets::force_create(
|
||||
RuntimeOrigin::root(),
|
||||
NativeOrAssetIdConverter::try_convert(&token_id).unwrap(),
|
||||
owner,
|
||||
false,
|
||||
1
|
||||
));
|
||||
let MultiAssetIdConversionResult::Converted(asset_id) = NativeOrAssetIdConverter::try_convert(&token_id) else { unreachable!("invalid token") };
|
||||
assert_ok!(Assets::force_create(RuntimeOrigin::root(), asset_id, owner, false, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -157,7 +152,15 @@ fn can_create_pool() {
|
||||
assert_eq!(balance(pool_account, NativeOrAssetId::Native), setup_fee);
|
||||
assert_eq!(lp_token + 1, AssetConversion::get_next_pool_asset_id());
|
||||
|
||||
assert_eq!(events(), [Event::<Test>::PoolCreated { creator: user, pool_id, lp_token }]);
|
||||
assert_eq!(
|
||||
events(),
|
||||
[Event::<Test>::PoolCreated {
|
||||
creator: user,
|
||||
pool_id,
|
||||
pool_account: AssetConversion::get_pool_account(&pool_id),
|
||||
lp_token
|
||||
}]
|
||||
);
|
||||
assert_eq!(pools(), vec![pool_id]);
|
||||
assert_eq!(assets(), vec![token_2]);
|
||||
assert_eq!(pool_assets(), vec![lp_token]);
|
||||
@@ -236,6 +239,7 @@ fn different_pools_should_have_different_lp_tokens() {
|
||||
[Event::<Test>::PoolCreated {
|
||||
creator: user,
|
||||
pool_id: pool_id_1_2,
|
||||
pool_account: AssetConversion::get_pool_account(&pool_id_1_2),
|
||||
lp_token: lp_token2_1
|
||||
}]
|
||||
);
|
||||
@@ -246,6 +250,7 @@ fn different_pools_should_have_different_lp_tokens() {
|
||||
[Event::<Test>::PoolCreated {
|
||||
creator: user,
|
||||
pool_id: pool_id_1_3,
|
||||
pool_account: AssetConversion::get_pool_account(&pool_id_1_3),
|
||||
lp_token: lp_token3_1,
|
||||
}]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user