Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moved traits from pallets to primitives/src/traits #1296

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"makefile.extensionOutputFolder": "./.vscode",
"rust-analyzer.cargo.features": "all"
"rust-analyzer.cargo.features": "all",
}
2 changes: 2 additions & 0 deletions Cargo.lock

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

5 changes: 2 additions & 3 deletions pallets/flexible-fee/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ use super::*;
use crate::{self as flexible_fee, tests::CHARLIE};
use bifrost_asset_registry::AssetIdMaps;
use bifrost_primitives::{
Balance, CurrencyId, DerivativeAccountHandler, DerivativeIndex, ExtraFeeInfo, MessageId,
ParaId, TokenSymbol, VTokenSupplyProvider, VKSM,
xcm_interface::XcmHelper, Balance, CurrencyId, DerivativeAccountHandler, DerivativeIndex,
ExtraFeeInfo, MessageId, ParaId, TokenSymbol, VTokenSupplyProvider, VKSM,
};
use bifrost_vtoken_voting::AccountVote;
use bifrost_xcm_interface::traits::XcmHelper;
use cumulus_primitives_core::ParaId as Pid;
use frame_support::{
derive_impl, ord_parameter_types, parameter_types,
Expand Down
1 change: 1 addition & 0 deletions pallets/parachain-staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ version = "3.0.1"
[dependencies]
log = { workspace = true }
serde = { workspace = true, features = ["derive"] }
bifrost-primitives = { workspace = true }

# Substrate
frame-benchmarking = { workspace = true, optional = true }
Expand Down
14 changes: 7 additions & 7 deletions pallets/parachain-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
mod delegation_requests;
pub mod inflation;
pub mod migrations;
pub mod traits;
pub mod types;
pub mod weights;

Expand All @@ -67,12 +66,11 @@ mod tests;
pub use delegation_requests::{CancelledScheduledRequest, DelegationAction, ScheduledRequest};
use frame_support::pallet;
pub use inflation::{InflationInfo, Range};
pub use pallet::*;
pub use traits::*;
pub use pallet::{RoundIndex, *};
pub use types::*;
use weights::WeightInfo;
pub use RoundIndex;
pub type AccountIdOf<T> = <T as frame_system::Config>::AccountId;
pub use bifrost_primitives::parachain_staking::*;
use frame_support::pallet_prelude::DispatchResultWithPostInfo;

#[pallet]
Expand All @@ -87,7 +85,6 @@ pub mod pallet {
};
use frame_system::pallet_prelude::*;
use pallet_session::ShouldEndSession;
// use parity_scale_codec::Decode;
use sp_runtime::{
traits::{AccountIdConversion, Saturating, Zero},
Perbill, Percent, Permill,
Expand All @@ -99,10 +96,13 @@ pub mod pallet {
use crate::{
delegation_requests::{CancelledScheduledRequest, DelegationAction, ScheduledRequest},
set::OrderedSet,
traits::*,
// traits::*,
types::*,
InflationInfo, Range, WeightInfo,
InflationInfo,
Range,
WeightInfo,
};
use bifrost_primitives::parachain_staking::*;

/// Pallet for parachain staking
#[pallet::pallet]
Expand Down
2 changes: 1 addition & 1 deletion pallets/salp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ pub mod pallet {
// Import various types used to declare pallet in scope.
use bifrost_primitives::{
BancorHandler, CurrencyId, CurrencyId::VSBond, LeasePeriod, MessageId, Nonce, ParaId,
XcmHelper,
};
use bifrost_xcm_interface::traits::XcmHelper;
use frame_support::{
pallet_prelude::{storage::child, *},
sp_runtime::traits::{AccountIdConversion, CheckedAdd, Hash, Saturating, Zero},
Expand Down
5 changes: 2 additions & 3 deletions pallets/salp/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,9 @@
use crate::*;
use bifrost_asset_registry::AssetIdMaps;
use bifrost_primitives::{
Amount, Balance, CurrencyId, CurrencyId::*, DoNothingExecuteXcm, MessageId, ParaId,
SlpOperator, SlpxOperator, TokenSymbol, TokenSymbol::*, VKSM,
xcm_interface::XcmHelper, Amount, Balance, CurrencyId, CurrencyId::*, DoNothingExecuteXcm,
MessageId, ParaId, SlpOperator, SlpxOperator, TokenSymbol, TokenSymbol::*, VKSM,
};
use bifrost_xcm_interface::traits::XcmHelper;
use cumulus_primitives_core::ParaId as Pid;
use frame_support::{
construct_runtime, derive_impl, ord_parameter_types, parameter_types,
Expand Down
6 changes: 4 additions & 2 deletions pallets/slp/src/agents/astar_agent/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ use crate::{
Ledger, QueryId, SubstrateLedger, SubstrateLedgerUpdateEntry,
SubstrateLedgerUpdateOperation, UnlockChunk, ValidatorsByDelegatorUpdateEntry,
},
traits::{QueryResponseManager, StakingAgent},
AccountIdOf, BalanceOf, Config, DelegatorLedgerXcmUpdateQueue, DelegatorLedgers,
DelegatorsMultilocation2Index, LedgerUpdateEntry, MinimumsAndMaximums, Pallet, TimeUnit,
Validators,
};
use bifrost_primitives::{CurrencyId, VtokenMintingOperator, XcmOperationType, ASTR_TOKEN_ID};
use bifrost_primitives::{
CurrencyId, QueryResponseManager, StakingAgent, VtokenMintingOperator, XcmOperationType,
ASTR_TOKEN_ID,
};
use core::marker::PhantomData;
use frame_support::{ensure, traits::Get};
use frame_system::pallet_prelude::BlockNumberFor;
Expand Down
5 changes: 3 additions & 2 deletions pallets/slp/src/agents/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ use crate::{
primitives::{
ParachainStakingLedgerUpdateEntry, ParachainStakingLedgerUpdateOperation, TIMEOUT_BLOCKS,
},
traits::QueryResponseManager,
vec, AccountIdOf, BalanceOf, BlockNumberFor, BoundedVec, Config, CurrencyDelays,
DelegationsOccupied, DelegatorLatestTuneRecord, DelegatorLedgerXcmUpdateQueue,
DelegatorLedgers, DelegatorNextIndex, DelegatorsIndex2Multilocation,
DelegatorsMultilocation2Index, Encode, Event, FeeSources, Ledger, LedgerUpdateEntry,
MinimumsAndMaximums, Pallet, TimeUnit, Validators, Vec, Weight, XcmOperationType, Zero, ASTR,
BNC, DOT, GLMR, KSM, MANTA, MOVR, PHA,
};
use bifrost_primitives::{CurrencyId, VtokenMintingOperator, XcmDestWeightAndFeeHandler};
use bifrost_primitives::{
CurrencyId, QueryResponseManager, VtokenMintingOperator, XcmDestWeightAndFeeHandler,
};
use frame_support::{dispatch::GetDispatchInfo, ensure, traits::Len};
use orml_traits::{MultiCurrency, XcmTransfer};
use polkadot_parachain_primitives::primitives::Sibling;
Expand Down
3 changes: 1 addition & 2 deletions pallets/slp/src/agents/filecoin_agent/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@
use crate::{
pallet::{Error, Event},
primitives::{FilecoinLedger, Ledger},
traits::StakingAgent,
AccountIdOf, BalanceOf, BoundedVec, Config, DelegatorLatestTuneRecord, DelegatorLedgers,
LedgerUpdateEntry, MinimumsAndMaximums, Pallet, TimeUnit, Validators, ValidatorsByDelegator,
ValidatorsByDelegatorUpdateEntry,
};
use bifrost_primitives::{CurrencyId, VtokenMintingOperator};
use bifrost_primitives::{CurrencyId, StakingAgent, VtokenMintingOperator};
use core::marker::PhantomData;
use frame_support::ensure;
use orml_traits::MultiCurrency;
Expand Down
3 changes: 1 addition & 2 deletions pallets/slp/src/agents/parachain_staking_agent/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,14 @@ use crate::{
OneToManyScheduledRequest, ParachainStakingLedgerUpdateEntry,
ParachainStakingLedgerUpdateOperation, QueryId,
},
traits::{QueryResponseManager, StakingAgent},
AccountIdOf, BalanceOf, Config, DelegatorLedgerXcmUpdateQueue, DelegatorLedgers,
DelegatorsMultilocation2Index, LedgerUpdateEntry, MinimumsAndMaximums, Pallet, TimeUnit,
Validators, ValidatorsByDelegatorUpdateEntry, BNC,
};
use bifrost_parachain_staking::ParachainStakingInterface;
use bifrost_primitives::{
currency::{GLMR, MANTA, MOVR},
CurrencyId, VtokenMintingOperator, XcmOperationType,
CurrencyId, QueryResponseManager, StakingAgent, VtokenMintingOperator, XcmOperationType,
};
use core::marker::PhantomData;
use frame_support::{ensure, traits::Get};
Expand Down
5 changes: 3 additions & 2 deletions pallets/slp/src/agents/phala_agent/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ use crate::{
primitives::{
Ledger, PhalaLedger, QueryId, SubstrateLedgerUpdateEntry, SubstrateLedgerUpdateOperation,
},
traits::{QueryResponseManager, StakingAgent},
AccountIdOf, BalanceOf, Config, CurrencyId, DelegatorLedgerXcmUpdateQueue, DelegatorLedgers,
DelegatorsMultilocation2Index, Hash, LedgerUpdateEntry, MinimumsAndMaximums, Pallet, TimeUnit,
Validators, ValidatorsByDelegatorUpdateEntry,
};
use bifrost_primitives::{TokenSymbol, VtokenMintingOperator, XcmOperationType};
use bifrost_primitives::{
QueryResponseManager, StakingAgent, TokenSymbol, VtokenMintingOperator, XcmOperationType,
};
use core::marker::PhantomData;
use frame_support::{ensure, traits::Get};
use frame_system::pallet_prelude::BlockNumberFor;
Expand Down
5 changes: 2 additions & 3 deletions pallets/slp/src/agents/polkadot_agent/agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ use crate::{
SubstrateLedgerUpdateOperation, SubstrateValidatorsByDelegatorUpdateEntry, UnlockChunk,
ValidatorsByDelegatorUpdateEntry,
},
traits::{QueryResponseManager, StakingAgent},
AccountIdOf, BalanceOf, BoundedVec, Config, DelegatorLedgerXcmUpdateQueue, DelegatorLedgers,
DelegatorsMultilocation2Index, LedgerUpdateEntry, MinimumsAndMaximums, Pallet, TimeUnit,
ValidatorsByDelegator, ValidatorsByDelegatorXcmUpdateQueue,
};
use bifrost_primitives::{
currency::KSM, CurrencyId, VtokenMintingOperator, XcmDestWeightAndFeeHandler, XcmOperationType,
DOT,
currency::KSM, CurrencyId, QueryResponseManager, StakingAgent, VtokenMintingOperator,
XcmDestWeightAndFeeHandler, XcmOperationType, DOT,
};
use core::marker::PhantomData;
use frame_support::{ensure, traits::Get};
Expand Down
3 changes: 1 addition & 2 deletions pallets/slp/src/agents/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ use crate::{
Pallet, TrailingZeroInput, Validators, ValidatorsByDelegatorUpdateEntry, ASTR, DOT, GLMR, H160,
KSM, MANTA, MOVR, PHA,
};
use bifrost_primitives::CurrencyId;
use bifrost_xcm_interface::traits::parachains;
use bifrost_primitives::{parachains, CurrencyId};
use frame_support::ensure;
use parity_scale_codec::Encode;
use sp_core::Get;
Expand Down
3 changes: 1 addition & 2 deletions pallets/slp/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ pub use crate::{
Delays, LedgerUpdateEntry, MinimumsMaximums, QueryId, SubstrateLedger,
ValidatorsByDelegatorUpdateEntry,
},
traits::{OnRefund, QueryResponseManager, StakingAgent},
Junction::AccountId32,
Junctions::X1,
};
use bifrost_asset_registry::AssetMetadata;
use bifrost_parachain_staking::ParachainStakingInterface;
pub use bifrost_primitives::slp::{OnRefund, QueryResponseManager, StakingAgent};
use bifrost_primitives::{
currency::{BNC, KSM, MANTA, MOVR, PHA},
traits::XcmDestWeightAndFeeHandler,
Expand Down Expand Up @@ -63,7 +63,6 @@ pub mod migrations;
mod mocks;
pub mod primitives;
mod tests;
pub mod traits;
pub mod weights;

#[cfg(feature = "runtime-benchmarks")]
Expand Down
Loading