Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Commit d75b442

Browse files
authored
fix kitchen sink (#12991)
* fix kitchen sink * Only the dex can mint lp_tokens
1 parent 20f1672 commit d75b442

File tree

2 files changed

+15
-12
lines changed

2 files changed

+15
-12
lines changed

bin/node/runtime/src/lib.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ use frame_support::{
3030
construct_runtime,
3131
dispatch::DispatchClass,
3232
instances::{Instance1, Instance2},
33+
ord_parameter_types,
3334
pallet_prelude::Get,
3435
parameter_types,
3536
traits::{
@@ -48,7 +49,7 @@ use frame_support::{
4849
};
4950
use frame_system::{
5051
limits::{BlockLength, BlockWeights},
51-
EnsureRoot, EnsureRootWithSuccess, EnsureSigned, EnsureWithSuccess,
52+
EnsureRoot, EnsureRootWithSuccess, EnsureSigned, EnsureSignedBy, EnsureWithSuccess,
5253
};
5354
pub use node_primitives::{AccountId, Signature};
5455
use node_primitives::{AccountIndex, Balance, BlockNumber, Hash, Index, Moment};
@@ -70,8 +71,8 @@ use sp_runtime::{
7071
curve::PiecewiseLinear,
7172
generic, impl_opaque_keys,
7273
traits::{
73-
self, BlakeTwo256, Block as BlockT, Bounded, ConvertInto, NumberFor, OpaqueKeys,
74-
SaturatedConversion, StaticLookup,
74+
self, AccountIdConversion, BlakeTwo256, Block as BlockT, Bounded, ConvertInto, NumberFor,
75+
OpaqueKeys, SaturatedConversion, StaticLookup,
7576
},
7677
transaction_validity::{TransactionPriority, TransactionSource, TransactionValidity},
7778
ApplyExtrinsicResult, FixedPointNumber, FixedU128, Perbill, Percent, Permill, Perquintill,
@@ -1485,12 +1486,17 @@ impl pallet_assets::Config<Instance1> for Runtime {
14851486
type BenchmarkHelper = ();
14861487
}
14871488

1489+
ord_parameter_types! {
1490+
pub const DexOrigin: AccountId = AccountIdConversion::<AccountId>::into_account_truncating(&DexPalletId::get());
1491+
}
1492+
14881493
impl pallet_assets::Config<Instance2> for Runtime {
14891494
type RuntimeEvent = RuntimeEvent;
14901495
type Balance = u128;
14911496
type AssetId = u32;
1497+
type AssetIdParameter = u32;
14921498
type Currency = Balances;
1493-
type CreateOrigin = AsEnsureOriginWithArg<EnsureSigned<AccountId>>;
1499+
type CreateOrigin = AsEnsureOriginWithArg<EnsureSignedBy<DexOrigin, AccountId>>;
14941500
type ForceOrigin = EnsureRoot<AccountId>;
14951501
type AssetDeposit = AssetDeposit;
14961502
type AssetAccountDeposit = ConstU128<DOLLARS>;
@@ -1574,9 +1580,6 @@ impl pallet_uniques::Config for Runtime {
15741580
type CollectionId = u32;
15751581
type ItemId = u32;
15761582
type Currency = Balances;
1577-
type CurrencyBalance = <Self as pallet_balances::Config>::Balance;
1578-
type Assets = Assets;
1579-
type AssetId = <Self as pallet_assets::Config<Instance1>>::AssetId;
15801583
type ForceOrigin = frame_system::EnsureRoot<AccountId>;
15811584
type CollectionDeposit = CollectionDeposit;
15821585
type ItemDeposit = ItemDeposit;

frame/dex/src/mock.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ use crate as pallet_dex;
2323
use frame_support::{
2424
construct_runtime,
2525
instances::{Instance1, Instance2},
26-
parameter_types,
26+
ord_parameter_types, parameter_types,
2727
traits::{AsEnsureOriginWithArg, ConstU32, ConstU64},
2828
PalletId,
2929
};
@@ -32,7 +32,7 @@ use sp_core::H256;
3232
use sp_keystore::{testing::KeyStore, KeystoreExt};
3333
use sp_runtime::{
3434
testing::Header,
35-
traits::{BlakeTwo256, IdentityLookup},
35+
traits::{AccountIdConversion, BlakeTwo256, IdentityLookup},
3636
};
3737
use std::sync::Arc;
3838

@@ -119,7 +119,7 @@ impl pallet_assets::Config<Instance2> for Test {
119119
type AssetId = u32;
120120
type AssetIdParameter = u32;
121121
type Currency = Balances;
122-
type CreateOrigin = AsEnsureOriginWithArg<EnsureSignedBy<DexAccount, u64>>;
122+
type CreateOrigin = AsEnsureOriginWithArg<EnsureSignedBy<DexOrigin, u64>>;
123123
type ForceOrigin = frame_system::EnsureRoot<u64>;
124124
type AssetDeposit = ConstU64<0>;
125125
type AssetAccountDeposit = ConstU64<0>;
@@ -137,8 +137,8 @@ parameter_types! {
137137
pub storage AllowMultiAssetPools: bool = true;
138138
}
139139

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

144144
impl Config for Test {

0 commit comments

Comments
 (0)