Skip to content

Commit

Permalink
fix: lido market cleanup [skip cypress] (#2123)
Browse files Browse the repository at this point in the history
Co-authored-by: Mark Hinschberger <[email protected]>
Co-authored-by: Joaquin Battilana <[email protected]>
  • Loading branch information
3 people authored Jul 29, 2024
1 parent 38a6e46 commit fad7c35
Show file tree
Hide file tree
Showing 10 changed files with 23 additions and 100 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"dependencies": {
"@aave/contract-helpers": "1.29.1",
"@aave/math-utils": "1.29.1",
"@bgd-labs/aave-address-book": "^2.26.1",
"@bgd-labs/aave-address-book": "^3.0.1",
"@emotion/cache": "11.10.3",
"@emotion/react": "11.10.4",
"@emotion/server": "latest",
Expand Down
57 changes: 1 addition & 56 deletions pages/history.page.tsx
Original file line number Diff line number Diff line change
@@ -1,77 +1,22 @@
import { Trans } from '@lingui/macro';
import { Box, Typography, useMediaQuery, useTheme } from '@mui/material';
import * as React from 'react';
import { useEffect } from 'react';
import { ContentContainer } from 'src/components/ContentContainer';
import { MULTIPLE_MARKET_OPTIONS } from 'src/components/MarketSwitcher';
import { StyledTxModalToggleButton } from 'src/components/StyledToggleButton';
import { StyledTxModalToggleGroup } from 'src/components/StyledToggleButtonGroup';
import { MainLayout } from 'src/layouts/MainLayout';
import { HistoryTopPanel } from 'src/modules/history/HistoryTopPanel';
import { HistoryWrapper } from 'src/modules/history/HistoryWrapper';
import { useRootStore } from 'src/store/root';
import { CustomMarket } from 'src/ui-config/marketsConfig';

export default function History() {
const [trackEvent, currentMarket, setCurrentMarket, currentAccount] = useRootStore((store) => [
store.trackEvent,
store.currentMarket,
store.setCurrentMarket,
store.account,
]);
const { breakpoints } = useTheme();
const upFromSm = useMediaQuery(breakpoints.up('xsm'));
const trackEvent = useRootStore((store) => store.trackEvent);

useEffect(() => {
trackEvent('Page Viewed', {
'Page Name': 'History',
});
}, [trackEvent]);

const handleUpdateEthMarket = (market: CustomMarket) => {
setCurrentMarket(market);
};

return (
<>
<HistoryTopPanel />
{currentAccount && MULTIPLE_MARKET_OPTIONS.includes(currentMarket) && (
<Box pb={2} sx={{ width: upFromSm ? 'calc(50% - 8px)' : '100%' }}>
<StyledTxModalToggleGroup
color="secondary"
value={currentMarket}
exclusive
onChange={(_, value) => handleUpdateEthMarket(value)}
>
<StyledTxModalToggleButton
maxWidth="160px"
unselectedBackgroundColor="#383D51"
value={'proto_mainnet_v3'}
disabled={currentMarket === 'proto_mainnet_v3'}
// Todo tracking?
// onClick={() =>
// trackEvent(WITHDRAW_MODAL.SWITCH_WITHDRAW_TYPE, { withdrawType: 'Withdraw' })
// }
>
<Typography variant="buttonM">
<Trans>Ethereum Main</Trans>
</Typography>
</StyledTxModalToggleButton>

<StyledTxModalToggleButton
maxWidth="160px"
unselectedBackgroundColor="#383D51"
value={'proto_lido_v3'}
disabled={currentMarket === 'proto_lido_v3'}
// Todo tracking?
>
<Typography variant="buttonM">
<Trans>Lido</Trans>
</Typography>
</StyledTxModalToggleButton>
</StyledTxModalToggleGroup>
</Box>
)}
<ContentContainer>
<HistoryWrapper />
</ContentContainer>
Expand Down
1 change: 0 additions & 1 deletion public/icons/networks/lido.svg

This file was deleted.

17 changes: 5 additions & 12 deletions src/components/MarketSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,6 @@ export const getMarketInfoById = (marketId: CustomMarket) => {
return { market, network };
};

export const getMarketLogoById = (marketId: CustomMarket, networkLogoPath: string) => {
const market: MarketDataType = marketsData[marketId as CustomMarket];

if (market.chainId === 1 && market.marketTitle === 'Ethereum Lido Market') {
return { marketLogo: '/icons/networks/lido.svg' };
}

return { marketLogo: networkLogoPath };
};

export const getMarketHelpData = (marketName: string) => {
const testChains = [
'Görli',
Expand Down Expand Up @@ -352,7 +342,6 @@ export const MarketSwitcher = () => {
.map((marketId: CustomMarket) => {
const { market, network } = getMarketInfoById(marketId);
const marketNaming = getMarketHelpData(market.marketTitle);
const { marketLogo } = getMarketLogoById(marketId, network.networkLogoPath);
return (
<MenuItem
key={marketId}
Expand All @@ -367,7 +356,11 @@ export const MarketSwitcher = () => {
: 'flex',
}}
>
<MarketLogo size={32} logo={marketLogo} testChainName={marketNaming.testChainName} />
<MarketLogo
size={32}
logo={network.networkLogoPath}
testChainName={marketNaming.testChainName}
/>
<ListItemText sx={{ mr: 0 }}>
{marketNaming.name} {market.isFork ? 'Fork' : ''}
</ListItemText>
Expand Down
2 changes: 0 additions & 2 deletions src/locales/en/messages.po
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,6 @@ msgstr "Estimated compounding interest, including discount for Staking {0}AAVE i
msgid "Estimated time"
msgstr "Estimated time"

#: pages/history.page.tsx
#: src/modules/dashboard/DashboardContentWrapper.tsx
#: src/modules/markets/MarketsTopPanel.tsx
msgid "Ethereum Main"
Expand Down Expand Up @@ -1427,7 +1426,6 @@ msgstr "Learn more."
msgid "Let us know how we can make the app better for you. For user support related inquiries please reach out on"
msgstr "Let us know how we can make the app better for you. For user support related inquiries please reach out on"

#: pages/history.page.tsx
#: src/modules/dashboard/DashboardContentWrapper.tsx
#: src/modules/markets/MarketsTopPanel.tsx
msgid "Lido"
Expand Down
10 changes: 5 additions & 5 deletions src/modules/dashboard/DashboardContentWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,15 @@ export const DashboardContentWrapper = ({ isBorrow }: DashboardContentWrapperPro
return (
<Box>
{currentAccount && MULTIPLE_MARKET_OPTIONS.includes(currentMarket) && (
<Box pb={2} sx={{ width: upFromSm ? 'calc(50% - 8px)' : '100%' }}>
<Box pb={2} sx={{ width: upFromSm ? '320px' : '100%' }}>
<StyledTxModalToggleGroup
color="secondary"
value={currentMarket}
exclusive
onChange={(_, value) => handleUpdateEthMarket(value)}
>
<StyledTxModalToggleButton
maxWidth="160px"
maxWidth={upFromSm ? '160px' : undefined}
unselectedBackgroundColor="#383D51"
value={currentNetworkConfig.isFork ? 'fork_proto_mainnet_v3' : 'proto_mainnet_v3'}
disabled={
Expand All @@ -73,7 +73,7 @@ export const DashboardContentWrapper = ({ isBorrow }: DashboardContentWrapperPro
</StyledTxModalToggleButton>

<StyledTxModalToggleButton
maxWidth="160px"
maxWidth={upFromSm ? '160px' : undefined}
unselectedBackgroundColor="#383D51"
disabled={
(currentNetworkConfig.isFork &&
Expand Down Expand Up @@ -114,7 +114,7 @@ export const DashboardContentWrapper = ({ isBorrow }: DashboardContentWrapperPro
<Button
sx={{
position: 'absolute',
top: upFromSm ? '-60px' : '-90px',
top: '-130px',
right: '0px',
}}
onClick={() => {
Expand Down Expand Up @@ -147,7 +147,7 @@ export const DashboardContentWrapper = ({ isBorrow }: DashboardContentWrapperPro
sx={{
position: 'absolute',

top: upFromSm ? '-60px' : '-90px',
top: downToLg ? '-130px' : '-90px',

right: '0px',
}}
Expand Down
5 changes: 0 additions & 5 deletions src/modules/dashboard/DashboardTopPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,6 @@ import { TopInfoPanelItem } from '../../components/TopInfoPanel/TopInfoPanelItem
import { useAppDataContext } from '../../hooks/app-data-provider/useAppDataProvider';
import { LiquidationRiskParametresInfoModal } from './LiquidationRiskParametresModal/LiquidationRiskParametresModal';

export enum EthMarketType {
ETHEREUM,
LIDO,
}

export const DashboardTopPanel = () => {
const { currentNetworkConfig, currentMarketData, currentMarket } = useProtocolDataContext();

Expand Down
2 changes: 1 addition & 1 deletion src/services/UIPoolService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class UiPoolService {
});
} else {
return new UiPoolDataProvider({
uiPoolDataProviderAddress: marketData.addresses.V3_1_UI_POOL_DATA_PROVIDER as string,
uiPoolDataProviderAddress: marketData.addresses.UI_POOL_DATA_PROVIDER as string,
provider,
chainId: marketData.chainId,
});
Expand Down
19 changes: 6 additions & 13 deletions src/ui-config/marketsConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ export type MarketDataType = {
WALLET_BALANCE_PROVIDER: string;
L2_ENCODER?: string;
UI_POOL_DATA_PROVIDER: string;
V3_1_UI_POOL_DATA_PROVIDER?: string;
UI_INCENTIVE_DATA_PROVIDER?: string;
COLLECTOR?: string;
V3_MIGRATOR?: string;
Expand Down Expand Up @@ -136,7 +135,6 @@ export const marketsData: {
SWAP_COLLATERAL_ADAPTER: AaveV3Ethereum.SWAP_COLLATERAL_ADAPTER,
WALLET_BALANCE_PROVIDER: AaveV3Ethereum.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Ethereum.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0x5c5228ac8bc1528482514af3e27e692495148717',
UI_INCENTIVE_DATA_PROVIDER: AaveV3Ethereum.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3Ethereum.COLLECTOR,
GHO_TOKEN_ADDRESS: AaveV3Ethereum.ASSETS.GHO.UNDERLYING,
Expand All @@ -157,9 +155,10 @@ export const marketsData: {
collateralRepay: true,
incentives: true,
withdrawAndSwitch: true,
debtSwitch: true,
debtSwitch: false,
switch: true,
},
disableCharts: true,
// subgraphUrl: `https://gateway-arbitrum.network.thegraph.com/api/${apiKey}/subgraphs/id/Cd2gEDVeqnjBn1hSeqFMitw8Q1iiyV9FYUZkLNRcL87g`,
addresses: {
LENDING_POOL_ADDRESS_PROVIDER: AaveV3EthereumLido.POOL_ADDRESSES_PROVIDER,
Expand All @@ -169,7 +168,6 @@ export const marketsData: {
SWAP_COLLATERAL_ADAPTER: AaveV3EthereumLido.SWAP_COLLATERAL_ADAPTER,
WALLET_BALANCE_PROVIDER: AaveV3EthereumLido.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3EthereumLido.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: AaveV3EthereumLido.UI_POOL_DATA_PROVIDER, // TODO: remove this
UI_INCENTIVE_DATA_PROVIDER: AaveV3EthereumLido.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3Ethereum.COLLECTOR,
WITHDRAW_SWITCH_ADAPTER: AaveV3EthereumLido.WITHDRAW_SWAP_ADAPTER,
Expand Down Expand Up @@ -332,7 +330,6 @@ export const marketsData: {
WETH_GATEWAY: AaveV3Base.WETH_GATEWAY,
WALLET_BALANCE_PROVIDER: AaveV3Base.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Base.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0x5d4D4007A4c6336550DdAa2a7c0d5e7972eebd16',
UI_INCENTIVE_DATA_PROVIDER: AaveV3Base.UI_INCENTIVE_DATA_PROVIDER,
L2_ENCODER: AaveV3Base.L2_ENCODER,
COLLECTOR: AaveV3Base.COLLECTOR,
Expand Down Expand Up @@ -381,7 +378,7 @@ export const marketsData: {
WETH_GATEWAY: AaveV3Arbitrum.WETH_GATEWAY,
WALLET_BALANCE_PROVIDER: AaveV3Arbitrum.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Arbitrum.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0x5d4d4007a4c6336550ddaa2a7c0d5e7972eebd16',

UI_INCENTIVE_DATA_PROVIDER: AaveV3Arbitrum.UI_INCENTIVE_DATA_PROVIDER,
L2_ENCODER: AaveV3Arbitrum.L2_ENCODER,
COLLECTOR: AaveV3Arbitrum.COLLECTOR,
Expand Down Expand Up @@ -431,7 +428,7 @@ export const marketsData: {
SWAP_COLLATERAL_ADAPTER: AaveV3Avalanche.SWAP_COLLATERAL_ADAPTER,
WALLET_BALANCE_PROVIDER: AaveV3Avalanche.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Avalanche.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0x5598bbfa2f4fe8151f45bba0a3ede1b54b51a0a9',

UI_INCENTIVE_DATA_PROVIDER: AaveV3Avalanche.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3Avalanche.COLLECTOR,
DEBT_SWITCH_ADAPTER: AaveV3Avalanche.DEBT_SWAP_ADAPTER,
Expand Down Expand Up @@ -575,7 +572,6 @@ export const marketsData: {
WETH_GATEWAY: AaveV3Optimism.WETH_GATEWAY,
WALLET_BALANCE_PROVIDER: AaveV3Optimism.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Optimism.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0x5598bbfa2f4fe8151f45bba0a3ede1b54b51a0a9',
UI_INCENTIVE_DATA_PROVIDER: AaveV3Optimism.UI_INCENTIVE_DATA_PROVIDER,
L2_ENCODER: AaveV3Optimism.L2_ENCODER,
COLLECTOR: AaveV3Optimism.COLLECTOR,
Expand Down Expand Up @@ -607,7 +603,6 @@ export const marketsData: {
SWAP_COLLATERAL_ADAPTER: AaveV3Polygon.SWAP_COLLATERAL_ADAPTER,
WALLET_BALANCE_PROVIDER: AaveV3Polygon.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Polygon.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0x5598bbfa2f4fe8151f45bba0a3ede1b54b51a0a9',
UI_INCENTIVE_DATA_PROVIDER: AaveV3Polygon.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3Polygon.COLLECTOR,
DEBT_SWITCH_ADAPTER: AaveV3Polygon.DEBT_SWAP_ADAPTER,
Expand Down Expand Up @@ -647,7 +642,7 @@ export const marketsData: {
WETH_GATEWAY: '0x0', // not applicable for Metis
WALLET_BALANCE_PROVIDER: AaveV3Metis.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Metis.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0xc851e6147dcE6A469CC33BE3121b6B2D4CaD2763',

UI_INCENTIVE_DATA_PROVIDER: AaveV3Metis.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3Metis.COLLECTOR,
},
Expand All @@ -664,7 +659,7 @@ export const marketsData: {
WETH_GATEWAY: AaveV3Gnosis.WETH_GATEWAY,
WALLET_BALANCE_PROVIDER: AaveV3Gnosis.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Gnosis.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0xc851e6147dce6a469cc33be3121b6b2d4cad2763',

UI_INCENTIVE_DATA_PROVIDER: AaveV3Gnosis.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3Gnosis.COLLECTOR,
},
Expand All @@ -690,7 +685,6 @@ export const marketsData: {
SWAP_COLLATERAL_ADAPTER: AaveV3BNB.SWAP_COLLATERAL_ADAPTER,
WALLET_BALANCE_PROVIDER: AaveV3BNB.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3BNB.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0x78f8bd884c3d738b74b420540659c82f392820e0',
UI_INCENTIVE_DATA_PROVIDER: AaveV3BNB.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3BNB.COLLECTOR,
DEBT_SWITCH_ADAPTER: AaveV3BNB.DEBT_SWAP_ADAPTER,
Expand All @@ -709,7 +703,6 @@ export const marketsData: {
WETH_GATEWAY: AaveV3Scroll.WETH_GATEWAY,
WALLET_BALANCE_PROVIDER: AaveV3Scroll.WALLET_BALANCE_PROVIDER,
UI_POOL_DATA_PROVIDER: AaveV3Scroll.UI_POOL_DATA_PROVIDER,
V3_1_UI_POOL_DATA_PROVIDER: '0xc851e6147dce6a469cc33be3121b6b2d4cad2763',
UI_INCENTIVE_DATA_PROVIDER: AaveV3Scroll.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3Scroll.COLLECTOR,
},
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1317,10 +1317,10 @@
resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39"
integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==

"@bgd-labs/aave-address-book@^2.26.1":
version "2.31.0"
resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.31.0.tgz#dd60550fc8f2078873f2fc4e8ec459ba445cee28"
integrity sha512-YSjkAu74WD6hJbhJsyF4GqF63f1hQ3bdbmDWzLyMnrx+ts9wMNAWVj9U54X5ZPNpaAoAFqFulw9zipacHm/RBQ==
"@bgd-labs/aave-address-book@^3.0.1":
version "3.0.1"
resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-3.0.1.tgz#942cef06984ed7b12b5a6694c5010637b505edd3"
integrity sha512-dlq/tBbGzmXPK4q94+Oy/XFXsE3qnKq60L9Hd67WlF3f6zCyzuTuQvUCPW/7hpH3Wda9LAnUbOxGunHAt05n6g==

"@coinbase/[email protected]", "@coinbase/wallet-sdk@^3.0.4":
version "3.1.0"
Expand Down

2 comments on commit fad7c35

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commit was deployed on ipfs

Please sign in to comment.