Skip to content

Commit

Permalink
test....
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Apr 12, 2024
1 parent 3d01384 commit e302dbd
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 18 deletions.
13 changes: 4 additions & 9 deletions contracts/cosmwasm/order/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,14 +265,8 @@ impl OrderContract<'_> {
#[msg(exec)]
pub fn solve(&self, mut ctx: ExecCtx, msg: SolutionSubMsg) -> StdResult<Response> {
// read all orders as solver provided
let mut all_orders = join_solution_with_orders(&self.orders, &msg, &ctx)?;
let at_least_one = all_orders.first().expect("at least one");

// normalize pair
let ab = DenomPair::new(
at_least_one.given().denom.clone(),
at_least_one.wants().denom.clone(),
);
let mut all_orders = join_solution_with_orders(&self.orders, &msg, &ctx)?;
let ab = all_orders.first().expect("at least one").pair();

// add solution to total solutions
let possible_solution = SolutionItem {
Expand Down Expand Up @@ -452,7 +446,8 @@ impl OrderContract<'_> {
/// simply exchange maximal given token for best price for other side
/// mostly for testing purposes because as any one bad price can prevent execution (even if it is small amount)
#[msg(exec)]
pub fn exchange(&self, mut ctx: ExecCtx, limit: Ratio) -> StdResult<Response> {
pub fn exchange(&self, mut _ctx: ExecCtx, limit: Ratio) -> StdResult<Response> {
println!("exchange {:?}", limit);
todo!();
}

Expand Down
4 changes: 2 additions & 2 deletions contracts/cosmwasm/order/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use mantis_cw::Denom;
use crate::*;

/// tracks best price for A in pair, so that simplest solution which can take ALL orders can pay this one
pub(crate) const PAIR_BEST_A: Map<DenomPair, Ratio> = Map::new("PAIR_BEST_A");
pub const PAIR_BEST_A: Map<DenomPair, Ratio> = Map::new("PAIR_BEST_A");

pub(crate) const PAIR_BEST_B: Map<DenomPair, Ratio> = Map::new("PAIR_BEST_B");
pub const PAIR_BEST_B: Map<DenomPair, Ratio> = Map::new("PAIR_BEST_B");

/// so we need to have several solution per pair to pick one best
pub struct SolutionIndexes<'a> {
Expand Down
2 changes: 1 addition & 1 deletion contracts/cosmwasm/outpost/src/contract/reply.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::prelude::*;

#[derive(PartialEq, Debug, Clone, Copy, enumn::N)]
#[derive(PartialEq, Debug, Clone, Copy, EnumNum)]
#[repr(u64)]
pub enum ReplyId {
InstantiateExecutor = 0,
Expand Down
1 change: 1 addition & 0 deletions contracts/cosmwasm/outpost/src/prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ pub use cvm_runtime::{outpost::config::*, shared::Displayed};
pub use cw_storage_plus::Map;
pub use ibc_core_host_types::identifiers::ChannelId;
pub use serde::{Deserialize, Serialize};
pub use enumn::N as EnumNum;
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,4 @@ pub struct SwapAmountInRoute {
pub pool_id: u64,
#[prost(string, tag = "2")]
pub token_out_denom: String,
}

impl SwapAmountInRoute {
pub const TYPE_URL: &'static str = "/osmosis.poolmanager.v1beta1.SwapAmountInRoute";
}
}
15 changes: 14 additions & 1 deletion mantis/node/tests/cvms.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,20 @@ async fn cvm_devnet_case() {
&[],
).unwrap();

panic!("solution: {:?}", solution);
centauri.update_block(|x| {
x.height += 2;
});

println!("=========================================================================================");
centauri.execute_contract(
sender.clone(),
cw_mantis_contract.clone(),
&solution[0],
&[],
).unwrap();


//panic!("solution: {:?}", solution);
}

enum True {}
Expand Down

0 comments on commit e302dbd

Please sign in to comment.