diff --git a/earn/src/App.tsx b/earn/src/App.tsx index 13ca61062..e71c0bf97 100644 --- a/earn/src/App.tsx +++ b/earn/src/App.tsx @@ -23,11 +23,10 @@ import AppBody from './components/common/AppBody'; import Header from './components/header/Header'; import { LendingPairsContext } from './data/hooks/UseLendingPairs'; import { getAvailableLendingPairs, LendingPair } from './data/LendingPair'; +import AdvancedPage from './pages/AdvancedPage'; import ImportBoostPage from './pages/boost/ImportBoostPage'; import ManageBoostPage from './pages/boost/ManageBoostPage'; import BoostPage from './pages/BoostPage'; -import BorrowPage from './pages/BorrowPage'; -import ClaimPage from './pages/ClaimPage'; import LeaderboardPage from './pages/LeaderboardPage'; import LendPage from './pages/LendPage'; import MarketsPage from './pages/MarketsPage'; @@ -130,10 +129,9 @@ function AppBodyWrapper() { } /> } /> } /> - } /> + } /> > )} - } /> } /> } /> diff --git a/earn/src/components/borrow/BorrowGraph.tsx b/earn/src/components/advanced/BorrowGraph.tsx similarity index 100% rename from earn/src/components/borrow/BorrowGraph.tsx rename to earn/src/components/advanced/BorrowGraph.tsx diff --git a/earn/src/components/borrow/BorrowGraphPlaceholder.tsx b/earn/src/components/advanced/BorrowGraphPlaceholder.tsx similarity index 100% rename from earn/src/components/borrow/BorrowGraphPlaceholder.tsx rename to earn/src/components/advanced/BorrowGraphPlaceholder.tsx diff --git a/earn/src/components/borrow/BorrowGraphTooltip.tsx b/earn/src/components/advanced/BorrowGraphTooltip.tsx similarity index 100% rename from earn/src/components/borrow/BorrowGraphTooltip.tsx rename to earn/src/components/advanced/BorrowGraphTooltip.tsx diff --git a/earn/src/components/borrow/BorrowMetrics.tsx b/earn/src/components/advanced/BorrowMetrics.tsx similarity index 100% rename from earn/src/components/borrow/BorrowMetrics.tsx rename to earn/src/components/advanced/BorrowMetrics.tsx diff --git a/earn/src/components/borrow/GlobalStatsTable.tsx b/earn/src/components/advanced/GlobalStatsTable.tsx similarity index 100% rename from earn/src/components/borrow/GlobalStatsTable.tsx rename to earn/src/components/advanced/GlobalStatsTable.tsx diff --git a/earn/src/components/borrow/ManageAccountButtons.tsx b/earn/src/components/advanced/ManageAccountButtons.tsx similarity index 100% rename from earn/src/components/borrow/ManageAccountButtons.tsx rename to earn/src/components/advanced/ManageAccountButtons.tsx diff --git a/earn/src/components/borrow/SmartWalletButton.tsx b/earn/src/components/advanced/SmartWalletButton.tsx similarity index 100% rename from earn/src/components/borrow/SmartWalletButton.tsx rename to earn/src/components/advanced/SmartWalletButton.tsx diff --git a/earn/src/components/borrow/UniswapPositionList.tsx b/earn/src/components/advanced/UniswapPositionList.tsx similarity index 100% rename from earn/src/components/borrow/UniswapPositionList.tsx rename to earn/src/components/advanced/UniswapPositionList.tsx diff --git a/earn/src/components/borrow/modal/AddCollateralModal.tsx b/earn/src/components/advanced/modal/AddCollateralModal.tsx similarity index 100% rename from earn/src/components/borrow/modal/AddCollateralModal.tsx rename to earn/src/components/advanced/modal/AddCollateralModal.tsx diff --git a/earn/src/components/borrow/modal/BorrowModal.tsx b/earn/src/components/advanced/modal/BorrowModal.tsx similarity index 99% rename from earn/src/components/borrow/modal/BorrowModal.tsx rename to earn/src/components/advanced/modal/BorrowModal.tsx index af400f2f2..82a37f822 100644 --- a/earn/src/components/borrow/modal/BorrowModal.tsx +++ b/earn/src/components/advanced/modal/BorrowModal.tsx @@ -27,8 +27,8 @@ import { Liabilities } from '../../../data/MarginAccount'; import { MarketInfo } from '../../../data/MarketInfo'; import { RateModel, yieldPerSecondToAPR } from '../../../data/RateModel'; import { UniswapPosition } from '../../../data/Uniswap'; +import HealthBar from '../../common/HealthBar'; import TokenAmountSelectInput from '../../portfolio/TokenAmountSelectInput'; -import HealthBar from '../HealthBar'; const GAS_ESTIMATE_WIGGLE_ROOM = 110; // 10% wiggle room const SECONDARY_COLOR = '#CCDFED'; diff --git a/earn/src/components/borrow/modal/NewSmartWalletModal.tsx b/earn/src/components/advanced/modal/NewSmartWalletModal.tsx similarity index 100% rename from earn/src/components/borrow/modal/NewSmartWalletModal.tsx rename to earn/src/components/advanced/modal/NewSmartWalletModal.tsx diff --git a/earn/src/components/borrow/modal/RemoveCollateralModal.tsx b/earn/src/components/advanced/modal/RemoveCollateralModal.tsx similarity index 99% rename from earn/src/components/borrow/modal/RemoveCollateralModal.tsx rename to earn/src/components/advanced/modal/RemoveCollateralModal.tsx index b91df8537..7489bffa9 100644 --- a/earn/src/components/borrow/modal/RemoveCollateralModal.tsx +++ b/earn/src/components/advanced/modal/RemoveCollateralModal.tsx @@ -25,8 +25,8 @@ import { BorrowerNftBorrower } from '../../../data/BorrowerNft'; import { Assets } from '../../../data/MarginAccount'; import { MarketInfo } from '../../../data/MarketInfo'; import { UniswapPosition } from '../../../data/Uniswap'; +import HealthBar from '../../common/HealthBar'; import TokenAmountSelectInput from '../../portfolio/TokenAmountSelectInput'; -import HealthBar from '../HealthBar'; const GAS_ESTIMATE_WIGGLE_ROOM = 110; // 10% wiggle room const SECONDARY_COLOR = '#CCDFED'; diff --git a/earn/src/components/borrow/modal/RepayModal.tsx b/earn/src/components/advanced/modal/RepayModal.tsx similarity index 99% rename from earn/src/components/borrow/modal/RepayModal.tsx rename to earn/src/components/advanced/modal/RepayModal.tsx index 2dcab74d6..cc4821ddf 100644 --- a/earn/src/components/borrow/modal/RepayModal.tsx +++ b/earn/src/components/advanced/modal/RepayModal.tsx @@ -19,8 +19,8 @@ import { ChainContext } from '../../../App'; import { isHealthy } from '../../../data/BalanceSheet'; import { Liabilities, MarginAccount } from '../../../data/MarginAccount'; import { UniswapPosition } from '../../../data/Uniswap'; +import HealthBar from '../../common/HealthBar'; import TokenAmountSelectInput from '../../portfolio/TokenAmountSelectInput'; -import HealthBar from '../HealthBar'; const GAS_ESTIMATE_WIGGLE_ROOM = 110; // 10% wiggle room const SECONDARY_COLOR = '#CCDFED'; diff --git a/earn/src/components/borrow/modal/WithdrawAnteModal.tsx b/earn/src/components/advanced/modal/WithdrawAnteModal.tsx similarity index 100% rename from earn/src/components/borrow/modal/WithdrawAnteModal.tsx rename to earn/src/components/advanced/modal/WithdrawAnteModal.tsx diff --git a/earn/src/components/borrow/modal/WithdrawUniswapNFTModal.tsx b/earn/src/components/advanced/modal/WithdrawUniswapNFTModal.tsx similarity index 100% rename from earn/src/components/borrow/modal/WithdrawUniswapNFTModal.tsx rename to earn/src/components/advanced/modal/WithdrawUniswapNFTModal.tsx diff --git a/earn/src/components/borrow/modal/tab/AddCollateralTab.tsx b/earn/src/components/advanced/modal/tab/AddCollateralTab.tsx similarity index 99% rename from earn/src/components/borrow/modal/tab/AddCollateralTab.tsx rename to earn/src/components/advanced/modal/tab/AddCollateralTab.tsx index c812374cd..5421d617c 100644 --- a/earn/src/components/borrow/modal/tab/AddCollateralTab.tsx +++ b/earn/src/components/advanced/modal/tab/AddCollateralTab.tsx @@ -15,8 +15,8 @@ import { ChainContext } from '../../../../App'; import { isHealthy } from '../../../../data/BalanceSheet'; import { Assets, MarginAccount } from '../../../../data/MarginAccount'; import { UniswapPosition } from '../../../../data/Uniswap'; +import HealthBar from '../../../common/HealthBar'; import TokenAmountSelectInput from '../../../portfolio/TokenAmountSelectInput'; -import HealthBar from '../../HealthBar'; const SECONDARY_COLOR = '#CCDFED'; const TERTIARY_COLOR = '#4b6980'; diff --git a/earn/src/components/borrow/modal/tab/AddUniswapNFTAsCollateralTab.tsx b/earn/src/components/advanced/modal/tab/AddUniswapNFTAsCollateralTab.tsx similarity index 100% rename from earn/src/components/borrow/modal/tab/AddUniswapNFTAsCollateralTab.tsx rename to earn/src/components/advanced/modal/tab/AddUniswapNFTAsCollateralTab.tsx diff --git a/earn/src/components/borrow/HealthBar.spec.tsx b/earn/src/components/common/HealthBar.spec.tsx similarity index 100% rename from earn/src/components/borrow/HealthBar.spec.tsx rename to earn/src/components/common/HealthBar.spec.tsx diff --git a/earn/src/components/borrow/HealthBar.tsx b/earn/src/components/common/HealthBar.tsx similarity index 100% rename from earn/src/components/borrow/HealthBar.tsx rename to earn/src/components/common/HealthBar.tsx diff --git a/earn/src/components/common/HealthGauge.tsx b/earn/src/components/common/HealthGauge.tsx index a79235ba2..71f0768e2 100644 --- a/earn/src/components/common/HealthGauge.tsx +++ b/earn/src/components/common/HealthGauge.tsx @@ -4,7 +4,7 @@ import { GREY_600 } from 'shared/lib/data/constants/Colors'; import { getHealthColor } from 'shared/lib/util/Health'; import styled from 'styled-components'; -import HealthBar from '../borrow/HealthBar'; +import HealthBar from './HealthBar'; const TooltipParent = styled.div` display: inline-block; diff --git a/earn/src/components/info/LenderCard.tsx b/earn/src/components/info/LenderCard.tsx deleted file mode 100644 index 590e51343..000000000 --- a/earn/src/components/info/LenderCard.tsx +++ /dev/null @@ -1,110 +0,0 @@ -import { useContext } from 'react'; - -import OpenIcon from 'shared/lib/assets/svg/OpenNoPad'; -import { Display, Text } from 'shared/lib/components/common/Typography'; -import { GREY_700, GREY_800 } from 'shared/lib/data/constants/Colors'; -import { GN } from 'shared/lib/data/GoodNumber'; -import { getEtherscanUrlForChain } from 'shared/lib/util/Chains'; -import styled from 'styled-components'; -import { Address } from 'wagmi'; - -import { ChainContext } from '../../App'; -import { ALOE_II_RATE_MODEL_NAMES } from '../../data/constants/Values'; - -const SECONDARY_COLOR = 'rgba(130, 160, 182, 1)'; - -const Wrapper = styled.div` - display: flex; - flex-direction: column; - gap: 4px; - margin-left: -2px; -`; - -const Container = styled.div` - display: flex; - flex-direction: column; - gap: 32px; - width: 100%; - background-color: ${GREY_800}; - border: 2px solid ${GREY_700}; - border-radius: 8px; - padding: 20px 32px; - flex-grow: 1; - white-space: nowrap; -`; - -const OpenIconLink = styled.a` - svg { - path { - stroke: ${SECONDARY_COLOR}; - } - } -`; - -const Column = styled.div` - display: flex; - flex-direction: column; - gap: 16px; - justify-content: space-evenly; - height: 100%; -`; - -const Cell = styled.div` - display: flex; - flex-direction: column; - gap: 4px; - align-items: center; -`; - -export type LenderCardProps = { - address: Address; - symbol: string; - reserveFactor: number; - totalSupply: GN; - rateModel: Address; - decimals: number; -}; - -export default function LenderCard(props: LenderCardProps) { - const { address, symbol, reserveFactor, rateModel } = props; - const { activeChain } = useContext(ChainContext); - - const baseEthEtherscanLink = getEtherscanUrlForChain(activeChain); - const lenderEtherscanLink = `${baseEthEtherscanLink}/address/${address}`; - const rateModelEtherscanLink = `${baseEthEtherscanLink}/address/${rateModel}`; - const rateModelName = ALOE_II_RATE_MODEL_NAMES[rateModel.toLowerCase()] ?? 'Unknown'; - - return ( - - - - {symbol} - - - - - - - - - - Rate Model - - - {rateModelName} - - - - - - - - Reserve Factor - - {reserveFactor.toFixed(2)}% - - - - - ); -} diff --git a/earn/src/components/info/MarketCard.tsx b/earn/src/components/info/MarketCard.tsx deleted file mode 100644 index 0efabf106..000000000 --- a/earn/src/components/info/MarketCard.tsx +++ /dev/null @@ -1,261 +0,0 @@ -import { useContext } from 'react'; - -import { SendTransactionResult } from '@wagmi/core'; -import { formatDistanceToNowStrict, format } from 'date-fns'; -import { factoryAbi } from 'shared/lib/abis/Factory'; -import { volatilityOracleAbi } from 'shared/lib/abis/VolatilityOracle'; -import OpenIcon from 'shared/lib/assets/svg/OpenNoPad'; -import { OutlinedWhiteButton } from 'shared/lib/components/common/Buttons'; -import { Display, Text } from 'shared/lib/components/common/Typography'; -import { ALOE_II_FACTORY_ADDRESS, ALOE_II_ORACLE_ADDRESS } from 'shared/lib/data/constants/ChainSpecific'; -import { GREY_700, GREY_800 } from 'shared/lib/data/constants/Colors'; -import { Q32 } from 'shared/lib/data/constants/Values'; -import { FeeTier, PrintFeeTier } from 'shared/lib/data/FeeTier'; -import { GN, GNFormat } from 'shared/lib/data/GoodNumber'; -import { getEtherscanUrlForChain } from 'shared/lib/util/Chains'; -import styled from 'styled-components'; -import { Address, useAccount, useContractWrite, usePrepareContractWrite } from 'wagmi'; - -import { ChainContext } from '../../App'; - -const SECONDARY_COLOR = 'rgba(130, 160, 182, 1)'; -const GREEN_COLOR = 'rgba(0, 189, 63, 1)'; -const YELLOW_COLOR = 'rgba(242, 201, 76, 1)'; -const RED_COLOR = 'rgba(234, 87, 87, 0.75)'; - -function getManipulationColor(manipulationMetric: number, manipulationThreshold: number) { - // If the manipulation metric is greater than or equal to the threshold, the color is red. - // If the manipulation metric is less than the threshold, but is within 20% of the threshold, - // the color is yellow. - // Otherwise, the color is green. - if (manipulationMetric >= manipulationThreshold) { - return RED_COLOR; - } else if (manipulationMetric >= manipulationThreshold * 0.8) { - return YELLOW_COLOR; - } else { - return GREEN_COLOR; - } -} - -const Wrapper = styled.div` - display: flex; - flex-direction: column; - gap: 4px; -`; - -const Container = styled.div` - display: flex; - flex-direction: row; - gap: 32px; - width: 100%; - justify-content: space-around; - background-color: ${GREY_800}; - border: 2px solid ${GREY_700}; - border-radius: 8px; - border-top-left-radius: 8px; - border-bottom-left-radius: 8px; - padding: 20px 32px; - flex-grow: 1; - white-space: nowrap; -`; - -const OpenIconLink = styled.a` - svg { - path { - stroke: ${SECONDARY_COLOR}; - } - } -`; - -const Column = styled.div` - display: flex; - flex-direction: column; - gap: 16px; -`; - -const Cell = styled.div` - display: flex; - flex-direction: column; - gap: 4px; - align-items: center; -`; - -const PausedStatus = styled.div<{ $color: string }>` - width: 8px; - height: 8px; - border-radius: 50%; - background-color: ${(props) => props.$color}; -`; - -export type MarketCardProps = { - nSigma: number; - ltv: number; - ante: GN; - pausedUntilTime: number; - manipulationMetric: number; - manipulationThreshold: number; - lenderSymbols: [string, string]; - poolAddress: string; - feeTier: FeeTier; - lastUpdatedTimestamp?: number; - setPendingTxn: (data: SendTransactionResult) => void; -}; - -export default function MarketCard(props: MarketCardProps) { - const { - nSigma, - ltv, - ante, - pausedUntilTime, - manipulationMetric, - manipulationThreshold, - lenderSymbols, - poolAddress, - feeTier, - lastUpdatedTimestamp, - setPendingTxn, - } = props; - const { activeChain } = useContext(ChainContext); - const { address: accountAddress } = useAccount(); - - const etherscanLink = `${getEtherscanUrlForChain(activeChain)}/address/${poolAddress}`; - const token0Symbol = lenderSymbols[0].slice(0, lenderSymbols[0].length - 1); - const token1Symbol = lenderSymbols[1].slice(0, lenderSymbols[1].length - 1); - - const manipulationColor = getManipulationColor(manipulationMetric, manipulationThreshold); - const manipulationInequality = manipulationMetric < manipulationThreshold ? '<' : '>'; - - const lastUpdated = lastUpdatedTimestamp - ? formatDistanceToNowStrict(new Date(lastUpdatedTimestamp * 1000), { addSuffix: true, roundingMethod: 'round' }) - : 'Never'; - const minutesSinceLastUpdate = lastUpdatedTimestamp ? (Date.now() / 1000 - lastUpdatedTimestamp) / 60 : 0; - const canUpdateLTV = minutesSinceLastUpdate > 240 || lastUpdatedTimestamp === undefined; - - const isPaused = pausedUntilTime > Date.now() / 1000; - const canBorrowingBeDisabled = manipulationMetric >= manipulationThreshold; - - const { config: pauseConfig } = usePrepareContractWrite({ - address: ALOE_II_FACTORY_ADDRESS[activeChain.id], - abi: factoryAbi, - functionName: 'pause', - // We don't care as much about gas here as we prioritize it working - args: [poolAddress as Address, Q32], - enabled: canBorrowingBeDisabled, - chainId: activeChain.id, - }); - - const pauseGasLimit = pauseConfig.request?.gasLimit.mul(110).div(100); - - const { write: pause, isLoading: isPauseLoading } = useContractWrite({ - ...pauseConfig, - request: { - ...pauseConfig.request, - gasLimit: pauseGasLimit, - }, - }); - - const { config: updateLTVConfig } = usePrepareContractWrite({ - address: ALOE_II_ORACLE_ADDRESS[activeChain.id], - abi: volatilityOracleAbi, - functionName: 'update', - args: [poolAddress as Address, Q32], - enabled: canUpdateLTV, - chainId: activeChain.id, - }); - - const updateLTVGasLimit = updateLTVConfig.request?.gasLimit.mul(110).div(100); - - const { write: updateLTV, isLoading: isUpdateLTVLoading } = useContractWrite({ - ...updateLTVConfig, - request: { - ...updateLTVConfig.request, - gasLimit: updateLTVGasLimit, - }, - onSuccess: (data: SendTransactionResult) => { - setPendingTxn(data); - }, - }); - - return ( - - - - {token0Symbol}/{token1Symbol} {PrintFeeTier(feeTier)} - - - - - - - - - - Ante - - - {ante.toString(GNFormat.LOSSY_HUMAN)} - ETH - - - - - # Sigma - - - {nSigma} - - - - - - - LTV - - {(ltv * 100).toFixed(2)}% - - - - Oracle Manipulation - - - - {manipulationMetric.toFixed(0)} - - {manipulationInequality} - {manipulationThreshold.toFixed(0)} - - - - - - - Last Updated: {lastUpdated} - - - - {isUpdateLTVLoading ? 'Loading' : 'Update LTV'} - - - - - - - Borrows: {isPaused ? `Paused Until ${format(pausedUntilTime * 1000, 'h:mmaaa')}` : 'Enabled'} - - - - - - {isPauseLoading ? 'Loading' : isPaused ? 'Extend Pause' : 'Pause'} - - - - - - - ); -} diff --git a/earn/src/components/lend/BorrowingWidget.tsx b/earn/src/components/markets/borrow/BorrowingWidget.tsx similarity index 97% rename from earn/src/components/lend/BorrowingWidget.tsx rename to earn/src/components/markets/borrow/BorrowingWidget.tsx index 5cf757557..be44ac235 100644 --- a/earn/src/components/lend/BorrowingWidget.tsx +++ b/earn/src/components/markets/borrow/BorrowingWidget.tsx @@ -15,16 +15,16 @@ import { formatTokenAmount, roundPercentage } from 'shared/lib/util/Numbers'; import styled from 'styled-components'; import { Address, Chain } from 'wagmi'; -import { computeLTV } from '../../data/BalanceSheet'; -import { BorrowerNftBorrower } from '../../data/BorrowerNft'; -import { LendingPair, LendingPairBalancesMap } from '../../data/LendingPair'; -import { fetchUniswapNFTPositions, UniswapNFTPosition } from '../../data/Uniswap'; -import { rgba } from '../../util/Colors'; -import HealthGauge from '../common/HealthGauge'; -import BorrowModal from './modal/BorrowModal'; -import BorrowModalUniswap from './modal/BorrowModalUniswap'; -import UpdateBorrowerModal from './modal/UpdateBorrowerModal'; -import UpdateCollateralModal from './modal/UpdateCollateralModal'; +import { computeLTV } from '../../../data/BalanceSheet'; +import { BorrowerNftBorrower } from '../../../data/BorrowerNft'; +import { LendingPair, LendingPairBalancesMap } from '../../../data/LendingPair'; +import { fetchUniswapNFTPositions, UniswapNFTPosition } from '../../../data/Uniswap'; +import { rgba } from '../../../util/Colors'; +import HealthGauge from '../../common/HealthGauge'; +import BorrowModal from '../modal/BorrowModal'; +import BorrowModalUniswap from '../modal/BorrowModalUniswap'; +import UpdateBorrowerModal from '../modal/UpdateBorrowerModal'; +import UpdateCollateralModal from '../modal/UpdateCollateralModal'; const SECONDARY_COLOR = 'rgba(130, 160, 182, 1)'; const SECONDARY_COLOR_LIGHT = 'rgba(130, 160, 182, 0.1)'; diff --git a/earn/src/components/lend/CollateralTable.tsx b/earn/src/components/markets/borrow/CollateralTable.tsx similarity index 100% rename from earn/src/components/lend/CollateralTable.tsx rename to earn/src/components/markets/borrow/CollateralTable.tsx diff --git a/earn/src/components/lend/modal/BorrowModal.tsx b/earn/src/components/markets/modal/BorrowModal.tsx similarity index 100% rename from earn/src/components/lend/modal/BorrowModal.tsx rename to earn/src/components/markets/modal/BorrowModal.tsx diff --git a/earn/src/components/lend/modal/BorrowModalUniswap.tsx b/earn/src/components/markets/modal/BorrowModalUniswap.tsx similarity index 100% rename from earn/src/components/lend/modal/BorrowModalUniswap.tsx rename to earn/src/components/markets/modal/BorrowModalUniswap.tsx diff --git a/earn/src/components/lend/modal/SupplyModal.tsx b/earn/src/components/markets/modal/SupplyModal.tsx similarity index 99% rename from earn/src/components/lend/modal/SupplyModal.tsx rename to earn/src/components/markets/modal/SupplyModal.tsx index b155ed3ca..e7376b313 100644 --- a/earn/src/components/lend/modal/SupplyModal.tsx +++ b/earn/src/components/markets/modal/SupplyModal.tsx @@ -19,7 +19,7 @@ import { Address, useAccount, useBalance, useContractWrite, usePrepareContractWr import { ChainContext } from '../../../App'; import { TokenIconsWithTooltip } from '../../common/TokenIconsWithTooltip'; -import { SupplyTableRow } from '../SupplyTable'; +import { SupplyTableRow } from '../supply/SupplyTable'; const SECONDARY_COLOR = 'rgba(130, 160, 182, 1)'; const TERTIARY_COLOR = '#4b6980'; diff --git a/earn/src/components/lend/modal/UpdateBorrowerModal.tsx b/earn/src/components/markets/modal/UpdateBorrowerModal.tsx similarity index 100% rename from earn/src/components/lend/modal/UpdateBorrowerModal.tsx rename to earn/src/components/markets/modal/UpdateBorrowerModal.tsx diff --git a/earn/src/components/lend/modal/UpdateCollateralModal.tsx b/earn/src/components/markets/modal/UpdateCollateralModal.tsx similarity index 100% rename from earn/src/components/lend/modal/UpdateCollateralModal.tsx rename to earn/src/components/markets/modal/UpdateCollateralModal.tsx diff --git a/earn/src/components/lend/modal/WithdrawModal.tsx b/earn/src/components/markets/modal/WithdrawModal.tsx similarity index 99% rename from earn/src/components/lend/modal/WithdrawModal.tsx rename to earn/src/components/markets/modal/WithdrawModal.tsx index 3dceb68fe..18e3ccff8 100644 --- a/earn/src/components/lend/modal/WithdrawModal.tsx +++ b/earn/src/components/markets/modal/WithdrawModal.tsx @@ -15,7 +15,7 @@ import { ChainContext } from '../../../App'; import { RedeemState, useRedeem } from '../../../data/hooks/UseRedeem'; import { useBalanceOfUnderlying } from '../../../data/hooks/UseUnderlyingBalanceOf'; import { TokenIconsWithTooltip } from '../../common/TokenIconsWithTooltip'; -import { SupplyTableRow } from '../SupplyTable'; +import { SupplyTableRow } from '../supply/SupplyTable'; const SECONDARY_COLOR = 'rgba(130, 160, 182, 1)'; const TERTIARY_COLOR = '#4b6980'; diff --git a/earn/src/components/lend/modal/content/AddCollateralModalContent.tsx b/earn/src/components/markets/modal/content/AddCollateralModalContent.tsx similarity index 99% rename from earn/src/components/lend/modal/content/AddCollateralModalContent.tsx rename to earn/src/components/markets/modal/content/AddCollateralModalContent.tsx index d62dce5ac..eb2cc082a 100644 --- a/earn/src/components/lend/modal/content/AddCollateralModalContent.tsx +++ b/earn/src/components/markets/modal/content/AddCollateralModalContent.tsx @@ -15,7 +15,7 @@ import { ChainContext } from '../../../../App'; import { isHealthy } from '../../../../data/BalanceSheet'; import { BorrowerNftBorrower } from '../../../../data/BorrowerNft'; import { Assets } from '../../../../data/MarginAccount'; -import HealthBar from '../../../borrow/HealthBar'; +import HealthBar from '../../../common/HealthBar'; const GAS_ESTIMATE_WIGGLE_ROOM = 110; const SECONDARY_COLOR = '#CCDFED'; diff --git a/earn/src/components/lend/modal/content/BorrowModalContent.tsx b/earn/src/components/markets/modal/content/BorrowModalContent.tsx similarity index 99% rename from earn/src/components/lend/modal/content/BorrowModalContent.tsx rename to earn/src/components/markets/modal/content/BorrowModalContent.tsx index 564f2b2fe..15dac34e7 100644 --- a/earn/src/components/lend/modal/content/BorrowModalContent.tsx +++ b/earn/src/components/markets/modal/content/BorrowModalContent.tsx @@ -26,7 +26,7 @@ import { BorrowerNftBorrower } from '../../../../data/BorrowerNft'; import { LendingPair } from '../../../../data/LendingPair'; import { Liabilities } from '../../../../data/MarginAccount'; import { RateModel, yieldPerSecondToAPR } from '../../../../data/RateModel'; -import HealthBar from '../../../borrow/HealthBar'; +import HealthBar from '../../../common/HealthBar'; const GAS_ESTIMATE_WIGGLE_ROOM = 110; const SECONDARY_COLOR = '#CCDFED'; diff --git a/earn/src/components/lend/modal/content/RemoveCollateralModalContent.tsx b/earn/src/components/markets/modal/content/RemoveCollateralModalContent.tsx similarity index 99% rename from earn/src/components/lend/modal/content/RemoveCollateralModalContent.tsx rename to earn/src/components/markets/modal/content/RemoveCollateralModalContent.tsx index 4e6c840f2..822298604 100644 --- a/earn/src/components/lend/modal/content/RemoveCollateralModalContent.tsx +++ b/earn/src/components/markets/modal/content/RemoveCollateralModalContent.tsx @@ -22,7 +22,7 @@ import { ChainContext } from '../../../../App'; import { isHealthy, maxWithdraws } from '../../../../data/BalanceSheet'; import { BorrowerNftBorrower } from '../../../../data/BorrowerNft'; import { Assets } from '../../../../data/MarginAccount'; -import HealthBar from '../../../borrow/HealthBar'; +import HealthBar from '../../../common/HealthBar'; const GAS_ESTIMATE_WIGGLE_ROOM = 110; const SECONDARY_COLOR = '#CCDFED'; diff --git a/earn/src/components/lend/modal/content/RepayModalContent.tsx b/earn/src/components/markets/modal/content/RepayModalContent.tsx similarity index 99% rename from earn/src/components/lend/modal/content/RepayModalContent.tsx rename to earn/src/components/markets/modal/content/RepayModalContent.tsx index 9c5c6804b..4c89d6908 100644 --- a/earn/src/components/lend/modal/content/RepayModalContent.tsx +++ b/earn/src/components/markets/modal/content/RepayModalContent.tsx @@ -17,7 +17,7 @@ import { ChainContext } from '../../../../App'; import { isHealthy } from '../../../../data/BalanceSheet'; import { BorrowerNftBorrower } from '../../../../data/BorrowerNft'; import { Liabilities } from '../../../../data/MarginAccount'; -import HealthBar from '../../../borrow/HealthBar'; +import HealthBar from '../../../common/HealthBar'; const GAS_ESTIMATE_WIGGLE_ROOM = 110; const SECONDARY_COLOR = '#CCDFED'; diff --git a/earn/src/components/lend/modal/content/ToUniswapNFTModalContent.tsx b/earn/src/components/markets/modal/content/ToUniswapNFTModalContent.tsx similarity index 99% rename from earn/src/components/lend/modal/content/ToUniswapNFTModalContent.tsx rename to earn/src/components/markets/modal/content/ToUniswapNFTModalContent.tsx index 7ba7df2f0..81944dfe1 100644 --- a/earn/src/components/lend/modal/content/ToUniswapNFTModalContent.tsx +++ b/earn/src/components/markets/modal/content/ToUniswapNFTModalContent.tsx @@ -17,7 +17,7 @@ import { ChainContext } from '../../../../App'; import { isHealthy } from '../../../../data/BalanceSheet'; import { BorrowerNftBorrower } from '../../../../data/BorrowerNft'; import { UniswapPosition, zip } from '../../../../data/Uniswap'; -import HealthBar from '../../../borrow/HealthBar'; +import HealthBar from '../../../common/HealthBar'; const GAS_ESTIMATE_WIGGLE_ROOM = 110; const SECONDARY_COLOR = '#CCDFED'; diff --git a/earn/src/components/info/InfoGraph.tsx b/earn/src/components/markets/monitor/InfoGraph.tsx similarity index 96% rename from earn/src/components/info/InfoGraph.tsx rename to earn/src/components/markets/monitor/InfoGraph.tsx index 80b9595e8..65d05a75e 100644 --- a/earn/src/components/info/InfoGraph.tsx +++ b/earn/src/components/markets/monitor/InfoGraph.tsx @@ -4,8 +4,8 @@ import { Text } from 'shared/lib/components/common/Typography'; import { GREY_600 } from 'shared/lib/data/constants/Colors'; import styled from 'styled-components'; -import { LendingPair } from '../../data/LendingPair'; -import LineGraph, { GraphChart } from '../graph/LineGraph'; +import { LendingPair } from '../../../data/LendingPair'; +import LineGraph, { GraphChart } from '../../graph/LineGraph'; import InfoGraphTooltip from './InfoGraphTooltip'; const FULL_HEIGHT = '342'; diff --git a/earn/src/components/info/InfoGraphTooltip.tsx b/earn/src/components/markets/monitor/InfoGraphTooltip.tsx similarity index 100% rename from earn/src/components/info/InfoGraphTooltip.tsx rename to earn/src/components/markets/monitor/InfoGraphTooltip.tsx diff --git a/earn/src/components/info/InfoTab.tsx b/earn/src/components/markets/monitor/InfoTab.tsx similarity index 98% rename from earn/src/components/info/InfoTab.tsx rename to earn/src/components/markets/monitor/InfoTab.tsx index 53f89ac8c..8e83b24c0 100644 --- a/earn/src/components/info/InfoTab.tsx +++ b/earn/src/components/markets/monitor/InfoTab.tsx @@ -9,8 +9,8 @@ import { GN } from 'shared/lib/data/GoodNumber'; import { useChainDependentState } from 'shared/lib/data/hooks/UseChainDependentState'; import { Address } from 'wagmi'; -import { computeLTV } from '../../data/BalanceSheet'; -import { LendingPair } from '../../data/LendingPair'; +import { computeLTV } from '../../../data/BalanceSheet'; +import { LendingPair } from '../../../data/LendingPair'; import InfoGraph, { InfoGraphColors, InfoGraphData, InfoGraphLabel } from './InfoGraph'; import StatsTable from './StatsTable'; diff --git a/earn/src/components/info/StatsTable.tsx b/earn/src/components/markets/monitor/StatsTable.tsx similarity index 99% rename from earn/src/components/info/StatsTable.tsx rename to earn/src/components/markets/monitor/StatsTable.tsx index 089e39ec2..69298e959 100644 --- a/earn/src/components/info/StatsTable.tsx +++ b/earn/src/components/markets/monitor/StatsTable.tsx @@ -22,8 +22,8 @@ import { roundPercentage } from 'shared/lib/util/Numbers'; import styled from 'styled-components'; import { Address, useContractWrite } from 'wagmi'; -import { ChainContext } from '../../App'; -import { LendingPair } from '../../data/LendingPair'; +import { ChainContext } from '../../../App'; +import { LendingPair } from '../../../data/LendingPair'; const PAGE_SIZE = 5; const SECONDARY_COLOR = 'rgba(130, 160, 182, 1)'; diff --git a/earn/src/components/lend/OptimizeButton.spec.tsx b/earn/src/components/markets/supply/OptimizeButton.spec.tsx similarity index 100% rename from earn/src/components/lend/OptimizeButton.spec.tsx rename to earn/src/components/markets/supply/OptimizeButton.spec.tsx diff --git a/earn/src/components/lend/OptimizeButton.tsx b/earn/src/components/markets/supply/OptimizeButton.tsx similarity index 87% rename from earn/src/components/lend/OptimizeButton.tsx rename to earn/src/components/markets/supply/OptimizeButton.tsx index 7f2ea3414..240658d7c 100644 --- a/earn/src/components/lend/OptimizeButton.tsx +++ b/earn/src/components/markets/supply/OptimizeButton.tsx @@ -1,8 +1,8 @@ import { Text } from 'shared/lib/components/common/Typography'; import styled from 'styled-components'; -import { ReactComponent as Check } from '../../assets/svg/check_black.svg'; -import { ReactComponent as ChevronsUp } from '../../assets/svg/chevrons_up.svg'; +import { ReactComponent as Check } from '../../../assets/svg/check_black.svg'; +import { ReactComponent as ChevronsUp } from '../../../assets/svg/chevrons_up.svg'; const StyledCheck = styled(Check)` path { diff --git a/earn/src/components/lend/SupplyTable.tsx b/earn/src/components/markets/supply/SupplyTable.tsx similarity index 97% rename from earn/src/components/lend/SupplyTable.tsx rename to earn/src/components/markets/supply/SupplyTable.tsx index 5cd9cbcdf..8dc2ec435 100644 --- a/earn/src/components/lend/SupplyTable.tsx +++ b/earn/src/components/markets/supply/SupplyTable.tsx @@ -15,10 +15,10 @@ import { formatTokenAmount } from 'shared/lib/util/Numbers'; import styled from 'styled-components'; import { useAccount } from 'wagmi'; -import { ApyWithTooltip } from '../common/ApyWithTooltip'; -import { TokenIconsWithTooltip } from '../common/TokenIconsWithTooltip'; -import SupplyModal from './modal/SupplyModal'; -import WithdrawModal from './modal/WithdrawModal'; +import { ApyWithTooltip } from '../../common/ApyWithTooltip'; +import { TokenIconsWithTooltip } from '../../common/TokenIconsWithTooltip'; +import SupplyModal from '../modal/SupplyModal'; +import WithdrawModal from '../modal/WithdrawModal'; // import OptimizeButton from './OptimizeButton'; const PAGE_SIZE = 10; diff --git a/earn/src/components/lend/YieldAggregatorCard.tsx b/earn/src/components/markets/supply/YieldAggregatorCard.tsx similarity index 98% rename from earn/src/components/lend/YieldAggregatorCard.tsx rename to earn/src/components/markets/supply/YieldAggregatorCard.tsx index 23197edfd..c74025f8a 100644 --- a/earn/src/components/lend/YieldAggregatorCard.tsx +++ b/earn/src/components/markets/supply/YieldAggregatorCard.tsx @@ -15,7 +15,7 @@ import { roundPercentage } from 'shared/lib/util/Numbers'; import styled from 'styled-components'; import tw from 'twin.macro'; -import LendTokenInfo from './LendTokenInfo'; +import LendTokenInfo from '../../lend/LendTokenInfo'; import YieldTokenIcons from './YieldTokenIcons'; const TOKEN_APY_BG_COLOR = 'rgb(29, 41, 53)'; diff --git a/earn/src/components/lend/YieldTokenIcons.tsx b/earn/src/components/markets/supply/YieldTokenIcons.tsx similarity index 100% rename from earn/src/components/lend/YieldTokenIcons.tsx rename to earn/src/components/markets/supply/YieldTokenIcons.tsx diff --git a/earn/src/pages/BorrowPage.tsx b/earn/src/pages/AdvancedPage.tsx similarity index 96% rename from earn/src/pages/BorrowPage.tsx rename to earn/src/pages/AdvancedPage.tsx index 17396f50a..e0dad2fdb 100644 --- a/earn/src/pages/BorrowPage.tsx +++ b/earn/src/pages/AdvancedPage.tsx @@ -28,19 +28,19 @@ import { Address, useAccount, useContract, useProvider, useContractRead, useBala import { ChainContext } from '../App'; import { ReactComponent as InfoIcon } from '../assets/svg/info.svg'; -import BorrowGraph, { BorrowGraphData } from '../components/borrow/BorrowGraph'; -import { BorrowGraphPlaceholder } from '../components/borrow/BorrowGraphPlaceholder'; -import { BorrowMetrics } from '../components/borrow/BorrowMetrics'; -import GlobalStatsTable from '../components/borrow/GlobalStatsTable'; -import ManageAccountButtons from '../components/borrow/ManageAccountButtons'; -import AddCollateralModal from '../components/borrow/modal/AddCollateralModal'; -import BorrowModal from '../components/borrow/modal/BorrowModal'; -import NewSmartWalletModal from '../components/borrow/modal/NewSmartWalletModal'; -import RemoveCollateralModal from '../components/borrow/modal/RemoveCollateralModal'; -import RepayModal from '../components/borrow/modal/RepayModal'; -import WithdrawAnteModal from '../components/borrow/modal/WithdrawAnteModal'; -import SmartWalletButton, { NewSmartWalletButton } from '../components/borrow/SmartWalletButton'; -import { UniswapPositionList } from '../components/borrow/UniswapPositionList'; +import BorrowGraph, { BorrowGraphData } from '../components/advanced/BorrowGraph'; +import { BorrowGraphPlaceholder } from '../components/advanced/BorrowGraphPlaceholder'; +import { BorrowMetrics } from '../components/advanced/BorrowMetrics'; +import GlobalStatsTable from '../components/advanced/GlobalStatsTable'; +import ManageAccountButtons from '../components/advanced/ManageAccountButtons'; +import AddCollateralModal from '../components/advanced/modal/AddCollateralModal'; +import BorrowModal from '../components/advanced/modal/BorrowModal'; +import NewSmartWalletModal from '../components/advanced/modal/NewSmartWalletModal'; +import RemoveCollateralModal from '../components/advanced/modal/RemoveCollateralModal'; +import RepayModal from '../components/advanced/modal/RepayModal'; +import WithdrawAnteModal from '../components/advanced/modal/WithdrawAnteModal'; +import SmartWalletButton, { NewSmartWalletButton } from '../components/advanced/SmartWalletButton'; +import { UniswapPositionList } from '../components/advanced/UniswapPositionList'; import PendingTxnModal, { PendingTxnModalStatus } from '../components/common/PendingTxnModal'; import { computeLTV } from '../data/BalanceSheet'; import { BorrowerNftBorrower, fetchListOfBorrowerNfts } from '../data/BorrowerNft'; @@ -209,7 +209,7 @@ export type UniswapPoolInfo = { fee: number; }; -export default function BorrowPage() { +export default function AdvancedPage() { const { activeChain } = useContext(ChainContext); const provider = useProvider({ chainId: activeChain.id }); const { address: userAddress, isConnected } = useAccount(); diff --git a/earn/src/pages/ClaimPage.tsx b/earn/src/pages/ClaimPage.tsx deleted file mode 100644 index 4d529f738..000000000 --- a/earn/src/pages/ClaimPage.tsx +++ /dev/null @@ -1,184 +0,0 @@ -import { useEffect, useState } from 'react'; - -import axios, { AxiosResponse } from 'axios'; -import { useNavigate } from 'react-router-dom'; -import AppPage from 'shared/lib/components/common/AppPage'; -import { FilledGradientButton, FilledGreyButton } from 'shared/lib/components/common/Buttons'; -import { SquareInput } from 'shared/lib/components/common/Input'; -import Modal from 'shared/lib/components/common/Modal'; -import { Display, Text } from 'shared/lib/components/common/Typography'; -import styled from 'styled-components'; -import { useAccount } from 'wagmi'; - -import { ReactComponent as ErrorIcon } from '../assets/svg/error.svg'; -import { ReactComponent as SuccessIcon } from '../assets/svg/success.svg'; -import { API_REDEEM_REWARD_URL } from '../data/constants/Values'; -import { RedeemRewardResponse } from '../data/RedeemRewardReponse'; - -const validAddressFormRegex = /^0x[0-9a-fA-F]{40}$/; -const validCodeFormRegex = /^[0-9]{6}$/; - -const Container = styled.div` - display: flex; - flex-direction: column; - justify-content: center; - align-items: flex-start; - gap: 64px; - max-width: 1280px; - height: calc(100vh - 256px); - margin: 0 auto; -`; - -const InnerContainer = styled.div` - width: 100%; - display: flex; - flex-direction: column; - align-items: center; - gap: 16px; - margin: 0 auto; -`; - -async function claimReward(redemptionCode: string, redemptionAddress: string) { - const axiosResponse: AxiosResponse = await axios.post( - `${API_REDEEM_REWARD_URL}/${redemptionCode}`, - { redemptionAddress }, - { headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' } } - ); - const { data } = axiosResponse; - if (axiosResponse.status !== 200) { - return Promise.reject(data.message); - } - return Promise.resolve(data); -} - -type SuccessModalProps = { - isOpen: boolean; - setIsOpen: (isOpen: boolean) => void; -}; - -function SuccessModal(props: SuccessModalProps) { - const { isOpen, setIsOpen } = props; - - const navigate = useNavigate(); - - return ( - - - - - 10 USDC+ - - - has been sent to your wallet. - - navigate('/portfolio')}> - Go To Portfolio - - - - ); -} - -type ErrorModalProps = { - message: string; - isOpen: boolean; - setIsOpen: (isOpen: boolean) => void; -}; - -function ErrorModal(props: ErrorModalProps) { - const { message, isOpen, setIsOpen } = props; - - return ( - - - - - {message} - - setIsOpen(false)}> - Close - - - - ); -} - -export default function ClaimPage() { - const [redemptionCode, setRedemptionCode] = useState(''); - const [redemptionAddress, setRedemptionAddress] = useState(''); - const [isSuccessModalOpen, setIsSuccessModalOpen] = useState(false); - const [isErrorModalOpen, setIsErrorModalOpen] = useState(false); - const [modalMessage, setModalMessage] = useState(''); - - const { address: userAddress } = useAccount(); - - useEffect(() => { - if (userAddress) { - setRedemptionAddress(userAddress); - } - }, [userAddress]); - - return ( - - - - - - Claim your - - - 10 USDC+ - - - setRedemptionCode(e.target.value)} - placeholder='Redemption Code' - paddingRightOverride='24px' - /> - setRedemptionAddress(e.target.value)} - placeholder='Recipient' - paddingRightOverride='24px' - /> - { - setModalMessage(''); - if (!validAddressFormRegex.test(redemptionAddress)) { - setModalMessage('Please enter a valid Ethereum address.'); - setIsErrorModalOpen(true); - return; - } - if (!validCodeFormRegex.test(redemptionCode)) { - setModalMessage('Please enter a valid redemption code.'); - setIsErrorModalOpen(true); - return; - } - claimReward(redemptionCode, redemptionAddress) - .then((data) => { - setModalMessage(data.message); - if (data.success) { - setIsSuccessModalOpen(true); - } else { - setIsErrorModalOpen(true); - } - }) - .catch((_error) => { - setModalMessage('Something went wrong. Please try again later.'); - setIsErrorModalOpen(true); - }); - }} - > - Claim - - - - - - - ); -} diff --git a/earn/src/pages/InfoPage.tsx b/earn/src/pages/InfoPage.tsx deleted file mode 100644 index df1149b6d..000000000 --- a/earn/src/pages/InfoPage.tsx +++ /dev/null @@ -1,109 +0,0 @@ -import { useContext, useEffect, useState } from 'react'; - -import { SendTransactionResult } from '@wagmi/core'; -import { ethers } from 'ethers'; -import AppPage from 'shared/lib/components/common/AppPage'; -import { ALOE_II_ORACLE_ADDRESS } from 'shared/lib/data/constants/ChainSpecific'; -import { useChainDependentState } from 'shared/lib/data/hooks/UseChainDependentState'; -import { useBlockNumber, useProvider } from 'wagmi'; - -import { ChainContext } from '../App'; -import PendingTxnModal, { PendingTxnModalStatus } from '../components/common/PendingTxnModal'; -import StatsTable from '../components/info/StatsTable'; -import { TOPIC0_UPDATE_ORACLE } from '../data/constants/Signatures'; -import { useLendingPairs } from '../data/hooks/UseLendingPairs'; - -export default function InfoPage() { - const { activeChain } = useContext(ChainContext); - const provider = useProvider({ chainId: activeChain.id }); - const [pendingTxn, setPendingTxn] = useState(null); - const [isPendingTxnModalOpen, setIsPendingTxnModalOpen] = useState(false); - const [pendingTxnModalStatus, setPendingTxnModalStatus] = useState(null); - const [latestTimestamps, setLatestTimestamps] = useChainDependentState<(number | undefined)[]>([], activeChain.id); - - const { lendingPairs } = useLendingPairs(); - - const { data: blockNumber, refetch } = useBlockNumber({ - chainId: activeChain.id, - }); - - useEffect(() => { - (async () => { - if (!pendingTxn) return; - setPendingTxnModalStatus(PendingTxnModalStatus.PENDING); - setIsPendingTxnModalOpen(true); - const receipt = await pendingTxn.wait(); - if (receipt.status === 1) { - setPendingTxnModalStatus(PendingTxnModalStatus.SUCCESS); - } else { - setPendingTxnModalStatus(PendingTxnModalStatus.FAILURE); - } - })(); - }, [pendingTxn, setIsPendingTxnModalOpen, setPendingTxnModalStatus]); - - useEffect(() => { - (async () => { - const chainId = (await provider.getNetwork()).chainId; - - // Get the time at which each pool was last updated via the oracle (using the update event and getLogs) - let updateLogs: ethers.providers.Log[] = []; - try { - updateLogs = await provider.getLogs({ - address: ALOE_II_ORACLE_ADDRESS[chainId], - topics: [TOPIC0_UPDATE_ORACLE], - fromBlock: 0, - toBlock: 'latest', - }); - } catch (e) { - console.error(e); - } - const logs = updateLogs.filter((log) => log.removed === false).reverse(); - const latestUpdateBlockNumbers = lendingPairs.map( - (pair) => - logs.find((log) => log.topics[1] === `0x000000000000000000000000${pair.uniswapPool.slice(2)}`)?.blockNumber - ); - // --> Map block numbers to times - const blockNumbersToTimestamps = new Map(); - await Promise.all( - Array.from(new Set(latestUpdateBlockNumbers)).map(async (blockNumber) => { - if (blockNumber === undefined) return; - blockNumbersToTimestamps.set(blockNumber, (await provider.getBlock(blockNumber)).timestamp); - }) - ); - // --> Put it all together to get the most recent `Update` timestamps - const newLatestTimestamps = latestUpdateBlockNumbers.map((blockNumber) => { - if (blockNumber === undefined) return -1; - return blockNumbersToTimestamps.get(blockNumber) || 0; - }); - setLatestTimestamps(newLatestTimestamps); - })(); - }, [provider, setLatestTimestamps, lendingPairs, blockNumber /* just here to trigger refetch */]); - - return ( - - ({ - lendingPair, - lastUpdatedTimestamp: latestTimestamps.at(i), - setPendingTxn, - onMouseEnter: () => {}, - }))} - /> - { - setIsPendingTxnModalOpen(isOpen); - if (!isOpen) { - setPendingTxn(null); - } - }} - onConfirm={() => { - setIsPendingTxnModalOpen(false); - setTimeout(() => refetch(), 100); - }} - status={pendingTxnModalStatus} - /> - - ); -} diff --git a/earn/src/pages/MarketsPage.tsx b/earn/src/pages/MarketsPage.tsx index 7f137d029..d458fc396 100644 --- a/earn/src/pages/MarketsPage.tsx +++ b/earn/src/pages/MarketsPage.tsx @@ -13,9 +13,9 @@ import { Address, useAccount, useBlockNumber, useProvider } from 'wagmi'; import { ChainContext } from '../App'; import PendingTxnModal, { PendingTxnModalStatus } from '../components/common/PendingTxnModal'; -import InfoTab from '../components/info/InfoTab'; -import BorrowingWidget from '../components/lend/BorrowingWidget'; -import SupplyTable, { SupplyTableRow } from '../components/lend/SupplyTable'; +import BorrowingWidget from '../components/markets/borrow/BorrowingWidget'; +import InfoTab from '../components/markets/monitor/InfoTab'; +import SupplyTable, { SupplyTableRow } from '../components/markets/supply/SupplyTable'; import { BorrowerNftBorrower, fetchListOfFuse2BorrowNfts } from '../data/BorrowerNft'; import { API_PRICE_RELAY_LATEST_URL } from '../data/constants/Values'; import { useLendingPairs } from '../data/hooks/UseLendingPairs';