Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions public/icons/markets/horizon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 1 addition & 12 deletions public/icons/other/velora.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/tokens/buidl.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/tokens/jaaa.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/tokens/jtrsy.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/tokens/uscc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/tokens/ustb.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/icons/tokens/usyc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 19 additions & 2 deletions src/components/transactions/Emode/EmodeModalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ import { useModalContext } from 'src/hooks/useModal';
import { useWeb3Context } from 'src/libs/hooks/useWeb3Context';
import { useRootStore } from 'src/store/root';
import { getNetworkConfig } from 'src/utils/marketsAndNetworksConfig';
import { useShallow } from 'zustand/shallow';

import { TxErrorView } from '../FlowCommons/Error';
import { GasEstimationError } from '../FlowCommons/GasEstimationError';
Expand Down Expand Up @@ -79,7 +80,9 @@ export const EmodeModalContent = ({ user }: { user: ExtendedFormattedUser }) =>
marketReferencePriceInUsd,
userReserves,
} = useAppDataContext();
const currentChainId = useRootStore((store) => store.currentChainId);
const [currentChainId, currentMarket] = useRootStore(
useShallow((store) => [store.currentChainId, store.currentMarket])
);
const { chainId: connectedChainId, readOnlyModeAddress } = useWeb3Context();
const currentTimestamp = useCurrentTimestamp(1);
const { gasLimit, mainTxState: emodeTxState, txError } = useModalContext();
Expand All @@ -95,8 +98,22 @@ export const EmodeModalContent = ({ user }: { user: ExtendedFormattedUser }) =>
])
);

// For Horizon markets (proto_horizon_v3 or proto_sepolia_horizon_v3), use eModeCategories[2] as default
// For all other markets, use eModeCategories[1] (eth correlanted) as default when user has no eMode enabled (userEmodeCategoryId === 0)
const getDefaultEModeCategory = () => {
if (user.userEmodeCategoryId !== 0) {
return eModeCategories[user.userEmodeCategoryId];
}

const isHorizonMarket =
currentMarket.includes('proto_horizon_v3') ||
currentMarket.includes('fork_proto_horizon_v3') ||
currentMarket.includes('proto_sepolia_horizon_v3');
return isHorizonMarket ? eModeCategories[2] : eModeCategories[1];
};

const [selectedEmode, setSelectedEmode] = useState<EModeCategoryDisplay>(
user.userEmodeCategoryId === 0 ? eModeCategories[1] : eModeCategories[user.userEmodeCategoryId]
getDefaultEModeCategory()
);
const networkConfig = getNetworkConfig(currentChainId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import {
assetCanBeBorrowedByUser,
getMaxAmountAvailableToBorrow,
} from '../../../../utils/getMaxAmountAvailableToBorrow';
import { isAssetHidden } from '../constants';
import { ListButtonsColumn } from '../ListButtonsColumn';
import { ListLoader } from '../ListLoader';
import { BorrowAssetsListItem } from './BorrowAssetsListItem';
Expand Down Expand Up @@ -75,9 +76,10 @@ const head = [
];

export const BorrowAssetsList = () => {
const [currentNetworkConfig, currentMarket] = useRootStore(
useShallow((store) => [store.currentNetworkConfig, store.currentMarket])
const [currentNetworkConfig, currentMarketData] = useRootStore(
useShallow((store) => [store.currentNetworkConfig, store.currentMarketData])
);
const currentMarket = currentMarketData.market;
const { user, reserves, marketReferencePriceInUsd, loading } = useAppDataContext();
const theme = useTheme();
const downToXSM = useMediaQuery(theme.breakpoints.down('xsm'));
Expand All @@ -88,6 +90,7 @@ export const BorrowAssetsList = () => {

const tokensToBorrow = reserves
.filter((reserve) => (user ? assetCanBeBorrowedByUser(reserve, user) : false))
.filter((reserve) => !isAssetHidden(currentMarketData.market, reserve.underlyingAsset))
.map((reserve: ComputedReserveData) => {
const availableBorrows = user ? Number(getMaxAmountAvailableToBorrow(reserve, user)) : 0;

Expand Down
Loading
Loading