From f893491c9d8a3070d142e9108317e02c9ad6cb71 Mon Sep 17 00:00:00 2001 From: dzmitry-lahoda Date: Thu, 11 Apr 2024 12:36:13 +0100 Subject: [PATCH] happier --- contracts/cosmwasm/order/src/lib.rs | 8 ++++++++ contracts/cosmwasm/order/src/state.rs | 12 ++++++------ mantis/node/tests/cvms.rs | 6 ++++++ 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/contracts/cosmwasm/order/src/lib.rs b/contracts/cosmwasm/order/src/lib.rs index 5952638..72c3479 100644 --- a/contracts/cosmwasm/order/src/lib.rs +++ b/contracts/cosmwasm/order/src/lib.rs @@ -449,6 +449,14 @@ impl OrderContract<'_> { Ok(()) } + + /// 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 { + todo!(); + } + /// Simple get all orders #[msg(query)] pub fn get_all_orders(&self, ctx: QueryCtx) -> StdResult> { diff --git a/contracts/cosmwasm/order/src/state.rs b/contracts/cosmwasm/order/src/state.rs index ef7ffb2..0af32f9 100644 --- a/contracts/cosmwasm/order/src/state.rs +++ b/contracts/cosmwasm/order/src/state.rs @@ -1,17 +1,17 @@ //! simple operation without constraint checks and calculations use cw_storage_plus::MultiIndex; +use mantis_cw::Denom; use crate::*; -/// the connection description from first network to second -// pub(crate) const NETWORK_TO_NETWORK: Map<(NetworkId, NetworkId), NetworkToNetworkItem> = -// Map::new("network_to_network"); +/// 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 = + Map::new("PAIR_BEST_A"); - - -// pub const BEST_A_PROIE: Ratio = ; +pub(crate) const PAIR_BEST_B: Map = + Map::new("PAIR_BEST_B"); /// so we need to have several solution per pair to pick one best pub struct SolutionIndexes<'a> { diff --git a/mantis/node/tests/cvms.rs b/mantis/node/tests/cvms.rs index ab2c607..943d381 100644 --- a/mantis/node/tests/cvms.rs +++ b/mantis/node/tests/cvms.rs @@ -24,6 +24,12 @@ fn cvm_devnet_case() { cw_cvm_outpost::contract::query::query, ); + let cw_cvm_executor_wasm = ContractWrapper::new( + cw_cvm_executor::contract::execute, + cw_cvm_executor::contract::instantiate, + cw_cvm_executor::contract::query, + ); + let sender = Addr::unchecked("juno16g2rahf5846rxzp3fwlswy08fz8ccuwk03k57y"); }