Skip to content

Commit

Permalink
Allow token transfer except BNC and ZLK (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
ark930 authored Oct 11, 2021
1 parent 249ea05 commit 1f13cc5
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 25 deletions.
53 changes: 33 additions & 20 deletions runtime/bifrost/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,43 +184,56 @@ pub struct CallFilter;
impl Contains<Call> for CallFilter {
fn contains(c: &Call) -> bool {
match *c {
// calls allowed
// vstoken transfer
// call banned

// BNC transfer
Call::Currencies(orml_currencies::Call::transfer_native_currency(..)) => false,
Call::Currencies(orml_currencies::Call::transfer(
_,
CurrencyId::VSToken(TokenSymbol::KSM),
CurrencyId::Native(TokenSymbol::BNC),
_,
)) => true,
)) => false,
Call::Tokens(orml_tokens::Call::transfer(
_,
CurrencyId::VSToken(TokenSymbol::KSM),
CurrencyId::Native(TokenSymbol::BNC),
_,
)) => true,
)) => false,
Call::Tokens(orml_tokens::Call::transfer_all(
_,
CurrencyId::VSToken(TokenSymbol::KSM),
CurrencyId::Native(TokenSymbol::BNC),
_,
)) => true,
)) => false,
Call::Tokens(orml_tokens::Call::transfer_keep_alive(
_,
CurrencyId::VSToken(TokenSymbol::KSM),
CurrencyId::Native(TokenSymbol::BNC),
_,
)) => true,
)) => false,

// vsbond transfer
Call::Currencies(orml_currencies::Call::transfer(_, CurrencyId::VSBond(..), _)) => true,
Call::Tokens(orml_tokens::Call::transfer(_, CurrencyId::VSBond(..), _)) => true,
Call::Tokens(orml_tokens::Call::transfer_all(_, CurrencyId::VSBond(..), _)) => true,
Call::Tokens(orml_tokens::Call::transfer_keep_alive(_, CurrencyId::VSBond(..), _)) =>
true,
// ZLK transfer
Call::Currencies(orml_currencies::Call::transfer(
_,
CurrencyId::Token(TokenSymbol::ZLK),
_,
)) => false,
Call::Tokens(orml_tokens::Call::transfer(
_,
CurrencyId::Token(TokenSymbol::ZLK),
_,
)) => false,
Call::Tokens(orml_tokens::Call::transfer_all(
_,
CurrencyId::Token(TokenSymbol::ZLK),
_,
)) => false,
Call::Tokens(orml_tokens::Call::transfer_keep_alive(
_,
CurrencyId::Token(TokenSymbol::ZLK),
_,
)) => false,

// call banned
Call::Balances(_) => false,
Call::Vesting(_) => false,
Call::Tokens(_) => false,
Call::PhragmenElection(_) => false,
Call::Currencies(_) => false,
// Call::Currencies(orml_currencies::Call::transfer_native_currency(..)) => false,
_ => true,
}
}
Expand Down
7 changes: 2 additions & 5 deletions runtime/common/src/xcm_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
use codec::{Decode, Encode};
pub use cumulus_primitives_core::ParaId;
use frame_support::{
sp_runtime::traits::{CheckedConversion, Convert, Zero},
sp_runtime::traits::{CheckedConversion, Convert},
traits::{Contains, Get},
weights::Weight,
};
Expand All @@ -29,10 +29,7 @@ use polkadot_parachain::primitives::Sibling;
use sp_std::{convert::TryFrom, marker::PhantomData};
use xcm::latest::prelude::*;
use xcm_builder::{AccountId32Aliases, NativeAsset, ParentIsDefault, SiblingParachainConvertsVia};
use xcm_executor::{
traits::{FilterAssetLocation, MatchesFungible, ShouldExecute, WeightTrader},
Assets,
};
use xcm_executor::traits::{FilterAssetLocation, MatchesFungible, ShouldExecute};

use crate::constants::parachains;

Expand Down

0 comments on commit 1f13cc5

Please sign in to comment.