Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: PrecDec impl [NTRN-438] #74

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ incremental = false
overflow-checks = true

[workspace.dependencies]
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "main" }
neutron-std = { git = "https://github.com/neutron-org/neutron-std", branch = "main" }
neutron-sdk = { package = "neutron-sdk", git = "https://github.com/neutron-org/neutron-sdk", branch = "feat/prec_dec" }
neutron-std = { git = "https://github.com/neutron-org/neutron-std", branch = "feat/prec_dec" }

prost = "0.12.4"
prost-types = "0.12.4"
Expand Down
9 changes: 6 additions & 3 deletions contracts/dex_grpc/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
use std::str::FromStr;

use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use cosmwasm_std::{
entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult,
Expand All @@ -8,6 +10,7 @@ use neutron_std::types::neutron::dex::{
DexQuerier, MsgCancelLimitOrder, MsgDeposit, MsgMultiHopSwap, MsgPlaceLimitOrder,
MsgWithdrawFilledLimitOrder, MsgWithdrawal,
};
use neutron_std::util::precdec::PrecDec;

const CONTRACT_NAME: &str = concat!("crates.io:neutron-contracts__", env!("CARGO_PKG_NAME"));
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down Expand Up @@ -88,7 +91,7 @@ pub fn execute(
token_in,
token_out,
tick_index_in_to_out,
limit_sell_price: Some(limit_sell_price),
limit_sell_price: Some(PrecDec::from_str(&limit_sell_price)?),
amount_in,
order_type,
expiration_time,
Expand Down Expand Up @@ -120,7 +123,7 @@ pub fn execute(
receiver,
routes,
amount_in,
exit_limit_price,
exit_limit_price: PrecDec::from_str(&exit_limit_price)?,
pick_best_route,
})),
}
Expand Down Expand Up @@ -241,7 +244,7 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> StdResult<Binary> {
receiver,
routes,
amount_in,
exit_limit_price,
PrecDec::from_str(&exit_limit_price)?,
pick_best_route,
)?)?),

Expand Down
Loading