Skip to content

Commit

Permalink
minor fixes and updates
Browse files Browse the repository at this point in the history
  • Loading branch information
dixitaniket committed Oct 25, 2023
1 parent bfe29f7 commit 1af2239
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
Binary file modified WiseWallet.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion contracts/entrypoint/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ pub mod execute {

msgs.push(msg);
}
Ok(Response::new())
Ok(Response::new().add_messages(msgs))
}
}

Expand Down
28 changes: 24 additions & 4 deletions contracts/limit/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,8 @@ pub fn execute(
pub mod execute {
use std::{default, io::Stderr};

use cosmwasm_std::{CosmosMsg, CustomMsg, WasmMsg, Coin, Uint128};
use cosmwasm_std::{CosmosMsg, CustomMsg, WasmMsg, Coin, Uint128, Coins};
use cw20::Cw20ExecuteMsg;
use prost::Message;
use serde::de;

Expand Down Expand Up @@ -125,11 +126,30 @@ pub mod execute {
deps: DepsMut,
order_id: u64,
) -> Result<Response, ContractError> {
let mut swap_order = SWAP_ORDER_STORE.load(deps.storage, order_id)?;
let mut swap_order:SwapOrder = SWAP_ORDER_STORE.load(deps.storage, order_id)?;
let mut pair = swap_order.token_sell.clone();


// perform oracle call, assume 1-1
// bank transfer

let mut msg: CosmosMsg;
if swap_order.token_bought.eq("ucmdx"){
msg = CosmosMsg::Bank(
cosmwasm_std::BankMsg::Send { to_address: swap_order.to, amount: vec![Coin::new(swap_order.quantity_order, swap_order.token_bought)] }
)
}
else {
msg = CosmosMsg::Wasm(WasmMsg::Execute {
contract_addr: swap_order.token_bought,
msg: to_binary(&Cw20ExecuteMsg::Transfer {
recipient: swap_order.to,
amount: Uint128::from(swap_order.quantity_order)
})?,
funds: vec![],
});
}

Ok(Response::default())
Ok(Response::new().add_message(msg))
}
}

Expand Down

0 comments on commit 1af2239

Please sign in to comment.