diff --git a/runtime/common/src/lib.rs b/runtime/common/src/lib.rs index 804a4f6c..d8562fdd 100644 --- a/runtime/common/src/lib.rs +++ b/runtime/common/src/lib.rs @@ -134,4 +134,18 @@ pub mod proxy { Self::Any } } + + impl ProxyType { + pub fn is_superset(s: &ProxyType, o: &ProxyType) -> bool { + match (s, o) { + (x, y) if x == y => true, + (ProxyType::Any, _) => true, + (_, ProxyType::Any) => false, + (ProxyType::Assets, ProxyType::AssetOwner) => true, + (ProxyType::Assets, ProxyType::AssetManager) => true, + (ProxyType::NonTransfer, ProxyType::Collator) => true, + _ => false, + } + } + } } diff --git a/runtime/devnet/src/proxy_config.rs b/runtime/devnet/src/proxy_config.rs index fd8c4ec8..fad05383 100644 --- a/runtime/devnet/src/proxy_config.rs +++ b/runtime/devnet/src/proxy_config.rs @@ -89,15 +89,7 @@ impl InstanceFilter for ProxyType { } fn is_superset(&self, o: &Self) -> bool { - match (self, o) { - (x, y) if x == y => true, - (ProxyType::Any, _) => true, - (_, ProxyType::Any) => false, - (ProxyType::Assets, ProxyType::AssetOwner) => true, - (ProxyType::Assets, ProxyType::AssetManager) => true, - (ProxyType::NonTransfer, ProxyType::Collator) => true, - _ => false, - } + ProxyType::is_superset(self, o) } } diff --git a/runtime/testnet/src/proxy_config.rs b/runtime/testnet/src/proxy_config.rs index fd8c4ec8..fad05383 100644 --- a/runtime/testnet/src/proxy_config.rs +++ b/runtime/testnet/src/proxy_config.rs @@ -89,15 +89,7 @@ impl InstanceFilter for ProxyType { } fn is_superset(&self, o: &Self) -> bool { - match (self, o) { - (x, y) if x == y => true, - (ProxyType::Any, _) => true, - (_, ProxyType::Any) => false, - (ProxyType::Assets, ProxyType::AssetOwner) => true, - (ProxyType::Assets, ProxyType::AssetManager) => true, - (ProxyType::NonTransfer, ProxyType::Collator) => true, - _ => false, - } + ProxyType::is_superset(self, o) } }