Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
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
17 changes: 10 additions & 7 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use frame_support::{
construct_runtime,
dispatch::DispatchClass,
instances::{Instance1, Instance2},
ord_parameter_types,
pallet_prelude::Get,
parameter_types,
traits::{
Expand All @@ -48,7 +49,7 @@ use frame_support::{
};
use frame_system::{
limits::{BlockLength, BlockWeights},
EnsureRoot, EnsureRootWithSuccess, EnsureSigned, EnsureWithSuccess,
EnsureRoot, EnsureRootWithSuccess, EnsureSigned, EnsureSignedBy, EnsureWithSuccess,
};
pub use node_primitives::{AccountId, Signature};
use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment};
Expand All @@ -70,8 +71,8 @@ use sp_runtime::{
curve::PiecewiseLinear,
generic, impl_opaque_keys,
traits::{
self, BlakeTwo256, Block as BlockT, Bounded, ConvertInto, NumberFor, OpaqueKeys,
SaturatedConversion, StaticLookup,
self, AccountIdConversion, BlakeTwo256, Block as BlockT, Bounded, ConvertInto, NumberFor,
OpaqueKeys, SaturatedConversion, StaticLookup,
},
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Percent, Permill, Perquintill,
Expand Down Expand Up @@ -1485,12 +1486,17 @@ impl pallet_assets::Config<Instance1> for Runtime {
type BenchmarkHelper = ();
}

ord_parameter_types! {
pub const DexOrigin: AccountId = AccountIdConversion::<AccountId>::into_account_truncating(&DexPalletId::get());
}

impl pallet_assets::Config<Instance2> for Runtime {
type RuntimeEvent = RuntimeEvent;
type Balance = u128;
type AssetId = u32;
type AssetIdParameter = u32;
type Currency = Balances;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSignedBy<DexOrigin, AccountId>>;
type ForceOrigin = EnsureRoot<AccountId>;
type AssetDeposit = AssetDeposit;
type AssetAccountDeposit = ConstU128<DOLLARS>;
Expand Down Expand Up @@ -1574,9 +1580,6 @@ impl pallet_uniques::Config for Runtime {
type CollectionId = u32;
type ItemId = u32;
type Currency = Balances;
type CurrencyBalance = <Self as pallet_balances::Config>::Balance;
type Assets = Assets;
type AssetId = <Self as pallet_assets::Config<Instance1>>::AssetId;
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
type CollectionDeposit = CollectionDeposit;
type ItemDeposit = ItemDeposit;
Expand Down
10 changes: 5 additions & 5 deletions frame/dex/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate as pallet_dex;
use frame_support::{
construct_runtime,
instances::{Instance1, Instance2},
parameter_types,
ord_parameter_types, parameter_types,
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64},
PalletId,
};
Expand All @@ -32,7 +32,7 @@ use sp_core::H256;
use sp_keystore::{testing::KeyStore, KeystoreExt};
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
traits::{AccountIdConversion, BlakeTwo256, IdentityLookup},
};
use std::sync::Arc;

Expand Down Expand Up @@ -119,7 +119,7 @@ impl pallet_assets::Config<Instance2> for Test {
type AssetId = u32;
type AssetIdParameter = u32;
type Currency = Balances;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSignedBy<DexAccount, u64>>;
type CreateOrigin = AsEnsureOriginWithArg<EnsureSignedBy<DexOrigin, u64>>;
type ForceOrigin = frame_system::EnsureRoot<u64>;
type AssetDeposit = ConstU64<0>;
type AssetAccountDeposit = ConstU64<0>;
Expand All @@ -137,8 +137,8 @@ parameter_types! {
pub storage AllowMultiAssetPools: bool = true;
}

frame_support::ord_parameter_types! {
pub const DexAccount: u64 = 33; //TODO: this should be DexPalletId
ord_parameter_types! {
pub const DexOrigin: u64 = AccountIdConversion::<u64>::into_account_truncating(&DexPalletId::get());
}

impl Config for Test {
Expand Down