mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 22:11:02 +00:00
* Fixups for new Convert APIs
* update lockfile for {"polkadot", "substrate"}
---------
Co-authored-by: parity-processbot <>
This commit is contained in:
@@ -1,3 +1,22 @@
|
||||
// This file is part of Cumulus.
|
||||
|
||||
// Copyright (C) Parity Technologies (UK) Ltd.
|
||||
// SPDX-License-Identifier: Apache-2.0
|
||||
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Tests for the Statemine (Kusama Assets Hub) chain.
|
||||
|
||||
use asset_hub_kusama_runtime::xcm_config::{
|
||||
AssetFeeAsExistentialDepositMultiplierFeeCharger, KsmLocation, TrustBackedAssetsPalletLocation,
|
||||
};
|
||||
@@ -17,8 +36,9 @@ use frame_support::{
|
||||
weights::{Weight, WeightToFee as WeightToFeeT},
|
||||
};
|
||||
use parachains_common::{AccountId, AssetIdForTrustBackedAssets, AuraId, Balance};
|
||||
use sp_runtime::traits::MaybeEquivalence;
|
||||
use xcm::latest::prelude::*;
|
||||
use xcm_executor::traits::{Convert, Identity, JustTry, WeightTrader};
|
||||
use xcm_executor::traits::{Identity, JustTry, WeightTrader};
|
||||
|
||||
const ALICE: [u8; 32] = [1u8; 32];
|
||||
const SOME_ASSET_ADMIN: [u8; 32] = [5u8; 32];
|
||||
@@ -66,7 +86,7 @@ fn test_asset_xcm_trader() {
|
||||
|
||||
// get asset id as multilocation
|
||||
let asset_multilocation =
|
||||
AssetIdForTrustBackedAssetsConvert::reverse_ref(local_asset_id).unwrap();
|
||||
AssetIdForTrustBackedAssetsConvert::convert_back(&local_asset_id).unwrap();
|
||||
|
||||
// Set Alice as block author, who will receive fees
|
||||
RuntimeHelper::<Runtime>::run_to_block(2, Some(AccountId::from(ALICE)));
|
||||
@@ -150,7 +170,7 @@ fn test_asset_xcm_trader_with_refund() {
|
||||
// We are going to buy 4e9 weight
|
||||
let bought = Weight::from_parts(4_000_000_000u64, 0);
|
||||
|
||||
let asset_multilocation = AssetIdForTrustBackedAssetsConvert::reverse_ref(1).unwrap();
|
||||
let asset_multilocation = AssetIdForTrustBackedAssetsConvert::convert_back(&1).unwrap();
|
||||
|
||||
// lets calculate amount needed
|
||||
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
||||
@@ -220,7 +240,7 @@ fn test_asset_xcm_trader_refund_not_possible_since_amount_less_than_ed() {
|
||||
// We are going to buy small amount
|
||||
let bought = Weight::from_parts(500_000_000u64, 0);
|
||||
|
||||
let asset_multilocation = AssetIdForTrustBackedAssetsConvert::reverse_ref(1).unwrap();
|
||||
let asset_multilocation = AssetIdForTrustBackedAssetsConvert::convert_back(&1).unwrap();
|
||||
|
||||
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
||||
|
||||
@@ -271,7 +291,7 @@ fn test_that_buying_ed_refund_does_not_refund() {
|
||||
// We are gonna buy ED
|
||||
let bought = Weight::from_parts(ExistentialDeposit::get().try_into().unwrap(), 0);
|
||||
|
||||
let asset_multilocation = AssetIdForTrustBackedAssetsConvert::reverse_ref(1).unwrap();
|
||||
let asset_multilocation = AssetIdForTrustBackedAssetsConvert::convert_back(&1).unwrap();
|
||||
|
||||
let amount_bought = WeightToFee::weight_to_fee(&bought);
|
||||
|
||||
@@ -346,7 +366,7 @@ fn test_asset_xcm_trader_not_possible_for_non_sufficient_assets() {
|
||||
// lets calculate amount needed
|
||||
let asset_amount_needed = WeightToFee::weight_to_fee(&bought);
|
||||
|
||||
let asset_multilocation = AssetIdForTrustBackedAssetsConvert::reverse_ref(1).unwrap();
|
||||
let asset_multilocation = AssetIdForTrustBackedAssetsConvert::convert_back(&1).unwrap();
|
||||
|
||||
let asset: MultiAsset = (asset_multilocation, asset_amount_needed).into();
|
||||
|
||||
@@ -461,13 +481,13 @@ fn test_assets_balances_api_works() {
|
||||
)));
|
||||
// check trusted asset
|
||||
assert!(result.inner().iter().any(|asset| asset.eq(&(
|
||||
AssetIdForTrustBackedAssetsConvert::reverse_ref(local_asset_id).unwrap(),
|
||||
AssetIdForTrustBackedAssetsConvert::convert_back(&local_asset_id).unwrap(),
|
||||
minimum_asset_balance
|
||||
)
|
||||
.into())));
|
||||
// check foreign asset
|
||||
assert!(result.inner().iter().any(|asset| asset.eq(&(
|
||||
Identity::reverse_ref(foreign_asset_id_multilocation).unwrap(),
|
||||
Identity::convert_back(&foreign_asset_id_multilocation).unwrap(),
|
||||
6 * foreign_asset_minimum_asset_balance
|
||||
)
|
||||
.into())));
|
||||
|
||||
Reference in New Issue
Block a user