Skip to content

Commit

Permalink
feat: event for inbound queue
Browse files Browse the repository at this point in the history
  • Loading branch information
mustermeiszer committed Sep 8, 2023
1 parent 4892e93 commit 696a15c
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 9 deletions.
4 changes: 1 addition & 3 deletions pallets/ethereum-transaction/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,7 @@ impl pallet_ethereum::Config for Runtime {
type StateRoot = IntermediateStateRoot<Self>;
}

impl pallet_ethereum_transaction::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
}
impl pallet_ethereum_transaction::Config for Runtime {}

pub fn new_test_ext() -> sp_io::TestExternalities {
let storage = frame_system::GenesisConfig::default()
Expand Down
4 changes: 1 addition & 3 deletions pallets/liquidity-pools-gateway/routers/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ impl pallet_mock_liquidity_pools::Config for Runtime {
type Message = MessageMock;
}

impl pallet_ethereum_transaction::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
}
impl pallet_ethereum_transaction::Config for Runtime {}

impl pallet_mock_routers::Config for Runtime {}

Expand Down
20 changes: 20 additions & 0 deletions pallets/liquidity-pools/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,19 @@ pub mod pallet {

#[pallet::constant]
type TreasuryAccount: Get<Self::AccountId>;

type RuntimeEvent: From<Event<Self>> + IsType<<Self as frame_system::Config>::RuntimeEvent>;
}

#[pallet::event]
#[pallet::generate_deposit(pub(super) fn deposit_event)]
pub enum Event<T: Config> {
/// An incoming LP message was
/// detected and is further processed
IncomingMessage {
sender: DomainAddress,
msg: MessageOf<T>,
},
}

#[pallet::error]
Expand Down Expand Up @@ -791,6 +804,12 @@ pub mod pallet {

#[transactional]
fn submit(sender: DomainAddress, msg: MessageOf<T>) -> DispatchResult {
Self::deposit_event(Event::<T>::IncomingMessage { sender, msg });

/*
TODO: Enable this again with the foreign-investments PR
match msg {
Message::Transfer {
currency,
Expand Down Expand Up @@ -876,6 +895,7 @@ pub mod pallet {
} => Self::handle_collect_redemption(pool_id, tranche_id, investor.into()),
_ => Err(Error::<T>::InvalidIncomingMessage.into()),
}?;
*/

Ok(())
}
Expand Down
3 changes: 2 additions & 1 deletion runtime/altair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1401,6 +1401,7 @@ impl pallet_liquidity_pools::Config for Runtime {
type Permission = Permissions;
type PoolId = PoolId;
type PoolInspect = PoolSystem;
type RuntimeEvent = RuntimeEvent;
type Time = Timestamp;
type Tokens = Tokens;
type TrancheCurrency = TrancheCurrency;
Expand Down Expand Up @@ -1795,7 +1796,7 @@ construct_runtime!(
BlockRewards: pallet_block_rewards::{Pallet, Call, Storage, Event<T>, Config<T>} = 105,
Keystore: pallet_keystore::{Pallet, Call, Storage, Event<T>} = 106,
PriceCollector: pallet_data_collector::{Pallet, Storage} = 107,
LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage} = 108,
LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage, Event<T>} = 108,
LiquidityPoolsGateway: pallet_liquidity_pools_gateway::{Pallet, Call, Storage, Event<T>, Origin } = 109,
LiquidityRewardsBase: pallet_rewards::<Instance2>::{Pallet, Storage, Event<T>, Config<T>} = 110,
LiquidityRewards: pallet_liquidity_rewards::{Pallet, Call, Storage, Event<T>} = 111,
Expand Down
3 changes: 2 additions & 1 deletion runtime/centrifuge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ impl pallet_liquidity_pools::Config for Runtime {
type Permission = Permissions;
type PoolId = PoolId;
type PoolInspect = PoolSystem;
type RuntimeEvent = RuntimeEvent;
type Time = Timestamp;
type Tokens = Tokens;
type TrancheCurrency = TrancheCurrency;
Expand Down Expand Up @@ -1960,7 +1961,7 @@ construct_runtime!(
BlockRewardsBase: pallet_rewards::<Instance1>::{Pallet, Storage, Event<T>, Config<T>} = 100,
BlockRewards: pallet_block_rewards::{Pallet, Call, Storage, Event<T>, Config<T>} = 101,
PriceCollector: pallet_data_collector::{Pallet, Storage} = 102,
LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage} = 103,
LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage, Event<T>} = 103,
LiquidityRewardsBase: pallet_rewards::<Instance2>::{Pallet, Storage, Event<T>, Config<T>} = 104,
LiquidityRewards: pallet_liquidity_rewards::{Pallet, Call, Storage, Event<T>} = 105,
GapRewardMechanism: pallet_rewards::mechanism::gap = 106,
Expand Down
3 changes: 2 additions & 1 deletion runtime/development/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1561,6 +1561,7 @@ impl pallet_liquidity_pools::Config for Runtime {
type Permission = Permissions;
type PoolId = PoolId;
type PoolInspect = PoolSystem;
type RuntimeEvent = RuntimeEvent;
type Time = Timestamp;
type Tokens = Tokens;
type TrancheCurrency = TrancheCurrency;
Expand Down Expand Up @@ -1892,7 +1893,7 @@ construct_runtime!(
Investments: pallet_investments::{Pallet, Call, Storage, Event<T>} = 105,
LiquidityRewardsBase: pallet_rewards::<Instance1>::{Pallet, Storage, Event<T>, Config<T>} = 106,
LiquidityRewards: pallet_liquidity_rewards::{Pallet, Call, Storage, Event<T>} = 107,
LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage} = 108,
LiquidityPools: pallet_liquidity_pools::{Pallet, Call, Storage, Event<T>} = 108,
PoolRegistry: pallet_pool_registry::{Pallet, Call, Storage, Event<T>} = 109,
BlockRewardsBase: pallet_rewards::<Instance2>::{Pallet, Storage, Event<T>, Config<T>} = 110,
BlockRewards: pallet_block_rewards::{Pallet, Call, Storage, Event<T>, Config<T>} = 111,
Expand Down

0 comments on commit 696a15c

Please sign in to comment.