Skip to content

Commit

Permalink
Merge branch 'develop' into fox-wif-hat-discount
Browse files Browse the repository at this point in the history
  • Loading branch information
NeOMakinG authored Jan 27, 2025
2 parents ad14930 + fb01169 commit bc47046
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 11 deletions.
12 changes: 7 additions & 5 deletions .env.base
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -51,7 +53,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
Expand Down
1 change: 0 additions & 1 deletion .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion .env.develop
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
Expand Down
2 changes: 2 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ export const ThorchainSaversOverview: React.FC<OverviewProps> = ({
const isThorchainSaversDepositEnabled = useFeatureFlag('SaversVaultsDeposit')
const isThorchainSaversWithdrawalsEnabled = useFeatureFlag('SaversVaultsWithdraw')

const isRunePoolDepositEnabled = useFeatureFlag('RunePoolDeposit')
const isRunepoolWithdrawEnabled = useFeatureFlag('RunePoolWithdraw')

useEffect(() => {
if (!maybeAccountId) return
handleAccountIdChange(maybeAccountId)
Expand Down Expand Up @@ -335,15 +338,22 @@ export const ThorchainSaversOverview: React.FC<OverviewProps> = ({
hasPendingTxs,
hasPendingQueries,
isHaltedDeposits: isTradingActive === false,
isDisabledDeposits: isThorchainSaversDepositEnabled === false,
isDisabledWithdrawals: isThorchainSaversWithdrawalsEnabled === false,
isDisabledDeposits:
(!isRunePool && isThorchainSaversDepositEnabled === false) ||
(isRunePool && !isRunePoolDepositEnabled),
isDisabledWithdrawals:
(!isRunePool && isThorchainSaversWithdrawalsEnabled === false) ||
(isRunePool && !isRunepoolWithdrawEnabled),
remainingLockupTime,
})
}, [
earnOpportunityData,
hasPendingQueries,
hasPendingTxs,
isHardCapReached,
isRunePool,
isRunePoolDepositEnabled,
isRunepoolWithdrawEnabled,
isThorchainSaversDepositEnabled,
isThorchainSaversWithdrawalsEnabled,
isTradingActive,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ const getBaseReducers = <T extends TradeInputBaseState>(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
Expand Down
4 changes: 4 additions & 0 deletions src/state/slices/preferencesSlice/preferencesSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ export type FeatureFlags = {
ArbitrumBridgeClaims: boolean
UsdtApprovalReset: boolean
RunePool: boolean
RunePoolDeposit: boolean
RunePoolWithdraw: boolean
Markets: boolean
PhantomWallet: boolean
FoxPage: boolean
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 2 additions & 0 deletions src/test/mocks/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ export const mockStore: ReduxState = {
ArbitrumBridgeClaims: false,
UsdtApprovalReset: false,
RunePool: false,
RunePoolDeposit: false,
RunePoolWithdraw: false,
PortalsSwap: false,
Markets: false,
PhantomWallet: false,
Expand Down

0 comments on commit bc47046

Please sign in to comment.