Skip to content

Commit

Permalink
Merge branch 'main' into feat/repay-bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
grothem committed Oct 25, 2023
2 parents 999c851 + 9e55b67 commit 1c468e6
Show file tree
Hide file tree
Showing 87 changed files with 9,256 additions and 321 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-test-deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ jobs:
- settings
- mobile
- governance-stake
- widgets
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-deploy-fork.yml
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ jobs:
- settings
- mobile
- governance-stake
- widgets
steps:
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # v3.0.2

Expand Down
12 changes: 12 additions & 0 deletions cypress/configs/widgets.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { defineConfig } from 'cypress';
import { defaultConfig } from './base.cypress';

const folder = `./cypress/e2e/5-widgets`;

export default defineConfig({
...defaultConfig,
e2e: {
specPattern: [folder + '**/*.*'],
excludeSpecPattern: [],
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const testData = {
],
},
};

describe.skip('SWITCH BORROWED, POLYGON V3 MARKET, INTEGRATION SPEC', () => {
const skipTestState = skipState(false);
configEnvWithTenderlyPolygonFork({ market: 'fork_proto_polygon_v3', v3: true });
Expand Down
4 changes: 2 additions & 2 deletions cypress/e2e/4-gho-ethereum/fixtures/gho.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"collateral": false,
"wrapped": false,
"apy": {
"min": 1.77,
"max": 2.53
"min": 2.13,
"max": 3.05
}
}
126 changes: 126 additions & 0 deletions cypress/e2e/5-widgets/switch-tool.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
import assets from '../../fixtures/assets.json';
import {
configEnvWithTenderlyAEthereumV3Fork,
configEnvWithTenderlyAvalancheFork,
configEnvWithTenderlyPolygonFork,
} from '../../support/steps/configuration.steps';
import { doCloseModal } from '../../support/steps/main.steps';

const switchByTool = ({
fromAsset,
toAsset,
amount,
hasApproval = true,
isMaxAmount = false,
}: {
fromAsset: { shortName: string; fullName: string };
toAsset: { shortName: string; fullName: string };
amount: number;
hasApproval: boolean;
isMaxAmount?: boolean;
}) => {
const _fromAssetName = fromAsset.shortName;
const _toAssetName = toAsset.shortName;

describe(`Switch ${_fromAssetName} to ${_toAssetName}`, () => {
it(`Open switch tool modal`, () => {
cy.get('button[aria-label="Switch tool"]').click();
});
it(`Choose asset from`, () => {
cy.get('[data-cy=Modal]').as('Modal');
cy.get('@Modal').find('[data-cy=assetSelect]').eq(0).click();
cy.get(`[data-cy="assetsSelectOption_${_fromAssetName}"]`, { timeout: 10000 })
.scrollIntoView()
.should('be.visible')
.click({ force: true });
cy.get(`[data-cy="assetsSelectedOption_${_fromAssetName}"]`, {
timeout: 10000,
}).should('be.visible', { timeout: 10000 });
});
it(`Choose asset to`, () => {
cy.get('[data-cy=Modal]').as('Modal');
cy.get('@Modal').find('[data-cy=assetSelect]').eq(1).click();
cy.get(`[data-cy="assetsSelectOption_${_toAssetName}"]`, { timeout: 10000 })
.scrollIntoView()
.click({ force: true });
cy.get(`[data-cy="assetsSelectedOption_${_toAssetName}"]`, {
timeout: 10000,
}).should('be.visible', { timeout: 10000 });
});
it(`Set amount`, () => {
if (isMaxAmount) {
cy.wait(2000); //there is no way to know when real max amount will upload by UI
cy.get('[data-cy=Modal]').find('button:contains("Max")').click();
} else {
cy.get('[data-cy=Modal] input[aria-label="amount input"]').first().type(amount.toString());
}
cy.wait(2000);
cy.doConfirm(hasApproval, 'Switch');
});
doCloseModal();
});
};

const testData = {
ethereum: [
{
fromAsset: assets.ethereumV3Market.ETH,
toAsset: assets.ethereumV3Market.DAI,
amount: 1,
hasApproval: true,
isMaxAmount: false,
},
{
fromAsset: assets.ethereumV3Market.ETH,
toAsset: assets.ethereumV3Market.LINK,
amount: 1,
hasApproval: true,
isMaxAmount: false,
},
],
polygon: [
{
fromAsset: assets.polygonV3Market.MATIC,
toAsset: assets.polygonV3Market.USDC,
amount: 1,
hasApproval: true,
isMaxAmount: false,
},
],
avalanche: [
{
fromAsset: assets.avalancheV3Market.AVAX,
toAsset: assets.avalancheV3Market.USDC,
amount: 1,
hasApproval: true,
isMaxAmount: false,
},
],
};

describe('SWITCH BY SWITCH TOOL, ETHEREUM', () => {
// const skipTestState = skipState(false);
configEnvWithTenderlyAEthereumV3Fork({ v3: true });

testData.ethereum.forEach((swapCase) => {
switchByTool(swapCase);
});
});

describe('SWITCH BY SWITCH TOOL, POLYGON', () => {
// const skipTestState = skipState(false);
configEnvWithTenderlyPolygonFork({ v3: true });

testData.polygon.forEach((swapCase) => {
switchByTool(swapCase);
});
});

describe('SWITCH BY SWITCH TOOL, AVALANCHE', () => {
// const skipTestState = skipState(false);
configEnvWithTenderlyAvalancheFork({ v3: true });

testData.avalanche.forEach((swapCase) => {
switchByTool(swapCase);
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"@lingui/react": "^3.14.0",
"@mui/icons-material": "^5.10.14",
"@mui/material": "^5.10.9",
"@paraswap/sdk": "6.2.2",
"@paraswap/sdk": "6.2.4",
"@tanstack/react-query": "^4.28.0",
"@visx/axis": "^2.14.0",
"@visx/curve": "^2.1.0",
Expand Down
5 changes: 5 additions & 0 deletions pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ import createEmotionCache from '../src/createEmotionCache';
import { AppGlobalStyles } from '../src/layouts/AppGlobalStyles';
import { LanguageProvider } from '../src/libs/LanguageProvider';

const SwitchModal = dynamic(() =>
import('src/components/transactions/Switch/SwitchModal').then((module) => module.SwitchModal)
);

const BorrowModal = dynamic(() =>
import('src/components/transactions/Borrow/BorrowModal').then((module) => module.BorrowModal)
);
Expand Down Expand Up @@ -148,6 +152,7 @@ export default function MyApp(props: MyAppProps) {
<FaucetModal />
<MigrateV3Modal />
<TransactionEventHandler />
<SwitchModal />
</SharedDependenciesProvider>
</GasStationProvider>
</AppDataProvider>
Expand Down
2 changes: 1 addition & 1 deletion pages/governance/proposal/[proposalId].governance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ export default function ProposalPage({
Link: 'Share on lens',
})
}
href={`https://lenster.xyz/?url=${url}&text=Check out this proposal on aave governance 👻👻 - ${ipfs.title}&hashtags=Aave&preview=true`}
href={`https://hey.xyz/?url=${url}&text=Check out this proposal on aave governance 👻👻 - ${ipfs.title}&hashtags=Aave&preview=true`}
startIcon={
<LensIcon
color={
Expand Down
2 changes: 1 addition & 1 deletion public/icons/tokens/knc.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/kncl.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 17 additions & 8 deletions scripts/populate-cache.js
Original file line number Diff line number Diff line change
Expand Up @@ -68879,7 +68879,8 @@ var marketsData = {
collateralRepay: true,
incentives: true,
withdrawAndSwitch: true,
debtSwitch: true
debtSwitch: true,
switch: true
},
subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v3",
addresses: {
Expand Down Expand Up @@ -68911,7 +68912,8 @@ var marketsData = {
liquiditySwap: true,
collateralRepay: true,
incentives: true,
debtSwitch: true
debtSwitch: true,
switch: true
},
subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v2",
addresses: {
Expand Down Expand Up @@ -69004,7 +69006,8 @@ var marketsData = {
liquiditySwap: true,
incentives: true,
collateralRepay: true,
debtSwitch: true
debtSwitch: true,
switch: true
},
subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v2-avalanche",
addresses: {
Expand Down Expand Up @@ -69052,7 +69055,8 @@ var marketsData = {
liquiditySwap: true,
withdrawAndSwitch: true,
collateralRepay: true,
debtSwitch: true
debtSwitch: true,
switch: true
},
// TODO: Need subgraph, currently not supported
// subgraphUrl: '',
Expand Down Expand Up @@ -69081,7 +69085,8 @@ var marketsData = {
liquiditySwap: true,
collateralRepay: true,
debtSwitch: true,
withdrawAndSwitch: true
withdrawAndSwitch: true,
switch: true
},
subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v3-arbitrum",
addresses: {
Expand Down Expand Up @@ -69132,7 +69137,8 @@ var marketsData = {
incentives: true,
collateralRepay: true,
debtSwitch: true,
withdrawAndSwitch: true
withdrawAndSwitch: true,
switch: true
},
subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v3-avalanche",
addresses: {
Expand Down Expand Up @@ -69283,7 +69289,8 @@ var marketsData = {
collateralRepay: true,
liquiditySwap: true,
debtSwitch: true,
withdrawAndSwitch: true
withdrawAndSwitch: true,
switch: true
},
subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v3-optimism",
addresses: {
Expand All @@ -69310,7 +69317,8 @@ var marketsData = {
incentives: true,
collateralRepay: true,
debtSwitch: true,
withdrawAndSwitch: true
withdrawAndSwitch: true,
switch: true
},
subgraphUrl: "https://api.thegraph.com/subgraphs/name/aave/protocol-v3-polygon",
addresses: {
Expand Down Expand Up @@ -69492,6 +69500,7 @@ var networkConfigs = {
},
[import_contract_helpers3.ChainId.polygon]: {
name: "Polygon POS",
displayName: "Polygon",
privateJsonRPCUrl: "https://poly-mainnet.gateway.pokt.network/v1/lb/62b3314e123e6f00397f19ca",
publicJsonRPCUrl: [
"https://polygon-rpc.com",
Expand Down
6 changes: 4 additions & 2 deletions src/components/MarketSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { ChevronDownIcon } from '@heroicons/react/outline';
import { Trans } from '@lingui/macro';
import {
Box,
BoxProps,
ListItemText,
MenuItem,
SvgIcon,
Expand Down Expand Up @@ -67,11 +68,12 @@ type MarketLogoProps = {
size: number;
logo: string;
testChainName?: string;
sx?: BoxProps;
};

export const MarketLogo = ({ size, logo, testChainName }: MarketLogoProps) => {
export const MarketLogo = ({ size, logo, testChainName, sx }: MarketLogoProps) => {
return (
<Box sx={{ mr: 2, width: size, height: size, position: 'relative' }}>
<Box sx={{ mr: 2, width: size, height: size, position: 'relative', ...sx }}>
<img src={logo} alt="" width="100%" height="100%" />

{testChainName && (
Expand Down
9 changes: 7 additions & 2 deletions src/components/TransactionEventHandler.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useEffect, useState } from 'react';
import { useRootStore } from 'src/store/root';
import { selectSuccessfulTransactions } from 'src/store/transactionsSelectors';
import { getNetworkConfig } from 'src/utils/marketsAndNetworksConfig';
import { GENERAL } from 'src/utils/mixPanelEvents';

export const TransactionEventHandler = () => {
Expand All @@ -14,17 +15,17 @@ export const TransactionEventHandler = () => {
useEffect(() => {
Object.keys(successfulTransactions).forEach((chainId) => {
const chainIdNumber = +chainId;
const networkConfig = getNetworkConfig(chainIdNumber);
Object.keys(successfulTransactions[chainIdNumber]).forEach((txHash) => {
if (!postedTransactions[chainIdNumber]?.includes(txHash)) {
const tx = successfulTransactions[chainIdNumber][txHash];

// const event = actionToEvent(tx.action);
trackEvent(GENERAL.TRANSACTION, {
transactionType: tx.action,
tokenAmount: tx.amount,
assetName: tx.assetName,
asset: tx.asset,
market: tx.market,
market: tx.market === null ? undefined : tx.market,
txHash: txHash,
proposalId: tx.proposalId,
support: tx.support,
Expand All @@ -33,6 +34,10 @@ export const TransactionEventHandler = () => {
outAsset: tx.outAsset,
outAmount: tx.outAmount,
outAssetName: tx.outAssetName,
amountUsd: tx.amountUsd,
outAmountUsd: tx.outAmountUsd,
chainId: chainIdNumber,
chainName: networkConfig.displayName || networkConfig.name,
});

// update local state
Expand Down
17 changes: 0 additions & 17 deletions src/components/Warnings/BUSDOffBoardingWarning.tsx

This file was deleted.

Loading

0 comments on commit 1c468e6

Please sign in to comment.