Skip to content

Commit

Permalink
Merge pull request #208 from osmosis-labs/connor/out-given-in-query
Browse files Browse the repository at this point in the history
fix: CalcOutAmtGivenIn query
  • Loading branch information
crnbarr93 authored Nov 11, 2024
2 parents 30e6006 + 6030caf commit bfd1c75
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
10 changes: 10 additions & 0 deletions contracts/sumtree-orderbook/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,16 @@ pub fn query(deps: Deps, _env: Env, msg: QueryMsg) -> ContractResult<Binary> {
token_out_denom,
swap_fee,
)?)?),
QueryMsg::CalcOutAmtGivenIn {
token_in,
token_out_denom,
swap_fee,
} => Ok(to_json_binary(&query::calc_out_amount_given_in(
deps,
token_in,
token_out_denom,
swap_fee,
)?)?),
QueryMsg::GetTotalPoolLiquidity {} => {
Ok(to_json_binary(&query::total_pool_liquidity(deps)?)?)
}
Expand Down
7 changes: 7 additions & 0 deletions contracts/sumtree-orderbook/src/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,13 @@ pub enum QueryMsg {
token_out_denom: String,
swap_fee: Decimal,
},
// Duplicate of the above, but for compatibility CosmWasm Pool module
#[returns(CalcOutAmtGivenInResponse)]
CalcOutAmtGivenIn {
token_in: Coin,
token_out_denom: String,
swap_fee: Decimal,
},
#[returns(GetTotalPoolLiquidityResponse)]
GetTotalPoolLiquidity {},
/// NO-OP QUERY
Expand Down

0 comments on commit bfd1c75

Please sign in to comment.