Skip to content

Commit 6c7ba44

Browse files
authored
Merge pull request #782 from CosmWasm/multitest-add-staking-module
[multi-test] Add staking and distribution module
2 parents 629fc4d + f1e2ee2 commit 6c7ba44

File tree

5 files changed

+1819
-33
lines changed

5 files changed

+1819
-33
lines changed

packages/multi-test/src/app.rs

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use crate::bank::{Bank, BankKeeper, BankSudo};
1717
use crate::contracts::Contract;
1818
use crate::executor::{AppResponse, Executor};
1919
use crate::module::{FailingModule, Module};
20-
use crate::staking::{Distribution, FailingDistribution, FailingStaking, Staking, StakingSudo};
20+
use crate::staking::{Distribution, DistributionKeeper, StakeKeeper, Staking, StakingSudo};
2121
use crate::transactions::transactional;
2222
use crate::wasm::{ContractData, Wasm, WasmKeeper, WasmSudo};
2323

@@ -33,6 +33,8 @@ pub type BasicApp<ExecC = Empty, QueryC = Empty> = App<
3333
MockStorage,
3434
FailingModule<ExecC, QueryC, Empty>,
3535
WasmKeeper<ExecC, QueryC>,
36+
StakeKeeper,
37+
DistributionKeeper,
3638
>;
3739

3840
/// Router is a persisted state. You can query this.
@@ -44,8 +46,8 @@ pub struct App<
4446
Storage = MockStorage,
4547
Custom = FailingModule<Empty, Empty, Empty>,
4648
Wasm = WasmKeeper<Empty, Empty>,
47-
Staking = FailingStaking,
48-
Distr = FailingDistribution,
49+
Staking = StakeKeeper,
50+
Distr = DistributionKeeper,
4951
> {
5052
router: Router<Bank, Custom, Wasm, Staking, Distr>,
5153
api: Api,
@@ -75,8 +77,8 @@ impl BasicApp {
7577
BankKeeper,
7678
FailingModule<Empty, Empty, Empty>,
7779
WasmKeeper<Empty, Empty>,
78-
FailingStaking,
79-
FailingDistribution,
80+
StakeKeeper,
81+
DistributionKeeper,
8082
>,
8183
&dyn Api,
8284
&mut dyn Storage,
@@ -97,8 +99,8 @@ where
9799
BankKeeper,
98100
FailingModule<ExecC, QueryC, Empty>,
99101
WasmKeeper<ExecC, QueryC>,
100-
FailingStaking,
101-
FailingDistribution,
102+
StakeKeeper,
103+
DistributionKeeper,
102104
>,
103105
&dyn Api,
104106
&mut dyn Storage,
@@ -159,8 +161,8 @@ pub type BasicAppBuilder<ExecC, QueryC> = AppBuilder<
159161
MockStorage,
160162
FailingModule<ExecC, QueryC, Empty>,
161163
WasmKeeper<ExecC, QueryC>,
162-
FailingStaking,
163-
FailingDistribution,
164+
StakeKeeper,
165+
DistributionKeeper,
164166
>;
165167

166168
/// Utility to build App in stages. If particular items wont be set, defaults would be used
@@ -182,8 +184,8 @@ impl Default
182184
MockStorage,
183185
FailingModule<Empty, Empty, Empty>,
184186
WasmKeeper<Empty, Empty>,
185-
FailingStaking,
186-
FailingDistribution,
187+
StakeKeeper,
188+
DistributionKeeper,
187189
>
188190
{
189191
fn default() -> Self {
@@ -198,8 +200,8 @@ impl
198200
MockStorage,
199201
FailingModule<Empty, Empty, Empty>,
200202
WasmKeeper<Empty, Empty>,
201-
FailingStaking,
202-
FailingDistribution,
203+
StakeKeeper,
204+
DistributionKeeper,
203205
>
204206
{
205207
/// Creates builder with default components working with empty exec and query messages.
@@ -211,8 +213,8 @@ impl
211213
bank: BankKeeper::new(),
212214
wasm: WasmKeeper::new(),
213215
custom: FailingModule::new(),
214-
staking: FailingStaking::new(),
215-
distribution: FailingDistribution::new(),
216+
staking: StakeKeeper::new(),
217+
distribution: DistributionKeeper::new(),
216218
}
217219
}
218220
}
@@ -224,8 +226,8 @@ impl<ExecC, QueryC>
224226
MockStorage,
225227
FailingModule<ExecC, QueryC, Empty>,
226228
WasmKeeper<ExecC, QueryC>,
227-
FailingStaking,
228-
FailingDistribution,
229+
StakeKeeper,
230+
DistributionKeeper,
229231
>
230232
where
231233
ExecC: Debug + Clone + PartialEq + JsonSchema + DeserializeOwned + 'static,
@@ -241,8 +243,8 @@ where
241243
bank: BankKeeper::new(),
242244
wasm: WasmKeeper::new(),
243245
custom: FailingModule::new(),
244-
staking: FailingStaking::new(),
245-
distribution: FailingDistribution::new(),
246+
staking: StakeKeeper::new(),
247+
distribution: DistributionKeeper::new(),
246248
}
247249
}
248250
}

packages/multi-test/src/contracts.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,7 @@ where
351351
CosmosMsg::Wasm(wasm) => CosmosMsg::Wasm(wasm),
352352
CosmosMsg::Bank(bank) => CosmosMsg::Bank(bank),
353353
CosmosMsg::Staking(staking) => CosmosMsg::Staking(staking),
354+
CosmosMsg::Distribution(distribution) => CosmosMsg::Distribution(distribution),
354355
CosmosMsg::Custom(_) => unreachable!(),
355356
#[cfg(feature = "stargate")]
356357
CosmosMsg::Ibc(ibc) => CosmosMsg::Ibc(ibc),

packages/multi-test/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,5 @@ pub use crate::bank::{Bank, BankKeeper, BankSudo};
2828
pub use crate::contracts::{Contract, ContractWrapper};
2929
pub use crate::executor::{AppResponse, Executor};
3030
pub use crate::module::{FailingModule, Module};
31-
pub use crate::staking::{FailingDistribution, FailingStaking, Staking, StakingSudo};
31+
pub use crate::staking::{DistributionKeeper, StakeKeeper, Staking, StakingInfo, StakingSudo};
3232
pub use crate::wasm::{Wasm, WasmKeeper, WasmSudo};

0 commit comments

Comments
 (0)