Skip to content

Commit

Permalink
Adapt tests to new sylvia version
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolacy committed Jul 26, 2023
1 parent 5615dbe commit 38bda4f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
11 changes: 6 additions & 5 deletions contracts/consumer/converter/src/multitest.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
mod virtual_staking_mock;

use cosmwasm_std::{coin, Addr, Decimal, Uint128};

use cw_multi_test::App as MtApp;
use sylvia::multitest::App;

use crate::contract;
Expand All @@ -16,12 +16,13 @@ struct SetupArgs<'a> {
}

struct SetupResponse<'a> {
price_feed: mesh_simple_price_feed::contract::multitest_utils::SimplePriceFeedContractProxy<'a>,
converter: contract::multitest_utils::ConverterContractProxy<'a>,
virtual_staking: virtual_staking_mock::multitest_utils::VirtualStakingMockProxy<'a>,
price_feed:
mesh_simple_price_feed::contract::multitest_utils::SimplePriceFeedContractProxy<'a, MtApp>,
converter: contract::multitest_utils::ConverterContractProxy<'a, MtApp>,
virtual_staking: virtual_staking_mock::multitest_utils::VirtualStakingMockProxy<'a, MtApp>,
}

fn setup<'a>(app: &'a App, args: SetupArgs<'a>) -> SetupResponse<'a> {
fn setup<'a>(app: &'a App<MtApp>, args: SetupArgs<'a>) -> SetupResponse<'a> {
let SetupArgs {
owner,
admin,
Expand Down
11 changes: 8 additions & 3 deletions contracts/provider/external-staking/src/multitest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,13 @@ const LOCAL_SLASHING_PERCENTAGE: u64 = 5;
//
// Returns vault and external staking proxies
fn setup<'app>(
app: &'app App,
app: &'app App<MtApp>,
owner: &str,
unbond_period: u64,
) -> AnyResult<(VaultContractProxy<'app>, ExternalStakingContractProxy<'app>)> {
) -> AnyResult<(
VaultContractProxy<'app, MtApp>,
ExternalStakingContractProxy<'app, MtApp>,
)> {
let native_staking_proxy_code = NativeStakingProxyCodeId::store_code(app);
let native_staking_code = NativeStakingCodeId::store_code(app);
let vault_code = VaultCodeId::store_code(app);
Expand Down Expand Up @@ -303,7 +306,9 @@ fn staking() {
}

#[track_caller]
fn get_last_external_staking_pending_tx_id(contract: &ExternalStakingContractProxy) -> Option<u64> {
fn get_last_external_staking_pending_tx_id(
contract: &ExternalStakingContractProxy<MtApp>,
) -> Option<u64> {
let txs = contract.all_pending_txs_desc(None, None).unwrap().txs;
txs.first().map(Tx::id)
}
Expand Down
6 changes: 3 additions & 3 deletions contracts/provider/native-staking-proxy/src/multitest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::msg::ConfigResponse;
const OSMO: &str = "uosmo";
const UNBONDING_PERIOD: u64 = 17 * 24 * 60 * 60; // 7 days

fn init_app(owner: &str, validators: &[&str]) -> App {
fn init_app(owner: &str, validators: &[&str]) -> App<MtApp> {
// Fund the staking contract, and add validators to staking keeper
let block = mock_env().block;
let app = MtApp::new(|router, api, storage| {
Expand Down Expand Up @@ -52,11 +52,11 @@ fn init_app(owner: &str, validators: &[&str]) -> App {
}

fn setup<'app>(
app: &'app App,
app: &'app App<MtApp>,
owner: &str,
user: &str,
validator: &str,
) -> AnyResult<VaultContractProxy<'app>> {
) -> AnyResult<VaultContractProxy<'app, MtApp>> {
let vault_code = mesh_vault::contract::multitest_utils::CodeId::store_code(app);
let staking_code = mesh_native_staking::contract::multitest_utils::CodeId::store_code(app);
let staking_proxy_code = contract::multitest_utils::CodeId::store_code(app);
Expand Down
2 changes: 1 addition & 1 deletion contracts/provider/vault/src/multitest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ fn stake_local() {
}

#[track_caller]
fn get_last_pending_tx_id(vault: &VaultContractProxy) -> Option<u64> {
fn get_last_pending_tx_id(vault: &VaultContractProxy<MtApp>) -> Option<u64> {
let txs = vault.all_pending_txs_desc(None, None).unwrap().txs;
txs.first().map(Tx::id)
}
Expand Down

0 comments on commit 38bda4f

Please sign in to comment.