Skip to content

Commit

Permalink
fix: use hardcoded cowswap for default limit order slippage
Browse files Browse the repository at this point in the history
  • Loading branch information
woodenfurniture committed Nov 11, 2024
1 parent 4da71c6 commit 8f43289
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Divider, Stack } from '@chakra-ui/react'
import { skipToken } from '@reduxjs/toolkit/query'
import { fromAccountId } from '@shapeshiftoss/caip'
import { SwapperName } from '@shapeshiftoss/swapper'
import { getDefaultSlippageDecimalPercentageForSwapper, SwapperName } from '@shapeshiftoss/swapper'
import type { Asset } from '@shapeshiftoss/types'
import { BigNumber, bn, bnOrZero, fromBaseUnit, toBaseUnit } from '@shapeshiftoss/utils'
import type { FormEvent } from 'react'
Expand Down Expand Up @@ -33,7 +33,6 @@ import {
} from 'state/slices/selectors'
import {
selectCalculatedFees,
selectDefaultSlippagePercentage,
selectIsTradeQuoteRequestAborted,
selectShouldShowTradeQuoteOrAwaitInput,
} from 'state/slices/tradeQuoteSlice/selectors'
Expand Down Expand Up @@ -76,14 +75,18 @@ export const LimitOrderInput = ({
const userSlippagePercentage = useAppSelector(selectUserSlippagePercentage)
const sellAsset = useAppSelector(selectInputSellAsset)
const buyAsset = useAppSelector(selectInputBuyAsset)

// TODO: Move to redux slice
const [limitPriceBuyAsset, setLimitPriceBuyAsset] = useState('0')

const defaultAccountId = useAppSelector(state =>
selectFirstAccountIdByChainId(state, sellAsset.chainId),
)
const defaultSlippagePercentage = useAppSelector(state =>
selectDefaultSlippagePercentage(state, SwapperName.CowSwap),
)
const defaultSlippagePercentage = useMemo(() => {
return bn(getDefaultSlippageDecimalPercentageForSwapper(SwapperName.CowSwap))
.times(100)
.toString()
}, [])

const [buyAccountId, setBuyAccountId] = useState(defaultAccountId)
const [sellAccountId, setSellAccountId] = useState(defaultAccountId)
Expand Down

0 comments on commit 8f43289

Please sign in to comment.