Skip to content

Commit

Permalink
Merge pull request #782 from CosmWasm/multitest-add-staking-module
Browse files Browse the repository at this point in the history
[multi-test] Add staking and distribution module
  • Loading branch information
chipshort authored Oct 13, 2022
2 parents 629fc4d + f1e2ee2 commit 6c7ba44
Show file tree
Hide file tree
Showing 5 changed files with 1,819 additions and 33 deletions.
40 changes: 21 additions & 19 deletions packages/multi-test/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::bank::{Bank, BankKeeper, BankSudo};
use crate::contracts::Contract;
use crate::executor::{AppResponse, Executor};
use crate::module::{FailingModule, Module};
use crate::staking::{Distribution, FailingDistribution, FailingStaking, Staking, StakingSudo};
use crate::staking::{Distribution, DistributionKeeper, StakeKeeper, Staking, StakingSudo};
use crate::transactions::transactional;
use crate::wasm::{ContractData, Wasm, WasmKeeper, WasmSudo};

Expand All @@ -33,6 +33,8 @@ pub type BasicApp<ExecC = Empty, QueryC = Empty> = App<
MockStorage,
FailingModule<ExecC, QueryC, Empty>,
WasmKeeper<ExecC, QueryC>,
StakeKeeper,
DistributionKeeper,
>;

/// Router is a persisted state. You can query this.
Expand All @@ -44,8 +46,8 @@ pub struct App<
Storage = MockStorage,
Custom = FailingModule<Empty, Empty, Empty>,
Wasm = WasmKeeper<Empty, Empty>,
Staking = FailingStaking,
Distr = FailingDistribution,
Staking = StakeKeeper,
Distr = DistributionKeeper,
> {
router: Router<Bank, Custom, Wasm, Staking, Distr>,
api: Api,
Expand Down Expand Up @@ -75,8 +77,8 @@ impl BasicApp {
BankKeeper,
FailingModule<Empty, Empty, Empty>,
WasmKeeper<Empty, Empty>,
FailingStaking,
FailingDistribution,
StakeKeeper,
DistributionKeeper,
>,
&dyn Api,
&mut dyn Storage,
Expand All @@ -97,8 +99,8 @@ where
BankKeeper,
FailingModule<ExecC, QueryC, Empty>,
WasmKeeper<ExecC, QueryC>,
FailingStaking,
FailingDistribution,
StakeKeeper,
DistributionKeeper,
>,
&dyn Api,
&mut dyn Storage,
Expand Down Expand Up @@ -159,8 +161,8 @@ pub type BasicAppBuilder<ExecC, QueryC> = AppBuilder<
MockStorage,
FailingModule<ExecC, QueryC, Empty>,
WasmKeeper<ExecC, QueryC>,
FailingStaking,
FailingDistribution,
StakeKeeper,
DistributionKeeper,
>;

/// Utility to build App in stages. If particular items wont be set, defaults would be used
Expand All @@ -182,8 +184,8 @@ impl Default
MockStorage,
FailingModule<Empty, Empty, Empty>,
WasmKeeper<Empty, Empty>,
FailingStaking,
FailingDistribution,
StakeKeeper,
DistributionKeeper,
>
{
fn default() -> Self {
Expand All @@ -198,8 +200,8 @@ impl
MockStorage,
FailingModule<Empty, Empty, Empty>,
WasmKeeper<Empty, Empty>,
FailingStaking,
FailingDistribution,
StakeKeeper,
DistributionKeeper,
>
{
/// Creates builder with default components working with empty exec and query messages.
Expand All @@ -211,8 +213,8 @@ impl
bank: BankKeeper::new(),
wasm: WasmKeeper::new(),
custom: FailingModule::new(),
staking: FailingStaking::new(),
distribution: FailingDistribution::new(),
staking: StakeKeeper::new(),
distribution: DistributionKeeper::new(),
}
}
}
Expand All @@ -224,8 +226,8 @@ impl<ExecC, QueryC>
MockStorage,
FailingModule<ExecC, QueryC, Empty>,
WasmKeeper<ExecC, QueryC>,
FailingStaking,
FailingDistribution,
StakeKeeper,
DistributionKeeper,
>
where
ExecC: Debug + Clone + PartialEq + JsonSchema + DeserializeOwned + 'static,
Expand All @@ -241,8 +243,8 @@ where
bank: BankKeeper::new(),
wasm: WasmKeeper::new(),
custom: FailingModule::new(),
staking: FailingStaking::new(),
distribution: FailingDistribution::new(),
staking: StakeKeeper::new(),
distribution: DistributionKeeper::new(),
}
}
}
Expand Down
1 change: 1 addition & 0 deletions packages/multi-test/src/contracts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ where
CosmosMsg::Wasm(wasm) => CosmosMsg::Wasm(wasm),
CosmosMsg::Bank(bank) => CosmosMsg::Bank(bank),
CosmosMsg::Staking(staking) => CosmosMsg::Staking(staking),
CosmosMsg::Distribution(distribution) => CosmosMsg::Distribution(distribution),
CosmosMsg::Custom(_) => unreachable!(),
#[cfg(feature = "stargate")]
CosmosMsg::Ibc(ibc) => CosmosMsg::Ibc(ibc),
Expand Down
2 changes: 1 addition & 1 deletion packages/multi-test/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,5 @@ pub use crate::bank::{Bank, BankKeeper, BankSudo};
pub use crate::contracts::{Contract, ContractWrapper};
pub use crate::executor::{AppResponse, Executor};
pub use crate::module::{FailingModule, Module};
pub use crate::staking::{FailingDistribution, FailingStaking, Staking, StakingSudo};
pub use crate::staking::{DistributionKeeper, StakeKeeper, Staking, StakingInfo, StakingSudo};
pub use crate::wasm::{Wasm, WasmKeeper, WasmSudo};
Loading

0 comments on commit 6c7ba44

Please sign in to comment.