Skip to content

Commit

Permalink
finishing flow
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Apr 6, 2024
1 parent 1c0b9aa commit 59a9ecd
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 9 deletions.
4 changes: 4 additions & 0 deletions Cargo.lock

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

11 changes: 11 additions & 0 deletions contracts/cosmwasm/xcm/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[package]
description = "CW XCM"
edition = "2021"
name = "cw-xcm"
version = {workspace = true}

[lib]
crate-type = ["cdylib", "rlib"]

[lints]
workspace = true
9 changes: 9 additions & 0 deletions contracts/cosmwasm/xcm/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Testbed to support XCM on Cosmos

`executor` - corresponds to parity `xcm-executor`
`configuraiton` - similar to usual configuration in substrate chain. Maps addresses, IBC connection/ports to and from XCM MultiLocation, barrier
`transactor` - uses `xcm-configuration` and `cw20-ics20` to transact assets
`trap-claim` - lost assets traps and claims
`runtime` - governance of all contracts (like treasury)
`simulator` helper tools to run `xcm` message amid several contracts on top of `cosmwasm-vm-test`. For each case there will be at least 1 positive test.
`sender` - sends message to IBC
Empty file.
1 change: 0 additions & 1 deletion crates/cvm/src/shared.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::{prelude::*, AssetId};
use cosmwasm_std::{from_json, to_json_binary, Api, Binary, CanonicalAddr, StdError, StdResult};
use serde::{de::DeserializeOwned, Serialize};

/// A wrapper around a type which is serde-serialised as a string.
Expand Down
5 changes: 2 additions & 3 deletions mantis/node/src/bin/mantis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ use cosmrs::{

use cosmrs::{
cosmwasm::MsgExecuteContract,
rpc::Client,
tx::{self, Fee, SignerInfo},
AccountId,
};
Expand Down Expand Up @@ -128,7 +127,7 @@ async fn solve_orders(solver_args: &SolverArgs) {

async fn simulate_orders(simulate_args: &SimulateArgs) {
let args = &simulate_args.shared;
let mut wasm_read_client = create_wasm_query_client(&args.grpc_centauri).await;
let _wasm_read_client = create_wasm_query_client(&args.grpc_centauri).await;

let signer = mantis_node::mantis::cosmos::signer::from_mnemonic(
args.wallet.as_str(),
Expand Down Expand Up @@ -208,7 +207,7 @@ async fn solve(

async fn send_solution(
cows: Vec<OrderSolution>,
cvm: CvmProgram,
_cvm: CvmProgram,
tip: &Tip,
optimal_price: Ratio,
signing_key: &cosmrs::crypto::secp256k1::SigningKey,
Expand Down
10 changes: 5 additions & 5 deletions mantis/node/src/mantis/solve.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ use super::cosmos::client::timeout;
/// input batched summarized from users for routing
pub struct IntentBankInput {
pub in_asset_id: AssetId,
pub in_asset_amount: Displayed<u64>,
pub in_asset_amount: Displayed<u128>,
pub out_asset_id: AssetId,
pub order_accounts: Vec<(CvmAddress, Amount)>,
pub order_accounts: Vec<CvmInstruction>,
}

impl IntentBankInput {
pub fn new(
in_asset_id: AssetId,
in_asset_amount: Displayed<u64>,
in_asset_amount: Displayed<u128>,
out_asset_id: AssetId,
order_accounts: Vec<CvmInstruction>,
) -> Self {
Expand Down Expand Up @@ -100,8 +100,8 @@ impl IntentBankInput {
});

(
IntentBankInput::new(a_asset, pair.a.amount, b_asset, b_received.collect()),
IntentBankInput::new(b_asset, pair.b.amount, a_asset, a_received.collect()),
IntentBankInput::new(a_asset, pair.a.amount.into(), b_asset, b_received.collect()),
IntentBankInput::new(b_asset, pair.b.amount.into(), a_asset, a_received.collect()),
)
}
}
Expand Down

0 comments on commit 59a9ecd

Please sign in to comment.