diff --git a/libs/mocks/src/token_swaps.rs b/libs/mocks/src/token_swaps.rs index a035198914..61dccf0b30 100644 --- a/libs/mocks/src/token_swaps.rs +++ b/libs/mocks/src/token_swaps.rs @@ -70,6 +70,12 @@ pub mod pallet { register_call!(move |(a, b, c)| f(a, b, c)); } + pub fn mock_market_ratio( + f: impl Fn(T::CurrencyId, T::CurrencyId) -> Result + 'static, + ) { + register_call!(move |(a, b)| f(a, b)); + } + pub fn mock_fill_order( f: impl Fn(T::AccountId, T::OrderId, T::BalanceOut) -> DispatchResult + 'static, ) { @@ -120,6 +126,13 @@ pub mod pallet { execute_call!((a, b, c)) } + fn market_ratio( + a: Self::CurrencyId, + b: Self::CurrencyId, + ) -> Result { + execute_call!((a, b)) + } + fn fill_order(a: T::AccountId, b: Self::OrderId, c: Self::BalanceOut) -> DispatchResult { execute_call!((a, b, c)) } diff --git a/libs/traits/src/swaps.rs b/libs/traits/src/swaps.rs index ad5367f390..217069b87a 100644 --- a/libs/traits/src/swaps.rs +++ b/libs/traits/src/swaps.rs @@ -98,11 +98,17 @@ pub trait TokenSwaps { currency_out: Self::CurrencyId, amount_out: Self::BalanceOut, ) -> Result; + + /// Returns the conversion ratio to convert currency out into currency in, + fn market_ratio( + currency_in: Self::CurrencyId, + currency_out: Self::CurrencyId, + ) -> Result; } /// A representation of a currency swap in process. #[derive(Clone, PartialEq, Eq, Debug, Encode, Decode, TypeInfo, MaxEncodedLen)] -pub struct SwapState { +pub struct SwapInfo { /// Swap not yet processed with the pending outcomming amount pub remaining: Swap, @@ -112,6 +118,9 @@ pub struct SwapState { /// Amount of incoming currency already swapped denominated in outgoing /// currency pub swapped_out: AmountOut, + + /// Ratio used to swap `swapped_out` into `swapped_in` + pub ratio: Ratio, } /// Used as result of `Pallet::apply_swap()` diff --git a/pallets/foreign-investments/src/impls.rs b/pallets/foreign-investments/src/impls.rs index 0f5005395d..45c8dac198 100644 --- a/pallets/foreign-investments/src/impls.rs +++ b/pallets/foreign-investments/src/impls.rs @@ -2,7 +2,7 @@ use cfg_traits::{ investments::{ForeignInvestment, Investment, InvestmentCollector}, - swaps::{SwapState, Swaps}, + swaps::{Swap, SwapInfo, SwapStatus, Swaps}, StatusNotificationHook, }; use cfg_types::investments::CollectedAmount; @@ -12,8 +12,8 @@ use sp_std::marker::PhantomData; use crate::{ entities::{InvestmentInfo, RedemptionInfo}, - pallet::{Config, Error, ForeignInvestmentInfo, ForeignRedemptionInfo, Pallet}, - pool_currency_of, Action, SwapId, + pallet::{Config, Error, Event, ForeignInvestmentInfo, ForeignRedemptionInfo, Pallet}, + pool_currency_of, Action, SwapId, SwapOf, }; impl ForeignInvestment for Pallet { @@ -57,6 +57,8 @@ impl ForeignInvestment for Pallet { } } + Pallet::::deposit_apply_swap_events(who, swap_id, &swap, &status)?; + Ok::<_, DispatchError>(msg) })?; @@ -108,6 +110,8 @@ impl ForeignInvestment for Pallet { } } + Pallet::::deposit_apply_swap_events(who, swap_id, &swap, &status)?; + if info.is_completed(who, investment_id)? { *entry = None; } @@ -209,23 +213,66 @@ impl ForeignInvestment for Pallet { } } +impl Pallet { + fn deposit_apply_swap_events( + who: &T::AccountId, + swap_id: SwapId, + swap: &SwapOf, + status: &SwapStatus, + ) -> DispatchResult { + if !status.swapped.is_zero() { + Pallet::::deposit_event(Event::SwapCancelled { + who: who.clone(), + swap_id, + remaining: Swap { + amount_out: status.pending, + ..swap.clone() + }, + cancelled_in: status.swapped, + opposite_in: T::Swaps::pending_amount(who, swap_id, swap.currency_in)?, + }); + } + + if !status.pending.is_zero() { + Pallet::::deposit_event(Event::SwapCreated { + who: who.clone(), + swap_id, + swap: Swap { + amount_out: status.pending, + ..swap.clone() + }, + }) + } + + Ok(()) + } +} + pub struct FulfilledSwapHook(PhantomData); impl StatusNotificationHook for FulfilledSwapHook { type Error = DispatchError; type Id = (T::AccountId, SwapId); - type Status = SwapState; + type Status = SwapInfo; fn notify_status_change( (who, (investment_id, action)): Self::Id, - swap_state: Self::Status, + swap_info: Self::Status, ) -> DispatchResult { let pool_currency = pool_currency_of::(investment_id)?; - let swapped_amount_in = swap_state.swapped_in; - let swapped_amount_out = swap_state.swapped_out; - let pending_amount = swap_state.remaining.amount_out; + let swapped_amount_in = swap_info.swapped_in; + let swapped_amount_out = swap_info.swapped_out; + let pending_amount = swap_info.remaining.amount_out; + + Pallet::::deposit_event(Event::SwapFullfilled { + who: who.clone(), + swap_id: (investment_id, action), + remaining: swap_info.remaining.clone(), + swapped_in: swap_info.swapped_in, + swapped_out: swap_info.swapped_out, + }); match action { - Action::Investment => match pool_currency == swap_state.remaining.currency_in { + Action::Investment => match pool_currency == swap_info.remaining.currency_in { true => SwapDone::::for_increase_investment( &who, investment_id, @@ -308,7 +355,9 @@ impl StatusNotificationHook for CollectedRedemptionHook { if let Some(swap) = swap { let swap_id = (investment_id, Action::Redemption); - let status = T::Swaps::apply_swap(&who, swap_id, swap)?; + let status = T::Swaps::apply_swap(&who, swap_id, swap.clone())?; + + Pallet::::deposit_apply_swap_events(&who, swap_id, &swap, &status)?; if !status.swapped.is_zero() { SwapDone::::for_redemption( diff --git a/pallets/foreign-investments/src/lib.rs b/pallets/foreign-investments/src/lib.rs index a28801918c..e5fe487d84 100644 --- a/pallets/foreign-investments/src/lib.rs +++ b/pallets/foreign-investments/src/lib.rs @@ -101,7 +101,7 @@ pub mod pallet { }; use cfg_types::investments::{ExecutedForeignCollect, ExecutedForeignDecreaseInvest}; use frame_support::pallet_prelude::*; - use sp_runtime::traits::AtLeast32BitUnsigned; + use sp_runtime::traits::{AtLeast32BitUnsigned, One}; use super::*; @@ -116,6 +116,8 @@ pub mod pallet { /// depends. #[pallet::config] pub trait Config: frame_system::Config { + type RuntimeEvent: From> + IsType<::RuntimeEvent>; + /// Represents a foreign amount type ForeignBalance: Parameter + Member @@ -149,6 +151,9 @@ pub mod pallet { /// Any balances used in TokenSwaps type SwapBalance: Parameter + Member + AtLeast32BitUnsigned + Default + Copy + MaxEncodedLen; + /// Ratio used for swapping amounts + type SwapRatio: Parameter + Member + Copy + MaxEncodedLen + One; + /// The currency type of transferrable tokens type CurrencyId: Parameter + Member + Copy + MaxEncodedLen; @@ -263,4 +268,31 @@ pub mod pallet { /// The decrease is greater than the current investment/redemption TooMuchDecrease, } + + #[pallet::event] + #[pallet::generate_deposit(pub(super) fn deposit_event)] + pub enum Event { + // The swap is created and now is wating to be fulfilled + SwapCreated { + who: T::AccountId, + swap_id: SwapId, + swap: SwapOf, + }, + // The swap was fulfilled by another participant. + SwapFullfilled { + who: T::AccountId, + swap_id: SwapId, + remaining: SwapOf, + swapped_in: T::SwapBalance, + swapped_out: T::SwapBalance, + }, + // The swap was fulfilled by cancelling an opposite swap for the same foreign investment. + SwapCancelled { + who: T::AccountId, + swap_id: SwapId, + remaining: SwapOf, + cancelled_in: T::SwapBalance, + opposite_in: T::SwapBalance, + }, + } } diff --git a/pallets/foreign-investments/src/mock.rs b/pallets/foreign-investments/src/mock.rs index a765aacfbe..9067ed74d3 100644 --- a/pallets/foreign-investments/src/mock.rs +++ b/pallets/foreign-investments/src/mock.rs @@ -148,7 +148,9 @@ impl pallet_foreign_investments::Config for Runtime { type InvestmentId = InvestmentId; type PoolBalance = Balance; type PoolInspect = MockPools; + type RuntimeEvent = RuntimeEvent; type SwapBalance = Balance; + type SwapRatio = Ratio; type Swaps = Swaps; type TrancheBalance = Balance; } @@ -158,5 +160,7 @@ pub fn new_test_ext() -> sp_io::TestExternalities { .build_storage::() .unwrap(); - sp_io::TestExternalities::new(storage) + let mut ext = sp_io::TestExternalities::new(storage); + ext.execute_with(|| frame_system::Pallet::::set_block_number(1)); + ext } diff --git a/pallets/foreign-investments/src/tests.rs b/pallets/foreign-investments/src/tests.rs index 673240f41c..8659c575b4 100644 --- a/pallets/foreign-investments/src/tests.rs +++ b/pallets/foreign-investments/src/tests.rs @@ -1,12 +1,13 @@ use cfg_traits::{ investments::{ForeignInvestment as _, Investment, TrancheCurrency}, - swaps::{OrderInfo, OrderRatio, Swap, SwapState, TokenSwaps}, + swaps::{OrderInfo, OrderRatio, Swap, SwapInfo, TokenSwaps}, StatusNotificationHook, }; use cfg_types::investments::{ CollectedAmount, ExecutedForeignCollect, ExecutedForeignDecreaseInvest, }; use frame_support::{assert_err, assert_ok}; +use sp_runtime::traits::One; use sp_std::sync::{Arc, Mutex}; use crate::{ @@ -57,6 +58,14 @@ mod util { } } + pub fn market_ratio(to: CurrencyId, from: CurrencyId) -> Ratio { + match (from, to) { + (POOL_CURR, FOREIGN_CURR) => Ratio::from_rational(1, STABLE_RATIO), + (FOREIGN_CURR, POOL_CURR) => Ratio::from_rational(STABLE_RATIO, 1), + _ => Ratio::one(), + } + } + pub fn configure_pool() { MockPools::mock_currency_for(|pool_id| { assert_eq!(pool_id, INVESTMENT_ID.of_pool()); @@ -105,6 +114,8 @@ mod util { MockTokenSwaps::mock_convert_by_market(|to, from, amount_from| { Ok(convert_currencies(to, from, amount_from)) }); + + MockTokenSwaps::mock_market_ratio(|to, from| Ok(util::market_ratio(to, from))); } // Setup basic investment system @@ -146,7 +157,7 @@ mod util { Swaps::notify_status_change( order_id, - SwapState { + SwapInfo { remaining: Swap { amount_out: order.swap.amount_out - amount_out, ..order.swap @@ -158,6 +169,7 @@ mod util { ) .unwrap(), swapped_out: amount_out, + ratio: util::market_ratio(order.swap.currency_in, order.swap.currency_out), }, ) .unwrap(); @@ -225,6 +237,19 @@ mod investment { Ok(AMOUNT) ); assert_eq!(MockInvestment::investment(&USER, INVESTMENT_ID), Ok(0)); + + System::assert_has_event( + Event::SwapCreated { + who: USER, + swap_id: (INVESTMENT_ID, Action::Investment), + swap: Swap { + amount_out: AMOUNT, + currency_out: FOREIGN_CURR, + currency_in: POOL_CURR, + }, + } + .into(), + ); }); } @@ -351,6 +376,21 @@ mod investment { Ok(AMOUNT * 3 / 4) ); assert_eq!(MockInvestment::investment(&USER, INVESTMENT_ID), Ok(0)); + + System::assert_has_event( + Event::SwapCancelled { + who: USER, + swap_id: (INVESTMENT_ID, Action::Investment), + remaining: Swap { + amount_out: 0, + currency_out: POOL_CURR, + currency_in: FOREIGN_CURR, + }, + cancelled_in: AMOUNT / 4, + opposite_in: 3 * AMOUNT / 4, + } + .into(), + ); }); } @@ -409,6 +449,21 @@ mod investment { MockInvestment::investment(&USER, INVESTMENT_ID), Ok(foreign_to_pool(AMOUNT / 4)) ); + + System::assert_has_event( + Event::SwapFullfilled { + who: USER, + swap_id: (INVESTMENT_ID, Action::Investment), + remaining: Swap { + amount_out: 3 * AMOUNT / 4, + currency_out: FOREIGN_CURR, + currency_in: POOL_CURR, + }, + swapped_in: foreign_to_pool(AMOUNT / 4), + swapped_out: AMOUNT / 4, + } + .into(), + ); }); } diff --git a/pallets/order-book/src/lib.rs b/pallets/order-book/src/lib.rs index 047a9959e4..514723bbe1 100644 --- a/pallets/order-book/src/lib.rs +++ b/pallets/order-book/src/lib.rs @@ -37,7 +37,7 @@ pub use weights::WeightInfo; pub mod pallet { use cfg_primitives::conversion::convert_balance_decimals; use cfg_traits::{ - swaps::{OrderInfo, OrderRatio, Swap, SwapState, TokenSwaps}, + swaps::{OrderInfo, OrderRatio, Swap, SwapInfo, TokenSwaps}, ConversionToAssetBalance, StatusNotificationHook, ValueProvider, }; use cfg_types::{self, tokens::CustomMetadata}; @@ -170,7 +170,7 @@ pub mod pallet { /// The hook which acts upon a (partially) fulfilled order type FulfilledOrderHook: StatusNotificationHook< Id = Self::OrderIdNonce, - Status = SwapState, + Status = SwapInfo, Error = DispatchError, >; @@ -613,7 +613,7 @@ pub mod pallet { T::FulfilledOrderHook::notify_status_change( order.order_id, - SwapState { + SwapInfo { remaining: Swap { amount_out: remaining_amount_out, currency_in: order.currency_in, @@ -621,6 +621,7 @@ pub mod pallet { }, swapped_in: amount_in, swapped_out: amount_out, + ratio, }, )?; @@ -768,6 +769,13 @@ pub mod pallet { let ratio = Self::market_ratio(currency_out, currency_in)?; Self::convert_with_ratio(currency_out, currency_in, ratio, amount_out) } + + fn market_ratio( + currency_in: Self::CurrencyId, + currency_out: Self::CurrencyId, + ) -> Result { + Self::market_ratio(currency_out, currency_in) + } } #[cfg(feature = "runtime-benchmarks")] diff --git a/pallets/order-book/src/mock.rs b/pallets/order-book/src/mock.rs index 22e6abbd07..19ea498768 100644 --- a/pallets/order-book/src/mock.rs +++ b/pallets/order-book/src/mock.rs @@ -11,7 +11,7 @@ // GNU General Public License for more details. use cfg_mocks::pallet_mock_fees; -use cfg_traits::{swaps::SwapState, ConversionToAssetBalance}; +use cfg_traits::{swaps::SwapInfo, ConversionToAssetBalance}; use cfg_types::tokens::{CurrencyId, CustomMetadata}; use frame_support::{ parameter_types, @@ -125,7 +125,7 @@ impl cfg_mocks::fees::pallet::Config for Runtime { impl cfg_mocks::status_notification::pallet::Config for Runtime { type Id = OrderId; - type Status = SwapState; + type Status = SwapInfo; } parameter_types! { diff --git a/pallets/order-book/src/tests.rs b/pallets/order-book/src/tests.rs index b4fb0b4cc4..cec52dd9a8 100644 --- a/pallets/order-book/src/tests.rs +++ b/pallets/order-book/src/tests.rs @@ -10,7 +10,7 @@ // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. -use cfg_traits::swaps::{OrderInfo, OrderRatio, Swap, SwapState, TokenSwaps}; +use cfg_traits::swaps::{OrderInfo, OrderRatio, Swap, SwapInfo, TokenSwaps}; use frame_support::{ assert_err, assert_ok, traits::fungibles::{Inspect, InspectHold}, @@ -72,11 +72,11 @@ mod util { swapped_in: Balance, swapped_out: Balance, ) { - MockFulfilledOrderHook::mock_notify_status_change(move |id, swap_state| { + MockFulfilledOrderHook::mock_notify_status_change(move |id, swap_info| { assert_eq!(order_id, id); assert_eq!( - swap_state, - SwapState { + swap_info, + SwapInfo { remaining: Swap { amount_out, currency_in: CURRENCY_B, @@ -84,6 +84,7 @@ mod util { }, swapped_in, swapped_out, + ratio: DEFAULT_RATIO, } ); Ok(()) diff --git a/pallets/swaps/src/lib.rs b/pallets/swaps/src/lib.rs index 0afb1a8d58..21fb1fa16c 100644 --- a/pallets/swaps/src/lib.rs +++ b/pallets/swaps/src/lib.rs @@ -27,7 +27,7 @@ pub use pallet::*; #[frame_support::pallet] pub mod pallet { use cfg_traits::{ - swaps::{OrderRatio, Swap, SwapState, SwapStatus, Swaps, TokenSwaps}, + swaps::{OrderRatio, Swap, SwapInfo, SwapStatus, Swaps, TokenSwaps}, StatusNotificationHook, }; use frame_support::pallet_prelude::*; @@ -36,6 +36,9 @@ pub mod pallet { use super::*; + pub type RatioOf = + <::OrderBook as TokenSwaps<::AccountId>>::Ratio; + #[pallet::pallet] pub struct Pallet(_); @@ -67,7 +70,7 @@ pub mod pallet { /// The hook which acts upon a (partially) fulfilled the swap type FulfilledSwap: StatusNotificationHook< Id = (Self::AccountId, Self::SwapId), - Status = SwapState, + Status = SwapInfo>, Error = DispatchError, >; } @@ -338,18 +341,15 @@ pub mod pallet { impl StatusNotificationHook for Pallet { type Error = DispatchError; type Id = T::OrderId; - type Status = SwapState; + type Status = SwapInfo>; - fn notify_status_change( - order_id: T::OrderId, - swap_state: SwapState, - ) -> DispatchResult { + fn notify_status_change(order_id: T::OrderId, swap_info: Self::Status) -> DispatchResult { if let Ok((who, swap_id)) = Self::swap_id(order_id) { - if swap_state.remaining.amount_out.is_zero() { + if swap_info.remaining.amount_out.is_zero() { Self::update_id(&who, swap_id, None)?; } - T::FulfilledSwap::notify_status_change((who, swap_id), swap_state)?; + T::FulfilledSwap::notify_status_change((who, swap_id), swap_info)?; } Ok(()) diff --git a/pallets/swaps/src/mock.rs b/pallets/swaps/src/mock.rs index 14b6a5c225..75a99201a3 100644 --- a/pallets/swaps/src/mock.rs +++ b/pallets/swaps/src/mock.rs @@ -1,4 +1,4 @@ -use cfg_traits::swaps::SwapState; +use cfg_traits::swaps::SwapInfo; use frame_support::traits::{ConstU16, ConstU32, ConstU64}; use sp_runtime::{ testing::{Header, H256}, @@ -16,6 +16,7 @@ pub type Balance = u128; pub type OrderId = u64; pub type SwapId = u32; pub type CurrencyId = u8; +pub type Ratio = FixedU128; frame_support::construct_runtime!( pub enum Runtime where @@ -62,12 +63,12 @@ impl cfg_mocks::token_swaps::pallet::Config for Runtime { type BalanceOut = Balance; type CurrencyId = CurrencyId; type OrderId = OrderId; - type Ratio = FixedU128; + type Ratio = Ratio; } impl cfg_mocks::status_notification::pallet::Config for Runtime { type Id = (AccountId, SwapId); - type Status = SwapState; + type Status = SwapInfo; } impl pallet_swaps::Config for Runtime { diff --git a/pallets/swaps/src/tests.rs b/pallets/swaps/src/tests.rs index 9a49ef5206..ce7cb60809 100644 --- a/pallets/swaps/src/tests.rs +++ b/pallets/swaps/src/tests.rs @@ -1,5 +1,5 @@ use cfg_traits::{ - swaps::{OrderInfo, OrderRatio, Swap, SwapState, SwapStatus, Swaps as TSwaps}, + swaps::{OrderInfo, OrderRatio, Swap, SwapInfo, SwapStatus, Swaps as TSwaps}, StatusNotificationHook, }; use frame_support::{assert_err, assert_ok}; @@ -446,7 +446,7 @@ mod fulfill { new_test_ext().execute_with(|| { Swaps::update_id(&USER, SWAP_ID, Some(ORDER_ID)).unwrap(); - let swap_state = SwapState { + let swap_info = SwapInfo { remaining: Swap { amount_out: AMOUNT, currency_in: CURRENCY_A, @@ -454,25 +454,26 @@ mod fulfill { }, swapped_in: AMOUNT * 2, swapped_out: AMOUNT / 2, + ratio: Ratio::from_rational(AMOUNT * 2, AMOUNT / 2), }; FulfilledSwapHook::mock_notify_status_change({ - let swap_state = swap_state.clone(); + let swap_info = swap_info.clone(); move |id, status| { assert_eq!(id, (USER, SWAP_ID)); - assert_eq!(status, swap_state); + assert_eq!(status, swap_info); Ok(()) } }); - assert_ok!(Swaps::notify_status_change(ORDER_ID, swap_state)); + assert_ok!(Swaps::notify_status_change(ORDER_ID, swap_info)); }); } #[test] fn skip_notification() { new_test_ext().execute_with(|| { - let swap_state = SwapState { + let swap_info = SwapInfo { remaining: Swap { amount_out: AMOUNT, currency_in: CURRENCY_A, @@ -480,11 +481,12 @@ mod fulfill { }, swapped_in: AMOUNT * 2, swapped_out: AMOUNT / 2, + ratio: Ratio::from_rational(AMOUNT * 2, AMOUNT / 2), }; // It does not send an event because it's not an order registered in // pallet_swaps - assert_ok!(Swaps::notify_status_change(ORDER_ID, swap_state)); + assert_ok!(Swaps::notify_status_change(ORDER_ID, swap_info)); }); } } diff --git a/runtime/altair/src/lib.rs b/runtime/altair/src/lib.rs index ab3e308fa0..5f09873b29 100644 --- a/runtime/altair/src/lib.rs +++ b/runtime/altair/src/lib.rs @@ -1748,7 +1748,9 @@ impl pallet_foreign_investments::Config for Runtime { type InvestmentId = TrancheCurrency; type PoolBalance = Balance; type PoolInspect = PoolSystem; + type RuntimeEvent = RuntimeEvent; type SwapBalance = Balance; + type SwapRatio = Ratio; type Swaps = Swaps; type TrancheBalance = Balance; } @@ -2012,7 +2014,7 @@ construct_runtime!( LiquidityRewards: pallet_liquidity_rewards::{Pallet, Call, Storage, Event} = 111, GapRewardMechanism: pallet_rewards::mechanism::gap = 112, OrderBook: pallet_order_book::{Pallet, Call, Storage, Event} = 113, - ForeignInvestments: pallet_foreign_investments::{Pallet, Storage} = 114, + ForeignInvestments: pallet_foreign_investments::{Pallet, Storage, Event} = 114, TransferAllowList: pallet_transfer_allowlist::{Pallet, Call, Storage, Event} = 115, OraclePriceFeed: pallet_oracle_feed::{Pallet, Call, Storage, Event} = 116, OraclePriceCollection: pallet_oracle_collection::{Pallet, Call, Storage, Event} = 117, diff --git a/runtime/centrifuge/src/lib.rs b/runtime/centrifuge/src/lib.rs index 43cca58daa..8fff881e54 100644 --- a/runtime/centrifuge/src/lib.rs +++ b/runtime/centrifuge/src/lib.rs @@ -1847,7 +1847,9 @@ impl pallet_foreign_investments::Config for Runtime { type InvestmentId = TrancheCurrency; type PoolBalance = Balance; type PoolInspect = PoolSystem; + type RuntimeEvent = RuntimeEvent; type SwapBalance = Balance; + type SwapRatio = Ratio; type Swaps = Swaps; type TrancheBalance = Balance; } @@ -2121,7 +2123,7 @@ construct_runtime!( GapRewardMechanism: pallet_rewards::mechanism::gap = 106, LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event, Origin } = 107, OrderBook: pallet_order_book::{Pallet, Call, Storage, Event} = 108, - ForeignInvestments: pallet_foreign_investments::{Pallet, Storage} = 109, + ForeignInvestments: pallet_foreign_investments::{Pallet, Storage, Event} = 109, TransferAllowList: pallet_transfer_allowlist::{Pallet, Call, Storage, Event} = 110, OraclePriceFeed: pallet_oracle_feed::{Pallet, Call, Storage, Event} = 111, OraclePriceCollection: pallet_oracle_collection::{Pallet, Call, Storage, Event} = 112, diff --git a/runtime/development/src/lib.rs b/runtime/development/src/lib.rs index d72d9b0878..cc86650c13 100644 --- a/runtime/development/src/lib.rs +++ b/runtime/development/src/lib.rs @@ -1822,7 +1822,9 @@ impl pallet_foreign_investments::Config for Runtime { type InvestmentId = TrancheCurrency; type PoolBalance = Balance; type PoolInspect = PoolSystem; + type RuntimeEvent = RuntimeEvent; type SwapBalance = Balance; + type SwapRatio = Ratio; type Swaps = Swaps; type TrancheBalance = Balance; } @@ -2111,7 +2113,7 @@ construct_runtime!( GapRewardMechanism: pallet_rewards::mechanism::gap = 114, LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event, Origin } = 115, OrderBook: pallet_order_book::{Pallet, Call, Storage, Event} = 116, - ForeignInvestments: pallet_foreign_investments::{Pallet, Storage} = 117, + ForeignInvestments: pallet_foreign_investments::{Pallet, Storage, Event} = 117, OraclePriceFeed: pallet_oracle_feed::{Pallet, Call, Storage, Event} = 118, OraclePriceCollection: pallet_oracle_collection::{Pallet, Call, Storage, Event} = 119,