Skip to content

Commit

Permalink
feat: calc_out_amt_given_in query
Browse files Browse the repository at this point in the history
  • Loading branch information
crnbarr93 committed Oct 30, 2024
1 parent 30e6006 commit 016e435
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::CalOutAmtGivenIn {
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 016e435

Please sign in to comment.