Skip to content

Commit

Permalink
Merge branch 'main' into connor/fill-limit
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Feb 21, 2024
2 parents 9ed7c6e + 140f5df commit e46b400
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 29 deletions.
6 changes: 1 addition & 5 deletions contracts/orderbook/src/order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use cw_utils::{must_pay, nonpayable};
#[allow(clippy::manual_range_contains)]
pub fn place_limit(
deps: DepsMut,
env: Env,
_env: Env,
info: MessageInfo,
book_id: u64,
tick_id: i64,
Expand Down Expand Up @@ -73,10 +73,6 @@ pub fn place_limit(
})?;

Ok(Response::new()
.add_message(BankMsg::Send {
to_address: env.contract.address.to_string(),
amount: vec![coin(quantity.u128(), expected_denom)],
})
.add_attribute("method", "placeLimit")
.add_attribute("owner", info.sender.to_string())
.add_attribute("book_id", book_id.to_string())
Expand Down
11 changes: 2 additions & 9 deletions contracts/orderbook/src/orderbook.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,9 @@ pub fn create_orderbook(
// https://github.com/osmosis-labs/orderbook/issues/26

let book_id = new_orderbook_id(deps.storage)?;
let _book = Orderbook {
book_id,
quote_denom,
base_denom,
current_tick: 0,
next_bid_tick: MIN_TICK,
next_ask_tick: MAX_TICK,
};
let book = Orderbook::new(book_id, quote_denom, base_denom, 0, MIN_TICK, MAX_TICK);

ORDERBOOKS.save(deps.storage, &book_id, &_book)?;
ORDERBOOKS.save(deps.storage, &book_id, &book)?;

Ok(Response::new()
.add_attribute("method", "createOrderbook")
Expand Down
23 changes: 8 additions & 15 deletions contracts/orderbook/src/tests/test_order.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
use crate::error::ContractError;
use crate::order::*;
use crate::orderbook::*;
use crate::state::*;
use crate::types::Fulfilment;
use crate::types::LimitOrder;
use crate::types::MarketOrder;
use crate::types::OrderDirection;
use crate::types::REPLY_ID_REFUND;
use crate::{
error::ContractError,
order::*,
orderbook::*,
state::*,
types::{Fulfilment, LimitOrder, MarketOrder, OrderDirection, REPLY_ID_REFUND},
};
use cosmwasm_std::testing::{mock_dependencies_with_balances, mock_env, mock_info};
use cosmwasm_std::BankMsg;
use cosmwasm_std::Coin;
use cosmwasm_std::Decimal;
use cosmwasm_std::Empty;
use cosmwasm_std::SubMsg;
use cosmwasm_std::{coin, Addr, Uint128};
use cosmwasm_std::{coin, Addr, BankMsg, Coin, Decimal, Empty, SubMsg, Uint128};
use cw_utils::PaymentError;

#[allow(clippy::uninlined_format_args)]
Expand Down

0 comments on commit e46b400

Please sign in to comment.