Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
1 change: 1 addition & 0 deletions runtime/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1296,6 +1296,7 @@ macro_rules! impl_config_traits {
type ExternalFees = MarketCreatorFee;
type MarketCommons = MarketCommons;
type MultiCurrency = AssetManager;
type PoolId = MarketId;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = zrml_neo_swaps::weights::WeightInfo<Runtime>;
type MaxLiquidityTreeDepth = MaxLiquidityTreeDepth;
Expand Down
1 change: 1 addition & 0 deletions zrml/hybrid-router/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ impl zrml_neo_swaps::Config for Runtime {
type ExternalFees = ExternalFees<Runtime, FeeAccount>;
type MarketCommons = MarketCommons;
type RuntimeEvent = RuntimeEvent;
type PoolId = MarketId;
type MaxLiquidityTreeDepth = MaxLiquidityTreeDepth;
type MaxSwapFee = NeoMaxSwapFee;
type PalletId = NeoSwapsPalletId;
Expand Down
21 changes: 17 additions & 4 deletions zrml/neo-swaps/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,20 @@ mod pallet {
pallet_prelude::StorageMap,
require_transactional,
traits::{Get, IsType, StorageVersion},
transactional, PalletError, PalletId, Twox64Concat,
transactional, PalletError, PalletId, Parameter, Twox64Concat,
};
use frame_system::{
ensure_signed,
pallet_prelude::{BlockNumberFor, OriginFor},
};
use orml_traits::MultiCurrency;
use parity_scale_codec::{Decode, Encode};
use parity_scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;
use sp_runtime::{
traits::{AccountIdConversion, CheckedSub, Saturating, Zero},
traits::{
AccountIdConversion, AtLeast32Bit, CheckedSub, MaybeSerializeDeserialize, Member,
Saturating, Zero,
},
DispatchError, DispatchResult, Perbill, RuntimeDebug, SaturatedConversion,
};
use zeitgeist_primitives::{
Expand Down Expand Up @@ -113,6 +116,7 @@ mod pallet {
<<T as Config>::MarketCommons as MarketCommonsPalletApi>::MarketId;
pub(crate) type LiquidityTreeOf<T> = LiquidityTree<T, <T as Config>::MaxLiquidityTreeDepth>;
pub(crate) type PoolOf<T> = Pool<T, LiquidityTreeOf<T>, MaxAssets>;
pub(crate) type PoolIdOf<T> = <T as Config>::PoolId;
pub(crate) type AmmTradeOf<T> = AmmTrade<BalanceOf<T>>;

#[pallet::config]
Expand All @@ -136,10 +140,19 @@ mod pallet {
AccountId = Self::AccountId,
BlockNumber = BlockNumberFor<Self>,
Balance = BalanceOf<Self>,
MarketId = Self::PoolId,
>;

type MultiCurrency: MultiCurrency<Self::AccountId, CurrencyId = AssetOf<Self>>;

type PoolId: AtLeast32Bit
+ Copy
+ Default
+ MaxEncodedLen
+ MaybeSerializeDeserialize
+ Member
+ Parameter;

type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;

type WeightInfo: WeightInfoZeitgeist;
Expand All @@ -161,7 +174,7 @@ mod pallet {
pub struct Pallet<T>(PhantomData<T>);

#[pallet::storage]
pub(crate) type Pools<T: Config> = StorageMap<_, Twox64Concat, MarketIdOf<T>, PoolOf<T>>;
pub(crate) type Pools<T: Config> = StorageMap<_, Twox64Concat, PoolIdOf<T>, PoolOf<T>>;

#[pallet::event]
#[pallet::generate_deposit(fn deposit_event)]
Expand Down
3 changes: 2 additions & 1 deletion zrml/neo-swaps/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ construct_runtime!(
);

impl crate::Config for Runtime {
type MultiCurrency = AssetManager;
type CompleteSetOperations = PredictionMarkets;
type ExternalFees = ExternalFees<Runtime, FeeAccount>;
type MarketCommons = MarketCommons;
type MultiCurrency = AssetManager;
type PoolId = MarketId;
type RuntimeEvent = RuntimeEvent;
type MaxLiquidityTreeDepth = MaxLiquidityTreeDepth;
type MaxSwapFee = NeoMaxSwapFee;
Expand Down