Skip to content

Commit

Permalink
filling orders stub extended
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Mar 12, 2024
1 parent 04ee4b6 commit 59e8a6a
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions contracts/cosmwasm/order/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,13 @@ cvm-runtime = { path = "../../../crates/cvm-runtime", default-features = false,
"cosmwasm",
] }

cvm-route = { path = "../../../crates/cvm-route", default-features = false, features = [
"cosmwasm",
] }




hex = {workspace = true, default-features = false, features = ["std"] }
sha2 = {workspace = true, default-features = false, features = ["std"] }

Expand Down
9 changes: 9 additions & 0 deletions contracts/cosmwasm/order/src/simulator.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
use cosmwasm_std::Storage;
use cvm_route::asset::AssetItem;
use cvm_runtime::shared::CvmProgram;
use cvm_runtime::AssetId;

use crate::prelude::*;
use crate::CowFilledOrder;
use crate::CowSolutionCalculation;
use crate::SolvedOrder;


/// given expected output amount and list of orders and CVM program, produce fill in of orders
/// return filling amounts for all orders from program, which may or may not lead to full fill
pub fn verify(route: CvmProgram, out_asset: &AssetItem, out_asset:&AssetItem, orders: Vec<SolvedOrder>) -> Result<Vec<int>, StdError> {

}

/// All orders amounts aggregated into common pool.
/// Ensure that solution does not violates this pool.
/// And return proper action to handle settling funds per order according solution
Expand Down
10 changes: 8 additions & 2 deletions contracts/cosmwasm/order/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub struct CowSolutionCalculation {
pub filled: Vec<CowFilledOrder>,
}

/// each pair waits ate least this amount of blocks before being decided
pub const BATCH_EPOCH: u32 = 1;
/// each pair waits at least this amount of blocks before being decided
pub const BATCH_EPOCH: u32 = 2;

/// count of solutions at minimum which can be decided, just set 1 for ease of devtest
pub const MIN_SOLUTION_COUNT: u32 = 1;
Expand Down Expand Up @@ -71,6 +71,12 @@ impl OrderItem {
}
}

/// simple stucture which can be applied to order to fill or partial fill it
pub struct Filling{
order_id: u64,
amount: Uint128,
}

#[cfg(test)]
mod test {
use cosmwasm_std::Coin;
Expand Down
5 changes: 5 additions & 0 deletions mantis/executor/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# MANTIS Executor

Permissionless cranker and propagator of CVM programs.

Used to help to facilitate multi block (multi transaction) execution of single CVM program.

0 comments on commit 59e8a6a

Please sign in to comment.