From bacdbfe14a46e88748acca675c828a55b6cb6fce Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Fri, 24 Jan 2025 10:46:57 +0100 Subject: [PATCH 1/4] feat: turn thorfi granular flags off (#8661) --- .env.base | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.env.base b/.env.base index 4f878feadf2..5dd0fc994f7 100644 --- a/.env.base +++ b/.env.base @@ -12,8 +12,8 @@ REACT_APP_FEATURE_OPTIMISM=true REACT_APP_FEATURE_JAYPEGZ=true REACT_APP_FEATURE_MIXPANEL=true REACT_APP_FEATURE_SAVERS_VAULTS=true -REACT_APP_FEATURE_SAVERS_VAULTS_DEPOSIT=true -REACT_APP_FEATURE_SAVERS_VAULTS_WITHDRAW=true +REACT_APP_FEATURE_SAVERS_VAULTS_DEPOSIT=false +REACT_APP_FEATURE_SAVERS_VAULTS_WITHDRAW=false REACT_APP_FEATURE_WALLET_CONNECT_TO_DAPPS_V2=true REACT_APP_FEATURE_WALLET_CONNECT_TO_DAPPS=true REACT_APP_FEATURE_YAT=true @@ -23,8 +23,8 @@ REACT_APP_FEATURE_ADVANCED_SLIPPAGE=true REACT_APP_FEATURE_LEDGER_WALLET=true REACT_APP_FEATURE_WALLET_CONNECT_V2=true REACT_APP_FEATURE_THORCHAIN_LENDING=true -REACT_APP_FEATURE_THORCHAIN_LENDING_BORROW=true -REACT_APP_FEATURE_THORCHAIN_LENDING_REPAY=true +REACT_APP_FEATURE_THORCHAIN_LENDING_BORROW=false +REACT_APP_FEATURE_THORCHAIN_LENDING_REPAY=false REACT_APP_FEATURE_THORCHAINSWAP_LONGTAIL=true REACT_APP_FEATURE_THORCHAINSWAP_L1_TO_LONGTAIL=true REACT_APP_FEATURE_SHAPESHIFT_MOBILE_WALLET=false From 1e896cd2a6ad54a0ea14bc08c909b113a2b98596 Mon Sep 17 00:00:00 2001 From: woody <125113430+woodenfurniture@users.noreply.github.com> Date: Sat, 25 Jan 2025 00:30:58 +1100 Subject: [PATCH 2/4] fix: sell amount briefly appearing as NaNaNaN due to division by zero (#8659) --- .../components/TradeInput/components/SellAssetInput.tsx | 9 ++++++++- .../common/tradeInputBase/createTradeInputBaseSlice.ts | 5 ++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/MultiHopTrade/components/TradeInput/components/SellAssetInput.tsx b/src/components/MultiHopTrade/components/TradeInput/components/SellAssetInput.tsx index ccaba296aa8..bb5ee845ec0 100644 --- a/src/components/MultiHopTrade/components/TradeInput/components/SellAssetInput.tsx +++ b/src/components/MultiHopTrade/components/TradeInput/components/SellAssetInput.tsx @@ -69,12 +69,19 @@ export const SellAssetInput = memo( const handleSellAssetInputChange = useCallback( (value: string, isFiat: boolean | undefined) => { + const isRateZero = bnOrZero(sellAssetUserCurrencyRate).isZero() + + // Avoid division by zero const sellAmountCryptoPrecision = isFiat - ? bnOrZero(value).div(sellAssetUserCurrencyRate).toFixed() + ? isRateZero + ? '0' + : bnOrZero(value).div(sellAssetUserCurrencyRate).toFixed() : value + const sellAmountUserCurrency = !isFiat ? bnOrZero(value).times(sellAssetUserCurrencyRate).toFixed() : value + setRawSellAmountCryptoPrecision(sellAmountCryptoPrecision) setRawSellAmountUserCurrency(sellAmountUserCurrency) }, diff --git a/src/state/slices/common/tradeInputBase/createTradeInputBaseSlice.ts b/src/state/slices/common/tradeInputBase/createTradeInputBaseSlice.ts index 09dea71847c..6e0adea182d 100644 --- a/src/state/slices/common/tradeInputBase/createTradeInputBaseSlice.ts +++ b/src/state/slices/common/tradeInputBase/createTradeInputBaseSlice.ts @@ -71,7 +71,10 @@ const getBaseReducers = (initialState: T) => ({ const { sellAssetUsdRate, buyAssetUsdRate } = action.payload const sellAmountUsd = bnOrZero(state.sellAmountCryptoPrecision).times(sellAssetUsdRate ?? '0') - state.sellAmountCryptoPrecision = sellAmountUsd.div(buyAssetUsdRate ?? '0').toFixed() + // Avoid division by zero + state.sellAmountCryptoPrecision = bnOrZero(buyAssetUsdRate).isZero() + ? '0' + : sellAmountUsd.div(buyAssetUsdRate!).toFixed() const buyAsset = state.sellAsset state.sellAsset = state.buyAsset From b3ef25a6c95b6bd86f817a55733fb23771822ad5 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Fri, 24 Jan 2025 16:39:31 +0100 Subject: [PATCH 3/4] feat: new wallet flow go live (#8655) --- .env.base | 2 +- .env.dev | 1 - .env.develop | 1 - 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/.env.base b/.env.base index 5dd0fc994f7..a80cceaf52c 100644 --- a/.env.base +++ b/.env.base @@ -51,7 +51,7 @@ REACT_APP_FEATURE_PHANTOM_WALLET=true REACT_APP_FEATURE_THOR_FREE_FEES=true REACT_APP_FEATURE_LIMIT_ORDERS=true REACT_APP_FEATURE_NEW_TRADE_FLOW=true -REACT_APP_FEATURE_NEW_WALLET_FLOW=false +REACT_APP_FEATURE_NEW_WALLET_FLOW=true REACT_APP_FEATURE_FOX_PAGE_FOX_WIF_HAT_SECTION=false # absolute URL prefix diff --git a/.env.dev b/.env.dev index 7e53bf7fb12..e9df090dc2a 100644 --- a/.env.dev +++ b/.env.dev @@ -8,7 +8,6 @@ REACT_APP_FEATURE_FOX_PAGE_FOX_WIF_HAT_SECTION=true # feature flags REACT_APP_FEATURE_RFOX_LP=true -REACT_APP_FEATURE_NEW_WALLET_FLOW=true # logging REACT_APP_REDUX_WINDOW=false diff --git a/.env.develop b/.env.develop index 79a49445cc2..e8b601c3196 100644 --- a/.env.develop +++ b/.env.develop @@ -8,7 +8,6 @@ REACT_APP_FEATURE_FOX_PAGE_FOX_WIF_HAT_SECTION=true # feature flags REACT_APP_FEATURE_RFOX_LP=true -REACT_APP_FEATURE_NEW_WALLET_FLOW=true # mixpanel REACT_APP_MIXPANEL_TOKEN=1c1369f6ea23a6404bac41b42817cc4b From fb0116991e5d258fa12f8f63732f4b061af5f643 Mon Sep 17 00:00:00 2001 From: gomes <17035424+gomesalexandre@users.noreply.github.com> Date: Fri, 24 Jan 2025 17:57:01 +0100 Subject: [PATCH 4/4] feat: runepool granular flags (#8665) --- .env.base | 2 ++ src/config.ts | 2 ++ .../Overview/ThorchainSaversOverview.tsx | 14 ++++++++++++-- .../slices/preferencesSlice/preferencesSlice.ts | 4 ++++ src/test/mocks/store.ts | 2 ++ 5 files changed, 22 insertions(+), 2 deletions(-) diff --git a/.env.base b/.env.base index a80cceaf52c..f8de1d57eb5 100644 --- a/.env.base +++ b/.env.base @@ -41,6 +41,8 @@ REACT_APP_FEATURE_ARBITRUM_BRIDGE_CLAIMS=true REACT_APP_FEATURE_USDT_APPROVAL_RESET=true REACT_APP_FEATURE_PORTALS_SWAPPER=true REACT_APP_FEATURE_RUNEPOOL=true +REACT_APP_FEATURE_RUNEPOOL_DEPOSIT=true +REACT_APP_FEATURE_RUNEPOOL_WITHDRAW=true REACT_APP_FEATURE_MARKETS=true REACT_APP_FEATURE_FOX_PAGE=true REACT_APP_FEATURE_FOX_PAGE_RFOX=true diff --git a/src/config.ts b/src/config.ts index 8cfaa1d8437..cac42227ad4 100644 --- a/src/config.ts +++ b/src/config.ts @@ -165,6 +165,8 @@ const validators = { REACT_APP_FEATURE_ARBITRUM_BRIDGE_CLAIMS: bool({ default: false }), REACT_APP_FEATURE_USDT_APPROVAL_RESET: bool({ default: false }), REACT_APP_FEATURE_RUNEPOOL: bool({ default: false }), + REACT_APP_FEATURE_RUNEPOOL_DEPOSIT: bool({ default: false }), + REACT_APP_FEATURE_RUNEPOOL_WITHDRAW: bool({ default: false }), REACT_APP_FEATURE_MARKETS: bool({ default: false }), REACT_APP_PORTALS_BASE_URL: url(), REACT_APP_ZERION_BASE_URL: url(), diff --git a/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Overview/ThorchainSaversOverview.tsx b/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Overview/ThorchainSaversOverview.tsx index 7d91685c921..5b017941b68 100644 --- a/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Overview/ThorchainSaversOverview.tsx +++ b/src/features/defi/providers/thorchain-savers/components/ThorchainSaversManager/Overview/ThorchainSaversOverview.tsx @@ -145,6 +145,9 @@ export const ThorchainSaversOverview: React.FC = ({ const isThorchainSaversDepositEnabled = useFeatureFlag('SaversVaultsDeposit') const isThorchainSaversWithdrawalsEnabled = useFeatureFlag('SaversVaultsWithdraw') + const isRunePoolDepositEnabled = useFeatureFlag('RunePoolDeposit') + const isRunepoolWithdrawEnabled = useFeatureFlag('RunePoolWithdraw') + useEffect(() => { if (!maybeAccountId) return handleAccountIdChange(maybeAccountId) @@ -335,8 +338,12 @@ export const ThorchainSaversOverview: React.FC = ({ hasPendingTxs, hasPendingQueries, isHaltedDeposits: isTradingActive === false, - isDisabledDeposits: isThorchainSaversDepositEnabled === false, - isDisabledWithdrawals: isThorchainSaversWithdrawalsEnabled === false, + isDisabledDeposits: + (!isRunePool && isThorchainSaversDepositEnabled === false) || + (isRunePool && !isRunePoolDepositEnabled), + isDisabledWithdrawals: + (!isRunePool && isThorchainSaversWithdrawalsEnabled === false) || + (isRunePool && !isRunepoolWithdrawEnabled), remainingLockupTime, }) }, [ @@ -344,6 +351,9 @@ export const ThorchainSaversOverview: React.FC = ({ hasPendingQueries, hasPendingTxs, isHardCapReached, + isRunePool, + isRunePoolDepositEnabled, + isRunepoolWithdrawEnabled, isThorchainSaversDepositEnabled, isThorchainSaversWithdrawalsEnabled, isTradingActive, diff --git a/src/state/slices/preferencesSlice/preferencesSlice.ts b/src/state/slices/preferencesSlice/preferencesSlice.ts index 7c2b291c717..3b747825e86 100644 --- a/src/state/slices/preferencesSlice/preferencesSlice.ts +++ b/src/state/slices/preferencesSlice/preferencesSlice.ts @@ -61,6 +61,8 @@ export type FeatureFlags = { ArbitrumBridgeClaims: boolean UsdtApprovalReset: boolean RunePool: boolean + RunePoolDeposit: boolean + RunePoolWithdraw: boolean Markets: boolean PhantomWallet: boolean FoxPage: boolean @@ -161,6 +163,8 @@ const initialState: Preferences = { ArbitrumBridgeClaims: getConfig().REACT_APP_FEATURE_ARBITRUM_BRIDGE_CLAIMS, UsdtApprovalReset: getConfig().REACT_APP_FEATURE_USDT_APPROVAL_RESET, RunePool: getConfig().REACT_APP_FEATURE_RUNEPOOL, + RunePoolDeposit: getConfig().REACT_APP_FEATURE_RUNEPOOL_DEPOSIT, + RunePoolWithdraw: getConfig().REACT_APP_FEATURE_RUNEPOOL_WITHDRAW, Markets: getConfig().REACT_APP_FEATURE_MARKETS, PhantomWallet: getConfig().REACT_APP_FEATURE_PHANTOM_WALLET, FoxPage: getConfig().REACT_APP_FEATURE_FOX_PAGE, diff --git a/src/test/mocks/store.ts b/src/test/mocks/store.ts index 2179c50b42f..f3fbcb1d18c 100644 --- a/src/test/mocks/store.ts +++ b/src/test/mocks/store.ts @@ -126,6 +126,8 @@ export const mockStore: ReduxState = { ArbitrumBridgeClaims: false, UsdtApprovalReset: false, RunePool: false, + RunePoolDeposit: false, + RunePoolWithdraw: false, PortalsSwap: false, Markets: false, PhantomWallet: false,