Skip to content

Commit

Permalink
block agent
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Apr 11, 2024
1 parent 3896bb9 commit 4a9d877
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
2 changes: 2 additions & 0 deletions crates/cvm-runtime/src/outpost/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ pub struct GetAssetResponse {
pub asset: AssetItem,
}

pub type CvmGlt = GetConfigResponse;

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(rename_all = "snake_case")]
#[cfg_attr(
Expand Down
12 changes: 6 additions & 6 deletions mantis/node/src/bin/mantis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,22 +188,22 @@ async fn get_data_and_solve(
}

async fn solve(
all_orders: Vec<OrderItem>,
active_orders: Vec<OrderItem>,
signing_key: &cosmrs::crypto::secp256k1::SigningKey,
tip: &Tip,
cvm_glt: Option<cw_cvm_outpost::msg::GetConfigResponse>,
router_api: &String,
cvm_glt: Option<cw_cvm_outpost::msg::CvmGlt>,
router: &String,
) -> Vec<cw_mantis_order::ExecMsg> {
let cows_per_pair = mantis_node::mantis::solve::find_cows(&all_orders);
let cows_per_pair = mantis_node::mantis::solve::find_cows(&active_orders);
let mut msgs = vec![];
for pair_solution in cows_per_pair {
let salt = crate::cvm::calculate_salt(signing_key, tip, pair_solution.ab.clone());
let cvm_program = if let Some(ref cvm_glt) = cvm_glt {
let cvm_program = intent_banks_to_cvm_program(
pair_solution.clone(),
&all_orders,
&active_orders,
cvm_glt,
router_api,
router,
&salt,
)
.await;
Expand Down
8 changes: 8 additions & 0 deletions mantis/node/src/mantis/cosmos/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ pub struct Tip {
pub account: cosmos_sdk_proto::cosmos::auth::v1beta1::BaseAccount,
}

/// allows to act on behalf of user
#[derive(Debug)]
pub struct BlockAgent {
pub tip: Tip,
pub key: cosmrs::crypto::secp256k1::SigningKey,
}


impl Tip {
pub fn timeout(&self, delta: u32) -> u64 {
self.block.value() + delta as u64
Expand Down

0 comments on commit 4a9d877

Please sign in to comment.