Skip to content

Commit

Permalink
virtual-staking tests work
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanfrey committed May 13, 2024
1 parent 07fb1ca commit 1009590
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 15 deletions.
3 changes: 1 addition & 2 deletions contracts/consumer/converter/src/multitest.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
mod virtual_staking_mock;

use cosmwasm_std::{coin, coins, Addr, Decimal, StdError, Uint128, Validator};
use cw_multi_test::no_init;
use cw_multi_test::AppBuilder;
use cw_multi_test::{no_init, AppBuilder};
use mesh_apis::converter_api::sv::mt::ConverterApiProxy;
use mesh_apis::converter_api::RewardInfo;
use mesh_simple_price_feed::contract::sv::mt::CodeId as PriceFeedCodeId;
Expand Down
3 changes: 3 additions & 0 deletions contracts/consumer/remote-price-feed/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ impl RemotePriceFeedContract {

impl PriceFeedApi for RemotePriceFeedContract {
type Error = ContractError;
// FIXME: make these under a feature flag if we need virtual-staking multitest compatibility
type ExecC = cosmwasm_std::Empty;
type QueryC = cosmwasm_std::Empty;

/// Return the price of the foreign token. That is, how many native tokens
/// are needed to buy one foreign token.
Expand Down
4 changes: 2 additions & 2 deletions contracts/consumer/virtual-staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ serde = { workspace = true }
thiserror = { workspace = true }

[dev-dependencies]
mesh-simple-price-feed = { workspace = true, features = ["mt"] }
mesh-converter = { workspace = true, features = ["mt"] }
mesh-simple-price-feed = { workspace = true, features = ["mt", "fake-custom"] }
mesh-converter = { workspace = true, features = ["mt", "fake-custom"] }
cw-multi-test = { workspace = true }
test-case = { workspace = true }
derivative = { workspace = true }
Expand Down
17 changes: 6 additions & 11 deletions contracts/consumer/virtual-staking/src/multitest.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use cosmwasm_std::{Addr, Decimal, Validator};
use cw_multi_test::no_init;
use mesh_apis::virtual_staking_api::sv::mt::VirtualStakingApiProxy;
use sylvia::multitest::Proxy;

use mesh_converter::contract::sv::mt::ConverterContractProxy;

use crate::contract;
use crate::contract::sv::mt::VirtualStakingContractProxy;
use crate::contract::sv::ContractSudoMsg;

const JUNO: &str = "ujuno";

Expand Down Expand Up @@ -120,7 +120,8 @@ fn instantiation() {
}

#[test]
#[ignore] // FIXME: Enable / finish this test once custom query support is added to sylvia
// FIXME: Enable / finish this test once custom query support is added to sylvia
#[ignore = "IBC Messages not supported yet"]
fn valset_update_sudo() {
let app = new_app();

Expand Down Expand Up @@ -160,8 +161,8 @@ fn valset_update_sudo() {
];
let rems = vec!["cosmosval2".to_string()];
let tombs = vec!["cosmosval3".to_string()];
// See this as an example how we can make working directly with these genertaed enums nicer
let inner = mesh_apis::virtual_staking_api::sv::VirtualStakingApiSudoMsg::handle_valset_update(

let res = virtual_staking.handle_valset_update(
Some(adds),
Some(rems),
None,
Expand All @@ -170,12 +171,6 @@ fn valset_update_sudo() {
Some(tombs),
None,
);
let msg = ContractSudoMsg::VirtualStakingApi(inner);

let res = app
.app_mut()
.wasm_sudo(virtual_staking.contract_addr, &msg)
.unwrap();

println!("res: {:?}", res);
res.unwrap();
}

0 comments on commit 1009590

Please sign in to comment.