Skip to content

Commit

Permalink
Moved palletId in runtime to primitives (#1443)
Browse files Browse the repository at this point in the history
  • Loading branch information
MJLNSN authored Sep 29, 2024
1 parent 766e60f commit 0aaf2cd
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 56 deletions.
16 changes: 11 additions & 5 deletions primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,10 @@ pub type TimeStampedPrice = orml_oracle::TimestampedValue<Price, Moment>;
// Pallet Id
parameter_types! {
pub const BifrostCrowdloanId: PalletId = PalletId(*b"bf/salp#");
pub BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin");
pub BifrostExitAccount: PalletId = PalletId(*b"bf/vtout");
pub BifrostVsbondAccount: PalletId = PalletId(*b"bf/salpb");
pub const BifrostEntranceAccount: PalletId = PalletId(*b"bf/vtkin");
pub const BifrostExitAccount: PalletId = PalletId(*b"bf/vtout");
pub const BifrostSalpLiteCrowdloanId: PalletId = PalletId(*b"bf/salpl");
pub const BifrostVsbondAccount: PalletId = PalletId(*b"bf/salpb");
pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck");
pub const BuybackPalletId: PalletId = PalletId(*b"bf/salpc");
pub const CloudsPalletId: PalletId = PalletId(*b"bf/cloud");
Expand All @@ -174,17 +175,22 @@ parameter_types! {
pub const FarmingRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmrir");
pub const FeeSharePalletId: PalletId = PalletId(*b"bf/feesh");
pub const FlexibleFeePalletId: PalletId = PalletId(*b"bf/flexi");
pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo");
pub IncentivePalletId: PalletId = PalletId(*b"bf/bbict");
pub const IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo");
pub const IncentivePalletId: PalletId = PalletId(*b"bf/bbict");
pub const LendMarketPalletId: PalletId = PalletId(*b"bf/ldmkt");
pub const LighteningRedeemPalletId: PalletId = PalletId(*b"lighten#");
pub const LiquidityAccount: PalletId = PalletId(*b"bf/liqdt");
pub const LiquidityMiningDOTPalletId: PalletId = PalletId(*b"bf/lmdot");
pub const LiquidityMiningPalletId: PalletId = PalletId(*b"mining##");
pub const MerkleDirtributorPalletId: PalletId = PalletId(*b"bf/mklds");
pub const OraclePalletId: PalletId = PalletId(*b"bf/oracl");
pub const ParachainStakingPalletId: PalletId = PalletId(*b"bf/stake");
pub const SlpEntrancePalletId: PalletId = PalletId(*b"bf/vtkin");
pub const SlpExitPalletId: PalletId = PalletId(*b"bf/vtout");
pub const StableAssetPalletId: PalletId = PalletId(*b"nuts/sta");
pub const SystemMakerPalletId: PalletId = PalletId(*b"bf/sysmk");
pub const SystemStakingPalletId: PalletId = PalletId(*b"bf/sysst");
pub const TreasuryPalletId: PalletId = PalletId(*b"bf/trsry");
pub const VBNCConvertPalletId: PalletId = PalletId(*b"bf/vbncc");
pub const VeMintingPalletId: PalletId = PalletId(*b"bf/vemnt");
pub const VsbondAuctionPalletId: PalletId = PalletId(*b"bf/vsbnd");
Expand Down
34 changes: 9 additions & 25 deletions runtime/bifrost-kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ use bifrost_slp::{DerivativeAccountProvider, QueryResponseManager};
use core::convert::TryInto;
// A few exports that help ease life for downstream crates.
pub use bifrost_parachain_staking::{InflationInfo, Range};
use bifrost_primitives::{
BifrostCrowdloanId, BifrostVsbondAccount, BuybackPalletId, CommissionPalletId,
FarmingBoostPalletId, FarmingGaugeRewardIssuerPalletId, FarmingKeeperPalletId,
FarmingRewardIssuerPalletId, FeeSharePalletId, FlexibleFeePalletId, IncentivePoolAccount,
LendMarketPalletId, MerkleDirtributorPalletId, OraclePalletId, ParachainStakingPalletId,
SlpEntrancePalletId, SlpExitPalletId, SystemMakerPalletId, SystemStakingPalletId,
TreasuryPalletId, VBNCConvertPalletId, VsbondAuctionPalletId,
};
pub use frame_support::{
construct_runtime, match_types, parameter_types,
traits::{
Expand Down Expand Up @@ -205,35 +213,11 @@ parameter_types! {
}

parameter_types! {
pub const TreasuryPalletId: PalletId = PalletId(*b"bf/trsry");
pub const BifrostCrowdloanId: PalletId = PalletId(*b"bf/salp#");
pub const BifrostSalpLiteCrowdloanId: PalletId = PalletId(*b"bf/salpl");
pub const LiquidityMiningPalletId: PalletId = PalletId(*b"bf/lm###");
pub const LiquidityMiningDOTPalletId: PalletId = PalletId(*b"bf/lmdot");
pub const LighteningRedeemPalletId: PalletId = PalletId(*b"bf/ltnrd");
pub const MerkleDirtributorPalletId: PalletId = PalletId(*b"bf/mklds");
pub const VsbondAuctionPalletId: PalletId = PalletId(*b"bf/vsbnd");
pub const ParachainStakingPalletId: PalletId = PalletId(*b"bf/stake");
pub const BifrostVsbondPalletId: PalletId = PalletId(*b"bf/salpb");
pub const SlpEntrancePalletId: PalletId = PalletId(*b"bf/vtkin");
pub const SlpExitPalletId: PalletId = PalletId(*b"bf/vtout");
pub const StableAmmPalletId: PalletId = PalletId(*b"bf/stamm");
pub const FarmingKeeperPalletId: PalletId = PalletId(*b"bf/fmkpr");
pub const FarmingRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmrir");
pub const SystemStakingPalletId: PalletId = PalletId(*b"bf/sysst");
pub const BuybackPalletId: PalletId = PalletId(*b"bf/salpc");
pub const SystemMakerPalletId: PalletId = PalletId(*b"bf/sysmk");
pub const FeeSharePalletId: PalletId = PalletId(*b"bf/feesh");
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub const FarmingBoostPalletId: PalletId = PalletId(*b"bf/fmbst");
pub const LendMarketPalletId: PalletId = PalletId(*b"bf/ldmkt");
pub const OraclePalletId: PalletId = PalletId(*b"bf/oracl");
pub const StableAssetPalletId: PalletId = PalletId(*b"bf/stabl");
pub const CommissionPalletId: PalletId = PalletId(*b"bf/comms");
pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo");
pub const FarmingGaugeRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmgar");
pub const FlexibleFeePalletId: PalletId = PalletId(*b"bf/flexi");
pub const VBNCConvertPalletId: PalletId = PalletId(*b"bf/vbncc");
}

impl frame_system::Config for Runtime {
Expand Down Expand Up @@ -1274,7 +1258,7 @@ impl bifrost_vstoken_conversion::Config for Runtime {
type RelayCurrencyId = RelayCurrencyId;
type TreasuryAccount = BifrostTreasuryAccount;
type ControlOrigin = CoreAdminOrCouncil;
type VsbondAccount = BifrostVsbondPalletId;
type VsbondAccount = BifrostVsbondAccount;
type CurrencyIdConversion = AssetIdMaps<Runtime>;
type WeightInfo = weights::bifrost_vstoken_conversion::BifrostWeight<Runtime>;
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/bifrost-kusama/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ impl Contains<AccountId> for DustRemovalWhitelist {
let whitelist: Vec<AccountId> = vec![
TreasuryPalletId::get().into_account_truncating(),
BifrostCrowdloanId::get().into_account_truncating(),
BifrostVsbondPalletId::get().into_account_truncating(),
BifrostVsbondAccount::get().into_account_truncating(),
SlpEntrancePalletId::get().into_account_truncating(),
SlpExitPalletId::get().into_account_truncating(),
BuybackPalletId::get().into_account_truncating(),
Expand Down
33 changes: 9 additions & 24 deletions runtime/bifrost-polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,14 @@ use bifrost_slp::{DerivativeAccountProvider, QueryResponseManager};
use core::convert::TryInto;
use pallet_traits::evm::InspectEvmAccounts;
// A few exports that help ease life for downstream crates.
use bifrost_primitives::{
BifrostCrowdloanId, BifrostVsbondAccount, BuyBackAccount, BuybackPalletId, CloudsPalletId,
CommissionPalletId, FarmingBoostPalletId, FarmingGaugeRewardIssuerPalletId,
FarmingKeeperPalletId, FarmingRewardIssuerPalletId, FeeSharePalletId, FlexibleFeePalletId,
IncentivePalletId, IncentivePoolAccount, LendMarketPalletId, LiquidityAccount,
MerkleDirtributorPalletId, OraclePalletId, SlpEntrancePalletId, SlpExitPalletId,
SystemMakerPalletId, SystemStakingPalletId, TreasuryPalletId,
};
use cumulus_pallet_parachain_system::{RelayNumberStrictlyIncreases, RelaychainDataProvider};
pub use frame_support::{
construct_runtime, match_types, parameter_types,
Expand Down Expand Up @@ -226,31 +234,8 @@ parameter_types! {
}

parameter_types! {
pub const TreasuryPalletId: PalletId = PalletId(*b"bf/trsry");
pub const BifrostCrowdloanId: PalletId = PalletId(*b"bf/salp#");
pub const MerkleDirtributorPalletId: PalletId = PalletId(*b"bf/mklds");
pub const BifrostVsbondPalletId: PalletId = PalletId(*b"bf/salpb");
pub const SlpEntrancePalletId: PalletId = PalletId(*b"bf/vtkin");
pub const SlpExitPalletId: PalletId = PalletId(*b"bf/vtout");
pub const FarmingKeeperPalletId: PalletId = PalletId(*b"bf/fmkpr");
pub const FarmingRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmrir");
pub const SystemStakingPalletId: PalletId = PalletId(*b"bf/sysst");
pub const BuybackPalletId: PalletId = PalletId(*b"bf/salpc");
pub const SystemMakerPalletId: PalletId = PalletId(*b"bf/sysmk");
pub const FeeSharePalletId: PalletId = PalletId(*b"bf/feesh");
pub CheckingAccount: AccountId = PolkadotXcm::check_account();
pub const IncentivePalletId: PalletId = PalletId(*b"bf/bbict");
pub const FarmingBoostPalletId: PalletId = PalletId(*b"bf/fmbst");
pub const LendMarketPalletId: PalletId = PalletId(*b"bf/ldmkt");
pub const OraclePalletId: PalletId = PalletId(*b"bf/oracl");
pub const StableAssetPalletId: PalletId = PalletId(*b"bf/stabl");
pub const CommissionPalletId: PalletId = PalletId(*b"bf/comms");
pub const CloudsPalletId: PalletId = PalletId(*b"bf/cloud");
pub IncentivePoolAccount: PalletId = PalletId(*b"bf/inpoo");
pub const FarmingGaugeRewardIssuerPalletId: PalletId = PalletId(*b"bf/fmgar");
pub const BuyBackAccount: PalletId = PalletId(*b"bf/bybck");
pub const LiquidityAccount: PalletId = PalletId(*b"bf/liqdt");
pub const FlexibleFeePalletId: PalletId = PalletId(*b"bf/flexi");
}

impl frame_system::Config for Runtime {
Expand Down Expand Up @@ -1135,7 +1120,7 @@ impl bifrost_vstoken_conversion::Config for Runtime {
type RelayCurrencyId = RelayCurrencyId;
type TreasuryAccount = BifrostTreasuryAccount;
type ControlOrigin = CoreAdminOrCouncil;
type VsbondAccount = BifrostVsbondPalletId;
type VsbondAccount = BifrostVsbondAccount;
type CurrencyIdConversion = AssetIdMaps<Runtime>;
type WeightInfo = weights::bifrost_vstoken_conversion::BifrostWeight<Runtime>;
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/bifrost-polkadot/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ impl Contains<AccountId> for DustRemovalWhitelist {
let whitelist: Vec<AccountId> = vec![
TreasuryPalletId::get().into_account_truncating(),
BifrostCrowdloanId::get().into_account_truncating(),
BifrostVsbondPalletId::get().into_account_truncating(),
BifrostVsbondAccount::get().into_account_truncating(),
SlpEntrancePalletId::get().into_account_truncating(),
SlpExitPalletId::get().into_account_truncating(),
BuybackPalletId::get().into_account_truncating(),
Expand Down

0 comments on commit 0aaf2cd

Please sign in to comment.