Skip to content
Draft
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
24 changes: 14 additions & 10 deletions src/components/transactions/Swap/constants/cow.constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ export const HOOK_ADAPTER_PER_TYPE: Record<AaveFlashLoanType, Record<SupportedCh
[SupportedChainId.BNB]: '0x029d584E847373B6373b01dfaD1a0C9BfB916382',
[SupportedChainId.POLYGON]: '0x029d584E847373B6373b01dfaD1a0C9BfB916382',
[SupportedChainId.BASE]: '0x029d584E847373B6373b01dfaD1a0C9BfB916382',
[SupportedChainId.LINEA]: '0x029d584E847373B6373b01dfaD1a0C9BfB916382',
[SupportedChainId.PLASMA]: '0x029d584E847373B6373b01dfaD1a0C9BfB916382',
[SupportedChainId.SEPOLIA]: '',
[SupportedChainId.LENS]: '',
[SupportedChainId.LINEA]: '',
[SupportedChainId.PLASMA]: '',
},
[AaveFlashLoanType.DebtSwap]: {
[SupportedChainId.MAINNET]: '0x73e7aF13Ef172F13d8FEfEbfD90C7A6530096344',
Expand All @@ -26,10 +26,10 @@ export const HOOK_ADAPTER_PER_TYPE: Record<AaveFlashLoanType, Record<SupportedCh
[SupportedChainId.BNB]: '0x73e7aF13Ef172F13d8FEfEbfD90C7A6530096344',
[SupportedChainId.POLYGON]: '0x73e7aF13Ef172F13d8FEfEbfD90C7A6530096344',
[SupportedChainId.BASE]: '0x73e7aF13Ef172F13d8FEfEbfD90C7A6530096344',
[SupportedChainId.LINEA]: '0x73e7aF13Ef172F13d8FEfEbfD90C7A6530096344',
[SupportedChainId.PLASMA]: '0x73e7aF13Ef172F13d8FEfEbfD90C7A6530096344',
[SupportedChainId.SEPOLIA]: '',
[SupportedChainId.LENS]: '',
[SupportedChainId.LINEA]: '',
[SupportedChainId.PLASMA]: '',
},
[AaveFlashLoanType.RepayCollateral]: {
[SupportedChainId.MAINNET]: '0xAc27F3f86e78B14721d07C4f9CE999285f9AAa06',
Expand All @@ -39,10 +39,10 @@ export const HOOK_ADAPTER_PER_TYPE: Record<AaveFlashLoanType, Record<SupportedCh
[SupportedChainId.BNB]: '0xAc27F3f86e78B14721d07C4f9CE999285f9AAa06',
[SupportedChainId.POLYGON]: '0xAc27F3f86e78B14721d07C4f9CE999285f9AAa06',
[SupportedChainId.BASE]: '0xAc27F3f86e78B14721d07C4f9CE999285f9AAa06',
[SupportedChainId.LINEA]: '0xAc27F3f86e78B14721d07C4f9CE999285f9AAa06',
[SupportedChainId.PLASMA]: '0xAc27F3f86e78B14721d07C4f9CE999285f9AAa06',
[SupportedChainId.SEPOLIA]: '',
[SupportedChainId.LENS]: '',
[SupportedChainId.LINEA]: '',
[SupportedChainId.PLASMA]: '',
},
};

Expand All @@ -54,9 +54,9 @@ export const ADAPTER_FACTORY: Record<SupportedChainId, string> = {
[SupportedChainId.BNB]: '0xdeCC46a4b09162F5369c5C80383AAa9159bCf192',
[SupportedChainId.POLYGON]: '0xdeCC46a4b09162F5369c5C80383AAa9159bCf192',
[SupportedChainId.BASE]: '0xdeCC46a4b09162F5369c5C80383AAa9159bCf192',
[SupportedChainId.LINEA]: '0xdeCC46a4b09162F5369c5C80383AAa9159bCf192',
[SupportedChainId.PLASMA]: '0xdeCC46a4b09162F5369c5C80383AAa9159bCf192',
[SupportedChainId.LENS]: '',
[SupportedChainId.LINEA]: '',
[SupportedChainId.PLASMA]: '',
[SupportedChainId.SEPOLIA]: '',
};

Expand Down Expand Up @@ -113,10 +113,12 @@ export const COW_UNSUPPORTED_ASSETS: Partial<
'0xd190eF37dB51Bb955A680fF1A85763CC72d083D4'.toLowerCase(), // aGHO not supported
],

[SupportedChainId.LINEA]: [
'0xacA92E438df0B2401fF60dA7E4337B687a2435DA'.toLowerCase(), // mUSD, to test no provider supported, remove before prod
],

// Safe checks, not supported
[SupportedChainId.LENS]: 'ALL',
[SupportedChainId.LINEA]: 'ALL',
[SupportedChainId.PLASMA]: 'ALL',
},
};

Expand All @@ -129,6 +131,8 @@ export const CoWProtocolSupportedNetworks = [
SupportedChainId.AVALANCHE,
SupportedChainId.POLYGON,
SupportedChainId.BNB,
SupportedChainId.LINEA,
SupportedChainId.PLASMA,
] as const;

export const isChainIdSupportedByCoWProtocol = (chainId: number): chainId is SupportedChainId => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,10 @@ export const generateCoWExplorerLink = (chainId: SupportedChainId, orderId?: str
return `${base}/pol/orders/${orderId}`;
case SupportedChainId.BNB:
return `${base}/bnb/orders/${orderId}`;
case SupportedChainId.LINEA:
return `${base}/linea/orders/${orderId}`;
case SupportedChainId.PLASMA:
return `${base}/plasma/orders/${orderId}`;
default:
throw new Error('Define explorer link for chainId: ' + chainId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
COW_UNSUPPORTED_ASSETS,
isChainIdSupportedByCoWProtocol,
} from '../../constants/cow.constants';
import { ParaswapSupportedNetworks } from '../../constants/paraswap.constants';
import { SwapProvider, SwapType } from '../../types';

/**
Expand Down Expand Up @@ -51,7 +52,7 @@ export const isSwapSupportedByCowProtocol = (
* Picks the provider for the current swap based on chain, assets and flow.
*
* Notes:
* - CoW is preferred when supported; fallback to ParaSwap
* - CoW is preferred when supported; fallback to ParaSwap if supported on chain
*/
export const getSwitchProvider = ({
chainId,
Expand All @@ -72,5 +73,9 @@ export const getSwitchProvider = ({
return SwapProvider.COW_PROTOCOL;
}

return SwapProvider.PARASWAP;
// Fallback to ParaSwap only if supported on this chain
if (ParaswapSupportedNetworks.includes(chainId)) {
return SwapProvider.PARASWAP;
}
return undefined;
};
5 changes: 4 additions & 1 deletion src/layouts/AppHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { useModalContext } from 'src/hooks/useModal';
import { useSwapOrdersTracking } from 'src/hooks/useSwapOrdersTracking';
import { useWeb3Context } from 'src/libs/hooks/useWeb3Context';
import { useRootStore } from 'src/store/root';
import { ENABLE_TESTNET, FORK_ENABLED } from 'src/utils/marketsAndNetworksConfig';
import { ENABLE_TESTNET, FORK_ENABLED, isFeatureEnabled } from 'src/utils/marketsAndNetworksConfig';
import { useShallow } from 'zustand/shallow';

import { Link } from '../components/primitives/Link';
Expand Down Expand Up @@ -107,6 +107,8 @@ export function AppHeader() {
])
);

const showSwitchButton = isFeatureEnabled.switch(currentMarketData);

const { openSwitch, openBridge, openReadMode } = useModalContext();
const { readOnlyMode } = useWeb3Context();
const [walletWidgetOpen, setWalletWidgetOpen] = useState(false);
Expand Down Expand Up @@ -312,6 +314,7 @@ export function AppHeader() {
variant="surface"
sx={{ p: '7px 8px', minWidth: 'unset', gap: 2, alignItems: 'center' }}
aria-label="Switch tool"
disabled={!showSwitchButton}
>
{!smd && (
<Typography component="span" typography="subheader1">
Expand Down
184 changes: 184 additions & 0 deletions src/ui-config/TokenList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,29 @@ const NETWORK_ASSETS: TokenInfo[] = [
isNative: true,
},
},
{
name: 'XPL',
symbol: 'XPL',
decimals: 18,
address: API_ETH_MOCK_ADDRESS,
chainId: 9745,
logoURI: '/icons/networks/plasma.svg',
extensions: {
isNative: true,
},
},
{
name: 'ETH',
symbol: 'ETH',
decimals: 18,
address: API_ETH_MOCK_ADDRESS,
chainId: 59144,
logoURI:
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2/logo.png',
extensions: {
isNative: true,
},
},
];

export const TOKEN_LIST: TokenList = {
Expand Down Expand Up @@ -13004,6 +13027,167 @@ export const TOKEN_LIST: TokenList = {
chainId: 1,
logoURI: 'https://assets.coingecko.com/coins/images/32254/standard/sdai.png?1697015278',
},
// Plasma
{
chainId: 9745,
address: '0x9895D81bB462A195b4922ED7De0e3ACD007c32CB',
name: 'Wrapped Ether',
symbol: 'WETH',
decimals: 18,
logoURI: 'https://assets.coingecko.com/coins/images/2518/standard/weth.png?1696503332',
},
{
chainId: 9745,
address: '0xB8CE59FC3717ada4C02eaDF9682A9e934F625ebb',
name: 'Tether USD',
symbol: 'USDT0',
decimals: 6,
logoURI:
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png',
},
{
chainId: 9745,
address: '0x5d3a1Ff2b6BAb83b63cd9AD0787074081a52ef34',
name: 'USDe',
symbol: 'USDe',
decimals: 18,
},
{
chainId: 9745,
address: '0x211Cc4DD073734dA055fbF44a2b4667d5E5fE5d2',
name: 'Staked USDe',
symbol: 'sUSDe',
decimals: 18,
},
{
chainId: 9745,
address: '0x1B64B9025EEbb9A6239575dF9Ea4b9Ac46D4d193',
name: 'Tether Gold',
symbol: 'XAUt0',
decimals: 6,
},
{
chainId: 9745,
address: '0xA3D68b74bF0528fdD07263c60d6488749044914b',
name: 'Wrapped eETH',
symbol: 'weETH',
decimals: 18,
},
{
chainId: 9745,
address: '0xe48D935e6C9e735463ccCf29a7F11e32bC09136E',
name: 'Wrapped liquid staked Ether 2.0',
symbol: 'wstETH',
decimals: 18,
logoURI: 'https://assets.coingecko.com/coins/images/18834/standard/wstETH.png?1696518295',
},
{
chainId: 9745,
address: '0xe561FE05C39075312Aa9Bc6af79DdaE981461359',
name: 'Wrapped rsETH',
symbol: 'wrsETH',
decimals: 18,
},
{
chainId: 9745,
address: '0x93B544c330F60A2aa05ceD87aEEffB8D38FD8c9a',
name: 'Pendle USDe PT 15JAN2026',
symbol: 'PT_USDe_15JAN2026',
decimals: 18,
},
{
chainId: 9745,
address: '0x02FCC4989B4C9D435b7ceD3fE1Ba4CF77BBb5Dd8',
name: 'Pendle sUSDe PT 15JAN2026',
symbol: 'PT_sUSDE_15JAN2026',
decimals: 18,
},
{
chainId: 9745,
address: '0xC4374775489CB9C56003BF2C9b12495fC64F0771',
name: 'syrupUSDT',
symbol: 'syrupUSDT',
decimals: 6,
},
{
chainId: 9745,
address: '0x6100E367285b01F48D07953803A2d8dCA5D19873',
name: 'Wrapped XPL',
symbol: 'WXPL',
decimals: 18,
},
// Linea
{
chainId: 59144,
address: '0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f',
name: 'Wrapped Ether',
symbol: 'WETH',
decimals: 18,
logoURI: 'https://assets.coingecko.com/coins/images/2518/standard/weth.png?1696503332',
},
{
chainId: 59144,
address: '0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4',
name: 'Wrapped BTC',
symbol: 'WBTC',
decimals: 8,
logoURI:
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0x2260FAC5E5542a773Aa44fBCfeDf7C193bc2C599/logo.png',
},
{
chainId: 59144,
address: '0x176211869cA2b568f2A7D4EE941E073a821EE1ff',
name: 'USDCoin',
symbol: 'USDC',
decimals: 6,
logoURI:
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48/logo.png',
},
{
chainId: 59144,
address: '0xA219439258ca9da29E9Cc4cE5596924745e12B93',
name: 'Tether USD',
symbol: 'USDT',
decimals: 6,
logoURI:
'https://raw.githubusercontent.com/trustwallet/assets/master/blockchains/ethereum/assets/0xdAC17F958D2ee523a2206206994597C13D831ec7/logo.png',
},
{
chainId: 59144,
address: '0xB5beDd42000b71FddE22D3eE8a79Bd49A568fC8F',
name: 'Wrapped liquid staked Ether 2.0',
symbol: 'wstETH',
decimals: 18,
logoURI: 'https://assets.coingecko.com/coins/images/18834/standard/wstETH.png?1696518295',
},
{
chainId: 59144,
address: '0x2416092f143378750bb29b79eD961ab195CcEea5',
name: 'Renzo Restaked ETH',
symbol: 'ezETH',
decimals: 18,
},
{
chainId: 59144,
address: '0x1Bf74C010E6320bab11e2e5A532b5AC15e0b8aA6',
name: 'Wrapped eETH',
symbol: 'weETH',
decimals: 18,
},
{
chainId: 59144,
address: '0xD2671165570f41BBB3B0097893300b6EB6101E6C',
name: 'Wrapped rsETH',
symbol: 'wrsETH',
decimals: 18,
},
{
chainId: 59144,
address: '0xacA92E438df0B2401fF60dA7E4337B687a2435DA',
name: 'mUSD',
symbol: 'mUSD',
decimals: 6,
},
// Sonic
{
name: 'USDC',
Expand Down
14 changes: 14 additions & 0 deletions src/ui-config/marketsConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,13 @@ export const marketsData: {
UI_INCENTIVE_DATA_PROVIDER: AaveV3Linea.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3Linea.COLLECTOR,
},
enabledFeatures: {
liquiditySwap: true,
withdrawAndSwitch: true,
collateralRepay: true,
debtSwitch: true,
switch: true,
},
},
[CustomMarket.proto_sonic_v3]: {
marketTitle: 'Sonic',
Expand Down Expand Up @@ -458,6 +465,13 @@ export const marketsData: {
UI_INCENTIVE_DATA_PROVIDER: AaveV3Plasma.UI_INCENTIVE_DATA_PROVIDER,
COLLECTOR: AaveV3Plasma.COLLECTOR,
},
enabledFeatures: {
// liquiditySwap: true,
// withdrawAndSwitch: true,
// collateralRepay: true,
// debtSwitch: true,
// switch: true,
},
},
[CustomMarket.proto_polygon_v3]: {
marketTitle: 'Polygon',
Expand Down
Loading