From 4fd2e86c995ee499dc936349c092368ced238dfe Mon Sep 17 00:00:00 2001 From: Gonza Montiel Date: Mon, 13 Jan 2025 22:57:33 -0300 Subject: [PATCH] update mock --- pallets/moonbeam-foreign-assets/src/mock.rs | 24 +++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/pallets/moonbeam-foreign-assets/src/mock.rs b/pallets/moonbeam-foreign-assets/src/mock.rs index c16b6980e5..08967b3e52 100644 --- a/pallets/moonbeam-foreign-assets/src/mock.rs +++ b/pallets/moonbeam-foreign-assets/src/mock.rs @@ -17,11 +17,11 @@ use super::*; use crate as pallet_moonbeam_foreign_assets; -use frame_support::traits::Everything; +use frame_support::traits::{EnsureOriginWithArg, Everything}; use frame_support::{construct_runtime, pallet_prelude::*, parameter_types}; -use frame_system::{EnsureRoot, EnsureSigned}; +use frame_system::EnsureSigned; use pallet_evm::{FrameSystemAccountProvider, SubstrateBlockHashMapping}; -use precompile_utils::testing::MockAccount; +use precompile_utils::testing::{Alice, MockAccount}; use sp_core::{H256, U256}; use sp_runtime::traits::{BlakeTwo256, IdentityLookup}; use sp_runtime::BuildStorage; @@ -177,6 +177,18 @@ impl sp_runtime::traits::Convert for AccountIdToH160 { } } +pub struct ForeignAssetMockOrigin; +impl EnsureOriginWithArg for ForeignAssetMockOrigin { + type Success = AccountId; + + fn try_origin( + _: RuntimeOrigin, + _: &Location, + ) -> core::result::Result { + Ok(Alice.into()) + } +} + parameter_types! { pub const ForeignAssetCreationDeposit: u128 = 1; } @@ -186,9 +198,9 @@ impl crate::Config for Test { type AssetIdFilter = Everything; type EvmRunner = pallet_evm::runner::stack::Runner; type ForeignAssetCreatorOrigin = EnsureSigned; - type ForeignAssetFreezerOrigin = EnsureRoot; - type ForeignAssetModifierOrigin = EnsureRoot; - type ForeignAssetUnfreezerOrigin = EnsureRoot; + type ForeignAssetFreezerOrigin = EnsureSigned; + type ForeignAssetModifierOrigin = EnsureSigned; + type ForeignAssetUnfreezerOrigin = EnsureSigned; type OnForeignAssetCreated = NoteDownHook; type MaxForeignAssets = ConstU32<3>; type RuntimeEvent = RuntimeEvent;