diff --git a/modules/homa-lite/Cargo.toml b/modules/homa-lite/Cargo.toml index c0d9eef8e4..a542d98cd7 100644 --- a/modules/homa-lite/Cargo.toml +++ b/modules/homa-lite/Cargo.toml @@ -21,7 +21,7 @@ module-support = { path = "../../modules/support", default-features = false } sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" } pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.8" } module-currencies = { path = "../../modules/currencies" } -orml-tokens = { path = "../../orml/tokens"} +orml-tokens = { path = "../../orml/tokens" } [features] default = ["std"] diff --git a/modules/homa-lite/src/lib.rs b/modules/homa-lite/src/lib.rs index f2eefb8563..9b94e30c50 100644 --- a/modules/homa-lite/src/lib.rs +++ b/modules/homa-lite/src/lib.rs @@ -31,7 +31,7 @@ use orml_traits::{MultiCurrency, XcmTransfer}; use primitives::{Balance, CurrencyId}; use sp_runtime::{traits::Zero, ArithmeticError, FixedPointNumber, Permill}; use sp_std::{ops::Mul, prelude::*}; -use xcm::opaque::v0::{MultiLocation, Outcome}; +use xcm::opaque::v0::MultiLocation; pub use module::*; pub use weights::WeightInfo; @@ -93,8 +93,6 @@ pub mod module { MintAmountBelowMinimumThreshold, /// The amount of Staking currency used has exceeded the cap allowed. ExceededStakingCurrencyMintCap, - /// Error has occurred during Cross-chain transfer. - XcmTransferFailed, } #[pallet::event] @@ -193,17 +191,13 @@ pub mod module { .expect("Max rewards cannot be above 100%; qed"); // All checks pass. Proceed with Xcm transfer. - let xcm_result = T::XcmTransfer::transfer( + T::XcmTransfer::transfer( who.clone(), staking_currency, amount, T::SovereignSubAccountLocation::get(), Self::xcm_dest_weight(), )?; - ensure!( - matches!(xcm_result, Outcome::Complete(_)), - Error::::XcmTransferFailed - ); // Mint the liquid currency into the user's account. T::Currency::deposit(T::LiquidCurrencyId::get(), &who, liquid_to_mint)?; diff --git a/modules/homa-lite/src/mock.rs b/modules/homa-lite/src/mock.rs index 06bf8c8c88..ea0ba3a610 100644 --- a/modules/homa-lite/src/mock.rs +++ b/modules/homa-lite/src/mock.rs @@ -24,11 +24,11 @@ use super::*; use frame_support::{ord_parameter_types, parameter_types}; use frame_system::EnsureSignedBy; use module_support::mocks::MockAddressMapping; -use orml_traits::{parameter_type_with_key, XcmExecutionResult, XcmTransfer}; +use orml_traits::{parameter_type_with_key, XcmTransfer}; use primitives::{Amount, TokenSymbol}; use sp_core::H256; use sp_runtime::{testing::Header, traits::IdentityLookup, AccountId32}; -use xcm::opaque::v0::{Junction, MultiAsset, MultiLocation, NetworkId, Outcome}; +use xcm::opaque::v0::{Junction, MultiAsset, MultiLocation, NetworkId}; pub type AccountId = AccountId32; pub type BlockNumber = u64; @@ -75,10 +75,10 @@ impl XcmTransfer for MockXcm { _amount: Balance, _dest: MultiLocation, _dest_weight: Weight, - ) -> XcmExecutionResult { + ) -> DispatchResult { match who { - INVALID_CALLER => Ok(Outcome::Error(xcm::opaque::v0::Error::Undefined)), - _ => Ok(Outcome::Complete(0)), + INVALID_CALLER => Err(DispatchError::Other("invalid caller")), + _ => Ok(()), } } @@ -88,8 +88,8 @@ impl XcmTransfer for MockXcm { _asset: MultiAsset, _dest: MultiLocation, _dest_weight: Weight, - ) -> XcmExecutionResult { - Ok(Outcome::Complete(0)) + ) -> DispatchResult { + Ok(()) } } diff --git a/modules/homa-lite/src/tests.rs b/modules/homa-lite/src/tests.rs index 7f96665ebb..4f6e5465ed 100644 --- a/modules/homa-lite/src/tests.rs +++ b/modules/homa-lite/src/tests.rs @@ -186,7 +186,7 @@ fn failed_xcm_transfer_is_handled() { // XCM transfer fails if it is called by INVALID_CALLER. assert_noop!( HomaLite::mint(Origin::signed(INVALID_CALLER), dollar(1)), - Error::::XcmTransferFailed + DispatchError::Other("invalid caller"), ); }); } diff --git a/orml b/orml index cae9290ad7..650ef607d0 160000 --- a/orml +++ b/orml @@ -1 +1 @@ -Subproject commit cae9290ad75463bb5a4a9599401bb8f3952b19b4 +Subproject commit 650ef607d023e4537d3f2932baa5e50bc3a349cb