Skip to content
This repository has been archived by the owner on Dec 29, 2023. It is now read-only.

Commit

Permalink
ci: update bindings version
Browse files Browse the repository at this point in the history
  • Loading branch information
politeWall committed Dec 27, 2023
1 parent f1c03cd commit 3917f2b
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 37 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ thiserror = "1"
schemars = "0.8.1"
cosmwasm-schema = "1.1.4"
cw-utils = "0.13"
elys-bindings = { git = "https://github.com/elys-network/bindings", tag = "v0.13.0" }
elys-bindings = { git = "https://github.com/elys-network/bindings", tag = "v0.14.0" }

[dev-dependencies]

cw-multi-test = "0.13.4"
serde_json = "1.0.107"
elys-bindings = { git = "https://github.com/elys-network/bindings", tag = "v0.13.0", features = [
elys-bindings = { git = "https://github.com/elys-network/bindings", tag = "v0.14.0", features = [
"testing",
] }
elys-bindings-test = { git = "https://github.com/elys-network/bindings", tag = "v0.13.0" }
elys-bindings-test = { git = "https://github.com/elys-network/bindings", tag = "v0.14.0" }
14 changes: 5 additions & 9 deletions src/action/execute/create_margin_order.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::msg::ReplyType;

use super::*;
use cosmwasm_std::{
to_json_binary, Decimal, OverflowError, OverflowOperation, StdError, StdResult, SubMsg,
coin, to_json_binary, Decimal, OverflowError, OverflowOperation, StdError, StdResult, SubMsg,
};
use cw_utils;
use MarginOrderType::*;
Expand Down Expand Up @@ -241,9 +241,9 @@ fn create_margin_close_order(
&info.sender,
mtp.position,
&order_type,
&mtp.collaterals[0],
&mtp.custodies[0].denom,
&mtp.leverages[0],
&coin(mtp.collateral.i128() as u128, &mtp.collateral_asset),
&mtp.trading_asset,
&mtp.leverage,
position_id,
&trigger_price,
&mtp.take_profit_price,
Expand All @@ -266,11 +266,7 @@ fn create_margin_close_order(
return Ok(resp);
}

let msg = ElysMsg::margin_close_position(
&info.sender,
position_id,
mtp.custodies[0].amount.u128() as i128,
);
let msg = ElysMsg::margin_close_position(&info.sender, position_id, mtp.custody.i128());

let reply_info_max_id = MAX_REPLY_ID.load(deps.storage)?;

Expand Down
2 changes: 1 addition & 1 deletion src/action/sudo/process_orders.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ fn process_margin_order(
}
};

let amount = mtp.custodies[0].amount.u128() as i128;
let amount = mtp.custody.i128();
(
ElysMsg::margin_close_position(&order.owner, order.position_id.unwrap(), amount),
ReplyType::MarginBrokerClose,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,32 @@ fn successful_create_margin_market_open_order() {
s,
&vec![Mtp {
address: "user".to_string(),
collaterals: vec![coin(2, "btc")],
liabilities: Int128::zero(),
interest_paid_collaterals: vec![],
interest_paid_custodies: vec![],
interest_unpaid_collaterals: vec![],
custodies: vec![coin(5000, "usdc")],
take_profit_liabilities: Int128::zero(),
take_profit_custodies: vec![],
leverages: vec![Decimal::from_str("1.2").unwrap()],
mtp_health: Decimal::one(),
position: 2,
id: 1,
amm_pool_id: 1,
consolidate_leverage: Decimal::zero(),
sum_collateral: Int128::zero(),
take_profit_price: Decimal::from_str("1.2").unwrap(),
funding_fee_paid_collaterals: vec![],
funding_fee_paid_custodies: vec![],
funding_fee_received_collaterals: vec![],
funding_fee_received_custodies: vec![],
borrow_interest_paid_collateral: Int128::zero(),
borrow_interest_paid_custody: Int128::zero(),
borrow_interest_unpaid_collateral: Int128::zero(),
collateral_asset: "btc".to_string(),
collateral: Int128::zero(),
custody: Int128::zero(),
custody_asset: "btc".to_string(),
funding_fee_paid_collateral: Int128::zero(),
funding_fee_paid_custody: Int128::zero(),
funding_fee_received_collateral: Int128::zero(),
funding_fee_received_custody: Int128::zero(),
leverage: Decimal::one(),
liabilities_asset: "usdc".to_string(),
open_price: Decimal::one(),
take_profit_borrow_rate: Decimal::one(),
take_profit_custody: Int128::zero(),
trading_asset: "usdc".to_string(),
}],
)
})
Expand Down
28 changes: 17 additions & 11 deletions src/tests/process_margin_order/process_order_close.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,26 +74,32 @@ fn successful_process_limit_buy_order() {
storage,
&vec![Mtp {
address: "user".to_string(),
collaterals: vec![coin(2, "btc")],
liabilities: Int128::zero(),
interest_paid_collaterals: vec![],
interest_paid_custodies: vec![],
interest_unpaid_collaterals: vec![],
custodies: vec![coin(5000, "usdc")],
take_profit_liabilities: Int128::zero(),
take_profit_custodies: vec![],
leverages: vec![Decimal::from_str("1.2").unwrap()],
mtp_health: Decimal::one(),
position: 2,
id: 1,
amm_pool_id: 1,
consolidate_leverage: Decimal::zero(),
sum_collateral: Int128::zero(),
take_profit_price: Decimal::from_str("1.2").unwrap(),
funding_fee_paid_collaterals: vec![],
funding_fee_paid_custodies: vec![],
funding_fee_received_collaterals: vec![],
funding_fee_received_custodies: vec![],
borrow_interest_paid_collateral: Int128::zero(),
borrow_interest_paid_custody: Int128::zero(),
borrow_interest_unpaid_collateral: Int128::zero(),
collateral_asset: "btc".to_string(),
collateral: Int128::zero(),
custody: Int128::zero(),
custody_asset: "btc".to_string(),
funding_fee_paid_collateral: Int128::zero(),
funding_fee_paid_custody: Int128::zero(),
funding_fee_received_collateral: Int128::zero(),
funding_fee_received_custody: Int128::zero(),
leverage: Decimal::one(),
liabilities_asset: "usdc".to_string(),
open_price: Decimal::one(),
take_profit_borrow_rate: Decimal::one(),
take_profit_custody: Int128::zero(),
trading_asset: "usdc".to_string(),
}],
)
})
Expand Down

0 comments on commit 3917f2b

Please sign in to comment.