From 5469d708cbe74cff848ad7f3fbd26bc9184696f7 Mon Sep 17 00:00:00 2001
From: Bob van der Helm <34470358+bobthebuidlr@users.noreply.github.com>
Date: Thu, 23 Nov 2023 15:38:47 +0100
Subject: [PATCH] v2.0.6 and use feature flag for auto repay (#650)
---
package.json | 2 +-
src/components/Trade/TradeModule/SwapForm/index.tsx | 8 +++++---
src/utils/constants.ts | 1 +
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/package.json b/package.json
index 1aa5f1ff..c6a2d52e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "mars-v2-frontend",
- "version": "2.0.5",
+ "version": "2.0.6",
"private": true,
"scripts": {
"build": "yarn validate-env && next build",
diff --git a/src/components/Trade/TradeModule/SwapForm/index.tsx b/src/components/Trade/TradeModule/SwapForm/index.tsx
index a52d9e17..4c47d6be 100644
--- a/src/components/Trade/TradeModule/SwapForm/index.tsx
+++ b/src/components/Trade/TradeModule/SwapForm/index.tsx
@@ -27,7 +27,7 @@ import { useUpdatedAccount } from 'hooks/useUpdatedAccount'
import useStore from 'store'
import { BNCoin } from 'types/classes/BNCoin'
import { byDenom } from 'utils/array'
-import { defaultFee } from 'utils/constants'
+import { defaultFee, ENABLE_AUTO_REPAY } from 'utils/constants'
import { getCapLeftWithBuffer } from 'utils/generic'
import { asyncThrottle, BN } from 'utils/helpers'
@@ -50,7 +50,9 @@ export default function SwapForm(props: Props) {
const isBorrowEnabled = !!marketAssets.find(byDenom(sellAsset.denom))?.borrowEnabled
const isRepayable = !!account?.debts.find(byDenom(buyAsset.denom))
const [isMarginChecked, setMarginChecked] = useToggle(isBorrowEnabled ? useMargin : false)
- const [isAutoRepayChecked, setAutoRepayChecked] = useToggle(isRepayable ? useAutoRepay : false)
+ const [isAutoRepayChecked, setAutoRepayChecked] = useToggle(
+ isRepayable && ENABLE_AUTO_REPAY ? useAutoRepay : false,
+ )
const [buyAssetAmount, setBuyAssetAmount] = useState(BN_ZERO)
const [sellAssetAmount, setSellAssetAmount] = useState(BN_ZERO)
const [maxBuyableAmountEstimation, setMaxBuyableAmountEstimation] = useState(BN_ZERO)
@@ -314,7 +316,7 @@ export default function SwapForm(props: Props) {
/>
- {isRepayable && (
+ {isRepayable && ENABLE_AUTO_REPAY && (