Skip to content
This repository was archived by the owner on May 21, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Removed FixedRateOfFungibles
  • Loading branch information
valentinfernandez1 committed Jun 6, 2023
commit 3a41e7ddef410883ac4b9b042d416f8fc49b27e9
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 0 additions & 10 deletions runtime/stout/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,4 @@ pub mod fee {
}]
}
}

pub fn base_tx_fee() -> Balance {
CENTS / 10
}

pub fn default_fee_per_second() -> u128 {
let base_weight = Balance::from(ExtrinsicBaseWeight::get().ref_time());
let base_tx_per_second = (WEIGHT_REF_TIME_PER_SECOND as u128) / base_weight;
base_tx_per_second * base_tx_fee()
}
}
8 changes: 1 addition & 7 deletions runtime/stout/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

use crate::{constants::fee::default_fee_per_second, AllPalletsWithSystem};
use crate::{AllPalletsWithSystem};

use super::{
AccountId, Assets, Balance, Balances, ParachainInfo, ParachainSystem, PolkadotXcm, Runtime,
Expand Down Expand Up @@ -192,11 +192,6 @@ parameter_types! {
// Statemine's Assets pallet index
pub StatemineAssetsPalletLocation: MultiLocation =
MultiLocation::new(1, X2(Parachain(1000), PalletInstance(50)));
pub XUsdPerSecond: (AssetId, u128, u128) = (
MultiLocation::new(1, X3(Parachain(1000), PalletInstance(50), GeneralIndex(1))).into(),
default_fee_per_second() * 10,
0
);
}

//- From PR https://github.com/paritytech/cumulus/pull/936
Expand Down Expand Up @@ -239,7 +234,6 @@ impl xcm_executor::Config for XcmConfig {
type Barrier = Barrier;
type Weigher = FixedWeightBounds<UnitWeightCost, RuntimeCall, MaxInstructions>;
type Trader = (
FixedRateOfFungible<XUsdPerSecond, ()>,
UsingComponents<WeightToFee, SelfReserve, AccountId, Balances, DealWithFees<Runtime>>,
);
type ResponseHandler = PolkadotXcm;
Expand Down
2 changes: 2 additions & 0 deletions runtime/trappist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ pallet-utility = { git = "https://github.com/paritytech/substrate", default-feat
pallet-treasury = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.40" }

# Cumulus dependencies
assets-common = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40", default-features = false }
cumulus-pallet-aura-ext = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40", default-features = false }
cumulus-pallet-dmp-queue = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40", default-features = false }
cumulus-pallet-parachain-system = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.40", default-features = false }
Expand Down Expand Up @@ -156,6 +157,7 @@ std = [
"pallet-uniques/std",
"pallet-utility/std",
"pallet-xcm/std",
"assets-common/std",
"cumulus-pallet-aura-ext/std",
"cumulus-pallet-parachain-system/std",
"cumulus-pallet-xcm/std",
Expand Down
16 changes: 1 addition & 15 deletions runtime/trappist/src/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@ pub mod currency {

/// Fee-related.
pub mod fee {
use super::currency::CENTS;
use frame_support::weights::{
constants::{ExtrinsicBaseWeight, WEIGHT_REF_TIME_PER_SECOND},
constants::{ExtrinsicBaseWeight},
WeightToFeeCoefficient, WeightToFeeCoefficients, WeightToFeePolynomial,
};
use polkadot_core_primitives::Balance;
Expand All @@ -45,9 +44,6 @@ pub mod fee {
/// The block saturation level. Fees will be updates based on this value.
pub const TARGET_BLOCK_FULLNESS: Perbill = Perbill::from_percent(25);

//TODO: Update WeightToFee functionality to match cummulus implementation (Should be done in a
// separated issue)

/// Handles converting a weight scalar to a fee value, based on the scale and granularity of the
/// node's balance type.
///
Expand All @@ -74,14 +70,4 @@ pub mod fee {
}]
}
}

pub fn base_tx_fee() -> Balance {
CENTS / 10
}

pub fn default_fee_per_second() -> u128 {
let base_weight = Balance::from(ExtrinsicBaseWeight::get().ref_time());
let base_tx_per_second = (WEIGHT_REF_TIME_PER_SECOND as u128) / base_weight;
base_tx_per_second * base_tx_fee()
}
}
20 changes: 9 additions & 11 deletions runtime/trappist/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@
// limitations under the License.

use crate::{
constants::fee::default_fee_per_second, impls::ToAuthor, weights::TrappistDropAssetsWeigher,
AllPalletsWithSystem,
constants::fee::{WeightToFee}, impls::ToAuthor, weights::TrappistDropAssetsWeigher,
AllPalletsWithSystem,
};

use super::{
AccountId, AssetRegistry, Assets, Balance, Balances, ParachainInfo, ParachainSystem,
PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, WeightToFee, XcmpQueue,
PolkadotXcm, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin, XcmpQueue,
};
use frame_support::{
match_types, parameter_types,
Expand All @@ -46,7 +46,7 @@ use xcm::latest::{prelude::*, Fungibility::Fungible, MultiAsset, MultiLocation};
use xcm_builder::{
AccountId32Aliases, AllowKnownQueryResponses, AllowSubscriptionsFrom,
AllowTopLevelPaidExecutionFrom, AllowUnpaidExecutionFrom, AsPrefixedGeneralIndex,
ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FixedRateOfFungible, FungiblesAdapter,
ConvertedConcreteId, CurrencyAdapter, EnsureXcmOrigin, FungiblesAdapter,
IsConcrete, MintLocation, NativeAsset, NoChecking, ParentAsSuperuser, ParentIsPreset,
RelayChainAsNative, SiblingParachainAsNative, SiblingParachainConvertsVia,
SignedAccountId32AsNative, SignedToAccountId32, SovereignSignedViaLocation, TakeWeightCredit,
Expand Down Expand Up @@ -90,6 +90,11 @@ pub type LocationToAccountId = (
AccountId32Aliases<RelayNetwork, AccountId>,
);


/// `AssetId/Balancer` converter for `TrustBackedAssets`
pub type TrustBackedAssetsConvertedConcreteId =
assets_common::TrustBackedAssetsConvertedConcreteId<AssetsPalletLocation, Balance>;

/// Means for transacting the native currency on this chain.
pub type LocalAssetTransactor = CurrencyAdapter<
// Use this currency:
Expand Down Expand Up @@ -221,11 +226,6 @@ parameter_types! {
// Rockmine's Assets pallet index
pub RockmineAssetsPalletLocation: MultiLocation =
MultiLocation::new(1, X2(Parachain(1000), PalletInstance(50)));
pub XUsdPerSecond: (xcm::v3::AssetId, u128, u128) = (
MultiLocation::new(1, X3(Parachain(1000), PalletInstance(50), GeneralIndex(1))).into(),
default_fee_per_second() * 10,
0
);
}

//- From PR https://github.com/paritytech/cumulus/pull/936
Expand Down Expand Up @@ -270,9 +270,7 @@ impl xcm_executor::Config for XcmConfig {
RuntimeCall,
MaxInstructions,
>;
//TODO: Modify current config of Trader removing XUsdPerSecond Implementation
type Trader = (
FixedRateOfFungible<XUsdPerSecond, ()>,
UsingComponents<WeightToFee, SelfReserve, AccountId, Balances, ToAuthor<Runtime>>,
);
type ResponseHandler = PolkadotXcm;
Expand Down