Skip to content
Open
Show file tree
Hide file tree
Changes from all 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
6 changes: 4 additions & 2 deletions cypress/support/steps/main.steps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,8 +308,9 @@ export const withdraw = (
it(`Open ${_shortName} Withdraw popup view`, () => {
cy.doSwitchToDashboardSupplyView();
cy.getDashBoardSuppliedRow(_shortName, isCollateral)
.find(`button:contains("Withdraw")`)
.find(`[data-cy=suppliedExtraActionsButton]`)
.click();
cy.get(`[data-cy=withdrawButton]`).click();
cy.get(`[data-cy=Modal] h2:contains("Withdraw ${_shortName}")`).should('be.visible');
});
it(`Choose ${forWrapped ? 'usual token' : 'wrapped token'}`, () => {
Expand Down Expand Up @@ -390,8 +391,9 @@ export const withdrawAndSwitch = (
it(`Open Withdraw and Switch modal for ${_shortNameFrom}`, () => {
cy.doSwitchToDashboardSupplyView();
cy.getDashBoardSuppliedRow(_shortNameFrom, isCollateralFromAsset)
.find(`button:contains("Withdraw")`)
.find(`[data-cy=suppliedExtraActionsButton]`)
.click();
cy.get(`[data-cy=withdrawButton]`).click();

cy.get(`[data-cy=Modal] h2:contains("Withdraw ${_shortNameFrom}")`).should('be.visible');

Expand Down
7 changes: 7 additions & 0 deletions pages/_app.page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@ const CollateralSwapModal = dynamic(() =>
)
);

const LeverageModal = dynamic(() =>
import('src/components/transactions/Swap/modals/LeverageModal').then(
(module) => module.LeverageModal
)
);

const DebtSwapModal = dynamic(() =>
import('src/components/transactions/Swap/modals/DebtSwapModal').then(
(module) => module.DebtSwapModal
Expand Down Expand Up @@ -195,6 +201,7 @@ export default function MyApp(props: MyAppProps) {
{/* Swap Modals */}
<SwapModal />
<CollateralSwapModal />
<LeverageModal />
<DebtSwapModal />
<CancelCowOrderModal />
<CowOrderToast />
Expand Down
6 changes: 3 additions & 3 deletions src/components/transactions/Swap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,17 @@
- `actions/`
- The submit/CTA area and transaction execution.
- Flow containers: `SwapActions`, `CollateralSwapActions`, `DebtSwapActions`, `RepayWithCollateralActions`, `WithdrawAndSwapActions`.
- Provider adapters implement the same surface per flow, e.g. `SwapActionsViaCoW.tsx`, `SwapActionsViaParaswap.tsx`, and their flow equivalents under each subfolder.
- Provider adapters implement the same surface per flow: CoW swaps are quoted and placed by the Aave backend (`SwapActionsViaBackend.tsx` for token swaps, `PositionSwapActionsViaBackend.tsx` for position swaps), ParaSwap ones in the browser (`SwapActionsViaParaswap.tsx` and its flow equivalents under each subfolder).
- `approval/useSwapTokenApproval.ts` handles allowance flows when needed.

- `hooks/`
- `useSwapQuote` retrieves and normalizes quotes (CoW/ParaSwap) and writes into `SwapState`.
- `useSwapQuote` retrieves and normalizes quotes (Aave backend for CoW, ParaSwap) and writes into `SwapState`.
- `useFlowSelector` computes health‑factor effects and decides when to use flash‑loans.
- Other utilities: `useSwapOrderAmounts`, `useSwapGasEstimation`, `useSlippageSelector`, `useMaxNativeAmount`, `useProtocolReserves`, `useUserContext`.

- `helpers/`
- `shared/` contains provider‑agnostic logic (provider selection, formatting, misc) and `gasEstimation.helpers.ts`.
- `cow/` and `paraswap/` contain provider integrations (rates, order helpers, misc).
- `cow/` keeps the CoW order book reads for orders placed before the backend; `paraswap/` contains the ParaSwap integration (rates, order helpers, misc).

- `errors/`
- UI components and mapping/helpers for error presentation; organized by provider and shared concerns.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import { Dispatch } from 'react';

import { TrackAnalyticsHandlers } from '../../analytics/useTrackAnalytics';
import { ProtocolSwapParams, ProtocolSwapState, SwapProvider, SwapState } from '../../types';
import { SwapActionsViaCoW } from '../SwapActions/SwapActionsViaCoW';
import { PositionSwapActionsViaBackend } from '../PositionSwapActionsViaBackend';
import { SwapActionsViaParaswap } from '../SwapActions/SwapActionsViaParaswap';
import { CollateralSwapActionsViaCowAdapters } from './CollateralSwapActionsViaCoWAdapters';
import { CollateralSwapActionsViaParaswapAdapters } from './CollateralSwapActionsViaParaswapAdapters';

export const CollateralSwapActions = ({
Expand All @@ -20,26 +19,14 @@ export const CollateralSwapActions = ({
}) => {
switch (state.provider) {
case SwapProvider.COW_PROTOCOL:
if (state.useFlashloan) {
return (
<CollateralSwapActionsViaCowAdapters
params={params}
state={state}
setState={setState}
trackingHandlers={trackingHandlers}
/>
);
} else {
// Essentially traditional aTokens swap
return (
<SwapActionsViaCoW
params={params}
state={state}
setState={setState}
trackingHandlers={trackingHandlers}
/>
);
}
return (
<PositionSwapActionsViaBackend
params={params}
state={state}
setState={setState}
trackingHandlers={trackingHandlers}
/>
);
case SwapProvider.PARASWAP:
if (state.useFlashloan) {
return (
Expand Down
Loading
Loading