Skip to content

Commit

Permalink
fix(swap): change limit when pool change (#2763)
Browse files Browse the repository at this point in the history
Signed-off-by: banklesss <[email protected]>
Signed-off-by: Juliano Lazzarotto <[email protected]>
Co-authored-by: Juliano Lazzarotto <[email protected]>
  • Loading branch information
banklesss and stackchain authored Oct 12, 2023
1 parent 4ba3d89 commit 24b8dcc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export const SelectPoolFromList = ({pools = []}: Props) => {
)
const formattedTvl = Quantities.format(tvl, decimals, 0)
const formattedBatcherFeeInPt = Quantities.format(pool.batcherFee.quantity, decimals, decimals)
const marketPrice = getMarketPrice(pool, orderData.amounts.sell)

return (
<View key={pool.poolId}>
Expand Down Expand Up @@ -86,7 +87,7 @@ export const SelectPoolFromList = ({pools = []}: Props) => {

<Text style={styles.infoValue}>
{`${Quantities.format(
getMarketPrice(pool, orderData.amounts.sell) ?? Quantities.zero,
marketPrice ?? Quantities.zero,
denomination,
PRECISION,
)} ${tokenToSellName}/${tokenToBuyName}`}
Expand Down
3 changes: 3 additions & 0 deletions packages/swap/src/translators/reactjs/state/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,9 @@ const orderReducer = (

draft.orderData.amounts.buy =
draft.orderData.selectedPoolCalculation.sides.buy

draft.orderData.limitPrice =
draft.orderData.selectedPoolCalculation.prices.market
break

case SwapCreateOrderActionType.SlippageChanged:
Expand Down

0 comments on commit 24b8dcc

Please sign in to comment.