Skip to content

Commit

Permalink
Install asset-limit for pangolin
Browse files Browse the repository at this point in the history
  • Loading branch information
jiguantong committed Aug 15, 2023
1 parent 62fc666 commit 7268d83
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 1 deletion.
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ parachain-info = { git = "https://github.com/paritytech/c
# darwinia
crab-runtime = { path = "runtime/crab" }
darwinia-account-migration = { path = "pallet/account-migration", default-features = false }
darwinia-asset-limit = { path = "pallet/asset-limit", default-features = false}
darwinia-common-runtime = { path = "runtime/common", default-features = false }
darwinia-deposit = { path = "pallet/deposit", default-features = false }
darwinia-ecdsa-authority = { path = "pallet/ecdsa-authority", default-features = false }
Expand Down
3 changes: 2 additions & 1 deletion pallet/asset-limit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ pub mod pallet {
AssetLimitChanged { asset_location: T::ForeignAssetType, limit: dc_types::Balance },
}

#[allow(missing_docs)]
#[pallet::error]
pub enum Error<T> {
AssetDoesNotExist
Expand All @@ -75,7 +76,7 @@ pub mod pallet {
T::LimitModifierOrigin::ensure_origin(origin)?;

ensure!(
pallet_asset_manager::AssetTypeId::<T>::get(&asset_location).is_some();
pallet_asset_manager::AssetTypeId::<T>::get(&asset_location).is_some(),
Error::<T>::AssetDoesNotExist
);

Expand Down
3 changes: 3 additions & 0 deletions runtime/pangolin/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ cumulus-pallet-session-benchmarking = { workspace = true, optional = true }

# darwinia
darwinia-account-migration = { workspace = true }
darwinia-asset-limit = { workspace = true }
darwinia-common-runtime = { workspace = true }
darwinia-deposit = { workspace = true }
darwinia-ecdsa-authority = { workspace = true }
Expand Down Expand Up @@ -164,6 +165,7 @@ std = [

# darwinia
"darwinia-account-migration/std",
"darwinia-asset-limit/std",
"darwinia-common-runtime/std",
"darwinia-deposit/std",
"darwinia-ecdsa-authority/std",
Expand Down Expand Up @@ -360,6 +362,7 @@ try-runtime = [

# darwinia
"darwinia-account-migration/try-runtime",
"darwinia-asset-limit/try-runtime",
"darwinia-deposit/try-runtime",
"darwinia-ecdsa-authority/try-runtime",
"darwinia-message-gadget/try-runtime",
Expand Down
1 change: 1 addition & 0 deletions runtime/pangolin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ frame_support::construct_runtime! {
DmpQueue: cumulus_pallet_dmp_queue = 35,
AssetManager: pallet_asset_manager = 45,
XTokens: orml_xtokens = 46,
AssetLimit: darwinia_asset_limit = 47,

// EVM stuff.
Ethereum: pallet_ethereum = 36,
Expand Down
2 changes: 2 additions & 0 deletions runtime/pangolin/src/pallets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ mod asset_manager;

mod orml_xtokens;

mod asset_limit;

// EVM stuff.
mod ethereum;

Expand Down
25 changes: 25 additions & 0 deletions runtime/pangolin/src/pallets/asset_limit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// This file is part of Darwinia.
//
// Copyright (C) 2018-2023 Darwinia Network
// SPDX-License-Identifier: GPL-3.0
//
// Darwinia is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Darwinia is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Darwinia. If not, see <https://www.gnu.org/licenses/>.

// darwinia
use crate::*;

impl darwinia_asset_limit::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type LimitModifierOrigin = Root;
}

0 comments on commit 7268d83

Please sign in to comment.