diff --git a/src/components/Modals/AstroLp/AstroLpWithdraw.tsx b/src/components/Modals/AstroLp/AstroLpWithdraw.tsx index 0b4d80a5c..fbe2f6587 100644 --- a/src/components/Modals/AstroLp/AstroLpWithdraw.tsx +++ b/src/components/Modals/AstroLp/AstroLpWithdraw.tsx @@ -9,7 +9,6 @@ import Card from 'components/common/Card' import Text from 'components/common/Text' import TokenInputWithSlider from 'components/common/TokenInput/TokenInputWithSlider' import { BN_ZERO } from 'constants/math' -import { useUpdatedAccount } from 'hooks/accounts/useUpdatedAccount' import useAssets from 'hooks/assets/useAssets' import useStakedAstroLpRewards from 'hooks/incentives/useStakedAstroLpRewards' import useStore from 'store' @@ -21,14 +20,20 @@ import checkAutoLendEnabled from 'utils/checkAutoLendEnabled' interface Props { account: Account astroLp: DepositedAstroLp + simulateUnstakeAstroLp: ( + isAutoLend: boolean, + BNCoin: BNCoin, + astroLp: DepositedAstroLp, + currentLpRewards: BNCoin[], + ) => void } export default function AstroLpWithdraw(props: Props) { - const { account, astroLp } = props + const { account, astroLp, simulateUnstakeAstroLp } = props + const { mutate } = useSWRConfig() const { data: assets } = useAssets() const astroLpAsset = assets.find(byDenom(astroLp.denoms.lp)) - const { simulateUnstakeAstroLp } = useUpdatedAccount(account) const [withdrawAmount, setWithdrawAmount] = useState(BN_ZERO) const withdrawFromAstroLps = useStore((s) => s.withdrawFromAstroLps) const chainConfig = useStore((s) => s.chainConfig) diff --git a/src/components/Modals/AstroLp/index.tsx b/src/components/Modals/AstroLp/index.tsx index 6a4346280..691d8a093 100644 --- a/src/components/Modals/AstroLp/index.tsx +++ b/src/components/Modals/AstroLp/index.tsx @@ -34,8 +34,13 @@ function AstroLpModal(props: Props) { useStore.setState({ farmModal: null }) }, []) - const { addedDebts, removedDeposits, removedLends, simulateAstroLpDeposit } = - useUpdatedAccount(currentAccount) + const { + addedDebts, + removedDeposits, + removedLends, + simulateAstroLpDeposit, + simulateUnstakeAstroLp, + } = useUpdatedAccount(currentAccount) return ( ) : ( - + )} ) diff --git a/src/components/Modals/Settings/index.tsx b/src/components/Modals/Settings/index.tsx index fdc799a60..3e2e5190d 100644 --- a/src/components/Modals/Settings/index.tsx +++ b/src/components/Modals/Settings/index.tsx @@ -30,7 +30,7 @@ import useStore from 'store' import { getCurrentChainId } from 'utils/getCurrentChainId' import { BN } from 'utils/helpers' -const slippages = [0.02, 0.03] +const slippages = [0.01, 0.02] export default function SettingsModal() { const chainConfig = useChainConfig() diff --git a/src/components/account/AccountBalancesTable/Columns/Size.tsx b/src/components/account/AccountBalancesTable/Columns/Size.tsx index 97f0f86dd..941f6ea02 100644 --- a/src/components/account/AccountBalancesTable/Columns/Size.tsx +++ b/src/components/account/AccountBalancesTable/Columns/Size.tsx @@ -46,7 +46,7 @@ export default function Size(props: Props) { const formattedAmount = formatAmountToPrecision(size, MAX_AMOUNT_DECIMALS) const minimumAmount = allowZero ? 0 : MIN_AMOUNT - const lowAmount = formattedAmount === 0 ? minimumAmount : Math.max(formattedAmount, MIN_AMOUNT) + const lowAmount = formattedAmount === 0 ? minimumAmount : formattedAmount return (
- Not enough Liquidty! + Not enough Liquidity! {`This transaction would exceed the amount of ${market.asset.symbol} currently available for borrowing on Mars.`} diff --git a/src/components/common/Callout.tsx b/src/components/common/Callout.tsx index fca597afc..d89d90cab 100644 --- a/src/components/common/Callout.tsx +++ b/src/components/common/Callout.tsx @@ -5,7 +5,7 @@ import { ExclamationMarkTriangle, InfoCircle } from 'components/common/Icons' import Text from 'components/common/Text' interface Props { - children: string + children: string | React.ReactNode className?: string type: CalloutType } diff --git a/src/components/common/RouteInfo.tsx b/src/components/common/RouteInfo.tsx index 80952fc66..58f924ad4 100644 --- a/src/components/common/RouteInfo.tsx +++ b/src/components/common/RouteInfo.tsx @@ -1,12 +1,14 @@ import classNames from 'classnames' import DisplayCurrency from 'components/common/DisplayCurrency' import Divider from 'components/common/Divider' -import { FormattedNumber } from 'components/common/FormattedNumber' -import { ChevronDown } from 'components/common/Icons' import SummaryLine from 'components/common/SummaryLine' import Text from 'components/common/Text' +import useChainConfig from 'hooks/chain/useChainConfig' import useToggle from 'hooks/common/useToggle' import { BNCoin } from 'types/classes/BNCoin' +import { ChevronDown } from 'components/common/Icons' +import { ChainInfoID } from 'types/enums' +import { FormattedNumber } from 'components/common/FormattedNumber' import { formatValue } from 'utils/formatters' interface Props { @@ -28,6 +30,7 @@ export interface SwapAssets { export function RouteInfo(props: Props) { const [showSummary, setShowSummary] = useToggle() + const chainConfig = useChainConfig() return (
@@ -54,22 +57,27 @@ export function RouteInfo(props: Props) { 5, + })} /> - - - + {chainConfig.isOsmosis && ( + + + + )} {props.route.description} {props.tradeInfo && ( diff --git a/src/components/earn/farm/astroLp/ActiveAstroLps.tsx b/src/components/earn/farm/astroLp/ActiveAstroLps.tsx index 04e1ce8db..5ed23d88d 100644 --- a/src/components/earn/farm/astroLp/ActiveAstroLps.tsx +++ b/src/components/earn/farm/astroLp/ActiveAstroLps.tsx @@ -5,6 +5,7 @@ import ActiveAstroLpsTable from 'components/earn/farm/astroLp/Table/ActiveAstroL import useActiveAstroLpsColumns from 'components/earn/farm/astroLp/Table/Columns/useActiveAstroLpsColumns' import useAssets from 'hooks/assets/useAssets' import useDepositedAstroLps from 'hooks/astroLp/useDepositedAstroLps' + export function ActiveAstroLps() { const { data: assets } = useAssets() const activeAstroLps = useDepositedAstroLps() diff --git a/src/components/trade/TradeModule/SwapForm/TradeSummary.tsx b/src/components/trade/TradeModule/SwapForm/TradeSummary.tsx index 3212260ce..d38c4bccb 100644 --- a/src/components/trade/TradeModule/SwapForm/TradeSummary.tsx +++ b/src/components/trade/TradeModule/SwapForm/TradeSummary.tsx @@ -1,6 +1,7 @@ import classNames from 'classnames' import ActionButton from 'components/common/Button/ActionButton' +import { Callout, CalloutType } from 'components/common/Callout' import { CircularProgress } from 'components/common/CircularProgress' import Divider from 'components/common/Divider' import { FormattedNumber } from 'components/common/FormattedNumber' @@ -12,6 +13,8 @@ import useSlippage from 'hooks/settings/useSlippage' import { useMemo } from 'react' import { formatPercent } from 'utils/formatters' import { getMinAmountOutFromRouteInfo } from 'utils/swap' +import useStore from 'store' +import Button from 'components/common/Button' interface Props { borrowAmount: BigNumber @@ -60,68 +63,92 @@ export default function TradeSummary(props: Props) { }, [isAdvanced, direction, sellAsset.symbol, buyAsset.symbol]) return ( -
+ {routeInfo && routeInfo.priceImpact.toNumber() > 5 && ( + + Your trade's price impact exceeds 5%. Please review the Summary before submitting the + transaction. + )} - > -
- -
- {isUpdatingLiquidationPrice ? ( - - ) : liquidationPrice === null || liquidationPrice === 0 ? ( - '-' - ) : ( - - )} -
-
- - {isMargin && ( - <> - - - - - {formatPercent(borrowRate || 0)} - - - - )} - {routeInfo && ( - + {routeInfo && slippage * 100 > 1 && ( + + Your slippage exceeds 1%. Please review the Summary before submitting the transaction or + change your Slippage in the + +
) } diff --git a/src/constants/defaultSettings.ts b/src/constants/defaultSettings.ts index 0d8b191fb..4a8083746 100644 --- a/src/constants/defaultSettings.ts +++ b/src/constants/defaultSettings.ts @@ -11,7 +11,7 @@ export const getDefaultChainSettings = (chainConfig: ChainConfig) => { tradingPairSimple: chainConfig.defaultTradingPair, tradingPairAdvanced: chainConfig.defaultTradingPair, displayCurrency: ORACLE_DENOM, - slippage: 0.02, + slippage: 0.01, tutorial: true, migrationBanner: true, perpsAsset: '',