From 379aeadabf551a142372f3a8cd445e632f0f0d80 Mon Sep 17 00:00:00 2001 From: Thor <109517311+swimthor@users.noreply.github.com> Date: Mon, 24 Oct 2022 23:28:08 +0100 Subject: [PATCH] refactor: remove legacy v1 token supports in sdk --- apps/scripts/src/config/tokens.ts | 2 +- apps/ui/package.json | 8 +- apps/ui/src/components/AddForm.tsx | 10 +- apps/ui/src/components/PoolListItem.tsx | 4 +- apps/ui/src/components/RemoveForm.tsx | 19 +- apps/ui/src/components/SwapForm/SwapForm.tsx | 4 +- .../src/components/SwapFormV2/SwapFormV2.tsx | 8 +- apps/ui/src/components/TokenIcon.tsx | 7 +- apps/ui/src/components/TokenSearchModal.tsx | 10 +- .../src/components/molecules/AddTransfer.tsx | 6 +- .../molecules/ClaimSwimUsdOnSolana.tsx | 5 +- .../components/molecules/RemoveTransfer.tsx | 6 +- .../src/components/molecules/SwapTransfer.tsx | 10 +- .../molecules/Transfer/Transfer.tsx | 5 +- apps/ui/src/config/chains.ts | 26 +- apps/ui/src/config/ecosystems/acala.ts | 106 +++ apps/ui/src/config/ecosystems/aptos.ts | 51 ++ apps/ui/src/config/ecosystems/aurora.ts | 184 +++++ apps/ui/src/config/ecosystems/avalanche.ts | 142 ++++ apps/ui/src/config/ecosystems/bnb.ts | 261 ++++++++ apps/ui/src/config/ecosystems/ethereum.ts | 195 ++++++ apps/ui/src/config/ecosystems/fantom.ts | 108 +++ apps/ui/src/config/ecosystems/karura.ts | 150 +++++ apps/ui/src/config/ecosystems/polygon.ts | 142 ++++ apps/ui/src/config/ecosystems/solana.ts | 626 ++++++++++++++++++ apps/ui/src/config/ecosystems/types.ts | 42 ++ apps/ui/src/config/index.ts | 1 + apps/ui/src/config/tokenProjects.ts | 279 ++++++++ apps/ui/src/config/tokens.test.ts | 4 +- apps/ui/src/config/tokens.ts | 282 ++++---- apps/ui/src/config/utils.ts | 6 +- .../ui/src/core/selectors/swapTokenOptions.ts | 2 +- .../ui/src/hooks/evm/useRegisterErc20Token.ts | 8 +- ...ossChainEvmToEvmSwapInteractionMutation.ts | 5 +- .../src/hooks/swim/useGetSwapFormErrorsV2.ts | 9 +- apps/ui/src/hooks/swim/useIsLargeSwap.ts | 6 +- apps/ui/src/hooks/swim/useIsLargeSwapV2.ts | 8 +- apps/ui/src/hooks/swim/usePoolUsdValues.ts | 9 +- .../ui/src/hooks/swim/useSwapTokensContext.ts | 6 +- .../ui/src/images/tokens}/lp_acala_ausd.svg | 0 .../ui/src/images/tokens}/lp_aurora_usdc.svg | 0 .../ui/src/images/tokens}/lp_aurora_usdt.svg | 0 .../ui/src/images/tokens}/lp_aurora_usn.svg | 0 .../src/images/tokens}/lp_avalanche_usdc.svg | 0 .../src/images/tokens}/lp_avalanche_usdt.svg | 0 .../ui/src/images/tokens}/lp_fantom_usdc.svg | 0 .../ui/src/images/tokens}/lp_karura_ausd.svg | 0 .../ui/src/images/tokens}/lp_karura_usdt.svg | 0 .../ui/src/images/tokens}/lp_polygon_usdc.svg | 0 .../ui/src/images/tokens}/lp_polygon_usdt.svg | 0 apps/ui/src/models/amount.test.ts | 6 +- apps/ui/src/models/amount.ts | 8 +- .../crossEcosystem/atomicString.test.ts | 4 +- apps/ui/src/models/swim/utils.ts | 9 +- apps/ui/src/models/wormhole/solana.test.ts | 5 +- apps/ui/src/pages/PoolPage.tsx | 11 +- apps/ui/src/pages/PoolsPage.tsx | 26 +- apps/ui/src/pages/SwapPage/SwapPage.tsx | 12 +- packages/aptos/src/ecosystem.ts | 5 - packages/core/src/chain.ts | 11 +- packages/core/src/client.ts | 3 +- packages/core/src/token.ts | 5 +- packages/evm/src/ecosystems/acala.ts | 51 +- packages/evm/src/ecosystems/aurora.ts | 69 +- packages/evm/src/ecosystems/avalanche.ts | 50 +- packages/evm/src/ecosystems/bnb.ts | 108 +-- packages/evm/src/ecosystems/ethereum.ts | 72 +- packages/evm/src/ecosystems/fantom.ts | 32 +- packages/evm/src/ecosystems/karura.ts | 51 +- packages/evm/src/ecosystems/polygon.ts | 50 +- .../src/walletAdapters/EvmWalletAdapter.ts | 17 +- packages/solana/src/ecosystem.ts | 448 +------------ packages/solana/src/wormhole.ts | 2 +- packages/token-projects/images/lp_gmt.svg | 1 - packages/token-projects/images/lp_gst.svg | 1 - packages/token-projects/images/sol.svg | 1 - packages/token-projects/images/swim.svg | 1 - packages/token-projects/images/xswim.svg | 1 - packages/token-projects/src/projects.test.ts | 1 + packages/token-projects/src/projects.ts | 178 ----- yarn.lock | 30 +- 81 files changed, 2589 insertions(+), 1442 deletions(-) create mode 100644 apps/ui/src/config/ecosystems/acala.ts create mode 100644 apps/ui/src/config/ecosystems/aptos.ts create mode 100644 apps/ui/src/config/ecosystems/aurora.ts create mode 100644 apps/ui/src/config/ecosystems/avalanche.ts create mode 100644 apps/ui/src/config/ecosystems/bnb.ts create mode 100644 apps/ui/src/config/ecosystems/ethereum.ts create mode 100644 apps/ui/src/config/ecosystems/fantom.ts create mode 100644 apps/ui/src/config/ecosystems/karura.ts create mode 100644 apps/ui/src/config/ecosystems/polygon.ts create mode 100644 apps/ui/src/config/ecosystems/solana.ts create mode 100644 apps/ui/src/config/ecosystems/types.ts create mode 100644 apps/ui/src/config/tokenProjects.ts rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_acala_ausd.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_aurora_usdc.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_aurora_usdt.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_aurora_usn.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_avalanche_usdc.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_avalanche_usdt.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_fantom_usdc.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_karura_ausd.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_karura_usdt.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_polygon_usdc.svg (100%) rename {packages/token-projects/images => apps/ui/src/images/tokens}/lp_polygon_usdt.svg (100%) delete mode 100644 packages/token-projects/images/lp_gmt.svg delete mode 100644 packages/token-projects/images/lp_gst.svg delete mode 100644 packages/token-projects/images/sol.svg delete mode 100644 packages/token-projects/images/swim.svg delete mode 100644 packages/token-projects/images/xswim.svg diff --git a/apps/scripts/src/config/tokens.ts b/apps/scripts/src/config/tokens.ts index 2ba22d25e..7a6cfd3d2 100644 --- a/apps/scripts/src/config/tokens.ts +++ b/apps/scripts/src/config/tokens.ts @@ -25,7 +25,7 @@ const EMPTY_MAP: TokenConfig["wrappedDetails"] = new Map(); export const DEVNET_SWIMUSD: TokenConfig = { isDisabled: !isPoolRestructureEnabled(), id: "devnet-swimusd", - projectId: TokenProjectId.SwimLpSolanaUsdcUsdt, + projectId: TokenProjectId.SwimUsd, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "5ctnNpb7h1SyPqZ8t8m2kCykrtDGVZBtZgYWv6UAeDhr", // TODO: Update diff --git a/apps/ui/package.json b/apps/ui/package.json index a87d9fba5..4d230880a 100644 --- a/apps/ui/package.json +++ b/apps/ui/package.json @@ -51,13 +51,13 @@ "@solana/spl-token": "^0.3.5", "@solana/web3.js": "^1.62.0", "@swim-io/aptos": "^0.40.0", - "@swim-io/core": "^0.40.0", - "@swim-io/evm": "^0.40.0", + "@swim-io/core": "workspace:^", + "@swim-io/evm": "workspace:^", "@swim-io/evm-contracts": "^0.40.0", "@swim-io/pool-math": "^0.40.0", - "@swim-io/solana": "^0.40.0", + "@swim-io/solana": "workspace:^", "@swim-io/solana-contracts": "^0.40.0", - "@swim-io/token-projects": "^0.40.0", + "@swim-io/token-projects": "workspace:^", "@swim-io/utils": "^0.40.0", "@swim-io/wormhole": "^0.40.0", "bn.js": "^5.2.1", diff --git a/apps/ui/src/components/AddForm.tsx b/apps/ui/src/components/AddForm.tsx index 5d1287552..1060b12e0 100644 --- a/apps/ui/src/components/AddForm.tsx +++ b/apps/ui/src/components/AddForm.tsx @@ -13,7 +13,6 @@ import { EuiText, } from "@elastic/eui"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { filterMap, isEachNotNull, isNotNull } from "@swim-io/utils"; import type Decimal from "decimal.js"; import type { FormEvent, ReactElement } from "react"; @@ -21,13 +20,14 @@ import { useMemo, useState } from "react"; import { useTranslation } from "react-i18next"; import shallow from "zustand/shallow.js"; +import type { EcosystemId, PoolSpec, TokenConfig } from "../config"; import { DISABLED_ECOSYSTEMS, ECOSYSTEMS, ECOSYSTEM_IDS, + getTokenProjectByProjectId, isEcosystemEnabled, } from "../config"; -import type { EcosystemId, PoolSpec, TokenConfig } from "../config"; import { selectConfig } from "../core/selectors"; import { useEnvironment, useNotification } from "../core/store"; import { captureAndWrapException } from "../errors"; @@ -86,7 +86,7 @@ const TokenAddPanel = ({ onBlur, }: TokenAddPanelProps): ReactElement => { const { t } = useTranslation(); - const tokenProject = TOKEN_PROJECTS_BY_ID[tokenConfig.projectId]; + const tokenProject = getTokenProjectByProjectId(tokenConfig.projectId); const balance = useUserBalanceAmount(tokenConfig, ecosystemId); return ( { const ecosystem = ECOSYSTEMS[ecosystemId]; return { @@ -499,7 +499,7 @@ export const AddForm = ({ } }; - const lpTokenProject = TOKEN_PROJECTS_BY_ID[lpToken.projectId]; + const lpTokenProject = getTokenProjectByProjectId(lpToken.projectId); const receiveLabel = poolSpec.isStakingPool ? t("add_token_form.choose_receive_tokens_on", { tokenSymbol: lpTokenProject.symbol, diff --git a/apps/ui/src/components/PoolListItem.tsx b/apps/ui/src/components/PoolListItem.tsx index 369bab1de..426b94a27 100644 --- a/apps/ui/src/components/PoolListItem.tsx +++ b/apps/ui/src/components/PoolListItem.tsx @@ -8,7 +8,6 @@ import { EuiTitle, EuiToolTip, } from "@elastic/eui"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { chunks } from "@swim-io/utils"; import Decimal from "decimal.js"; import type { ReactElement } from "react"; @@ -17,6 +16,7 @@ import { useNavigate } from "react-router-dom"; import { atomicToCurrencyString } from "../amounts"; import type { PoolSpec, TokenConfig } from "../config"; +import { getTokenProjectByProjectId } from "../config"; import { i18next } from "../i18n"; import { TokenIcon } from "./TokenIcon"; @@ -92,7 +92,7 @@ export const PoolListItem = ({ style={{ margin: flexItemMargin }} > { const ecosystem = ECOSYSTEMS[ecosystemId]; const lpBalance = userLpBalances[ecosystemId]; @@ -396,9 +399,9 @@ export const RemoveForm = ({ ); return { value: id, - text: `${TOKEN_PROJECTS_BY_ID[tokenConfig.projectId].displayName} (${ - ECOSYSTEMS[tokenConfig.nativeEcosystemId].displayName - })`, + text: `${ + getTokenProjectByProjectId(tokenConfig.projectId).displayName + } (${ECOSYSTEMS[tokenConfig.nativeEcosystemId].displayName})`, }; }, ); @@ -642,7 +645,7 @@ export const RemoveForm = ({ } }; - const lpTokenProject = TOKEN_PROJECTS_BY_ID[lpToken.projectId]; + const lpTokenProject = getTokenProjectByProjectId(lpToken.projectId); const maximumLpBurnLabel = poolSpec.isStakingPool ? t("remove_token_form.max_required_lp_tokens", { tokenSymbol: lpTokenProject.symbol, @@ -814,7 +817,7 @@ export const RemoveForm = ({ prepend={ } diff --git a/apps/ui/src/components/SwapForm/SwapForm.tsx b/apps/ui/src/components/SwapForm/SwapForm.tsx index e71d75a38..c4258f4d2 100644 --- a/apps/ui/src/components/SwapForm/SwapForm.tsx +++ b/apps/ui/src/components/SwapForm/SwapForm.tsx @@ -8,7 +8,6 @@ import { } from "@elastic/eui"; import { EvmEcosystemId } from "@swim-io/evm"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { defaultIfError, isEachNotNull } from "@swim-io/utils"; import type Decimal from "decimal.js"; import type { FormEvent, ReactElement, ReactNode } from "react"; @@ -16,6 +15,7 @@ import { useEffect, useState } from "react"; import { useTranslation } from "react-i18next"; import shallow from "zustand/shallow.js"; +import { getTokenProjectByProjectId } from "../../config"; import { selectConfig } from "../../core/selectors"; import { useEnvironment, useNotification } from "../../core/store"; import { captureAndWrapException } from "../../errors"; @@ -110,7 +110,7 @@ export const SwapForm = ({ maxSlippageFraction }: Props): ReactElement => { const isLargeSwap = useIsLargeSwap(fromToken, toToken, inputAmount); const isSmallEthSwap = - TOKEN_PROJECTS_BY_ID[fromToken.projectId].isStablecoin && + getTokenProjectByProjectId(fromToken.projectId).isStablecoin && [fromToken.nativeEcosystemId, toToken.nativeEcosystemId].includes( EvmEcosystemId.Ethereum, ) && diff --git a/apps/ui/src/components/SwapFormV2/SwapFormV2.tsx b/apps/ui/src/components/SwapFormV2/SwapFormV2.tsx index 30ad0f39c..597bb4bf0 100644 --- a/apps/ui/src/components/SwapFormV2/SwapFormV2.tsx +++ b/apps/ui/src/components/SwapFormV2/SwapFormV2.tsx @@ -8,7 +8,6 @@ import { } from "@elastic/eui"; import { EvmEcosystemId } from "@swim-io/evm"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { defaultIfError } from "@swim-io/utils"; import Decimal from "decimal.js"; import type { FormEvent, ReactElement, ReactNode } from "react"; @@ -16,7 +15,10 @@ import { useState } from "react"; import { useTranslation } from "react-i18next"; import shallow from "zustand/shallow.js"; -import { getTokenDetailsForEcosystem } from "../../config"; +import { + getTokenDetailsForEcosystem, + getTokenProjectByProjectId, +} from "../../config"; import { selectConfig } from "../../core/selectors"; import { useEnvironment, useNotification } from "../../core/store"; import { captureAndWrapException } from "../../errors"; @@ -109,7 +111,7 @@ export const SwapFormV2 = ({ maxSlippageFraction }: Props): ReactElement => { maxSlippageFraction, ); const isSmallEthSwap = - TOKEN_PROJECTS_BY_ID[fromTokenConfig.projectId].isStablecoin && + getTokenProjectByProjectId(fromTokenConfig.projectId).isStablecoin && [fromTokenOption.ecosystemId, toTokenOption.ecosystemId].includes( EvmEcosystemId.Ethereum, ) && diff --git a/apps/ui/src/components/TokenIcon.tsx b/apps/ui/src/components/TokenIcon.tsx index b2b61a417..9d46fbe86 100644 --- a/apps/ui/src/components/TokenIcon.tsx +++ b/apps/ui/src/components/TokenIcon.tsx @@ -1,12 +1,11 @@ import { EuiIcon } from "@elastic/eui"; import type { TokenProject } from "@swim-io/token-projects"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import type { ComponentProps, ReactElement } from "react"; import { Fragment } from "react"; import { Trans } from "react-i18next"; import type { EcosystemId, TokenConfig } from "../config"; -import { ECOSYSTEMS } from "../config"; +import { ECOSYSTEMS, getTokenProjectByProjectId } from "../config"; import { useIntlListSeparators } from "../hooks"; import type { Amount } from "../models/amount"; @@ -117,7 +116,7 @@ export const TokenConfigIcon = ({ ecosystem, }: TokenConfigIconProps): ReactElement => ( ); @@ -125,5 +124,5 @@ export const TokenConfigIcon = ({ export const TokenSearchConfigIcon = ({ token, }: Pick): ReactElement => ( - + ); diff --git a/apps/ui/src/components/TokenSearchModal.tsx b/apps/ui/src/components/TokenSearchModal.tsx index 06577f061..2a03be233 100644 --- a/apps/ui/src/components/TokenSearchModal.tsx +++ b/apps/ui/src/components/TokenSearchModal.tsx @@ -9,14 +9,18 @@ import { EuiSelectable, } from "@elastic/eui"; import type { EuiSelectableOption } from "@elastic/eui"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { useCallback } from "react"; import type { ReactElement } from "react"; import { useTranslation } from "react-i18next"; import shallow from "zustand/shallow.js"; import type { EcosystemId, TokenConfig } from "../config"; -import { ECOSYSTEM_LIST, isEcosystemEnabled, isSwimUsd } from "../config"; +import { + ECOSYSTEM_LIST, + getTokenProjectByProjectId, + isEcosystemEnabled, + isSwimUsd, +} from "../config"; import { selectConfig } from "../core/selectors"; import { useEnvironment } from "../core/store"; import { useUserBalanceAmount } from "../hooks"; @@ -88,7 +92,7 @@ export const TokenSearchModal = ({ ); const options = filteredTokens.map((token) => { - const tokenProject = TOKEN_PROJECTS_BY_ID[token.projectId]; + const tokenProject = getTokenProjectByProjectId(token.projectId); return { label: `${tokenProject.symbol}`, searchableLabel: `${tokenProject.symbol} ${tokenProject.displayName}`, diff --git a/apps/ui/src/components/molecules/AddTransfer.tsx b/apps/ui/src/components/molecules/AddTransfer.tsx index 352f79491..156c40fab 100644 --- a/apps/ui/src/components/molecules/AddTransfer.tsx +++ b/apps/ui/src/components/molecules/AddTransfer.tsx @@ -1,10 +1,10 @@ import { EuiLoadingSpinner, EuiText } from "@elastic/eui"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { filterMap } from "@swim-io/utils"; import type { VFC } from "react"; import { useTranslation } from "react-i18next"; import type { EcosystemId, TokenConfig } from "../../config"; +import { getTokenProjectByProjectId } from "../../config"; import { useIntlListFormatter } from "../../hooks"; import type { Amount } from "../../models"; @@ -29,11 +29,11 @@ export const AddTransfer: VFC = ({ const listFormatter = useIntlListFormatter(); const nonZeroInputTokens = filterMap( (amount: Amount) => !amount.isZero(), - (amount) => TOKEN_PROJECTS_BY_ID[amount.tokenConfig.projectId].symbol, + (amount) => getTokenProjectByProjectId(amount.tokenConfig.projectId).symbol, fromAmounts, ); const inputTokenNames = listFormatter.format(nonZeroInputTokens); - const outputTokenName = TOKEN_PROJECTS_BY_ID[toToken.projectId].symbol; + const outputTokenName = getTokenProjectByProjectId(toToken.projectId).symbol; return ( diff --git a/apps/ui/src/components/molecules/ClaimSwimUsdOnSolana.tsx b/apps/ui/src/components/molecules/ClaimSwimUsdOnSolana.tsx index 3590727b0..88d3c120b 100644 --- a/apps/ui/src/components/molecules/ClaimSwimUsdOnSolana.tsx +++ b/apps/ui/src/components/molecules/ClaimSwimUsdOnSolana.tsx @@ -1,9 +1,9 @@ import { EuiLoadingSpinner, EuiText } from "@elastic/eui"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import type { VFC } from "react"; import { useTranslation } from "react-i18next"; +import { getTokenProjectByProjectId } from "../../config"; import { useSwimUsd } from "../../hooks"; import { TxEcosystemList } from "./TxList"; @@ -30,7 +30,8 @@ export const ClaimSwimUsdOnSolana: VFC = ({ {isLoading && } {t("recent_interactions.claim_token_on_solana", { - tokenName: TOKEN_PROJECTS_BY_ID[swimUsd.projectId].displayName, + tokenName: getTokenProjectByProjectId(swimUsd.projectId) + .displayName, })} diff --git a/apps/ui/src/components/molecules/RemoveTransfer.tsx b/apps/ui/src/components/molecules/RemoveTransfer.tsx index 8eb4041da..e7eb8361f 100644 --- a/apps/ui/src/components/molecules/RemoveTransfer.tsx +++ b/apps/ui/src/components/molecules/RemoveTransfer.tsx @@ -1,10 +1,10 @@ import { EuiLoadingSpinner, EuiText } from "@elastic/eui"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { filterMap } from "@swim-io/utils"; import type { VFC } from "react"; import { useTranslation } from "react-i18next"; import type { EcosystemId, TokenConfig } from "../../config"; +import { getTokenProjectByProjectId } from "../../config"; import { useIntlListFormatter } from "../../hooks"; import type { Amount } from "../../models"; @@ -29,11 +29,11 @@ export const RemoveTransfer: VFC = ({ const listFormatter = useIntlListFormatter(); const nonZeroOutputTokens = filterMap( (amount: Amount) => !amount.isZero(), - (amount) => TOKEN_PROJECTS_BY_ID[amount.tokenConfig.projectId].symbol, + (amount) => getTokenProjectByProjectId(amount.tokenConfig.projectId).symbol, toAmounts, ); const outputTokenNames = listFormatter.format(nonZeroOutputTokens); - const inputTokenName = TOKEN_PROJECTS_BY_ID[fromToken.projectId].symbol; + const inputTokenName = getTokenProjectByProjectId(fromToken.projectId).symbol; return ( diff --git a/apps/ui/src/components/molecules/SwapTransfer.tsx b/apps/ui/src/components/molecules/SwapTransfer.tsx index 776f4e381..db8d9ef02 100644 --- a/apps/ui/src/components/molecules/SwapTransfer.tsx +++ b/apps/ui/src/components/molecules/SwapTransfer.tsx @@ -1,10 +1,9 @@ import { EuiLoadingSpinner, EuiText } from "@elastic/eui"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import type { VFC } from "react"; import { useTranslation } from "react-i18next"; import type { EcosystemId, TokenConfig } from "../../config"; -import { ECOSYSTEMS } from "../../config"; +import { ECOSYSTEMS, getTokenProjectByProjectId } from "../../config"; import { TxEcosystemList } from "./TxList"; @@ -30,9 +29,10 @@ export const SwapTransfer: VFC = ({ {isLoading && } {t("recent_interactions.swap_token_from_x_to_y", { - fromTokenName: - TOKEN_PROJECTS_BY_ID[fromToken.projectId].displayName, - toTokenName: TOKEN_PROJECTS_BY_ID[toToken.projectId].displayName, + fromTokenName: getTokenProjectByProjectId(fromToken.projectId) + .displayName, + toTokenName: getTokenProjectByProjectId(toToken.projectId) + .displayName, ecosystemName: ECOSYSTEMS[ecosystemId].displayName, })} diff --git a/apps/ui/src/components/molecules/Transfer/Transfer.tsx b/apps/ui/src/components/molecules/Transfer/Transfer.tsx index 09ec7e22d..eb5163140 100644 --- a/apps/ui/src/components/molecules/Transfer/Transfer.tsx +++ b/apps/ui/src/components/molecules/Transfer/Transfer.tsx @@ -1,10 +1,9 @@ import { EuiLoadingSpinner, EuiText } from "@elastic/eui"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import type { VFC } from "react"; import { useTranslation } from "react-i18next"; import type { EcosystemId, TokenConfig } from "../../../config"; -import { ECOSYSTEMS } from "../../../config"; +import { ECOSYSTEMS, getTokenProjectByProjectId } from "../../../config"; import { TxList } from "../TxList"; interface Props { @@ -32,7 +31,7 @@ export const Transfer: VFC = ({ {isLoading && } {t("recent_interactions.transfer_token_from_x_to_y", { - tokenName: TOKEN_PROJECTS_BY_ID[token.projectId].displayName, + tokenName: getTokenProjectByProjectId(token.projectId).displayName, fromEcosystemName: ECOSYSTEMS[from].displayName, toEcosystemName: ECOSYSTEMS[to].displayName, })} diff --git a/apps/ui/src/config/chains.ts b/apps/ui/src/config/chains.ts index bf88b329d..4d1847002 100644 --- a/apps/ui/src/config/chains.ts +++ b/apps/ui/src/config/chains.ts @@ -1,24 +1,24 @@ import type { AptosChainConfig } from "@swim-io/aptos"; -import { APTOS_ECOSYSTEM_ID, aptos } from "@swim-io/aptos"; +import { APTOS_ECOSYSTEM_ID } from "@swim-io/aptos"; import { Env } from "@swim-io/core"; import type { EvmChainConfig } from "@swim-io/evm"; -import { - EvmEcosystemId, - acala, - aurora, - avalanche, - bnb, - ethereum, - fantom, - karura, - polygon, -} from "@swim-io/evm"; +import { EvmEcosystemId } from "@swim-io/evm"; import type { SolanaChainConfig } from "@swim-io/solana"; -import { SOLANA_ECOSYSTEM_ID, solana } from "@swim-io/solana"; +import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; import type { ReadonlyRecord } from "@swim-io/utils"; import type { EcosystemId } from "./ecosystem"; import { Protocol } from "./ecosystem"; +import { acala } from "./ecosystems/acala"; +import { aptos } from "./ecosystems/aptos"; +import { aurora } from "./ecosystems/aurora"; +import { avalanche } from "./ecosystems/avalanche"; +import { bnb } from "./ecosystems/bnb"; +import { ethereum } from "./ecosystems/ethereum"; +import { fantom } from "./ecosystems/fantom"; +import { karura } from "./ecosystems/karura"; +import { polygon } from "./ecosystems/polygon"; +import { solana } from "./ecosystems/solana"; export const enum EvmChainId { EthereumMainnet = 1, diff --git a/apps/ui/src/config/ecosystems/acala.ts b/apps/ui/src/config/ecosystems/acala.ts new file mode 100644 index 000000000..77eefaff4 --- /dev/null +++ b/apps/ui/src/config/ecosystems/acala.ts @@ -0,0 +1,106 @@ +import type { GasToken } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { EVM_PROTOCOL, EvmEcosystemId, acalaChainId } from "@swim-io/evm"; +import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; +import { assertType } from "@swim-io/utils"; + +import { TokenProjectIdV1 } from "../tokenProjects"; + +import type { EvmChainConfigV1, EvmEcosystemConfigV1 } from "./types"; + +const mainnet: EvmChainConfigV1 = { + name: "Acala Mainnet", + chainId: acalaChainId[Env.Mainnet], + wormhole: { + bridge: "0xa321448d90d4e5b0A732867c18eA198e75CAC48E", + portal: "0xae9d7fe007b3327AA64A32824Aaac52C42a6E624", + }, + publicRpcUrls: ["https://acala-polkadot.api.onfinality.io/public-rpc"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "", // TODO: add when deployed + decimals: 8, // TODO: confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "mainnet-acala-ausd", + projectId: TokenProjectIdV1.Ausd, + nativeDetails: { + address: "0x0000000000000000000000000000000000000000", // TODO: Update + decimals: 6, // TODO: Update + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "11111111111111111111111111111112", // TODO: Update + decimals: 6, // TODO: Update + }, + ], + ]), + }, + ], + pools: [], +}; + +const testnet: EvmChainConfigV1 = { + name: "Acala Testnet", + chainId: acalaChainId[Env.Testnet], + wormhole: { + bridge: "0x4377B49d559c0a9466477195C6AdC3D433e265c0", + portal: "0xebA00cbe08992EdD08ed7793E07ad6063c807004", + }, + publicRpcUrls: ["https://acala-dev.aca-dev.network/eth/http"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "", // TODO: add when deployed + decimals: 8, // TODO: confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "testnet-acala-ausd", + projectId: TokenProjectIdV1.Ausd, + nativeDetails: { + address: "0x996f42BdB0CB71F831C2eFB05Ac6d0d226979e5B", + decimals: 12, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "BbdPh2Nvpp7XftBHWENJu5dpC5gF5FtCSyFLTU4qNr7g", + decimals: 8, + }, + ], + ]), + }, + { + id: "testnet-acala-lp-ausd", + projectId: TokenProjectIdV2.SwimLpAcalaAusd, + nativeDetails: { + address: "0x1111111111111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + }, + ], + pools: [], +}; + +const gasToken: GasToken = { + name: "Acala", + symbol: "ACA", + decimals: 18, +}; + +export const acala = assertType>()({ + id: EvmEcosystemId.Acala, + protocol: EVM_PROTOCOL, + wormholeChainId: 12, + displayName: "Acala", + gasToken, + chains: { + [Env.Mainnet]: mainnet, + [Env.Testnet]: testnet, + }, +} as const); diff --git a/apps/ui/src/config/ecosystems/aptos.ts b/apps/ui/src/config/ecosystems/aptos.ts new file mode 100644 index 000000000..579851a5b --- /dev/null +++ b/apps/ui/src/config/ecosystems/aptos.ts @@ -0,0 +1,51 @@ +import { + APTOS_ECOSYSTEM_ID, + APTOS_PROTOCOL, + AptosChainId, +} from "@swim-io/aptos"; +import type { GasToken } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { assertType } from "@swim-io/utils"; + +import type { AptosChainConfigV1, AptosEcosystemConfigV1 } from "./types"; + +const testnet: AptosChainConfigV1 = { + name: "Aptos Testnet", + chainId: AptosChainId.Testnet, + wormhole: { + // Usually listed in https://book.wormhole.com/reference/contracts.html + // For now https://github.com/kcsongor provided these addresses: + // https://github.com/wormhole-foundation/wormhole/blob/a93d8d65296410e5d6d8d214edd7ce6cb454fa76/clients/js/main.ts#L82-L85 + // and told us that the same addresses will be used in production. + bridge: + "0x7041d0a5ae46a24fd5f1df67c54bf1a2e0fe7668ae9402e30e58f3ad452f9d52", + portal: + "0x799c8d35a610b6fa8ed33432e31c686c97b4ce4205fce88c13577615372e99a3", + }, + publicRpcUrls: ["https://testnet.aptoslabs.com/v1"], + swimUsdDetails: { + address: + "0x246bfb8da92a72f29d0441138058a43970551734d68958281d59e23a4f2b19a0::coin::T", + decimals: 6, + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [], + pools: [], +}; + +const gasToken: GasToken = { + name: "Aptos Coin", + symbol: "APT", + decimals: 8, +}; + +export const aptos = assertType()({ + id: APTOS_ECOSYSTEM_ID, + protocol: APTOS_PROTOCOL, + wormholeChainId: 22, + displayName: "Aptos", + gasToken, + chains: { + [Env.Testnet]: testnet, + }, +} as const); diff --git a/apps/ui/src/config/ecosystems/aurora.ts b/apps/ui/src/config/ecosystems/aurora.ts new file mode 100644 index 000000000..4b668a512 --- /dev/null +++ b/apps/ui/src/config/ecosystems/aurora.ts @@ -0,0 +1,184 @@ +import type { GasToken } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { EVM_PROTOCOL, EvmEcosystemId, auroraChainId } from "@swim-io/evm"; +import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; +import { assertType } from "@swim-io/utils"; + +import { TokenProjectIdV1 } from "../tokenProjects"; + +import type { EvmChainConfigV1, EvmEcosystemConfigV1 } from "./types"; + +const mainnet: EvmChainConfigV1 = { + name: "Aurora Mainnet", + chainId: auroraChainId[Env.Mainnet], + wormhole: { + bridge: "0xa321448d90d4e5b0A732867c18eA198e75CAC48E", + portal: "0x51b5123a7b0F9b2bA265f9c4C8de7D78D52f510F", + }, + publicRpcUrls: ["https://mainnet.aurora.dev/"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "", // TODO: add when deployed + decimals: 8, // TODO: confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "mainnet-aurora-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "9Y8pJhF8AQGBGL5PTd12P4w82n2qAADTmWakkXSatdAu", + decimals: 6, + }, + ], + ]), + }, + { + id: "mainnet-aurora-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "GFhej2oJ1NPLbzSX3D3B9jzYaidff6NoBAUNmu6dLXwU", + decimals: 6, + }, + ], + ]), + }, + { + id: "mainnet-aurora-usn", + projectId: TokenProjectIdV1.Usn, + nativeDetails: { + address: "0x5183e1B1091804BC2602586919E6880ac1cf2896", + decimals: 18, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "3NDmtc2xKMpm8wCiaALey2y3EGhBkUNuXJ9m3JcjnHMM", + decimals: 8, + }, + ], + ]), + }, + ], + pools: [], +}; + +const testnet: EvmChainConfigV1 = { + name: "Aurora Testnet", + chainId: auroraChainId[Env.Testnet], + wormhole: { + bridge: "0xBd07292de7b505a4E803CEe286184f7Acf908F5e", + portal: "0xD05eD3ad637b890D68a854d607eEAF11aF456fba", + }, + publicRpcUrls: ["https://testnet.aurora.dev/"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "", // TODO: add when deployed + decimals: 8, // TODO: confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "testnet-aurora-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "B3qmqCvzbni27z5TRrt1uBYMczUCjCjui7piGAZifSTU", + decimals: 6, + }, + ], + ]), + }, + { + id: "testnet-aurora-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x489dDcd070b6c4e0373FBB5d529Cc06328E048c3", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "BaTEf2Mnrf9wePKb9g9BtSPkrZmmBnR6K9Q1ZxDKmWoh", + decimals: 6, + }, + ], + ]), + }, + { + id: "testnet-aurora-usn", + projectId: TokenProjectIdV1.Usn, + nativeDetails: { + address: "0x0000000000000000000000000000000000000000", // TODO: Update + decimals: 18, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "11111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + ], + ]), + }, + { + id: "testnet-aurora-lp-usdc-usdt", + projectId: TokenProjectIdV2.SwimLpAuroraUsdcUsdt, + nativeDetails: { + address: "0x1111111111111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + }, + { + id: "testnet-aurora-lp-usn", + projectId: TokenProjectIdV2.SwimLpAuroraUsn, + nativeDetails: { + address: "0x1111111111111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + }, + ], + pools: [], +}; + +const gasToken: GasToken = { + name: "Ethereum", + symbol: "ETH", + decimals: 18, +}; + +export const aurora = assertType>()( + { + id: EvmEcosystemId.Aurora, + protocol: EVM_PROTOCOL, + wormholeChainId: 9, + displayName: "Aurora", + gasToken, + chains: { + [Env.Mainnet]: mainnet, + [Env.Testnet]: testnet, + }, + } as const, +); diff --git a/apps/ui/src/config/ecosystems/avalanche.ts b/apps/ui/src/config/ecosystems/avalanche.ts new file mode 100644 index 000000000..d0643d0b7 --- /dev/null +++ b/apps/ui/src/config/ecosystems/avalanche.ts @@ -0,0 +1,142 @@ +import type { GasToken } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { EVM_PROTOCOL, EvmEcosystemId, avalancheChainId } from "@swim-io/evm"; +import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; +import { assertType } from "@swim-io/utils"; + +import { TokenProjectIdV1 } from "../tokenProjects"; + +import type { EvmChainConfigV1, EvmEcosystemConfigV1 } from "./types"; + +const mainnet: EvmChainConfigV1 = { + name: "Avalanche Mainnet", + chainId: avalancheChainId[Env.Mainnet], + wormhole: { + bridge: "0x54a8e5f9c4CbA08F9943965859F6c34eAF03E26c", + portal: "0x0e082F06FF657D94310cB8cE8B0D9a04541d8052", + }, + publicRpcUrls: ["https://api.avax.network/ext/bc/C/rpc"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "", // TODO: add when deployed + decimals: 8, // TODO: confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "mainnet-avalanche-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "FHfba3ov5P3RjaiLVgh8FTv4oirxQDoVXuoUUDvHuXax", + decimals: 6, + }, + ], + ]), + }, + { + id: "mainnet-avalanche-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "Kz1csQA91WUGcQ2TB3o5kdGmWmMGp8eJcDEyHzNDVCX", + decimals: 6, + }, + ], + ]), + }, + ], + pools: [], +}; + +const testnet: EvmChainConfigV1 = { + name: "Avalanche Testnet", + chainId: avalancheChainId[Env.Testnet], + wormhole: { + bridge: "0x7bbcE28e64B3F8b84d876Ab298393c38ad7aac4C", + portal: "0x61E44E506Ca5659E6c0bba9b678586fA2d729756", + }, + publicRpcUrls: ["https://api.avax-test.network/ext/bc/C/rpc"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "0x5eDEa6B0881425AE4Aa7c65aCa6AeaFecC7E72f5", // TODO: Update if necessary + decimals: 6, + }, + routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary + tokens: [ + { + id: "testnet-avalanche-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "2t6pVTufn9A4b37oLmex3YMjm3smp1G9tPd9HpAFSeka", + decimals: 6, + }, + ], + ]), + }, + { + id: "testnet-avalanche-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x489dDcd070b6c4e0373FBB5d529Cc06328E048c3", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "9ibet2CuBX1a4HpbzH9auxxtyUvkSKVy39jWtZY5Bfor", + decimals: 6, + }, + ], + ]), + }, + { + id: "testnet-avalanche-lp-usdc-usdt", + projectId: TokenProjectIdV2.SwimLpAvalancheUsdcUsdt, + nativeDetails: { + address: "0x1111111111111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + }, + ], + pools: [], +}; + +const gasToken: GasToken = { + name: "Avalanche", + symbol: "AVAX", + decimals: 18, +}; + +export const avalanche = assertType< + EvmEcosystemConfigV1 +>()({ + id: EvmEcosystemId.Avalanche, + protocol: EVM_PROTOCOL, + wormholeChainId: 6, + displayName: "Avalanche", + gasToken, + chains: { + [Env.Mainnet]: mainnet, + [Env.Testnet]: testnet, + }, +} as const); diff --git a/apps/ui/src/config/ecosystems/bnb.ts b/apps/ui/src/config/ecosystems/bnb.ts new file mode 100644 index 000000000..063b5a341 --- /dev/null +++ b/apps/ui/src/config/ecosystems/bnb.ts @@ -0,0 +1,261 @@ +import type { GasToken } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { EVM_PROTOCOL, EvmEcosystemId, bnbChainId } from "@swim-io/evm"; +import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; +import { assertType } from "@swim-io/utils"; + +import { TokenProjectIdV1 } from "../tokenProjects"; + +import type { EvmChainConfigV1, EvmEcosystemConfigV1 } from "./types"; + +const mainnet: EvmChainConfigV1 = { + name: "BNB Chain Mainnet", + chainId: bnbChainId[Env.Mainnet], + wormhole: { + bridge: "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B", + portal: "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7", + }, + publicRpcUrls: ["https://bsc-dataseed1.ninicoin.io/"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "0xF78479d516A12b9cFb000951D19f67B4fE0B065d", // TODO: Update when deployed + decimals: 8, // TODO: Confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "mainnet-bnb-busd", + projectId: TokenProjectIdV1.Busd, + nativeDetails: { + address: "0xe9e7cea3dedca5984780bafc599bd69add087d56", + decimals: 18, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "5RpUwQ8wtdPCZHhu6MERp2RGrpobsbZ6MH5dDHkUjs2", + decimals: 8, + }, + ], + ]), + }, + { + id: "mainnet-bnb-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x55d398326f99059ff775485246999027b3197955", + decimals: 18, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "8qJSyQprMC57TWKaYEmetUR3UUiTP2M3hXdcvFhkZdmv", + decimals: 8, + }, + ], + ]), + }, + { + id: "mainnet-bnb-gst", + projectId: TokenProjectIdV1.Gst, + nativeDetails: { + address: "0x4a2c860cec6471b9f5f5a336eb4f38bb21683c98", + decimals: 8, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "GDuUFXEhUm4jG71vPxYRX3VxUMJ5etGvHTR1iKwTdb6p", + decimals: 8, + }, + ], + ]), + }, + { + id: "mainnet-bnb-gmt", + projectId: TokenProjectIdV1.Gmt, + nativeDetails: { + address: "0x3019bf2a2ef8040c242c9a4c5c4bd4c81678b2a1", + decimals: 8, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "7dzFD8xQ3FDmVLxwn75UA9WhVnBsUdRAexASVvpXX3Bo", + decimals: 8, + }, + ], + ]), + }, + ], + pools: [], +}; + +const testnet: EvmChainConfigV1 = { + name: "BNB Chain Testnet", + chainId: bnbChainId[Env.Testnet], + wormhole: { + bridge: "0x68605AD7b15c732a30b1BbC62BE8F2A509D74b4D", + portal: "0x9dcF9D205C9De35334D646BeE44b2D2859712A09", + }, + publicRpcUrls: ["https://data-seed-prebsc-2-s2.binance.org:8545/"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "0x4C15919A4354b4416e7aFcB9A27a118bc45818C0", // TODO: Update if necessary + decimals: 6, + }, + routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary + tokens: [ + { + id: "testnet-bnb-busd", + projectId: TokenProjectIdV1.Busd, + nativeDetails: { + address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", + decimals: 18, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "6KTvgrkLoPJdB3Grv4ZBUGt6JiLdVnKzJNo4HvLEgm6d", + decimals: 8, + }, + ], + ]), + }, + { + id: "testnet-bnb-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x98529E942FD121d9C470c3d4431A008257E0E714", + decimals: 18, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "4dr6ogcLsaFf2RDF4LJU1CvNtNKxonVqQvM6vuGdVR1e", + decimals: 8, + }, + ], + ]), + }, + { + id: "testnet-bnb-gst", + projectId: TokenProjectIdV1.Gst, + nativeDetails: { + address: "0x73160078948280B8680e5F1eB2964698928E8cd7", + decimals: 8, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "6oAiihJq1urtb6P8ARjwA6TFoduSoVGxaMb8gEMm5cR6", + decimals: 8, + }, + ], + ]), + }, + { + id: "testnet-bnb-gmt", + projectId: TokenProjectIdV1.Gmt, + nativeDetails: { + address: "0x1F65D61D01E3f10b34B855287b32D7bfbEA088D0", + decimals: 8, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "GE2tiQBCoPjCABkoTXa9jTSV8zCVZo8shyiBh8v52hDz", + decimals: 8, + }, + ], + ]), + }, + { + id: "testnet-bnb-lp-busd-usdt", + projectId: TokenProjectIdV2.SwimLpBnbBusdUsdt, + nativeDetails: { + address: "0x57FCF9B276d3E7D698112D9b87e6f410B1B5d78d", // TODO: Update + decimals: 6, + }, + }, + ], + pools: [], +}; + +const localnet: EvmChainConfigV1 = { + name: "BNB Chain Localnet", + chainId: bnbChainId[Env.Local], + wormhole: { + bridge: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550", + portal: "0x0290FB167208Af455bB137780163b7B7a9a10C16", + }, + publicRpcUrls: ["http://localhost:8546"], + swimUsdDetails: { + address: "0x7231BBdaB2F3814664f6E1f072A5ae0525709431", // TODO: Update when deployed + decimals: 8, // TODO: Confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "local-bnb-busd", + projectId: TokenProjectIdV1.Busd, + nativeDetails: { + address: "0xCeeFD27e0542aFA926B87d23936c79c276A48277", + decimals: 18, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "4X3Fu7ZcRSf7dvKEwwQ8b5xb2jQg2NPNkWs1gDGf1WMg", + decimals: 8, + }, + ], + ]), + }, + { + id: "local-bnb-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x988B6CFBf3332FF98FFBdED665b1F53a61f92612", + decimals: 18, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "9idXDPGb5jfwaf5fxjiMacgUcwpy3ZHfdgqSjAV5XLDr", + decimals: 8, + }, + ], + ]), + }, + ], + pools: [], +}; + +const gasToken: GasToken = { + name: "Binance Coin", + symbol: "BNB", + decimals: 18, +}; + +export const bnb = assertType>()({ + id: EvmEcosystemId.Bnb, + protocol: EVM_PROTOCOL, + wormholeChainId: 4, + displayName: "BNB Chain", + gasToken, + chains: { + [Env.Mainnet]: mainnet, + [Env.Testnet]: testnet, + [Env.Local]: localnet, + }, +} as const); diff --git a/apps/ui/src/config/ecosystems/ethereum.ts b/apps/ui/src/config/ecosystems/ethereum.ts new file mode 100644 index 000000000..e0c9f687f --- /dev/null +++ b/apps/ui/src/config/ecosystems/ethereum.ts @@ -0,0 +1,195 @@ +import type { GasToken } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { EVM_PROTOCOL, EvmEcosystemId, ethereumChainId } from "@swim-io/evm"; +import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; +import { assertType } from "@swim-io/utils"; + +import { TokenProjectIdV1 } from "../tokenProjects"; + +import type { EvmChainConfigV1, EvmEcosystemConfigV1 } from "./types"; + +const mainnet: EvmChainConfigV1 = { + name: "Ethereum Mainnet", + chainId: ethereumChainId[Env.Mainnet], + wormhole: { + bridge: "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B", + portal: "0x3ee18B2214AFF97000D974cf647E7C347E8fa585", + }, + publicRpcUrls: ["https://main-light.eth.linkpool.io/"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "0x01F369bF2d5a62CE60B0a2E92143CD623BeCb0fB", // TODO: Update when deployed + decimals: 8, // TODO: Confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "mainnet-ethereum-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM", + decimals: 6, + }, + ], + ]), + }, + { + id: "mainnet-ethereum-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0xdac17f958d2ee523a2206206994597c13d831ec7", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1", + decimals: 6, + }, + ], + ]), + }, + ], + pools: [], +}; + +const testnet: EvmChainConfigV1 = { + name: "Ethereum Görli Testnet", + chainId: ethereumChainId[Env.Testnet], + wormhole: { + bridge: "0x706abc4E45D419950511e474C7B9Ed348A4a716c", + portal: "0xF890982f9310df57d00f659cf4fd87e65adEd8d7", + }, + publicRpcUrls: ["https://goerli.prylabs.net/"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "0x4873edbb0B4b5b48A6FBe50CacB85e58D0b62ab5", // TODO: Update if necessary + decimals: 6, + }, + routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary + tokens: [ + { + id: "testnet-ethereum-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0x45B167CF5b14007Ca0490dCfB7C4B870Ec0C0Aa6", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "7Lf95y8NuCU5RRC95oUtbBtckPAtbr9ubTgrCiyZ1kEf", + decimals: 6, + }, + ], + ]), + }, + { + id: "testnet-ethereum-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x996f42BdB0CB71F831C2eFB05Ac6d0d226979e5B", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "8Cfyi1mYXqKATUkMPvb9BMXikdbppJst6E7eQJkKjAtf", + decimals: 6, + }, + ], + ]), + }, + { + id: "testnet-ethereum-lp-usdc-usdt", + projectId: TokenProjectIdV2.SwimLpEthereumUsdcUsdt, + nativeDetails: { + address: "0xf3eb1180A64827A602A7e02883b7299191527073", // TODO: Update + decimals: 6, + }, + }, + ], + pools: [], +}; + +const localnet: EvmChainConfigV1 = { + name: "Ethereum Localnet", + chainId: ethereumChainId[Env.Local], + wormhole: { + bridge: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550", + portal: "0x0290FB167208Af455bB137780163b7B7a9a10C16", + }, + publicRpcUrls: ["http://localhost:8545"], + swimUsdDetails: { + address: "0x56cd8686e818c0C29983eA32fa6938618b35923f", // TODO: Update when deployed + decimals: 8, // TODO: Confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "local-ethereum-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0xFcCeD5E997E7fb1D0594518D3eD57245bB8ed17E", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "Ep9cMbgyG46b6PVvJNypopc6i8TFzvUVmGiT4MA1PhSb", + decimals: 6, + }, + ], + ]), + }, + { + id: "local-ethereum-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0xdAA71FBBA28C946258DD3d5FcC9001401f72270F", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "9AGDY4Xa9wDfRZc2LHeSS9iAdH6Bhw6VnMd2t7tkJhYv", + decimals: 6, + }, + ], + ]), + }, + ], + pools: [], +}; + +const gasToken: GasToken = { + name: "Ethereum", + symbol: "ETH", + decimals: 18, +}; + +export const ethereum = assertType< + EvmEcosystemConfigV1 +>()({ + id: EvmEcosystemId.Ethereum, + protocol: EVM_PROTOCOL, + wormholeChainId: 2, + displayName: "Ethereum", + gasToken, + chains: { + [Env.Mainnet]: mainnet, + [Env.Testnet]: testnet, + [Env.Local]: localnet, + }, +} as const); diff --git a/apps/ui/src/config/ecosystems/fantom.ts b/apps/ui/src/config/ecosystems/fantom.ts new file mode 100644 index 000000000..e40a1c9e7 --- /dev/null +++ b/apps/ui/src/config/ecosystems/fantom.ts @@ -0,0 +1,108 @@ +import type { GasToken } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { EVM_PROTOCOL, EvmEcosystemId, fantomChainId } from "@swim-io/evm"; +import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; +import { assertType } from "@swim-io/utils"; + +import { TokenProjectIdV1 } from "../tokenProjects"; + +import type { EvmChainConfigV1, EvmEcosystemConfigV1 } from "./types"; + +const mainnet: EvmChainConfigV1 = { + name: "Fantom Mainnet", + chainId: fantomChainId[Env.Mainnet], + wormhole: { + bridge: "0x126783A6Cb203a3E35344528B26ca3a0489a1485", + portal: "0x7C9Fc5741288cDFdD83CeB07f3ea7e22618D79D2", + }, + publicRpcUrls: ["https://rpc.ftm.tools/"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "", // TODO: add when deployed + decimals: 8, // TODO: confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "mainnet-fantom-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "Dnr8fDaswHtYMSKbtR9e8D5EadyxqyJwE98xp17ZxE2E", + decimals: 6, + }, + ], + ]), + }, + ], + pools: [], +}; + +const testnet: EvmChainConfigV1 = { + name: "Fantom Testnet", + chainId: fantomChainId[Env.Testnet], + wormhole: { + bridge: "0x1BB3B4119b7BA9dfad76B0545fb3F531383c3bB7", + portal: "0x599CEa2204B4FaECd584Ab1F2b6aCA137a0afbE8", + }, + publicRpcUrls: ["https://rpc.testnet.fantom.network/"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "0x3733E12163A14b7Cbb4E0b5Bf88788975D1DaE9f", // TODO: Update if necessary + decimals: 6, + }, + routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary + tokens: [ + { + id: "testnet-fantom-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "9uJH6SjzmoqdiZXjcwYKuRevbYh5tR449FU5pg4rpden", + decimals: 6, + }, + ], + ]), + }, + { + id: "testnet-fantom-lp-usdc", + projectId: TokenProjectIdV2.SwimLpFantomUsdc, + nativeDetails: { + address: "0x1111111111111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + }, + ], + pools: [], +}; + +const gasToken: GasToken = { + name: "FTM", + symbol: "FTM", + decimals: 18, +}; + +export const fantom = assertType>()( + { + id: EvmEcosystemId.Fantom, + protocol: EVM_PROTOCOL, + wormholeChainId: 10, + displayName: "Fantom", + gasToken, + chains: { + [Env.Mainnet]: mainnet, + [Env.Testnet]: testnet, + }, + } as const, +); diff --git a/apps/ui/src/config/ecosystems/karura.ts b/apps/ui/src/config/ecosystems/karura.ts new file mode 100644 index 000000000..38080c407 --- /dev/null +++ b/apps/ui/src/config/ecosystems/karura.ts @@ -0,0 +1,150 @@ +import type { GasToken } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { EVM_PROTOCOL, EvmEcosystemId, karuraChainId } from "@swim-io/evm"; +import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; +import { assertType } from "@swim-io/utils"; + +import { TokenProjectIdV1 } from "../tokenProjects"; + +import type { EvmChainConfigV1, EvmEcosystemConfigV1 } from "./types"; + +const mainnet: EvmChainConfigV1 = { + name: "Karura Mainnet", + chainId: karuraChainId[Env.Mainnet], + wormhole: { + bridge: "0xa321448d90d4e5b0A732867c18eA198e75CAC48E", + portal: "0xae9d7fe007b3327AA64A32824Aaac52C42a6E624", + }, + publicRpcUrls: ["https://karura.api.onfinality.io/public-rpc"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "", // TODO: add when deployed + decimals: 8, // TODO: confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "mainnet-karura-ausd", + projectId: TokenProjectIdV1.Ausd, + nativeDetails: { + address: "0x0000000000000000000100000000000000000081", + decimals: 12, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "3sEvyXzC2vAPqF7uprB2vRaL1X1FbqQqmPxhwVi53GYF", + decimals: 8, + }, + ], + ]), + }, + { + id: "mainnet-karura-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x0000000000000000000500000000000000000007", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "E942z7FnS7GpswTvF5Vggvo7cMTbvZojjLbFgsrDVff1", + decimals: 6, + }, + ], + ]), + }, + ], + pools: [], +}; + +const testnet: EvmChainConfigV1 = { + name: "Karura Testnet", + chainId: karuraChainId[Env.Testnet], + wormhole: { + bridge: "0xE4eacc10990ba3308DdCC72d985f2a27D20c7d03", + portal: "0xd11De1f930eA1F7Dd0290Fe3a2e35b9C91AEFb37", + }, + publicRpcUrls: ["https://karura-dev.aca-dev.network/eth/http"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "", // TODO: add when deployed + decimals: 8, // TODO: confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "testnet-karura-ausd", + projectId: TokenProjectIdV1.Ausd, + nativeDetails: { + address: "0x074370ca8Fea9e8f1C5eE23f34CBdcD3FB7a66aD", + decimals: 12, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "BRpsJtEUyCPQPRP4DAavXU5KmBqfgKQmX7fwnpVvUUMG", + decimals: 8, + }, + ], + ]), + }, + { + id: "testnet-karura-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x535d5e3b1ff7de526fe180e654a41350903c328d", + decimals: 18, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "AnYj8Rbkfd8FYmoiyv6iDS3Tje7PzhPWyE5VZVDh9pzD", + decimals: 8, + }, + ], + ]), + }, + { + id: "testnet-karura-lp-usdt", + projectId: TokenProjectIdV2.SwimLpKaruraUsdt, + nativeDetails: { + address: "0x1111111111111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + }, + { + id: "testnet-karura-lp-ausd", + projectId: TokenProjectIdV2.SwimLpKaruraAusd, + nativeDetails: { + address: "0x1111111111111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + }, + ], + pools: [], +}; + +const gasToken: GasToken = { + name: "Karura", + symbol: "KAR", + decimals: 18, +}; + +export const karura = assertType>()( + { + id: EvmEcosystemId.Karura, + protocol: EVM_PROTOCOL, + wormholeChainId: 11, + displayName: "Karura", + gasToken, + chains: { + [Env.Mainnet]: mainnet, + [Env.Testnet]: testnet, + }, + } as const, +); diff --git a/apps/ui/src/config/ecosystems/polygon.ts b/apps/ui/src/config/ecosystems/polygon.ts new file mode 100644 index 000000000..9cb383456 --- /dev/null +++ b/apps/ui/src/config/ecosystems/polygon.ts @@ -0,0 +1,142 @@ +import type { GasToken } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { EVM_PROTOCOL, EvmEcosystemId, polygonChainId } from "@swim-io/evm"; +import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; +import { assertType } from "@swim-io/utils"; + +import { TokenProjectIdV1 } from "../tokenProjects"; + +import type { EvmChainConfigV1, EvmEcosystemConfigV1 } from "./types"; + +const mainnet: EvmChainConfigV1 = { + name: "Polygon Mainnet", + chainId: polygonChainId[Env.Mainnet], + wormhole: { + bridge: "0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7", + portal: "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE", + }, + publicRpcUrls: ["https://polygon-rpc.com/"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "", // TODO: add when deployed + decimals: 8, // TODO: confirm when deployed + }, + routingContractAddress: "", // TODO: add when deployed + tokens: [ + { + id: "mainnet-polygon-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "E2VmbootbVCBkMNNxKQgCLMS1X3NoGMaYAsufaAsf7M", + decimals: 6, + }, + ], + ]), + }, + { + id: "mainnet-polygon-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "5goWRao6a3yNC4d6UjMdQxonkCMvKBwdpubU3qhfcdf1", + decimals: 6, + }, + ], + ]), + }, + ], + pools: [], +}; + +const testnet: EvmChainConfigV1 = { + name: "Polygon Testnet", + chainId: polygonChainId[Env.Testnet], + wormhole: { + bridge: "0x0CBE91CF822c73C2315FB05100C2F714765d5c20", + portal: "0x377D55a7928c046E18eEbb61977e714d2a76472a", + }, + publicRpcUrls: ["https://rpc-mumbai.maticvigil.com"], // TODO: Think about what is best to recommend to MetaMask + swimUsdDetails: { + address: "0x5558dA18eCFEE96cCC1B0451eEC4e55b5a002cE0", // TODO: Update if necessary + decimals: 6, + }, + routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary + tokens: [ + { + id: "testnet-polygon-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "0x0a0d7cEA57faCBf5DBD0D3b5169Ab00AC8Cf7dd1", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "D5YvMW5U3HUpD1EstYbKmmZsLdmCPgUj44JqBmNY7fUM", + decimals: 6, + }, + ], + ]), + }, + { + id: "testnet-polygon-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "0x2Ac9183EC64F71AfB73909c7C028Db14d35FAD2F", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + SOLANA_ECOSYSTEM_ID, + { + address: "2otzQWyoydNp4Ws1kV8J8WVYiun6wmuFMMbicgdoEULn", + decimals: 6, + }, + ], + ]), + }, + { + id: "testnet-polygon-lp-usdc-usdt", + projectId: TokenProjectIdV2.SwimLpPolygonUsdcUsdt, + nativeDetails: { + address: "0x1111111111111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + }, + ], + pools: [], +}; + +const gasToken: GasToken = { + name: "Matic", + symbol: "MATIC", + decimals: 18, +}; + +export const polygon = assertType< + EvmEcosystemConfigV1 +>()({ + id: EvmEcosystemId.Polygon, + protocol: EVM_PROTOCOL, + wormholeChainId: 5, + displayName: "Polygon", + gasToken, + chains: { + [Env.Mainnet]: mainnet, + [Env.Testnet]: testnet, + }, +} as const); diff --git a/apps/ui/src/config/ecosystems/solana.ts b/apps/ui/src/config/ecosystems/solana.ts new file mode 100644 index 000000000..d705e3318 --- /dev/null +++ b/apps/ui/src/config/ecosystems/solana.ts @@ -0,0 +1,626 @@ +import type { GasToken, TokenDetails } from "@swim-io/core"; +import { Env } from "@swim-io/core"; +import { + SOLANA_ECOSYSTEM_ID, + SOLANA_PROTOCOL, + SolanaChainId, +} from "@swim-io/solana"; +import { assertType } from "@swim-io/utils"; + +import type { EcosystemId } from "../ecosystem"; +import { TokenProjectIdV1 } from "../tokenProjects"; + +import { bnb } from "./bnb"; +import { ethereum } from "./ethereum"; +import type { SolanaChainConfigV1, SolanaEcosystemConfigV1 } from "./types"; + +const EMPTY_MAP: ReadonlyMap = new Map(); +const BNB_ECOSYSTEM_ID = bnb.id; +const ETHEREUM_ECOSYSTEM_ID = ethereum.id; + +const mainnet: SolanaChainConfigV1 = { + name: "Solana Mainnet Beta", + chainId: SolanaChainId.MainnetBeta, + wormhole: { + bridge: "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth", + portal: "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb", + }, + publicRpcUrls: ["https://solana-api.projectserum.com"], + swimUsdDetails: { + address: "BJUH9GJLaMSLV1E7B3SQLCy9eCfyr6zsrwGcpS2MkqR1", + decimals: 8, + }, + routingContractAddress: "", // TODO: Add when deployed + routingContractStateAddress: "", // TODO: Add when deployed + twoPoolContractAddress: "", // TODO: Add when deployed + tokens: [ + { + id: "mainnet-solana-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + ETHEREUM_ECOSYSTEM_ID, + { + address: "0x41f7B8b9b897276b7AAE926a9016935280b44E97", + decimals: 6, + }, + ], + [ + BNB_ECOSYSTEM_ID, + { + address: "0x91Ca579B0D47E5cfD5D0862c21D5659d39C8eCf0", + decimals: 6, + }, + ], + ]), + }, + { + id: "mainnet-solana-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + ETHEREUM_ECOSYSTEM_ID, + { + address: "0x1CDD2EaB61112697626F7b4bB0e23Da4FeBF7B7C", + decimals: 6, + }, + ], + [ + BNB_ECOSYSTEM_ID, + { + address: "0x49d5cC521F75e13fa8eb4E89E9D381352C897c96", + decimals: 6, + }, + ], + ]), + }, + { + id: "mainnet-solana-gst", + projectId: TokenProjectIdV1.Gst, + nativeDetails: { + address: "AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB", + decimals: 9, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-gmt", + projectId: TokenProjectIdV1.Gmt, + nativeDetails: { + address: "7i5KKsX2weiTkry7jA4ZwSuXGhs5eJBEjY8vVxR4pfRx", + decimals: 9, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-hexapool", + projectId: TokenProjectIdV1.SwimUsdV1, + nativeDetails: { + address: "BJUH9GJLaMSLV1E7B3SQLCy9eCfyr6zsrwGcpS2MkqR1", + decimals: 8, + }, + wrappedDetails: new Map([ + [ + ETHEREUM_ECOSYSTEM_ID, + { + address: "0x01F369bF2d5a62CE60B0a2E92143CD623BeCb0fB", + decimals: 8, + }, + ], + [ + BNB_ECOSYSTEM_ID, + { + address: "0xF78479d516A12b9cFb000951D19f67B4fE0B065d", + decimals: 8, + }, + ], + ]), + }, + { + id: "mainnet-solana-lp-meta-avalanche-usdc", + projectId: TokenProjectIdV1.SwimAvalancheUsdcLp, + nativeDetails: { + address: "DKwsWeqHrB8R1u2DFMHKtq4iqaQNgPgUbHTJyXPqkTzK", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-avalanche-usdt", + projectId: TokenProjectIdV1.SwimAvalancheUsdtLp, + nativeDetails: { + address: "5rwvDmUbcnZTwZ4Zywev2wnDbyDDD2vcsGU2Xmy7aRNS", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-polygon-usdc", + projectId: TokenProjectIdV1.SwimPolygonUsdcLp, + nativeDetails: { + address: "ANFojEXhiEQQoovhBs77XmBQuqbe59UBygRWViyf4945", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-polygon-usdt", + projectId: TokenProjectIdV1.SwimPolygonUsdtLp, + nativeDetails: { + address: "2Nx6L79dHHgHcJtNfZWukQkWZvf5h4bps34zuh1gjtdP", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-gst", + projectId: TokenProjectIdV1.SwimSolanaGstBinanceGstLp, + nativeDetails: { + address: "8YYBkTNhpY9mFdCdZWM6mHNf8J6A9hGfimb33LEiiZ3x", + decimals: 9, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-gmt", + projectId: TokenProjectIdV1.SwimSolanaGmtBinanceGmtLp, + nativeDetails: { + address: "2x7MjgopLXd3qETGLpY19cyZjHvVnGkrwVjTkJnBza4A", + decimals: 9, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-aurora-usdc", + projectId: TokenProjectIdV1.SwimAuroraUsdcLp, + nativeDetails: { + address: "9qRe2nBrR2rTXxRaV1PZN9hZnqq3UXgoFWTbP6NE3MEu", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-aurora-usdt", + projectId: TokenProjectIdV1.SwimAuroraUsdtLp, + nativeDetails: { + address: "4XPDxtGbcM7bAPKZxALd2s862n3WoG4xPPvyCPVULKAb", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-aurora-usn", + projectId: TokenProjectIdV1.SwimAuroraUsnLp, + nativeDetails: { + address: "3eXCU7YoiCq3rZ6787pPFJE7TXBsKuTZ49wH2kFnuTeF", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-fantom-usdc", + projectId: TokenProjectIdV1.SwimFantomUsdcLp, + nativeDetails: { + address: "J5ifGexAQTg76TresJhJSqTPJLT6BNxrV5rwNJTTz4Cx", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-karura-ausd", + projectId: TokenProjectIdV1.SwimKaruraAusdLp, + nativeDetails: { + address: "8vzXSNVAX4fymEFahJFh1ypzDBFv3QMVaZ4GtJWHrRjU", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-karura-usdt", + projectId: TokenProjectIdV1.SwimKaruraUsdtLp, + nativeDetails: { + address: "2sXvitirRSjgTTNzGNWAFZWSqEx87kDoTJvqG9JSyivh", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-meta-acala-ausd", + projectId: TokenProjectIdV1.SwimAcalaAusdLp, + nativeDetails: { + address: "11111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-swim", + projectId: TokenProjectIdV1.Swim, + nativeDetails: { + address: "swimnKEr963p7EbCjsSnBCoYwytuZHPm3zbq6fKLHXb", + decimals: 6, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "mainnet-solana-lp-swimlake", + projectId: TokenProjectIdV1.XSwim, + nativeDetails: { + address: "SwiMNJ49SxkqMaVWLGGVRH25kE5dBnD2RQoiQUnKtMC", + decimals: 6, + }, + wrappedDetails: EMPTY_MAP, + }, + ], + pools: [], +}; + +const testnet: SolanaChainConfigV1 = { + name: "Solana Devnet", + chainId: SolanaChainId.Devnet, + wormhole: { + bridge: "3u8hJUVTA4jH1wYAyUur7FFZVQ8H635K3tSHHF4ssjQ5", + portal: "DZnkkTmCiFWfYTfT41X3Rd1kDgozqzxWaHqsw6W4x2oe", + }, + publicRpcUrls: ["https://api.devnet.solana.com"], + swimUsdDetails: { + address: "3ngTtoyP9GFybFifX1dr7gCFXFiM2Wr6NfXn6EuU7k6C", + decimals: 6, + }, + routingContractAddress: "9z6G41AyXk73r1E4nTv81drQPtEqupCSAnsLdGV5WGfK", // TODO: Update if necessary + routingContractStateAddress: "Dzx6CofYZQwJrvLctW9vbnNJX4ViqFoTV7bjcrWxUbwY", // TODO: Update if necessary + twoPoolContractAddress: "8VNVtWUae4qMe535i4yL1gD3VTo8JhcfFEygaozBq8aM", + tokens: [ + { + id: "testnet-solana-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "6iSRgpK4oiqJZuhpLsTecW3n9xBKUq9N3VPQN7RinYwq", + decimals: 6, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "8VbikoRxEoyYzTDzDcPTSsGk2E5mM7fK1WrVpKrVd75M", + decimals: 6, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-gst", + projectId: TokenProjectIdV1.Gst, + nativeDetails: { + address: "FYxTtPiGxNSDouZQftVRHFqraFJyLvNbTXzZj8X2gKQP", + decimals: 9, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-gmt", + projectId: TokenProjectIdV1.Gmt, + nativeDetails: { + address: "3xsNPBpf7UAKpJsLTqiPqHT3ZBKPDndj1rJFM7xaSJcV", + decimals: 9, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-hexapool", + projectId: TokenProjectIdV1.SwimUsdV1, + nativeDetails: { + address: "5ctnNpb7h1SyPqZ8t8m2kCykrtDGVZBtZgYWv6UAeDhr", + decimals: 8, + }, + wrappedDetails: new Map([ + [ + ETHEREUM_ECOSYSTEM_ID, + { + address: "0x4DF39C514Eb1747bb4D89cA9Ee35718611590935", + decimals: 8, + }, + ], + [ + BNB_ECOSYSTEM_ID, + { + address: "0x84252522366DB2eA1dAaDe5E2C55CD90a50aC46e", + decimals: 8, + }, + ], + ]), + }, + { + id: "testnet-solana-swim", + projectId: TokenProjectIdV1.Swim, + nativeDetails: { + address: "swimnKEr963p7EbCjsSnBCoYwytuZHPm3zbq6fKLHXb", + decimals: 6, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-swimlake", + projectId: TokenProjectIdV1.XSwim, + nativeDetails: { + address: "A8UVBwvj1XcdP5okoMqkjhCQGLaqQ8iJDYnNxAMbsNNF", + decimals: 6, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-avalanche-usdc", + projectId: TokenProjectIdV1.SwimAvalancheUsdcLp, + nativeDetails: { + address: "DU15RXzuPWTLC4tbAcQvtXbDkHFrY8u6CxgTdhz2Mt8c", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-avalanche-usdt", + projectId: TokenProjectIdV1.SwimAvalancheUsdtLp, + nativeDetails: { + address: "D6PuZckpEcBhVcpfgjgbWnARhFD3ApHhvnxBGWR6MW5Z", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-polygon-usdc", + projectId: TokenProjectIdV1.SwimPolygonUsdcLp, + nativeDetails: { + address: "6WBFbyA3XJ3T2BeqA9JbyZFfj3KTCRtnC8MJANBsVNrz", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-polygon-usdt", + projectId: TokenProjectIdV1.SwimPolygonUsdtLp, + nativeDetails: { + address: "HH3RwS94BWhR4bKeNYGvr2CfSLRQ2Kq6EYSDTKgGLgET", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-gst", + projectId: TokenProjectIdV1.SwimSolanaGstBinanceGstLp, + nativeDetails: { + address: "BM3sXSfRg1yKzf2AbTA5QV76MdnKHi9M8D7VCGzDEYM1", + decimals: 9, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-gmt", + projectId: TokenProjectIdV1.SwimSolanaGmtBinanceGmtLp, + nativeDetails: { + address: "5VUZL2JcvbmjuT1DzDyWJ4mwtEH8unKyuQj3k38j8Ngs", + decimals: 9, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-aurora-usdc", + projectId: TokenProjectIdV1.SwimAuroraUsdcLp, + nativeDetails: { + address: "AQiHPuuBPsq4MLLjLv2WHRFbrNB1JHZeR4mQGVJTwVHn", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-aurora-usdt", + projectId: TokenProjectIdV1.SwimAuroraUsdtLp, + nativeDetails: { + address: "utXdXdUMaS5qrBDDUg5btQMGL2CedouzmMPbYMJPEZD", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-aurora-usn", + projectId: TokenProjectIdV1.SwimAuroraUsnLp, + nativeDetails: { + address: "11111111111111111111111111111111", // TODO: Update + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-fantom-usdc", + projectId: TokenProjectIdV1.SwimFantomUsdcLp, + nativeDetails: { + address: "4hmRgsk3hSdK1gXV7rg1pStwYtntKmbcFQyKqsZ4USis", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-karura-ausd", + projectId: TokenProjectIdV1.SwimKaruraAusdLp, + nativeDetails: { + address: "4idDPnTYR4J9YhXmayKZYW8QBrASuuiTAxfkWUeaL3ap", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-karura-usdt", + projectId: TokenProjectIdV1.SwimKaruraUsdtLp, + nativeDetails: { + address: "882uzB9euTbBQJ6MrGrvxjXSTQi23VBQZcLcTH4E5Xow", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "testnet-solana-lp-meta-acala-ausd", + projectId: TokenProjectIdV1.SwimAcalaAusdLp, + nativeDetails: { + address: "BTbHtbUtDX5WAUSxPgELzy9VsbMbKAVFQ2hykNrD3X7L", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + ], + pools: [ + { + id: "two-pool", + displayName: "Two Pool", + ecosystemId: SOLANA_ECOSYSTEM_ID, + address: "EGm6UfAJ6LFy8WRxE2YjjJzwUbZ1ZFiuG2rP6YudKKBB", + contract: "8VNVtWUae4qMe535i4yL1gD3VTo8JhcfFEygaozBq8aM", + governanceFeeAccount: "FN9strke8tiDYmRNH3LFtg9zjJpTsxgTPHUegsQsUiai", + lpTokenId: "swimUSD", + tokenIds: ["testnet-solana-usdc", "testnet-solana-usdt"], + tokenAccounts: new Map([ + ["testnet-solana-usdc", "49fm8MaATyD4BwaqxXmjASGuR3WLg8PL1SvMiYpyTdrx"], + ["testnet-solana-usdt", "849M4dvrdoUqsn7t6eVWWNos8Q8RfLJxRTzQC46KGoYE"], + ]), + feeDecimals: 6, + isStableSwap: true, + isStakingPool: false, + }, + ], +}; + +const localnet: SolanaChainConfigV1 = { + name: "Solana Localnet", + chainId: SolanaChainId.Localnet, + wormhole: { + bridge: "Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o", + portal: "B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE", + }, + publicRpcUrls: ["http://127.0.0.1:8899"], + swimUsdDetails: { + address: "LPTufpWWSucDqq1hib8vxj1uJxTh2bkE7ZTo65LH4J2", + decimals: 8, + }, + routingContractAddress: "", // TODO: Add when deployed + routingContractStateAddress: "", // TODO: Add when deployed + twoPoolContractAddress: "", // TODO: Add when deployed + tokens: [ + { + id: "local-solana-usdc", + projectId: TokenProjectIdV1.Usdc, + nativeDetails: { + address: "USCAD1T3pV246XwC5kBFXpEjuudS1zT1tTNYhxby9vy", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + ETHEREUM_ECOSYSTEM_ID, + { + address: "0x81681EC304dcfe2Ddad462E7e968C49A848410c3", + decimals: 6, + }, + ], + [ + BNB_ECOSYSTEM_ID, + { + address: "0x04C5Bf0f72FC1a9F50Ff3228C6285491ad00e13E", + decimals: 6, + }, + ], + ]), + }, + { + id: "local-solana-usdt", + projectId: TokenProjectIdV1.Usdt, + nativeDetails: { + address: "USTPJc7bSkXxRPP1ZdxihfxtfgWNrcRPrE4KEC6EK23", + decimals: 6, + }, + wrappedDetails: new Map([ + [ + ETHEREUM_ECOSYSTEM_ID, + { + address: "0xa22915e82eb27fb64988Efa3d2749838174ccCBE", + decimals: 6, + }, + ], + [ + BNB_ECOSYSTEM_ID, + { + address: "0x23F55d75CFBe4334031dc7a19bf030613E966b2B", + decimals: 6, + }, + ], + ]), + }, + { + id: "local-solana-lp-hexapool", + projectId: TokenProjectIdV1.SwimUsdV1, + nativeDetails: { + address: "LPTufpWWSucDqq1hib8vxj1uJxTh2bkE7ZTo65LH4J2", + decimals: 8, + }, + wrappedDetails: new Map([ + [ + ETHEREUM_ECOSYSTEM_ID, + { + address: "0x56cd8686e818c0C29983eA32fa6938618b35923f", + decimals: 8, + }, + ], + [ + BNB_ECOSYSTEM_ID, + { + address: "0x7231BBdaB2F3814664f6E1f072A5ae0525709431", + decimals: 8, + }, + ], + ]), + }, + { + id: "local-solana-swim", + projectId: TokenProjectIdV1.Swim, + nativeDetails: { + address: "SWMPqjB9AAtpCbatAEEGK67wNBCN1HDW6VypX7E5r9g", + decimals: 6, + }, + wrappedDetails: EMPTY_MAP, + }, + { + id: "local-solana-lp-swimlake", + projectId: TokenProjectIdV1.XSwim, + nativeDetails: { + address: "xSwy12tTsuYwM2Hd7ceNmvDftgxJ2ZSTycjzAfrNwPW", + decimals: 8, + }, + wrappedDetails: EMPTY_MAP, + }, + ], + pools: [], +}; + +const gasToken: GasToken = { + name: "sol", + symbol: "SOL", + decimals: 9, +}; + +export const solana = assertType()({ + id: SOLANA_ECOSYSTEM_ID, + protocol: SOLANA_PROTOCOL, + wormholeChainId: 1, + displayName: "Solana", + gasToken, + chains: { + [Env.Mainnet]: mainnet, + [Env.Testnet]: testnet, + [Env.Local]: localnet, + }, +} as const); diff --git a/apps/ui/src/config/ecosystems/types.ts b/apps/ui/src/config/ecosystems/types.ts new file mode 100644 index 000000000..82219cf69 --- /dev/null +++ b/apps/ui/src/config/ecosystems/types.ts @@ -0,0 +1,42 @@ +import type { AptosChainConfig, AptosEcosystemConfig } from "@swim-io/aptos"; +import type { Env, TokenDetails } from "@swim-io/core"; +import type { + EvmChainConfig, + EvmEcosystemConfig, + EvmEcosystemId, +} from "@swim-io/evm"; +import type { SolanaChainConfig, SolanaEcosystemConfig } from "@swim-io/solana"; +import type { ReadonlyRecord } from "@swim-io/utils"; + +import type { TokenConfig } from "../tokens"; + +export type AptosChainConfigV1 = Omit & { + readonly swimUsdDetails: TokenDetails; + readonly tokens: readonly Omit[]; +}; + +export type AptosEcosystemConfigV1 = Omit & { + readonly chains: Partial>; +}; + +export type EvmChainConfigV1 = Omit< + EvmChainConfig, + "tokens" +> & { + readonly swimUsdDetails: TokenDetails; + readonly tokens: readonly Omit[]; +}; + +export type EvmEcosystemConfigV1 = + Omit, "chains"> & { + readonly chains: Partial>>; + }; + +export type SolanaChainConfigV1 = Omit & { + readonly swimUsdDetails: TokenDetails; + readonly tokens: readonly Omit[]; +}; + +export type SolanaEcosystemConfigV1 = Omit & { + readonly chains: Partial>; +}; diff --git a/apps/ui/src/config/index.ts b/apps/ui/src/config/index.ts index 14ddfff90..b528cf031 100644 --- a/apps/ui/src/config/index.ts +++ b/apps/ui/src/config/index.ts @@ -15,6 +15,7 @@ export * from "./chains"; export * from "./ecosystem"; export * from "./i18n"; export * from "./pools"; +export * from "./tokenProjects"; export * from "./tokens"; export * from "./utils"; export * from "./wormhole"; diff --git a/apps/ui/src/config/tokenProjects.ts b/apps/ui/src/config/tokenProjects.ts new file mode 100644 index 000000000..67a573aa6 --- /dev/null +++ b/apps/ui/src/config/tokenProjects.ts @@ -0,0 +1,279 @@ +import type { + TokenProjectId as TokenProjectIdV2, + TokenProject as TokenProjectV2, +} from "@swim-io/token-projects"; +import { TOKEN_PROJECTS_BY_ID as TOKEN_PROJECTS_BY_ID_V2 } from "@swim-io/token-projects"; +import type { ReadonlyRecord } from "@swim-io/utils"; +import { assertType } from "@swim-io/utils"; + +import AUSD_SVG from "../images/tokens/ausd.svg"; +import BUSD_SVG from "../images/tokens/busd.svg"; +import GMT_SVG from "../images/tokens/gmt.svg"; +import GST_SVG from "../images/tokens/gst.svg"; +import LP_ACALA_AUSD_SVG from "../images/tokens/lp_acala_ausd.svg"; +import LP_AURORA_USDC_SVG from "../images/tokens/lp_aurora_usdc.svg"; +import LP_AURORA_USDT_SVG from "../images/tokens/lp_aurora_usdt.svg"; +import LP_AURORA_USN_SVG from "../images/tokens/lp_aurora_usn.svg"; +import LP_AVALANCHE_USDC_SVG from "../images/tokens/lp_avalanche_usdc.svg"; +import LP_AVALANCHE_USDT_SVG from "../images/tokens/lp_avalanche_usdt.svg"; +import LP_FANTOM_USDC_SVG from "../images/tokens/lp_fantom_usdc.svg"; +import LP_GMT_SVG from "../images/tokens/lp_gmt.svg"; +import LP_GST_SVG from "../images/tokens/lp_gst.svg"; +import LP_KARURA_AUSD_SVG from "../images/tokens/lp_karura_ausd.svg"; +import LP_KARURA_USDT_SVG from "../images/tokens/lp_karura_usdt.svg"; +import LP_POLYGON_USDC_SVG from "../images/tokens/lp_polygon_usdc.svg"; +import LP_POLYGON_USDT_SVG from "../images/tokens/lp_polygon_usdt.svg"; +import SWIM_TOKEN_SVG from "../images/tokens/swim.svg"; +import SWIM_USD_SVG from "../images/tokens/swim_usd.svg"; +import USDC_SVG from "../images/tokens/usdc.svg"; +import USDT_SVG from "../images/tokens/usdt.svg"; +import USN_SVG from "../images/tokens/usn.svg"; +import XSWIM_TOKEN_SVG from "../images/tokens/xswim.svg"; + +export enum TokenProjectIdV1 { + Ausd = "ausd-v1", + Busd = "busd-v1", + Gmt = "gmt-v1", + Gst = "gst-v1", + Swim = "swim-v1", + SwimAcalaAusdLp = "swim-acala-ausd-lp-v1", + SwimAuroraUsdcLp = "swim-aurora-usdc-lp-v1", + SwimAuroraUsdtLp = "swim-aurora-usdt-lp-v1", + SwimAuroraUsnLp = "swim-aurora-usn-lp-v1", + SwimAvalancheUsdcLp = "swim-avalanche-usdc-lp-v1", + SwimAvalancheUsdtLp = "swim-avalanche-usdt-lp-v1", + SwimFantomUsdcLp = "swim-fantom-usdc-lp-v1", + SwimKaruraAusdLp = "swim-karura-ausd-lp-v1", + SwimKaruraUsdtLp = "swim-karura-usdt-lp-v1", + SwimPolygonUsdcLp = "swim-polygon-usdc-lp-v1", + SwimPolygonUsdtLp = "swim-polygon-usdt-lp-v1", + SwimSolanaGmtBinanceGmtLp = "swim-solana-gmt-binance-gst-lp-v1", + SwimSolanaGstBinanceGstLp = "swim-solana-gst-binance-gst-lp-v1", + SwimUsdV1 = "swim-usd-v1", + Usdc = "usdc-v1", + Usdt = "usdt-v1", + Usn = "usn-v1", + XSwim = "xswim-v1", +} +// Make sure no name collision with v2 +assertType>()(TokenProjectIdV1); + +type Override = Omit & U; +export type TokenProjectV1 = Override< + TokenProjectV2, + { + readonly id: TokenProjectIdV1; + readonly tokenNumber?: never; + } +>; + +export const TOKEN_PROJECTS_BY_ID_V1: ReadonlyRecord< + TokenProjectIdV1, + TokenProjectV1 +> = { + [TokenProjectIdV1.Usdc]: { + id: TokenProjectIdV1.Usdc, + symbol: "USDC", + displayName: "USD Coin", + icon: USDC_SVG, + isStablecoin: true, + isLp: false, + }, + [TokenProjectIdV1.Usdt]: { + id: TokenProjectIdV1.Usdt, + symbol: "USDT", + displayName: "Tether USD", + icon: USDT_SVG, + isStablecoin: true, + isLp: false, + }, + [TokenProjectIdV1.Usn]: { + id: TokenProjectIdV1.Usn, + symbol: "USN", + displayName: "USN", + icon: USN_SVG, + isStablecoin: true, + isLp: false, + }, + [TokenProjectIdV1.Busd]: { + id: TokenProjectIdV1.Busd, + symbol: "BUSD", + displayName: "Binance USD", + icon: BUSD_SVG, + isStablecoin: true, + isLp: false, + }, + [TokenProjectIdV1.Ausd]: { + id: TokenProjectIdV1.Ausd, + symbol: "aUSD", + displayName: "Acala USD", + icon: AUSD_SVG, + isStablecoin: true, + isLp: false, + }, + [TokenProjectIdV1.Gst]: { + id: TokenProjectIdV1.Gst, + symbol: "GST", + displayName: "Green Satoshi Token", + icon: GST_SVG, + isStablecoin: false, + isLp: false, + }, + [TokenProjectIdV1.Gmt]: { + id: TokenProjectIdV1.Gmt, + symbol: "GMT", + displayName: "STEPN", + icon: GMT_SVG, + isStablecoin: false, + isLp: false, + }, + [TokenProjectIdV1.SwimUsdV1]: { + id: TokenProjectIdV1.SwimUsdV1, + symbol: "swimUSD", + displayName: "swimUSD (Swim Hexapool LP)", + icon: SWIM_USD_SVG, + isStablecoin: true, + isLp: true, + }, + [TokenProjectIdV1.Swim]: { + id: TokenProjectIdV1.Swim, + symbol: "SWIM", + displayName: "Swim Protocol Token", + icon: SWIM_TOKEN_SVG, + isStablecoin: false, + isLp: false, + }, + [TokenProjectIdV1.XSwim]: { + id: TokenProjectIdV1.XSwim, + symbol: "xSWIM", + displayName: "xSWIM (SwimLake LP)", + icon: XSWIM_TOKEN_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimAvalancheUsdcLp]: { + id: TokenProjectIdV1.SwimAvalancheUsdcLp, + symbol: "SWIM-AVALANCHE-USDC-LP", + displayName: "Avalanche USDC LP", + icon: LP_AVALANCHE_USDC_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimAvalancheUsdtLp]: { + id: TokenProjectIdV1.SwimAvalancheUsdtLp, + symbol: "SWIM-AVALANCHE-USDT-LP", + displayName: "Avalanche USDT LP", + icon: LP_AVALANCHE_USDT_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimPolygonUsdcLp]: { + id: TokenProjectIdV1.SwimPolygonUsdcLp, + symbol: "SWIM-POLYGON-USDC-LP", + displayName: "Polygon USDC LP", + icon: LP_POLYGON_USDC_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimPolygonUsdtLp]: { + id: TokenProjectIdV1.SwimPolygonUsdtLp, + symbol: "SWIM-POLYGON-USDT-LP", + displayName: "Polygon USDT LP", + icon: LP_POLYGON_USDT_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimSolanaGstBinanceGstLp]: { + id: TokenProjectIdV1.SwimSolanaGstBinanceGstLp, + symbol: "solaGST-binaGST", + displayName: "Swim Solana GST Binance GST LP", + icon: LP_GST_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimSolanaGmtBinanceGmtLp]: { + id: TokenProjectIdV1.SwimSolanaGmtBinanceGmtLp, + symbol: "solaGMT-binaGMT", + displayName: "Swim Solana GMT Binance GMT LP", + icon: LP_GMT_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimAuroraUsdcLp]: { + id: TokenProjectIdV1.SwimAuroraUsdcLp, + symbol: "SWIM-AURORA-USDC-LP", + displayName: "Aurora USDC LP", + icon: LP_AURORA_USDC_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimAuroraUsdtLp]: { + id: TokenProjectIdV1.SwimAuroraUsdtLp, + symbol: "SWIM-AURORA-USDT-LP", + displayName: "Aurora USDT LP", + icon: LP_AURORA_USDT_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimAuroraUsnLp]: { + id: TokenProjectIdV1.SwimAuroraUsnLp, + symbol: "SWIM-AURORA-USN-LP", + displayName: "Aurora USN LP", + icon: LP_AURORA_USN_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimFantomUsdcLp]: { + id: TokenProjectIdV1.SwimFantomUsdcLp, + symbol: "SWIM-FANTOM-USDC-LP", + displayName: "Fantom USDC LP", + icon: LP_FANTOM_USDC_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimKaruraAusdLp]: { + id: TokenProjectIdV1.SwimKaruraAusdLp, + symbol: "SWIM-KARURA-AUSD-LP", + displayName: "Karura AUSD LP", + icon: LP_KARURA_AUSD_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimKaruraUsdtLp]: { + id: TokenProjectIdV1.SwimKaruraUsdtLp, + symbol: "SWIM-KARURA-USDT-LP", + displayName: "Karura USDT LP", + icon: LP_KARURA_USDT_SVG, + isStablecoin: false, + isLp: true, + }, + [TokenProjectIdV1.SwimAcalaAusdLp]: { + id: TokenProjectIdV1.SwimAcalaAusdLp, + symbol: "SWIM-ACALA-AUSD-LP", + displayName: "Acala AUSD LP", + icon: LP_ACALA_AUSD_SVG, + isStablecoin: false, + isLp: true, + }, +}; + +export const TOKEN_PROJECTS_V1 = Object.values(TOKEN_PROJECTS_BY_ID_V1); + +export function getTokenProjectByProjectId( + projectId: TokenProjectIdV1, +): TokenProjectV1; +export function getTokenProjectByProjectId( + projectId: TokenProjectIdV2, +): TokenProjectV2; +export function getTokenProjectByProjectId( + projectId: TokenProjectIdV1 | TokenProjectIdV2, +): TokenProjectV1 | TokenProjectV2; +export function getTokenProjectByProjectId( + projectId: TokenProjectIdV1 | TokenProjectIdV2, +): TokenProjectV1 | TokenProjectV2 { + return ( + // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition + TOKEN_PROJECTS_BY_ID_V1[projectId as TokenProjectIdV1] ?? + TOKEN_PROJECTS_BY_ID_V2[projectId as TokenProjectIdV2] + ); +} diff --git a/apps/ui/src/config/tokens.test.ts b/apps/ui/src/config/tokens.test.ts index c65249bc0..e7cd86c2d 100644 --- a/apps/ui/src/config/tokens.test.ts +++ b/apps/ui/src/config/tokens.test.ts @@ -41,7 +41,7 @@ const generateSuite = (env: Env): void => { // NOTE: We may have to rethink this test if eg tokens on Ethereum/BNB can be deployed at the same address it("does not specify an address more than once", () => { const allAddresses = tokens.flatMap((token) => - [token.nativeDetails, ...token.wrappedDetails.values()].map( + [token.nativeDetails, ...(token.wrappedDetails?.values() ?? [])].map( (details) => details.address, ), ); @@ -80,7 +80,7 @@ const generateSuite = (env: Env): void => { it("does not specify token details for any token’s native Wormhole ecosystem", () => { const nativeEcosystemDetails = tokens.map((token) => - token.wrappedDetails.get(token.nativeEcosystemId), + token.wrappedDetails?.get(token.nativeEcosystemId), ); expect(nativeEcosystemDetails.some(Boolean)).toBe(false); }); diff --git a/apps/ui/src/config/tokens.ts b/apps/ui/src/config/tokens.ts index 04c43e65a..0ab78977b 100644 --- a/apps/ui/src/config/tokens.ts +++ b/apps/ui/src/config/tokens.ts @@ -5,28 +5,38 @@ import type { } from "@swim-io/core"; import { EvmEcosystemId } from "@swim-io/evm"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TokenProjectId } from "@swim-io/token-projects"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; import type { ReadonlyRecord } from "@swim-io/utils"; import type { EcosystemId } from "./ecosystem"; import { isEcosystemEnabled } from "./ecosystem"; import { isPoolRestructureEnabled } from "./pools"; +import { TokenProjectIdV1 } from "./tokenProjects"; -export interface TokenConfig extends CoreTokenConfig { +type CommonTokenConfig = Pick & { readonly isDisabled?: boolean; // TODO: Remove and derive from ChainConfig readonly nativeEcosystemId: EcosystemId; - /** Required for v1 pool support */ - readonly wrappedDetails: ReadonlyMap; -} +}; +export type TokenConfig = CommonTokenConfig & + ( + | { + readonly projectId: TokenProjectIdV1; + readonly wrappedDetails: ReadonlyMap; + } + | { + readonly projectId: TokenProjectIdV2; + readonly wrappedDetails?: never; + } + ); // NOTE: Use a shared empty map to save memory -const EMPTY_MAP: TokenConfig["wrappedDetails"] = new Map(); +const EMPTY_MAP: ReadonlyMap = new Map(); const MAINNET_TOKENS: readonly TokenConfig[] = [ { id: "mainnet-solana-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", @@ -51,7 +61,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", @@ -76,7 +86,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-gst", - projectId: TokenProjectId.Gst, + projectId: TokenProjectIdV1.Gst, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB", @@ -86,7 +96,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-gmt", - projectId: TokenProjectId.Gmt, + projectId: TokenProjectIdV1.Gmt, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "7i5KKsX2weiTkry7jA4ZwSuXGhs5eJBEjY8vVxR4pfRx", @@ -96,7 +106,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, + projectId: TokenProjectIdV1.SwimUsdV1, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "BJUH9GJLaMSLV1E7B3SQLCy9eCfyr6zsrwGcpS2MkqR1", @@ -121,7 +131,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-meta-avalanche-usdc", - projectId: TokenProjectId.SwimAvalancheUsdcLp, + projectId: TokenProjectIdV1.SwimAvalancheUsdcLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "DKwsWeqHrB8R1u2DFMHKtq4iqaQNgPgUbHTJyXPqkTzK", @@ -131,7 +141,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-meta-avalanche-usdt", - projectId: TokenProjectId.SwimAvalancheUsdtLp, + projectId: TokenProjectIdV1.SwimAvalancheUsdtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "5rwvDmUbcnZTwZ4Zywev2wnDbyDDD2vcsGU2Xmy7aRNS", @@ -141,7 +151,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-meta-polygon-usdc", - projectId: TokenProjectId.SwimPolygonUsdcLp, + projectId: TokenProjectIdV1.SwimPolygonUsdcLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "ANFojEXhiEQQoovhBs77XmBQuqbe59UBygRWViyf4945", @@ -151,7 +161,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-meta-polygon-usdt", - projectId: TokenProjectId.SwimPolygonUsdtLp, + projectId: TokenProjectIdV1.SwimPolygonUsdtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "2Nx6L79dHHgHcJtNfZWukQkWZvf5h4bps34zuh1gjtdP", @@ -161,7 +171,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-gst", - projectId: TokenProjectId.SwimSolanaGstBinanceGstLp, + projectId: TokenProjectIdV1.SwimSolanaGstBinanceGstLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "8YYBkTNhpY9mFdCdZWM6mHNf8J6A9hGfimb33LEiiZ3x", @@ -171,7 +181,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-gmt", - projectId: TokenProjectId.SwimSolanaGmtBinanceGmtLp, + projectId: TokenProjectIdV1.SwimSolanaGmtBinanceGmtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "2x7MjgopLXd3qETGLpY19cyZjHvVnGkrwVjTkJnBza4A", @@ -181,7 +191,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-meta-aurora-usdc", - projectId: TokenProjectId.SwimAuroraUsdcLp, + projectId: TokenProjectIdV1.SwimAuroraUsdcLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "9qRe2nBrR2rTXxRaV1PZN9hZnqq3UXgoFWTbP6NE3MEu", @@ -191,7 +201,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-meta-aurora-usdt", - projectId: TokenProjectId.SwimAuroraUsdtLp, + projectId: TokenProjectIdV1.SwimAuroraUsdtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "4XPDxtGbcM7bAPKZxALd2s862n3WoG4xPPvyCPVULKAb", @@ -202,7 +212,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !process.env.REACT_APP_ENABLE_AURORA_USN, id: "mainnet-solana-lp-meta-aurora-usn", - projectId: TokenProjectId.SwimAuroraUsnLp, + projectId: TokenProjectIdV1.SwimAuroraUsnLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "3eXCU7YoiCq3rZ6787pPFJE7TXBsKuTZ49wH2kFnuTeF", @@ -212,7 +222,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-meta-fantom-usdc", - projectId: TokenProjectId.SwimFantomUsdcLp, + projectId: TokenProjectIdV1.SwimFantomUsdcLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "J5ifGexAQTg76TresJhJSqTPJLT6BNxrV5rwNJTTz4Cx", @@ -223,7 +233,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !process.env.REACT_APP_ENABLE_KARURA_AUSD, id: "mainnet-solana-lp-meta-karura-ausd", - projectId: TokenProjectId.SwimKaruraAusdLp, + projectId: TokenProjectIdV1.SwimKaruraAusdLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "8vzXSNVAX4fymEFahJFh1ypzDBFv3QMVaZ4GtJWHrRjU", @@ -233,7 +243,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-solana-lp-meta-karura-usdt", - projectId: TokenProjectId.SwimKaruraUsdtLp, + projectId: TokenProjectIdV1.SwimKaruraUsdtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "2sXvitirRSjgTTNzGNWAFZWSqEx87kDoTJvqG9JSyivh", @@ -244,7 +254,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !isEcosystemEnabled(EvmEcosystemId.Acala), id: "mainnet-solana-lp-meta-acala-ausd", - projectId: TokenProjectId.SwimAcalaAusdLp, + projectId: TokenProjectIdV1.SwimAcalaAusdLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "11111111111111111111111111111111", // TODO: Update @@ -254,7 +264,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-ethereum-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Ethereum, nativeDetails: { address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", @@ -272,7 +282,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-ethereum-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Ethereum, nativeDetails: { address: "0xdac17f958d2ee523a2206206994597c13d831ec7", @@ -290,7 +300,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-bnb-busd", - projectId: TokenProjectId.Busd, + projectId: TokenProjectIdV1.Busd, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0xe9e7cea3dedca5984780bafc599bd69add087d56", @@ -308,7 +318,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-bnb-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0x55d398326f99059ff775485246999027b3197955", @@ -326,7 +336,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-bnb-gst", - projectId: TokenProjectId.Gst, + projectId: TokenProjectIdV1.Gst, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0x4a2c860cec6471b9f5f5a336eb4f38bb21683c98", @@ -344,7 +354,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-bnb-gmt", - projectId: TokenProjectId.Gmt, + projectId: TokenProjectIdV1.Gmt, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0x3019bf2a2ef8040c242c9a4c5c4bd4c81678b2a1", @@ -362,7 +372,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-avalanche-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Avalanche, nativeDetails: { address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", @@ -380,7 +390,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-avalanche-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Avalanche, nativeDetails: { address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", @@ -398,7 +408,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-polygon-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Polygon, nativeDetails: { address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", @@ -416,7 +426,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-polygon-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Polygon, nativeDetails: { address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", @@ -434,7 +444,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-aurora-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Aurora, nativeDetails: { address: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", @@ -452,7 +462,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-aurora-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Aurora, nativeDetails: { address: "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", @@ -471,7 +481,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !process.env.REACT_APP_ENABLE_AURORA_USN, id: "mainnet-aurora-usn", - projectId: TokenProjectId.Usn, + projectId: TokenProjectIdV1.Usn, nativeEcosystemId: EvmEcosystemId.Aurora, nativeDetails: { address: "0x5183e1B1091804BC2602586919E6880ac1cf2896", @@ -489,7 +499,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-fantom-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Fantom, nativeDetails: { address: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", @@ -508,7 +518,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !process.env.REACT_APP_ENABLE_KARURA_AUSD, id: "mainnet-karura-ausd", - projectId: TokenProjectId.Ausd, + projectId: TokenProjectIdV1.Ausd, nativeEcosystemId: EvmEcosystemId.Karura, nativeDetails: { address: "0x0000000000000000000100000000000000000081", @@ -526,7 +536,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ }, { id: "mainnet-karura-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Karura, nativeDetails: { address: "0x0000000000000000000500000000000000000007", @@ -545,7 +555,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !isEcosystemEnabled(EvmEcosystemId.Acala), id: "mainnet-acala-ausd", - projectId: TokenProjectId.Ausd, + projectId: TokenProjectIdV1.Ausd, nativeEcosystemId: EvmEcosystemId.Acala, nativeDetails: { address: "0x0000000000000000000000000000000000000000", // TODO: Update @@ -564,7 +574,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: true, id: "mainnet-solana-swim", - projectId: TokenProjectId.Swim, + projectId: TokenProjectIdV1.Swim, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "swimnKEr963p7EbCjsSnBCoYwytuZHPm3zbq6fKLHXb", @@ -575,7 +585,7 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: true, id: "mainnet-solana-lp-swimlake", - projectId: TokenProjectId.XSwim, + projectId: TokenProjectIdV1.XSwim, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "SwiMNJ49SxkqMaVWLGGVRH25kE5dBnD2RQoiQUnKtMC", @@ -588,191 +598,123 @@ const MAINNET_TOKENS: readonly TokenConfig[] = [ export const TESTNET_SWIMUSD: TokenConfig = { isDisabled: !isPoolRestructureEnabled(), id: "testnet-swimusd", - projectId: TokenProjectId.SwimLpSolanaUsdcUsdt, + projectId: TokenProjectIdV2.SwimUsd, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "3ngTtoyP9GFybFifX1dr7gCFXFiM2Wr6NfXn6EuU7k6C", // TODO: Update decimals: 6, }, - wrappedDetails: new Map([ - [ - EvmEcosystemId.Acala, - { - address: "0x1111111111111111111111111111111111111111", // TODO: Update - decimals: 6, - }, - ], - [ - EvmEcosystemId.Aurora, - { - address: "0x1111111111111111111111111111111111111111", // TODO: Update - decimals: 6, - }, - ], - [ - EvmEcosystemId.Avalanche, - { - address: "0x1111111111111111111111111111111111111111", // TODO: Update - decimals: 6, - }, - ], - [ - EvmEcosystemId.Bnb, - { - address: "0x4c15919a4354b4416e7afcb9a27a118bc45818c0", // TODO: Update - decimals: 6, - }, - ], - [ - EvmEcosystemId.Ethereum, - { - address: "0x4873edbb0B4b5b48A6FBe50CacB85e58D0b62ab5", // TODO: Update - decimals: 6, - }, - ], - [ - EvmEcosystemId.Fantom, - { - address: "0x1111111111111111111111111111111111111111", // TODO: Update - decimals: 6, - }, - ], - [ - EvmEcosystemId.Karura, - { - address: "0x1111111111111111111111111111111111111111", // TODO: Update - decimals: 6, - }, - ], - [ - EvmEcosystemId.Polygon, - { - address: "0x1111111111111111111111111111111111111111", // TODO: Update - decimals: 6, - }, - ], - ]), }; export const TESTNET_TOKENS_FOR_RESTRUCTURE: readonly TokenConfig[] = [ { isDisabled: !isPoolRestructureEnabled(), id: "testnet-ethereum-lp-usdc-usdt", - projectId: TokenProjectId.SwimLpEthereumUsdcUsdt, + projectId: TokenProjectIdV2.SwimLpEthereumUsdcUsdt, nativeEcosystemId: EvmEcosystemId.Ethereum, nativeDetails: { address: "0xee525c4cEB776D9e770D2Fd81fc91d6418657955", // TODO: Update decimals: 6, }, - wrappedDetails: EMPTY_MAP, }, { isDisabled: !isPoolRestructureEnabled(), id: "testnet-bnb-lp-busd-usdt", - projectId: TokenProjectId.SwimLpBnbBusdUsdt, + projectId: TokenProjectIdV2.SwimLpBnbBusdUsdt, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0x976943205ef791A1cf676A880c07458C91F241d7", // TODO: Update decimals: 6, }, - wrappedDetails: EMPTY_MAP, }, { isDisabled: !isPoolRestructureEnabled(), id: "testnet-avalanche-lp-usdc-usdt", - projectId: TokenProjectId.SwimLpAvalancheUsdcUsdt, + projectId: TokenProjectIdV2.SwimLpAvalancheUsdcUsdt, nativeEcosystemId: EvmEcosystemId.Avalanche, nativeDetails: { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, { isDisabled: !isPoolRestructureEnabled(), id: "testnet-polygon-lp-usdc-usdt", - projectId: TokenProjectId.SwimLpPolygonUsdcUsdt, + projectId: TokenProjectIdV2.SwimLpPolygonUsdcUsdt, nativeEcosystemId: EvmEcosystemId.Polygon, nativeDetails: { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, { isDisabled: !isPoolRestructureEnabled(), id: "testnet-aurora-lp-usdc-usdt", - projectId: TokenProjectId.SwimLpAuroraUsdcUsdt, + projectId: TokenProjectIdV2.SwimLpAuroraUsdcUsdt, nativeEcosystemId: EvmEcosystemId.Aurora, nativeDetails: { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, { isDisabled: !isPoolRestructureEnabled() || !process.env.REACT_APP_ENABLE_AURORA_USN, id: "testnet-aurora-lp-usn", - projectId: TokenProjectId.SwimLpAuroraUsn, + projectId: TokenProjectIdV2.SwimLpAuroraUsn, nativeEcosystemId: EvmEcosystemId.Aurora, nativeDetails: { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, { isDisabled: !isPoolRestructureEnabled(), id: "testnet-fantom-lp-usdc", - projectId: TokenProjectId.SwimLpFantomUsdc, + projectId: TokenProjectIdV2.SwimLpFantomUsdc, nativeEcosystemId: EvmEcosystemId.Fantom, nativeDetails: { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, { isDisabled: !isPoolRestructureEnabled(), id: "testnet-karura-lp-usdt", - projectId: TokenProjectId.SwimLpKaruraUsdt, + projectId: TokenProjectIdV2.SwimLpKaruraUsdt, nativeEcosystemId: EvmEcosystemId.Karura, nativeDetails: { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, { isDisabled: !isPoolRestructureEnabled() || !process.env.REACT_APP_ENABLE_KARURA_AUSD, id: "testnet-karura-lp-ausd", - projectId: TokenProjectId.SwimLpKaruraAusd, + projectId: TokenProjectIdV2.SwimLpKaruraAusd, nativeEcosystemId: EvmEcosystemId.Karura, nativeDetails: { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, { isDisabled: !isPoolRestructureEnabled(), id: "testnet-acala-lp-ausd", - projectId: TokenProjectId.SwimLpAcalaAusd, + projectId: TokenProjectIdV2.SwimLpAcalaAusd, nativeEcosystemId: EvmEcosystemId.Acala, nativeDetails: { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, ]; export const TESTNET_TOKENS: readonly TokenConfig[] = [ { id: "testnet-solana-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "2w7wsGofEAvLiWXZgJySXZ4gofEhm8jQ9rtwXr1zbzUc", @@ -782,7 +724,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "DznJzVAjPHBvyyqXEQgPWTonF2nhwoSoutPNbXjmsUvY", @@ -792,7 +734,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-usdc-v2", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "6iSRgpK4oiqJZuhpLsTecW3n9xBKUq9N3VPQN7RinYwq", @@ -802,7 +744,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-usdt-v2", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "8VbikoRxEoyYzTDzDcPTSsGk2E5mM7fK1WrVpKrVd75M", @@ -812,7 +754,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-gst", - projectId: TokenProjectId.Gst, + projectId: TokenProjectIdV1.Gst, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "FYxTtPiGxNSDouZQftVRHFqraFJyLvNbTXzZj8X2gKQP", @@ -822,7 +764,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-gmt", - projectId: TokenProjectId.Gmt, + projectId: TokenProjectIdV1.Gmt, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "3xsNPBpf7UAKpJsLTqiPqHT3ZBKPDndj1rJFM7xaSJcV", @@ -832,7 +774,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, + projectId: TokenProjectIdV1.SwimUsdV1, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "5ctnNpb7h1SyPqZ8t8m2kCykrtDGVZBtZgYWv6UAeDhr", @@ -857,7 +799,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-swim", - projectId: TokenProjectId.Swim, + projectId: TokenProjectIdV1.Swim, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "swimnKEr963p7EbCjsSnBCoYwytuZHPm3zbq6fKLHXb", @@ -867,7 +809,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-swimlake", - projectId: TokenProjectId.XSwim, + projectId: TokenProjectIdV1.XSwim, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "A8UVBwvj1XcdP5okoMqkjhCQGLaqQ8iJDYnNxAMbsNNF", @@ -877,7 +819,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-meta-avalanche-usdc", - projectId: TokenProjectId.SwimAvalancheUsdcLp, + projectId: TokenProjectIdV1.SwimAvalancheUsdcLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "DU15RXzuPWTLC4tbAcQvtXbDkHFrY8u6CxgTdhz2Mt8c", @@ -887,7 +829,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-meta-avalanche-usdt", - projectId: TokenProjectId.SwimAvalancheUsdtLp, + projectId: TokenProjectIdV1.SwimAvalancheUsdtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "D6PuZckpEcBhVcpfgjgbWnARhFD3ApHhvnxBGWR6MW5Z", @@ -897,7 +839,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-meta-polygon-usdc", - projectId: TokenProjectId.SwimPolygonUsdcLp, + projectId: TokenProjectIdV1.SwimPolygonUsdcLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "6WBFbyA3XJ3T2BeqA9JbyZFfj3KTCRtnC8MJANBsVNrz", @@ -907,7 +849,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-meta-polygon-usdt", - projectId: TokenProjectId.SwimPolygonUsdtLp, + projectId: TokenProjectIdV1.SwimPolygonUsdtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "HH3RwS94BWhR4bKeNYGvr2CfSLRQ2Kq6EYSDTKgGLgET", @@ -917,7 +859,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-gst", - projectId: TokenProjectId.SwimSolanaGstBinanceGstLp, + projectId: TokenProjectIdV1.SwimSolanaGstBinanceGstLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "BM3sXSfRg1yKzf2AbTA5QV76MdnKHi9M8D7VCGzDEYM1", @@ -927,7 +869,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-gmt", - projectId: TokenProjectId.SwimSolanaGmtBinanceGmtLp, + projectId: TokenProjectIdV1.SwimSolanaGmtBinanceGmtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "5VUZL2JcvbmjuT1DzDyWJ4mwtEH8unKyuQj3k38j8Ngs", @@ -937,7 +879,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-meta-aurora-usdc", - projectId: TokenProjectId.SwimAuroraUsdcLp, + projectId: TokenProjectIdV1.SwimAuroraUsdcLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "AQiHPuuBPsq4MLLjLv2WHRFbrNB1JHZeR4mQGVJTwVHn", @@ -947,7 +889,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-meta-aurora-usdt", - projectId: TokenProjectId.SwimAuroraUsdtLp, + projectId: TokenProjectIdV1.SwimAuroraUsdtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "utXdXdUMaS5qrBDDUg5btQMGL2CedouzmMPbYMJPEZD", @@ -958,7 +900,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !process.env.REACT_APP_ENABLE_AURORA_USN, id: "testnet-solana-lp-meta-aurora-usn", - projectId: TokenProjectId.SwimAuroraUsnLp, + projectId: TokenProjectIdV1.SwimAuroraUsnLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "11111111111111111111111111111111", // TODO: Update @@ -968,7 +910,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-meta-fantom-usdc", - projectId: TokenProjectId.SwimFantomUsdcLp, + projectId: TokenProjectIdV1.SwimFantomUsdcLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "4hmRgsk3hSdK1gXV7rg1pStwYtntKmbcFQyKqsZ4USis", @@ -978,7 +920,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-meta-karura-ausd", - projectId: TokenProjectId.SwimKaruraAusdLp, + projectId: TokenProjectIdV1.SwimKaruraAusdLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "4idDPnTYR4J9YhXmayKZYW8QBrASuuiTAxfkWUeaL3ap", @@ -988,7 +930,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-solana-lp-meta-karura-usdt", - projectId: TokenProjectId.SwimKaruraUsdtLp, + projectId: TokenProjectIdV1.SwimKaruraUsdtLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "882uzB9euTbBQJ6MrGrvxjXSTQi23VBQZcLcTH4E5Xow", @@ -999,7 +941,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !isEcosystemEnabled(EvmEcosystemId.Acala), id: "testnet-solana-lp-meta-acala-ausd", - projectId: TokenProjectId.SwimAcalaAusdLp, + projectId: TokenProjectIdV1.SwimAcalaAusdLp, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "BTbHtbUtDX5WAUSxPgELzy9VsbMbKAVFQ2hykNrD3X7L", @@ -1009,7 +951,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-ethereum-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Ethereum, nativeDetails: { address: "0x45B167CF5b14007Ca0490dCfB7C4B870Ec0C0Aa6", @@ -1027,7 +969,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-ethereum-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Ethereum, nativeDetails: { address: "0x996f42BdB0CB71F831C2eFB05Ac6d0d226979e5B", @@ -1045,7 +987,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-bnb-busd", - projectId: TokenProjectId.Busd, + projectId: TokenProjectIdV1.Busd, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", @@ -1063,7 +1005,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-bnb-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0x98529E942FD121d9C470c3d4431A008257E0E714", @@ -1081,7 +1023,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-bnb-gst", - projectId: TokenProjectId.Gst, + projectId: TokenProjectIdV1.Gst, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0x73160078948280B8680e5F1eB2964698928E8cd7", @@ -1099,7 +1041,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-bnb-gmt", - projectId: TokenProjectId.Gmt, + projectId: TokenProjectIdV1.Gmt, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0x1F65D61D01E3f10b34B855287b32D7bfbEA088D0", @@ -1117,7 +1059,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-avalanche-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Avalanche, nativeDetails: { address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", @@ -1135,7 +1077,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-avalanche-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Avalanche, nativeDetails: { address: "0x489dDcd070b6c4e0373FBB5d529Cc06328E048c3", @@ -1153,7 +1095,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-polygon-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Polygon, nativeDetails: { address: "0x0a0d7cEA57faCBf5DBD0D3b5169Ab00AC8Cf7dd1", @@ -1171,7 +1113,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-polygon-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Polygon, nativeDetails: { address: "0x2Ac9183EC64F71AfB73909c7C028Db14d35FAD2F", @@ -1189,7 +1131,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-aurora-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Aurora, nativeDetails: { address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", @@ -1207,7 +1149,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-aurora-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Aurora, nativeDetails: { address: "0x489dDcd070b6c4e0373FBB5d529Cc06328E048c3", @@ -1226,7 +1168,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !process.env.REACT_APP_ENABLE_AURORA_USN, id: "testnet-aurora-usn", - projectId: TokenProjectId.Usn, + projectId: TokenProjectIdV1.Usn, nativeEcosystemId: EvmEcosystemId.Aurora, nativeDetails: { address: "0x0000000000000000000000000000000000000000", // TODO: Update @@ -1244,7 +1186,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-fantom-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Fantom, nativeDetails: { address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", @@ -1262,7 +1204,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-karura-ausd", - projectId: TokenProjectId.Ausd, + projectId: TokenProjectIdV1.Ausd, nativeEcosystemId: EvmEcosystemId.Karura, nativeDetails: { address: "0x074370ca8Fea9e8f1C5eE23f34CBdcD3FB7a66aD", @@ -1280,7 +1222,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ }, { id: "testnet-karura-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Karura, nativeDetails: { address: "0x535d5e3b1ff7de526fe180e654a41350903c328d", @@ -1299,7 +1241,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ { isDisabled: !isEcosystemEnabled(EvmEcosystemId.Acala), id: "testnet-acala-ausd", - projectId: TokenProjectId.Ausd, + projectId: TokenProjectIdV1.Ausd, nativeEcosystemId: EvmEcosystemId.Acala, nativeDetails: { address: "0x996f42BdB0CB71F831C2eFB05Ac6d0d226979e5B", @@ -1322,7 +1264,7 @@ export const TESTNET_TOKENS: readonly TokenConfig[] = [ const LOCAL_TOKENS: readonly TokenConfig[] = [ { id: "local-solana-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "USCAD1T3pV246XwC5kBFXpEjuudS1zT1tTNYhxby9vy", @@ -1347,7 +1289,7 @@ const LOCAL_TOKENS: readonly TokenConfig[] = [ }, { id: "local-solana-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "USTPJc7bSkXxRPP1ZdxihfxtfgWNrcRPrE4KEC6EK23", @@ -1372,7 +1314,7 @@ const LOCAL_TOKENS: readonly TokenConfig[] = [ }, { id: "local-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, + projectId: TokenProjectIdV1.SwimUsdV1, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "LPTufpWWSucDqq1hib8vxj1uJxTh2bkE7ZTo65LH4J2", @@ -1397,7 +1339,7 @@ const LOCAL_TOKENS: readonly TokenConfig[] = [ }, { id: "local-solana-swim", - projectId: TokenProjectId.Swim, + projectId: TokenProjectIdV1.Swim, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "SWMPqjB9AAtpCbatAEEGK67wNBCN1HDW6VypX7E5r9g", @@ -1407,7 +1349,7 @@ const LOCAL_TOKENS: readonly TokenConfig[] = [ }, { id: "local-solana-lp-swimlake", - projectId: TokenProjectId.XSwim, + projectId: TokenProjectIdV1.XSwim, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "xSwy12tTsuYwM2Hd7ceNmvDftgxJ2ZSTycjzAfrNwPW", @@ -1417,7 +1359,7 @@ const LOCAL_TOKENS: readonly TokenConfig[] = [ }, { id: "local-ethereum-usdc", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: EvmEcosystemId.Ethereum, nativeDetails: { address: "0xFcCeD5E997E7fb1D0594518D3eD57245bB8ed17E", @@ -1435,7 +1377,7 @@ const LOCAL_TOKENS: readonly TokenConfig[] = [ }, { id: "local-ethereum-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Ethereum, nativeDetails: { address: "0xdAA71FBBA28C946258DD3d5FcC9001401f72270F", @@ -1453,7 +1395,7 @@ const LOCAL_TOKENS: readonly TokenConfig[] = [ }, { id: "local-bnb-busd", - projectId: TokenProjectId.Busd, + projectId: TokenProjectIdV1.Busd, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0xCeeFD27e0542aFA926B87d23936c79c276A48277", @@ -1471,7 +1413,7 @@ const LOCAL_TOKENS: readonly TokenConfig[] = [ }, { id: "local-bnb-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Bnb, nativeDetails: { address: "0x988B6CFBf3332FF98FFBdED665b1F53a61f92612", diff --git a/apps/ui/src/config/utils.ts b/apps/ui/src/config/utils.ts index 51bf32561..093277fbc 100644 --- a/apps/ui/src/config/utils.ts +++ b/apps/ui/src/config/utils.ts @@ -1,6 +1,6 @@ import type { Env, TokenDetails } from "@swim-io/core"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TokenProjectId } from "@swim-io/token-projects"; +import { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; import { deduplicate } from "@swim-io/utils"; import type { Ecosystem, EcosystemId } from "./ecosystem"; @@ -15,7 +15,7 @@ export const getTokenDetailsForEcosystem = ( ): TokenDetails | null => tokenConfig.nativeEcosystemId === ecosystemId ? tokenConfig.nativeDetails - : tokenConfig.wrappedDetails.get(ecosystemId) ?? null; + : tokenConfig.wrappedDetails?.get(ecosystemId) ?? null; export const getSolanaTokenDetails = ( tokenConfig: TokenConfig, @@ -56,4 +56,4 @@ export const hasTokenEcosystem = ( getPoolTokenEcosystems(pool, env).some(({ id }) => id === ecosystemId); export const isSwimUsd = (token: TokenConfig) => - token.projectId === TokenProjectId.SwimLpSolanaUsdcUsdt; + token.projectId === TokenProjectIdV2.SwimUsd; diff --git a/apps/ui/src/core/selectors/swapTokenOptions.ts b/apps/ui/src/core/selectors/swapTokenOptions.ts index dce6225d4..64941f074 100644 --- a/apps/ui/src/core/selectors/swapTokenOptions.ts +++ b/apps/ui/src/core/selectors/swapTokenOptions.ts @@ -31,7 +31,7 @@ export const selectSwapTokenOptions = ( const swimUsdSpec = findOrThrow(tokens, isSwimUsd); const swimUsdOptions = [ swimUsdSpec.nativeEcosystemId, - ...swimUsdSpec.wrappedDetails.keys(), + ...(swimUsdSpec.wrappedDetails?.keys() ?? []), ] .filter((ecosystemId) => poolEcosystems.has(ecosystemId)) .map((ecosystemId) => ({ diff --git a/apps/ui/src/hooks/evm/useRegisterErc20Token.ts b/apps/ui/src/hooks/evm/useRegisterErc20Token.ts index cbaf73635..538c6a532 100644 --- a/apps/ui/src/hooks/evm/useRegisterErc20Token.ts +++ b/apps/ui/src/hooks/evm/useRegisterErc20Token.ts @@ -2,7 +2,11 @@ import type { EvmEcosystemId } from "@swim-io/evm"; import { useTranslation } from "react-i18next"; import type { TokenConfig } from "../../config"; -import { ECOSYSTEMS, getTokenDetailsForEcosystem } from "../../config"; +import { + ECOSYSTEMS, + getTokenDetailsForEcosystem, + getTokenProjectByProjectId, +} from "../../config"; import { useNotification } from "../../core/store"; import { captureException } from "../../errors"; @@ -43,7 +47,7 @@ export const useRegisterErc20Token = ( } await wallet.registerToken( tokenDetails, - tokenConfig.projectId, + getTokenProjectByProjectId(tokenConfig.projectId), evmChainId, ); } catch (error) { diff --git a/apps/ui/src/hooks/interaction/useCrossChainEvmToEvmSwapInteractionMutation.ts b/apps/ui/src/hooks/interaction/useCrossChainEvmToEvmSwapInteractionMutation.ts index 981822b5e..31d7c0067 100644 --- a/apps/ui/src/hooks/interaction/useCrossChainEvmToEvmSwapInteractionMutation.ts +++ b/apps/ui/src/hooks/interaction/useCrossChainEvmToEvmSwapInteractionMutation.ts @@ -9,6 +9,7 @@ import { isEvmEcosystemId, } from "@swim-io/evm"; import { Routing__factory } from "@swim-io/evm-contracts"; +import type { TokenProjectId } from "@swim-io/token-projects"; import { useMutation } from "react-query"; import shallow from "zustand/shallow.js"; @@ -75,11 +76,11 @@ export const useCrossChainEvmToEvmSwapInteractionMutation = () => { } const fromTokenDetails = getTokenDetails( fromChainConfig, - fromTokenSpec.projectId, + fromTokenSpec.projectId as TokenProjectId, ); const toTokenDetails = getTokenDetails( toChainConfig, - toTokenSpec.projectId, + toTokenSpec.projectId as TokenProjectId, ); await wallet.switchNetwork(fromChainConfig.chainId); const fromEvmClient = getEvmClient(fromEcosystem); diff --git a/apps/ui/src/hooks/swim/useGetSwapFormErrorsV2.ts b/apps/ui/src/hooks/swim/useGetSwapFormErrorsV2.ts index 8d2d48c65..7898aea46 100644 --- a/apps/ui/src/hooks/swim/useGetSwapFormErrorsV2.ts +++ b/apps/ui/src/hooks/swim/useGetSwapFormErrorsV2.ts @@ -1,9 +1,12 @@ -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { isNotNull } from "@swim-io/utils"; import type Decimal from "decimal.js"; import { useTranslation } from "react-i18next"; -import { DISABLED_ECOSYSTEMS, ECOSYSTEMS } from "../../config"; +import { + DISABLED_ECOSYSTEMS, + ECOSYSTEMS, + getTokenProjectByProjectId, +} from "../../config"; import type { TokenOption } from "../../models"; import { isValidSlippageFraction } from "../../models"; import { @@ -71,7 +74,7 @@ export const useGetSwapFormErrorsV2 = ( ...errors, `Insufficient funds for ${ ECOSYSTEMS[fromTokenOption.ecosystemId].displayName - } ${TOKEN_PROJECTS_BY_ID[fromToken.projectId].displayName}`, + } ${getTokenProjectByProjectId(fromToken.projectId).displayName}`, ]; } diff --git a/apps/ui/src/hooks/swim/useIsLargeSwap.ts b/apps/ui/src/hooks/swim/useIsLargeSwap.ts index 390f84820..75ddd2b81 100644 --- a/apps/ui/src/hooks/swim/useIsLargeSwap.ts +++ b/apps/ui/src/hooks/swim/useIsLargeSwap.ts @@ -1,8 +1,8 @@ import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import shallow from "zustand/shallow.js"; import type { TokenConfig } from "../../config"; +import { getTokenProjectByProjectId } from "../../config"; import { selectConfig } from "../../core/selectors"; import { useEnvironment } from "../../core/store"; import type { Amount } from "../../models"; @@ -28,12 +28,12 @@ export const useIsLargeSwap = ( const outputPoolUsdValue = pools[pools.length - 1].poolUsdValue; const outputAmount = useSwapOutputAmountEstimate(inputAmount, toToken); return ( - (TOKEN_PROJECTS_BY_ID[fromToken.projectId].isStablecoin && + (getTokenProjectByProjectId(fromToken.projectId).isStablecoin && inputPoolUsdValue !== null && inputAmount .toHuman(SOLANA_ECOSYSTEM_ID) .gt(inputPoolUsdValue.mul(0.1))) || - (TOKEN_PROJECTS_BY_ID[toToken.projectId].isStablecoin && + (getTokenProjectByProjectId(toToken.projectId).isStablecoin && outputPoolUsdValue !== null && outputAmount !== null && outputAmount.toHuman(SOLANA_ECOSYSTEM_ID).gt(outputPoolUsdValue.mul(0.1))) diff --git a/apps/ui/src/hooks/swim/useIsLargeSwapV2.ts b/apps/ui/src/hooks/swim/useIsLargeSwapV2.ts index 641eca92b..195bdc75f 100644 --- a/apps/ui/src/hooks/swim/useIsLargeSwapV2.ts +++ b/apps/ui/src/hooks/swim/useIsLargeSwapV2.ts @@ -1,8 +1,8 @@ -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import type Decimal from "decimal.js"; import shallow from "zustand/shallow.js"; import { sum } from "../../amounts"; +import { getTokenProjectByProjectId } from "../../config"; import { selectConfig } from "../../core/selectors"; import { useEnvironment } from "../../core/store"; import type { TokenOption } from "../../models"; @@ -36,10 +36,12 @@ export const useIsLargeSwapV2 = ( const inputBalance = sum(poolBalances[0]); const outputBalance = sum(poolBalances[poolBalances.length - 1]); return ( - (TOKEN_PROJECTS_BY_ID[fromTokenOption.tokenConfig.projectId].isStablecoin && + (getTokenProjectByProjectId(fromTokenOption.tokenConfig.projectId) + .isStablecoin && inputBalance !== null && inputAmount.gt(inputBalance.mul(0.1))) || - (TOKEN_PROJECTS_BY_ID[toTokenOption.tokenConfig.projectId].isStablecoin && + (getTokenProjectByProjectId(toTokenOption.tokenConfig.projectId) + .isStablecoin && outputBalance !== null && minimumOutputAmount !== null && minimumOutputAmount.gt(outputBalance.mul(0.1))) diff --git a/apps/ui/src/hooks/swim/usePoolUsdValues.ts b/apps/ui/src/hooks/swim/usePoolUsdValues.ts index 9d8448ed9..c690a5efb 100644 --- a/apps/ui/src/hooks/swim/usePoolUsdValues.ts +++ b/apps/ui/src/hooks/swim/usePoolUsdValues.ts @@ -1,9 +1,9 @@ -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { findOrThrow } from "@swim-io/utils"; -import type { PoolSpec, TokenConfig } from "config"; import Decimal from "decimal.js"; import shallow from "zustand/shallow.js"; +import type { PoolSpec, TokenConfig } from "../../config"; +import { getTokenProjectByProjectId } from "../../config"; import { selectConfig } from "../../core/selectors"; import { useEnvironment } from "../../core/store"; import { isSolanaPool } from "../../models"; @@ -29,14 +29,15 @@ export const usePoolUsdValues = (poolSpecs: readonly PoolSpec[]) => { if ( poolTokens.some( (tokenConfig) => - !TOKEN_PROJECTS_BY_ID[tokenConfig.projectId].isStablecoin && + !getTokenProjectByProjectId(tokenConfig.projectId).isStablecoin && !prices.get(tokenConfig.id), ) ) { return new Decimal(0); } return poolTokens.reduce((sum, tokenConfig, i) => { - const price = TOKEN_PROJECTS_BY_ID[tokenConfig.projectId].isStablecoin + const price = getTokenProjectByProjectId(tokenConfig.projectId) + .isStablecoin ? new Decimal(1) : prices.get(tokenConfig.id) ?? new Decimal(1); return sum.add(poolBalances[i].mul(price)); diff --git a/apps/ui/src/hooks/swim/useSwapTokensContext.ts b/apps/ui/src/hooks/swim/useSwapTokensContext.ts index c6d16dbb1..b37ca5250 100644 --- a/apps/ui/src/hooks/swim/useSwapTokensContext.ts +++ b/apps/ui/src/hooks/swim/useSwapTokensContext.ts @@ -1,9 +1,9 @@ -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { findOrThrow } from "@swim-io/utils"; import { useNavigate, useParams } from "react-router-dom"; import shallow from "zustand/shallow.js"; import type { TokenConfig } from "../../config"; +import { getTokenProjectByProjectId } from "../../config"; import { selectConfig } from "../../core/selectors"; import { useEnvironment } from "../../core/store"; @@ -28,7 +28,7 @@ interface SwapTokensContext { const convertTokenConfigToUrlParam = (token: TokenConfig): string => `${token.nativeEcosystemId}-${ - TOKEN_PROJECTS_BY_ID[token.projectId].symbol + getTokenProjectByProjectId(token.projectId).symbol }`.toLowerCase(); export const useSwapTokensContext = (): SwapTokensContext => { @@ -47,7 +47,7 @@ export const useSwapTokensContext = (): SwapTokensContext => { return ( tokens.find((token) => { return ( - TOKEN_PROJECTS_BY_ID[token.projectId].symbol.toLowerCase() === + getTokenProjectByProjectId(token.projectId).symbol.toLowerCase() === projectSymbol && token.nativeEcosystemId.toLowerCase() === ecosystemId ); diff --git a/packages/token-projects/images/lp_acala_ausd.svg b/apps/ui/src/images/tokens/lp_acala_ausd.svg similarity index 100% rename from packages/token-projects/images/lp_acala_ausd.svg rename to apps/ui/src/images/tokens/lp_acala_ausd.svg diff --git a/packages/token-projects/images/lp_aurora_usdc.svg b/apps/ui/src/images/tokens/lp_aurora_usdc.svg similarity index 100% rename from packages/token-projects/images/lp_aurora_usdc.svg rename to apps/ui/src/images/tokens/lp_aurora_usdc.svg diff --git a/packages/token-projects/images/lp_aurora_usdt.svg b/apps/ui/src/images/tokens/lp_aurora_usdt.svg similarity index 100% rename from packages/token-projects/images/lp_aurora_usdt.svg rename to apps/ui/src/images/tokens/lp_aurora_usdt.svg diff --git a/packages/token-projects/images/lp_aurora_usn.svg b/apps/ui/src/images/tokens/lp_aurora_usn.svg similarity index 100% rename from packages/token-projects/images/lp_aurora_usn.svg rename to apps/ui/src/images/tokens/lp_aurora_usn.svg diff --git a/packages/token-projects/images/lp_avalanche_usdc.svg b/apps/ui/src/images/tokens/lp_avalanche_usdc.svg similarity index 100% rename from packages/token-projects/images/lp_avalanche_usdc.svg rename to apps/ui/src/images/tokens/lp_avalanche_usdc.svg diff --git a/packages/token-projects/images/lp_avalanche_usdt.svg b/apps/ui/src/images/tokens/lp_avalanche_usdt.svg similarity index 100% rename from packages/token-projects/images/lp_avalanche_usdt.svg rename to apps/ui/src/images/tokens/lp_avalanche_usdt.svg diff --git a/packages/token-projects/images/lp_fantom_usdc.svg b/apps/ui/src/images/tokens/lp_fantom_usdc.svg similarity index 100% rename from packages/token-projects/images/lp_fantom_usdc.svg rename to apps/ui/src/images/tokens/lp_fantom_usdc.svg diff --git a/packages/token-projects/images/lp_karura_ausd.svg b/apps/ui/src/images/tokens/lp_karura_ausd.svg similarity index 100% rename from packages/token-projects/images/lp_karura_ausd.svg rename to apps/ui/src/images/tokens/lp_karura_ausd.svg diff --git a/packages/token-projects/images/lp_karura_usdt.svg b/apps/ui/src/images/tokens/lp_karura_usdt.svg similarity index 100% rename from packages/token-projects/images/lp_karura_usdt.svg rename to apps/ui/src/images/tokens/lp_karura_usdt.svg diff --git a/packages/token-projects/images/lp_polygon_usdc.svg b/apps/ui/src/images/tokens/lp_polygon_usdc.svg similarity index 100% rename from packages/token-projects/images/lp_polygon_usdc.svg rename to apps/ui/src/images/tokens/lp_polygon_usdc.svg diff --git a/packages/token-projects/images/lp_polygon_usdt.svg b/apps/ui/src/images/tokens/lp_polygon_usdt.svg similarity index 100% rename from packages/token-projects/images/lp_polygon_usdt.svg rename to apps/ui/src/images/tokens/lp_polygon_usdt.svg diff --git a/apps/ui/src/models/amount.test.ts b/apps/ui/src/models/amount.test.ts index cb413b7f8..4eb2b93e0 100644 --- a/apps/ui/src/models/amount.test.ts +++ b/apps/ui/src/models/amount.test.ts @@ -1,10 +1,10 @@ import { EvmEcosystemId } from "@swim-io/evm"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TokenProjectId } from "@swim-io/token-projects"; import BN from "bn.js"; import Decimal from "decimal.js"; import type { TokenConfig } from "../config"; +import { TokenProjectIdV1 } from "../config"; import { Amount } from "./amount"; @@ -31,7 +31,7 @@ const staticMethodConstructionCases: readonly StaticMethodConstructionCase[] = [ describe("Amount", () => { const defaultNonStablecoinTokenConfig: TokenConfig = { id: "test-token", - projectId: TokenProjectId.Swim, + projectId: TokenProjectIdV1.Swim, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "xxx", decimals: 8 }, wrappedDetails: new Map([ @@ -40,7 +40,7 @@ describe("Amount", () => { }; const defaultStablecoinTokenConfig: TokenConfig = { id: "test-stablecoin", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "xxx", decimals: 8 }, wrappedDetails: new Map([ diff --git a/apps/ui/src/models/amount.ts b/apps/ui/src/models/amount.ts index 01ce3fd9e..e61dde084 100644 --- a/apps/ui/src/models/amount.ts +++ b/apps/ui/src/models/amount.ts @@ -1,10 +1,12 @@ import type { TokenDetails } from "@swim-io/core"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import BN from "bn.js"; import Decimal from "decimal.js"; import type { EcosystemId, TokenConfig } from "../config"; -import { getTokenDetailsForEcosystem } from "../config"; +import { + getTokenDetailsForEcosystem, + getTokenProjectByProjectId, +} from "../config"; import { fallbackLanguageIfNotSupported, i18next } from "../i18n"; export class Amount { @@ -114,7 +116,7 @@ export class Amount { i18next.resolvedLanguage, ); const numberFormatter = new Intl.NumberFormat(language, { - ...(TOKEN_PROJECTS_BY_ID[this.tokenConfig.projectId].isStablecoin + ...(getTokenProjectByProjectId(this.tokenConfig.projectId).isStablecoin ? { minimumFractionDigits: 2, maximumFractionDigits: 2, diff --git a/apps/ui/src/models/crossEcosystem/atomicString.test.ts b/apps/ui/src/models/crossEcosystem/atomicString.test.ts index a08cd0e2f..d26c75c00 100644 --- a/apps/ui/src/models/crossEcosystem/atomicString.test.ts +++ b/apps/ui/src/models/crossEcosystem/atomicString.test.ts @@ -1,9 +1,9 @@ import { EvmEcosystemId } from "@swim-io/evm"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TokenProjectId } from "@swim-io/token-projects"; import Decimal from "decimal.js"; import type { TokenConfig } from "../../config"; +import { TokenProjectIdV1 } from "../../config"; import { atomicStringToHumanDecimal, @@ -12,7 +12,7 @@ import { const defaultStablecoinTokenConfig: TokenConfig = { id: "test-stablecoin", - projectId: TokenProjectId.Usdc, + projectId: TokenProjectIdV1.Usdc, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "xxx", decimals: 8 }, wrappedDetails: new Map([ diff --git a/apps/ui/src/models/swim/utils.ts b/apps/ui/src/models/swim/utils.ts index 4b01038d6..6a24e0e69 100644 --- a/apps/ui/src/models/swim/utils.ts +++ b/apps/ui/src/models/swim/utils.ts @@ -2,13 +2,15 @@ import { APTOS_ECOSYSTEM_ID } from "@swim-io/aptos"; import { EvmEcosystemId } from "@swim-io/evm"; import type { TokenAccount } from "@swim-io/solana"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import type { ReadonlyRecord } from "@swim-io/utils"; import { filterMap, findOrThrow } from "@swim-io/utils"; import Decimal from "decimal.js"; import type { EcosystemId, PoolSpec, TokenConfig } from "../../config"; -import { getTokenDetailsForEcosystem } from "../../config"; +import { + getTokenDetailsForEcosystem, + getTokenProjectByProjectId, +} from "../../config"; import { Amount } from "../amount"; import type { InteractionSpec, InteractionSpecV2 } from "./interaction"; @@ -188,7 +190,8 @@ export const getPoolUsdValue = ( poolTokenAccounts: readonly TokenAccount[], ): Decimal | null => tokens.every( - (tokenConfig) => TOKEN_PROJECTS_BY_ID[tokenConfig.projectId].isStablecoin, + (tokenConfig) => + getTokenProjectByProjectId(tokenConfig.projectId).isStablecoin, ) ? poolTokenAccounts.reduce((acc, account) => { const tokenConfig = tokens.find( diff --git a/apps/ui/src/models/wormhole/solana.test.ts b/apps/ui/src/models/wormhole/solana.test.ts index 19934d10e..3098bca0b 100644 --- a/apps/ui/src/models/wormhole/solana.test.ts +++ b/apps/ui/src/models/wormhole/solana.test.ts @@ -4,10 +4,9 @@ import { Env } from "@swim-io/core"; import { EvmEcosystemId } from "@swim-io/evm"; import type { SolanaTx } from "@swim-io/solana"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TokenProjectId } from "@swim-io/token-projects"; import type { TokenConfig } from "../../config"; -import { CHAINS, Protocol, TOKENS } from "../../config"; +import { CHAINS, Protocol, TOKENS, TokenProjectIdV1 } from "../../config"; import { parsedSwimSwapTx, parsedWormholePostVaaTxs, @@ -29,7 +28,7 @@ describe("models - Wormhole utils", () => { "Ex4QfU1vD5dtFQYHJrs6XwLaRzy2C5yZKhQSNJJXQg5e"; const token: TokenConfig = { id: "test-token", - projectId: TokenProjectId.Swim, + projectId: TokenProjectIdV1.Swim, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "xxx", decimals: 8 }, wrappedDetails: new Map([ diff --git a/apps/ui/src/pages/PoolPage.tsx b/apps/ui/src/pages/PoolPage.tsx index e79b0b49f..77b92c79d 100644 --- a/apps/ui/src/pages/PoolPage.tsx +++ b/apps/ui/src/pages/PoolPage.tsx @@ -15,7 +15,6 @@ import { EuiToolTip, } from "@elastic/eui"; import { EvmEcosystemId } from "@swim-io/evm"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { defaultIfError } from "@swim-io/utils"; import Decimal from "decimal.js"; import type { ReactElement } from "react"; @@ -36,7 +35,11 @@ import { StatList } from "../components/StatList"; import { TokenConfigIcon, TokenIcon } from "../components/TokenIcon"; import { EthereumMergeWarning } from "../components/molecules/EthereumMergeWarning"; import type { PoolSpec } from "../config"; -import { getSolanaTokenDetails, getTokenDetailsForEcosystem } from "../config"; +import { + getSolanaTokenDetails, + getTokenDetailsForEcosystem, + getTokenProjectByProjectId, +} from "../config"; import { selectConfig } from "../core/selectors"; import { useEnvironment } from "../core/store"; import { @@ -175,13 +178,13 @@ export const PoolPageInner = ({ const userLpBalances = useUserLpBalances(lpToken, userLpTokenAccount); const userLpStats = [ lpToken.nativeEcosystemId, - ...(poolSpec.isLegacyPool ? lpToken.wrappedDetails.keys() : []), + ...(poolSpec.isLegacyPool ? lpToken.wrappedDetails?.keys() ?? [] : []), ].map((ecosystemId) => { const userLpBalance = userLpBalances[ecosystemId]; return { title: ( ), diff --git a/apps/ui/src/pages/PoolsPage.tsx b/apps/ui/src/pages/PoolsPage.tsx index b3a122c93..a84b9d3ea 100644 --- a/apps/ui/src/pages/PoolsPage.tsx +++ b/apps/ui/src/pages/PoolsPage.tsx @@ -17,7 +17,7 @@ import { } from "@elastic/eui"; import { EvmEcosystemId } from "@swim-io/evm"; import { SOLANA_ECOSYSTEM_ID } from "@swim-io/solana"; -import { TOKEN_PROJECTS_BY_ID, TokenProjectId } from "@swim-io/token-projects"; +import type { TokenProjectId as TokenProjectIdV2 } from "@swim-io/token-projects"; import { deduplicate, filterMap, findOrThrow, sortBy } from "@swim-io/utils"; import type { ReadonlyRecord } from "@swim-io/utils"; import Decimal from "decimal.js"; @@ -30,7 +30,9 @@ import { atomicToTvlString } from "../amounts"; import { PoolListItem } from "../components/PoolListItem"; import { EthereumMergeWarning } from "../components/molecules/EthereumMergeWarning"; import { + TokenProjectIdV1, getPoolTokenEcosystems, + getTokenProjectByProjectId, hasTokenEcosystem, isEcosystemEnabled, } from "../config"; @@ -40,7 +42,7 @@ import { useEnvironment } from "../core/store"; import { usePoolUsdValues, useTitle } from "../hooks"; type EcosystemSelectType = EcosystemId | "all"; -type TokenProjectSelectType = TokenProjectId | "all"; +type TokenProjectSelectType = TokenProjectIdV1 | TokenProjectIdV2 | "all"; const PoolsPage = (): ReactElement => { const { t } = useTranslation(); @@ -174,7 +176,7 @@ const PoolsPage = (): ReactElement => { tokenConfigs={[ { id: "placeholder-aurora-native-usn", - projectId: TokenProjectId.Usn, + projectId: TokenProjectIdV1.Usn, nativeEcosystemId: EvmEcosystemId.Aurora, nativeDetails: { address: "", @@ -184,7 +186,7 @@ const PoolsPage = (): ReactElement => { }, { id: "mainnet-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, + projectId: TokenProjectIdV1.SwimUsdV1, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "", @@ -208,7 +210,7 @@ const PoolsPage = (): ReactElement => { tokenConfigs={[ { id: "placeholder-karura-native-ausd", - projectId: TokenProjectId.Ausd, + projectId: TokenProjectIdV1.Ausd, nativeEcosystemId: EvmEcosystemId.Karura, nativeDetails: { address: "", @@ -218,7 +220,7 @@ const PoolsPage = (): ReactElement => { }, { id: "mainnet-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, + projectId: TokenProjectIdV1.SwimUsdV1, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "", @@ -237,7 +239,7 @@ const PoolsPage = (): ReactElement => { tokenConfigs={[ { id: "placeholder-karura-native-usdt", - projectId: TokenProjectId.Usdt, + projectId: TokenProjectIdV1.Usdt, nativeEcosystemId: EvmEcosystemId.Karura, nativeDetails: { address: "", @@ -247,7 +249,7 @@ const PoolsPage = (): ReactElement => { }, { id: "mainnet-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, + projectId: TokenProjectIdV1.SwimUsdV1, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "", @@ -271,7 +273,7 @@ const PoolsPage = (): ReactElement => { tokenConfigs={[ { id: "placeholder-acala-native-ausd", - projectId: TokenProjectId.Ausd, + projectId: TokenProjectIdV1.Ausd, nativeEcosystemId: EvmEcosystemId.Acala, nativeDetails: { address: "", @@ -281,7 +283,7 @@ const PoolsPage = (): ReactElement => { }, { id: "mainnet-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, + projectId: TokenProjectIdV1.SwimUsdV1, nativeEcosystemId: SOLANA_ECOSYSTEM_ID, nativeDetails: { address: "", @@ -421,7 +423,7 @@ function useTokenProjectFilter() { deduplicate( (project) => project.id, tokens - .map((token) => TOKEN_PROJECTS_BY_ID[token.projectId]) + .map((token) => getTokenProjectByProjectId(token.projectId)) .filter((project) => project.symbol !== "SWIM" && !project.isLp), ), "displayName", @@ -460,7 +462,7 @@ function useFilteredPools( const projectsPerPool: ReadonlyRecord< PoolSpec["id"], - readonly TokenProjectId[] + readonly (TokenProjectIdV1 | TokenProjectIdV2)[] > = useMemo(() => { return pools.reduce( (accumulator, pool) => ({ diff --git a/apps/ui/src/pages/SwapPage/SwapPage.tsx b/apps/ui/src/pages/SwapPage/SwapPage.tsx index 2fe46d2ea..84749100e 100644 --- a/apps/ui/src/pages/SwapPage/SwapPage.tsx +++ b/apps/ui/src/pages/SwapPage/SwapPage.tsx @@ -9,7 +9,6 @@ import { EuiSpacer, EuiTitle, } from "@elastic/eui"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { defaultIfError } from "@swim-io/utils"; import Decimal from "decimal.js"; import type { ReactElement } from "react"; @@ -22,7 +21,7 @@ import { RecentInteractions } from "../../components/RecentInteractions"; import { SlippageButton } from "../../components/SlippageButton"; import { SwapForm } from "../../components/SwapForm"; import { EthereumMergeWarning } from "../../components/molecules/EthereumMergeWarning"; -import { ECOSYSTEMS } from "../../config"; +import { ECOSYSTEMS, getTokenProjectByProjectId } from "../../config"; import { selectConfig } from "../../core/selectors"; import { useEnvironment } from "../../core/store"; import { useSwapTokensContext, useTitle } from "../../hooks"; @@ -36,10 +35,13 @@ const SwapPage = (): ReactElement => { const { fromToken, toToken } = useSwapTokensContext(); const fromEcosystemName = ECOSYSTEMS[fromToken.nativeEcosystemId].displayName; - const fromTokenProjectId = - TOKEN_PROJECTS_BY_ID[fromToken.projectId].displayName; + const fromTokenProjectId = getTokenProjectByProjectId( + fromToken.projectId, + ).displayName; const toEcosystemName = ECOSYSTEMS[toToken.nativeEcosystemId].displayName; - const toTokenProjectId = TOKEN_PROJECTS_BY_ID[toToken.projectId].displayName; + const toTokenProjectId = getTokenProjectByProjectId( + toToken.projectId, + ).displayName; useTitle( t("swap_page.title", { fromEcosystemName, diff --git a/packages/aptos/src/ecosystem.ts b/packages/aptos/src/ecosystem.ts index c7f4ef261..c571c0d16 100644 --- a/packages/aptos/src/ecosystem.ts +++ b/packages/aptos/src/ecosystem.ts @@ -25,11 +25,6 @@ const testnet: AptosChainConfig = { "0x799c8d35a610b6fa8ed33432e31c686c97b4ce4205fce88c13577615372e99a3", }, publicRpcUrls: ["https://testnet.aptoslabs.com/v1"], - swimUsdDetails: { - address: - "0x246bfb8da92a72f29d0441138058a43970551734d68958281d59e23a4f2b19a0::coin::T", - decimals: 6, - }, routingContractAddress: "", // TODO: add when deployed tokens: [], pools: [], diff --git a/packages/core/src/chain.ts b/packages/core/src/chain.ts index d8d90e0e0..69ff57f91 100644 --- a/packages/core/src/chain.ts +++ b/packages/core/src/chain.ts @@ -1,4 +1,4 @@ -import { TokenProjectId } from "@swim-io/token-projects"; +import type { TokenProjectId } from "@swim-io/token-projects"; import { findOrThrow } from "@swim-io/utils"; import type { PoolConfig } from "./pool"; @@ -11,7 +11,6 @@ export interface ChainConfig { readonly chainId: number; readonly wormhole: WormholeChainConfig; readonly publicRpcUrls: readonly string[]; - readonly swimUsdDetails: TokenDetails; readonly routingContractAddress: string; readonly tokens: readonly TokenConfig[]; readonly pools: readonly PoolConfig[]; @@ -19,10 +18,12 @@ export interface ChainConfig { export const getTokenDetails = ( chainConfig: ChainConfig, - tokenProjectId: TokenProjectId, + /** @todo to be removed: legacy v1 token project id */ + tokenProjectId: TokenProjectId | `${string}-v1`, ): TokenDetails => - tokenProjectId === TokenProjectId.SwimUsd - ? chainConfig.swimUsdDetails + /** @todo to be removed: legacy v1 token project id */ + tokenProjectId === "swim-usd-v1" + ? (chainConfig as unknown as Record).swimUsdDetails : findOrThrow( chainConfig.tokens, (token) => token.projectId === tokenProjectId, diff --git a/packages/core/src/client.ts b/packages/core/src/client.ts index 312808b33..7df0cb55f 100644 --- a/packages/core/src/client.ts +++ b/packages/core/src/client.ts @@ -17,7 +17,8 @@ export interface WrappedTokenInfo { export interface InitiatePortalTransferParams { readonly wallet: Wallet; readonly interactionId: string; - readonly tokenProjectId: TokenProjectId; + /** @todo to be removed: legacy v1 token project id */ + readonly tokenProjectId: TokenProjectId | `${string}-v1`; /** Standardized Wormhole format, ie 32 bytes */ readonly targetAddress: Uint8Array; readonly targetChainId: ChainId; diff --git a/packages/core/src/token.ts b/packages/core/src/token.ts index 3fcacd0ed..d6eb35ba1 100644 --- a/packages/core/src/token.ts +++ b/packages/core/src/token.ts @@ -13,8 +13,7 @@ export interface TokenDetails { export interface TokenConfig { readonly id: string; /** The ID of the token project to which this token belongs */ - readonly projectId: TokenProjectId; + /** @todo to be removed: legacy v1 token project id */ + readonly projectId: TokenProjectId | `${string}-v1`; readonly nativeDetails: TokenDetails; - /** A map from ecosystem ID to token details for a Wormhole-wrapped version of the token */ - readonly wrappedDetails: ReadonlyMap; } diff --git a/packages/evm/src/ecosystems/acala.ts b/packages/evm/src/ecosystems/acala.ts index 6364fc690..98795c99e 100644 --- a/packages/evm/src/ecosystems/acala.ts +++ b/packages/evm/src/ecosystems/acala.ts @@ -1,4 +1,4 @@ -import type { GasToken, TokenDetails } from "@swim-io/core"; +import type { GasToken } from "@swim-io/core"; import { Env } from "@swim-io/core"; import { TokenProjectId } from "@swim-io/token-projects"; import { assertType } from "@swim-io/utils"; @@ -10,9 +10,6 @@ import type { } from "../protocol"; import { EVM_PROTOCOL, EvmEcosystemId } from "../protocol"; -const EMPTY_MAP: ReadonlyMap = new Map(); -const SOLANA_ECOSYSTEM_ID = "solana"; - export const acalaChainId = assertType()({ [Env.Mainnet]: 787, [Env.Testnet]: 597, @@ -26,30 +23,8 @@ const mainnet: EvmChainConfig = { portal: "0xae9d7fe007b3327AA64A32824Aaac52C42a6E624", }, publicRpcUrls: ["https://acala-polkadot.api.onfinality.io/public-rpc"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "", // TODO: add when deployed - decimals: 8, // TODO: confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed - tokens: [ - { - id: "mainnet-acala-ausd", - projectId: TokenProjectId.Ausd, - nativeDetails: { - address: "0x0000000000000000000000000000000000000000", // TODO: Update - decimals: 6, // TODO: Update - }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "11111111111111111111111111111112", // TODO: Update - decimals: 6, // TODO: Update - }, - ], - ]), - }, - ], + tokens: [], pools: [], }; @@ -61,29 +36,8 @@ const testnet: EvmChainConfig = { portal: "0xebA00cbe08992EdD08ed7793E07ad6063c807004", }, publicRpcUrls: ["https://acala-dev.aca-dev.network/eth/http"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "", // TODO: add when deployed - decimals: 8, // TODO: confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ - { - id: "testnet-acala-ausd", - projectId: TokenProjectId.Ausd, - nativeDetails: { - address: "0x996f42BdB0CB71F831C2eFB05Ac6d0d226979e5B", - decimals: 12, - }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "BbdPh2Nvpp7XftBHWENJu5dpC5gF5FtCSyFLTU4qNr7g", - decimals: 8, - }, - ], - ]), - }, { id: "testnet-acala-lp-ausd", projectId: TokenProjectId.SwimLpAcalaAusd, @@ -91,7 +45,6 @@ const testnet: EvmChainConfig = { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], diff --git a/packages/evm/src/ecosystems/aurora.ts b/packages/evm/src/ecosystems/aurora.ts index aa51b9ac2..b0aa9959c 100644 --- a/packages/evm/src/ecosystems/aurora.ts +++ b/packages/evm/src/ecosystems/aurora.ts @@ -1,4 +1,4 @@ -import type { GasToken, TokenDetails } from "@swim-io/core"; +import type { GasToken } from "@swim-io/core"; import { Env } from "@swim-io/core"; import { TokenProjectId } from "@swim-io/token-projects"; import { assertType } from "@swim-io/utils"; @@ -10,9 +10,6 @@ import type { } from "../protocol"; import { EVM_PROTOCOL, EvmEcosystemId } from "../protocol"; -const EMPTY_MAP: ReadonlyMap = new Map(); -const SOLANA_ECOSYSTEM_ID = "solana"; - export const auroraChainId = assertType()({ [Env.Mainnet]: 1313161554, [Env.Testnet]: 1313161555, @@ -26,10 +23,6 @@ const mainnet: EvmChainConfig = { portal: "0x51b5123a7b0F9b2bA265f9c4C8de7D78D52f510F", }, publicRpcUrls: ["https://mainnet.aurora.dev/"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "", // TODO: add when deployed - decimals: 8, // TODO: confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -39,15 +32,6 @@ const mainnet: EvmChainConfig = { address: "0xB12BFcA5A55806AaF64E99521918A4bf0fC40802", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "9Y8pJhF8AQGBGL5PTd12P4w82n2qAADTmWakkXSatdAu", - decimals: 6, - }, - ], - ]), }, { id: "mainnet-aurora-usdt", @@ -56,15 +40,6 @@ const mainnet: EvmChainConfig = { address: "0x4988a896b1227218e4A686fdE5EabdcAbd91571f", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "GFhej2oJ1NPLbzSX3D3B9jzYaidff6NoBAUNmu6dLXwU", - decimals: 6, - }, - ], - ]), }, { id: "mainnet-aurora-usn", @@ -73,15 +48,6 @@ const mainnet: EvmChainConfig = { address: "0x5183e1B1091804BC2602586919E6880ac1cf2896", decimals: 18, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "3NDmtc2xKMpm8wCiaALey2y3EGhBkUNuXJ9m3JcjnHMM", - decimals: 8, - }, - ], - ]), }, ], pools: [], @@ -95,10 +61,6 @@ const testnet: EvmChainConfig = { portal: "0xD05eD3ad637b890D68a854d607eEAF11aF456fba", }, publicRpcUrls: ["https://testnet.aurora.dev/"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "", // TODO: add when deployed - decimals: 8, // TODO: confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -108,15 +70,6 @@ const testnet: EvmChainConfig = { address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "B3qmqCvzbni27z5TRrt1uBYMczUCjCjui7piGAZifSTU", - decimals: 6, - }, - ], - ]), }, { id: "testnet-aurora-usdt", @@ -125,15 +78,6 @@ const testnet: EvmChainConfig = { address: "0x489dDcd070b6c4e0373FBB5d529Cc06328E048c3", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "BaTEf2Mnrf9wePKb9g9BtSPkrZmmBnR6K9Q1ZxDKmWoh", - decimals: 6, - }, - ], - ]), }, { id: "testnet-aurora-usn", @@ -142,15 +86,6 @@ const testnet: EvmChainConfig = { address: "0x0000000000000000000000000000000000000000", // TODO: Update decimals: 18, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "11111111111111111111111111111111", // TODO: Update - decimals: 8, - }, - ], - ]), }, { id: "testnet-aurora-lp-usdc-usdt", @@ -159,7 +94,6 @@ const testnet: EvmChainConfig = { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, { id: "testnet-aurora-lp-usn", @@ -168,7 +102,6 @@ const testnet: EvmChainConfig = { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], diff --git a/packages/evm/src/ecosystems/avalanche.ts b/packages/evm/src/ecosystems/avalanche.ts index bdf1b88c6..911332329 100644 --- a/packages/evm/src/ecosystems/avalanche.ts +++ b/packages/evm/src/ecosystems/avalanche.ts @@ -1,4 +1,4 @@ -import type { GasToken, TokenDetails } from "@swim-io/core"; +import type { GasToken } from "@swim-io/core"; import { Env } from "@swim-io/core"; import { TokenProjectId } from "@swim-io/token-projects"; import { assertType } from "@swim-io/utils"; @@ -10,9 +10,6 @@ import type { } from "../protocol"; import { EVM_PROTOCOL, EvmEcosystemId } from "../protocol"; -const EMPTY_MAP: ReadonlyMap = new Map(); -const SOLANA_ECOSYSTEM_ID = "solana"; - export const avalancheChainId = assertType()({ [Env.Mainnet]: 43114, // C-Chain [Env.Testnet]: 43113, @@ -26,10 +23,6 @@ const mainnet: EvmChainConfig = { portal: "0x0e082F06FF657D94310cB8cE8B0D9a04541d8052", }, publicRpcUrls: ["https://api.avax.network/ext/bc/C/rpc"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "", // TODO: add when deployed - decimals: 8, // TODO: confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -39,15 +32,6 @@ const mainnet: EvmChainConfig = { address: "0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "FHfba3ov5P3RjaiLVgh8FTv4oirxQDoVXuoUUDvHuXax", - decimals: 6, - }, - ], - ]), }, { id: "mainnet-avalanche-usdt", @@ -56,15 +40,6 @@ const mainnet: EvmChainConfig = { address: "0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "Kz1csQA91WUGcQ2TB3o5kdGmWmMGp8eJcDEyHzNDVCX", - decimals: 6, - }, - ], - ]), }, ], pools: [], @@ -78,10 +53,6 @@ const testnet: EvmChainConfig = { portal: "0x61E44E506Ca5659E6c0bba9b678586fA2d729756", }, publicRpcUrls: ["https://api.avax-test.network/ext/bc/C/rpc"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "0x5eDEa6B0881425AE4Aa7c65aCa6AeaFecC7E72f5", // TODO: Update if necessary - decimals: 6, - }, routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary tokens: [ { @@ -91,15 +62,6 @@ const testnet: EvmChainConfig = { address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "2t6pVTufn9A4b37oLmex3YMjm3smp1G9tPd9HpAFSeka", - decimals: 6, - }, - ], - ]), }, { id: "testnet-avalanche-usdt", @@ -108,15 +70,6 @@ const testnet: EvmChainConfig = { address: "0x489dDcd070b6c4e0373FBB5d529Cc06328E048c3", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "9ibet2CuBX1a4HpbzH9auxxtyUvkSKVy39jWtZY5Bfor", - decimals: 6, - }, - ], - ]), }, { id: "testnet-avalanche-lp-usdc-usdt", @@ -125,7 +78,6 @@ const testnet: EvmChainConfig = { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], diff --git a/packages/evm/src/ecosystems/bnb.ts b/packages/evm/src/ecosystems/bnb.ts index a93e233a3..e98f5e2d1 100644 --- a/packages/evm/src/ecosystems/bnb.ts +++ b/packages/evm/src/ecosystems/bnb.ts @@ -1,4 +1,4 @@ -import type { GasToken, TokenDetails } from "@swim-io/core"; +import type { GasToken } from "@swim-io/core"; import { Env } from "@swim-io/core"; import { TokenProjectId } from "@swim-io/token-projects"; import { assertType } from "@swim-io/utils"; @@ -10,9 +10,6 @@ import type { } from "../protocol"; import { EVM_PROTOCOL, EvmEcosystemId } from "../protocol"; -const EMPTY_MAP: ReadonlyMap = new Map(); -const SOLANA_ECOSYSTEM_ID = "solana"; - export const bnbChainId = assertType()({ [Env.Mainnet]: 56, [Env.Testnet]: 97, @@ -27,10 +24,6 @@ const mainnet: EvmChainConfig = { portal: "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7", }, publicRpcUrls: ["https://bsc-dataseed1.ninicoin.io/"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "0xF78479d516A12b9cFb000951D19f67B4fE0B065d", // TODO: Update when deployed - decimals: 8, // TODO: Confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -40,15 +33,6 @@ const mainnet: EvmChainConfig = { address: "0xe9e7cea3dedca5984780bafc599bd69add087d56", decimals: 18, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "5RpUwQ8wtdPCZHhu6MERp2RGrpobsbZ6MH5dDHkUjs2", - decimals: 8, - }, - ], - ]), }, { id: "mainnet-bnb-usdt", @@ -57,15 +41,6 @@ const mainnet: EvmChainConfig = { address: "0x55d398326f99059ff775485246999027b3197955", decimals: 18, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "8qJSyQprMC57TWKaYEmetUR3UUiTP2M3hXdcvFhkZdmv", - decimals: 8, - }, - ], - ]), }, { id: "mainnet-bnb-gst", @@ -74,15 +49,6 @@ const mainnet: EvmChainConfig = { address: "0x4a2c860cec6471b9f5f5a336eb4f38bb21683c98", decimals: 8, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "GDuUFXEhUm4jG71vPxYRX3VxUMJ5etGvHTR1iKwTdb6p", - decimals: 8, - }, - ], - ]), }, { id: "mainnet-bnb-gmt", @@ -91,15 +57,6 @@ const mainnet: EvmChainConfig = { address: "0x3019bf2a2ef8040c242c9a4c5c4bd4c81678b2a1", decimals: 8, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "7dzFD8xQ3FDmVLxwn75UA9WhVnBsUdRAexASVvpXX3Bo", - decimals: 8, - }, - ], - ]), }, ], pools: [], @@ -113,10 +70,6 @@ const testnet: EvmChainConfig = { portal: "0x9dcF9D205C9De35334D646BeE44b2D2859712A09", }, publicRpcUrls: ["https://data-seed-prebsc-2-s2.binance.org:8545/"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "0x4C15919A4354b4416e7aFcB9A27a118bc45818C0", // TODO: Update if necessary - decimals: 6, - }, routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary tokens: [ { @@ -126,15 +79,6 @@ const testnet: EvmChainConfig = { address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", decimals: 18, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "6KTvgrkLoPJdB3Grv4ZBUGt6JiLdVnKzJNo4HvLEgm6d", - decimals: 8, - }, - ], - ]), }, { id: "testnet-bnb-usdt", @@ -143,15 +87,6 @@ const testnet: EvmChainConfig = { address: "0x98529E942FD121d9C470c3d4431A008257E0E714", decimals: 18, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "4dr6ogcLsaFf2RDF4LJU1CvNtNKxonVqQvM6vuGdVR1e", - decimals: 8, - }, - ], - ]), }, { id: "testnet-bnb-gst", @@ -160,15 +95,6 @@ const testnet: EvmChainConfig = { address: "0x73160078948280B8680e5F1eB2964698928E8cd7", decimals: 8, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "6oAiihJq1urtb6P8ARjwA6TFoduSoVGxaMb8gEMm5cR6", - decimals: 8, - }, - ], - ]), }, { id: "testnet-bnb-gmt", @@ -177,15 +103,6 @@ const testnet: EvmChainConfig = { address: "0x1F65D61D01E3f10b34B855287b32D7bfbEA088D0", decimals: 8, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "GE2tiQBCoPjCABkoTXa9jTSV8zCVZo8shyiBh8v52hDz", - decimals: 8, - }, - ], - ]), }, { id: "testnet-bnb-lp-busd-usdt", @@ -194,7 +111,6 @@ const testnet: EvmChainConfig = { address: "0x57FCF9B276d3E7D698112D9b87e6f410B1B5d78d", // TODO: Update decimals: 6, }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], @@ -208,10 +124,6 @@ const localnet: EvmChainConfig = { portal: "0x0290FB167208Af455bB137780163b7B7a9a10C16", }, publicRpcUrls: ["http://localhost:8546"], - swimUsdDetails: { - address: "0x7231BBdaB2F3814664f6E1f072A5ae0525709431", // TODO: Update when deployed - decimals: 8, // TODO: Confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -221,15 +133,6 @@ const localnet: EvmChainConfig = { address: "0xCeeFD27e0542aFA926B87d23936c79c276A48277", decimals: 18, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "4X3Fu7ZcRSf7dvKEwwQ8b5xb2jQg2NPNkWs1gDGf1WMg", - decimals: 8, - }, - ], - ]), }, { id: "local-bnb-usdt", @@ -238,15 +141,6 @@ const localnet: EvmChainConfig = { address: "0x988B6CFBf3332FF98FFBdED665b1F53a61f92612", decimals: 18, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "9idXDPGb5jfwaf5fxjiMacgUcwpy3ZHfdgqSjAV5XLDr", - decimals: 8, - }, - ], - ]), }, ], pools: [], diff --git a/packages/evm/src/ecosystems/ethereum.ts b/packages/evm/src/ecosystems/ethereum.ts index 778fa30c1..6cfc6beeb 100644 --- a/packages/evm/src/ecosystems/ethereum.ts +++ b/packages/evm/src/ecosystems/ethereum.ts @@ -1,4 +1,4 @@ -import type { GasToken, TokenDetails } from "@swim-io/core"; +import type { GasToken } from "@swim-io/core"; import { Env } from "@swim-io/core"; import { TokenProjectId } from "@swim-io/token-projects"; import { assertType } from "@swim-io/utils"; @@ -10,9 +10,6 @@ import type { } from "../protocol"; import { EVM_PROTOCOL, EvmEcosystemId } from "../protocol"; -const EMPTY_MAP: ReadonlyMap = new Map(); -const SOLANA_ECOSYSTEM_ID = "solana"; - export const ethereumChainId = assertType()({ [Env.Mainnet]: 1, [Env.Testnet]: 5, @@ -27,10 +24,6 @@ const mainnet: EvmChainConfig = { portal: "0x3ee18B2214AFF97000D974cf647E7C347E8fa585", }, publicRpcUrls: ["https://main-light.eth.linkpool.io/"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "0x01F369bF2d5a62CE60B0a2E92143CD623BeCb0fB", // TODO: Update when deployed - decimals: 8, // TODO: Confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -40,15 +33,6 @@ const mainnet: EvmChainConfig = { address: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "A9mUU4qviSctJVPJdBJWkb28deg915LYJKrzQ19ji3FM", - decimals: 6, - }, - ], - ]), }, { id: "mainnet-ethereum-usdt", @@ -57,15 +41,6 @@ const mainnet: EvmChainConfig = { address: "0xdac17f958d2ee523a2206206994597c13d831ec7", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "Dn4noZ5jgGfkntzcQSUZ8czkreiZ1ForXYoV2H8Dm7S1", - decimals: 6, - }, - ], - ]), }, ], pools: [], @@ -79,10 +54,6 @@ const testnet: EvmChainConfig = { portal: "0xF890982f9310df57d00f659cf4fd87e65adEd8d7", }, publicRpcUrls: ["https://goerli.prylabs.net/"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "0x4873edbb0B4b5b48A6FBe50CacB85e58D0b62ab5", // TODO: Update if necessary - decimals: 6, - }, routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary tokens: [ { @@ -92,15 +63,6 @@ const testnet: EvmChainConfig = { address: "0x45B167CF5b14007Ca0490dCfB7C4B870Ec0C0Aa6", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "7Lf95y8NuCU5RRC95oUtbBtckPAtbr9ubTgrCiyZ1kEf", - decimals: 6, - }, - ], - ]), }, { id: "testnet-ethereum-usdt", @@ -109,15 +71,6 @@ const testnet: EvmChainConfig = { address: "0x996f42BdB0CB71F831C2eFB05Ac6d0d226979e5B", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "8Cfyi1mYXqKATUkMPvb9BMXikdbppJst6E7eQJkKjAtf", - decimals: 6, - }, - ], - ]), }, { id: "testnet-ethereum-lp-usdc-usdt", @@ -126,7 +79,6 @@ const testnet: EvmChainConfig = { address: "0xf3eb1180A64827A602A7e02883b7299191527073", // TODO: Update decimals: 6, }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], @@ -140,10 +92,6 @@ const localnet: EvmChainConfig = { portal: "0x0290FB167208Af455bB137780163b7B7a9a10C16", }, publicRpcUrls: ["http://localhost:8545"], - swimUsdDetails: { - address: "0x56cd8686e818c0C29983eA32fa6938618b35923f", // TODO: Update when deployed - decimals: 8, // TODO: Confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -153,15 +101,6 @@ const localnet: EvmChainConfig = { address: "0xFcCeD5E997E7fb1D0594518D3eD57245bB8ed17E", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "Ep9cMbgyG46b6PVvJNypopc6i8TFzvUVmGiT4MA1PhSb", - decimals: 6, - }, - ], - ]), }, { id: "local-ethereum-usdt", @@ -170,15 +109,6 @@ const localnet: EvmChainConfig = { address: "0xdAA71FBBA28C946258DD3d5FcC9001401f72270F", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "9AGDY4Xa9wDfRZc2LHeSS9iAdH6Bhw6VnMd2t7tkJhYv", - decimals: 6, - }, - ], - ]), }, ], pools: [], diff --git a/packages/evm/src/ecosystems/fantom.ts b/packages/evm/src/ecosystems/fantom.ts index 3d6ec4a49..17d6e932a 100644 --- a/packages/evm/src/ecosystems/fantom.ts +++ b/packages/evm/src/ecosystems/fantom.ts @@ -1,4 +1,4 @@ -import type { GasToken, TokenDetails } from "@swim-io/core"; +import type { GasToken } from "@swim-io/core"; import { Env } from "@swim-io/core"; import { TokenProjectId } from "@swim-io/token-projects"; import { assertType } from "@swim-io/utils"; @@ -10,9 +10,6 @@ import type { } from "../protocol"; import { EVM_PROTOCOL, EvmEcosystemId } from "../protocol"; -const EMPTY_MAP: ReadonlyMap = new Map(); -const SOLANA_ECOSYSTEM_ID = "solana"; - export const fantomChainId = assertType()({ [Env.Mainnet]: 250, [Env.Testnet]: 4002, @@ -26,10 +23,6 @@ const mainnet: EvmChainConfig = { portal: "0x7C9Fc5741288cDFdD83CeB07f3ea7e22618D79D2", }, publicRpcUrls: ["https://rpc.ftm.tools/"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "", // TODO: add when deployed - decimals: 8, // TODO: confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -39,15 +32,6 @@ const mainnet: EvmChainConfig = { address: "0x04068DA6C83AFCFA0e13ba15A6696662335D5B75", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "Dnr8fDaswHtYMSKbtR9e8D5EadyxqyJwE98xp17ZxE2E", - decimals: 6, - }, - ], - ]), }, ], pools: [], @@ -61,10 +45,6 @@ const testnet: EvmChainConfig = { portal: "0x599CEa2204B4FaECd584Ab1F2b6aCA137a0afbE8", }, publicRpcUrls: ["https://rpc.testnet.fantom.network/"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "0x3733E12163A14b7Cbb4E0b5Bf88788975D1DaE9f", // TODO: Update if necessary - decimals: 6, - }, routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary tokens: [ { @@ -74,15 +54,6 @@ const testnet: EvmChainConfig = { address: "0x92934a8b10DDF85e81B65Be1D6810544744700dC", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "9uJH6SjzmoqdiZXjcwYKuRevbYh5tR449FU5pg4rpden", - decimals: 6, - }, - ], - ]), }, { id: "testnet-fantom-lp-usdc", @@ -91,7 +62,6 @@ const testnet: EvmChainConfig = { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], diff --git a/packages/evm/src/ecosystems/karura.ts b/packages/evm/src/ecosystems/karura.ts index 1ec6d55d5..4d4fac968 100644 --- a/packages/evm/src/ecosystems/karura.ts +++ b/packages/evm/src/ecosystems/karura.ts @@ -1,4 +1,4 @@ -import type { GasToken, TokenDetails } from "@swim-io/core"; +import type { GasToken } from "@swim-io/core"; import { Env } from "@swim-io/core"; import { TokenProjectId } from "@swim-io/token-projects"; import { assertType } from "@swim-io/utils"; @@ -10,9 +10,6 @@ import type { } from "../protocol"; import { EVM_PROTOCOL, EvmEcosystemId } from "../protocol"; -const EMPTY_MAP: ReadonlyMap = new Map(); -const SOLANA_ECOSYSTEM_ID = "solana"; - export const karuraChainId = assertType()({ [Env.Mainnet]: 686, [Env.Testnet]: 596, @@ -26,10 +23,6 @@ const mainnet: EvmChainConfig = { portal: "0xae9d7fe007b3327AA64A32824Aaac52C42a6E624", }, publicRpcUrls: ["https://karura.api.onfinality.io/public-rpc"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "", // TODO: add when deployed - decimals: 8, // TODO: confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -39,15 +32,6 @@ const mainnet: EvmChainConfig = { address: "0x0000000000000000000100000000000000000081", decimals: 12, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "3sEvyXzC2vAPqF7uprB2vRaL1X1FbqQqmPxhwVi53GYF", - decimals: 8, - }, - ], - ]), }, { id: "mainnet-karura-usdt", @@ -56,15 +40,6 @@ const mainnet: EvmChainConfig = { address: "0x0000000000000000000500000000000000000007", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "E942z7FnS7GpswTvF5Vggvo7cMTbvZojjLbFgsrDVff1", - decimals: 6, - }, - ], - ]), }, ], pools: [], @@ -78,10 +53,6 @@ const testnet: EvmChainConfig = { portal: "0xd11De1f930eA1F7Dd0290Fe3a2e35b9C91AEFb37", }, publicRpcUrls: ["https://karura-dev.aca-dev.network/eth/http"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "", // TODO: add when deployed - decimals: 8, // TODO: confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -91,15 +62,6 @@ const testnet: EvmChainConfig = { address: "0x074370ca8Fea9e8f1C5eE23f34CBdcD3FB7a66aD", decimals: 12, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "BRpsJtEUyCPQPRP4DAavXU5KmBqfgKQmX7fwnpVvUUMG", - decimals: 8, - }, - ], - ]), }, { id: "testnet-karura-usdt", @@ -108,15 +70,6 @@ const testnet: EvmChainConfig = { address: "0x535d5e3b1ff7de526fe180e654a41350903c328d", decimals: 18, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "AnYj8Rbkfd8FYmoiyv6iDS3Tje7PzhPWyE5VZVDh9pzD", - decimals: 8, - }, - ], - ]), }, { id: "testnet-karura-lp-usdt", @@ -125,7 +78,6 @@ const testnet: EvmChainConfig = { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, { id: "testnet-karura-lp-ausd", @@ -134,7 +86,6 @@ const testnet: EvmChainConfig = { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], diff --git a/packages/evm/src/ecosystems/polygon.ts b/packages/evm/src/ecosystems/polygon.ts index 75b806415..6b65250f0 100644 --- a/packages/evm/src/ecosystems/polygon.ts +++ b/packages/evm/src/ecosystems/polygon.ts @@ -1,4 +1,4 @@ -import type { GasToken, TokenDetails } from "@swim-io/core"; +import type { GasToken } from "@swim-io/core"; import { Env } from "@swim-io/core"; import { TokenProjectId } from "@swim-io/token-projects"; import { assertType } from "@swim-io/utils"; @@ -10,9 +10,6 @@ import type { } from "../protocol"; import { EVM_PROTOCOL, EvmEcosystemId } from "../protocol"; -const EMPTY_MAP: ReadonlyMap = new Map(); -const SOLANA_ECOSYSTEM_ID = "solana"; - export const polygonChainId = assertType()({ [Env.Mainnet]: 137, [Env.Testnet]: 80001, @@ -26,10 +23,6 @@ const mainnet: EvmChainConfig = { portal: "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE", }, publicRpcUrls: ["https://polygon-rpc.com/"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "", // TODO: add when deployed - decimals: 8, // TODO: confirm when deployed - }, routingContractAddress: "", // TODO: add when deployed tokens: [ { @@ -39,15 +32,6 @@ const mainnet: EvmChainConfig = { address: "0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "E2VmbootbVCBkMNNxKQgCLMS1X3NoGMaYAsufaAsf7M", - decimals: 6, - }, - ], - ]), }, { id: "mainnet-polygon-usdt", @@ -56,15 +40,6 @@ const mainnet: EvmChainConfig = { address: "0xc2132D05D31c914a87C6611C10748AEb04B58e8F", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "5goWRao6a3yNC4d6UjMdQxonkCMvKBwdpubU3qhfcdf1", - decimals: 6, - }, - ], - ]), }, ], pools: [], @@ -78,10 +53,6 @@ const testnet: EvmChainConfig = { portal: "0x377D55a7928c046E18eEbb61977e714d2a76472a", }, publicRpcUrls: ["https://rpc-mumbai.maticvigil.com"], // TODO: Think about what is best to recommend to MetaMask - swimUsdDetails: { - address: "0x5558dA18eCFEE96cCC1B0451eEC4e55b5a002cE0", // TODO: Update if necessary - decimals: 6, - }, routingContractAddress: "0x280999aB9aBfDe9DC5CE7aFB25497d6BB3e8bDD4", // TODO: Update if necessary tokens: [ { @@ -91,15 +62,6 @@ const testnet: EvmChainConfig = { address: "0x0a0d7cEA57faCBf5DBD0D3b5169Ab00AC8Cf7dd1", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "D5YvMW5U3HUpD1EstYbKmmZsLdmCPgUj44JqBmNY7fUM", - decimals: 6, - }, - ], - ]), }, { id: "testnet-polygon-usdt", @@ -108,15 +70,6 @@ const testnet: EvmChainConfig = { address: "0x2Ac9183EC64F71AfB73909c7C028Db14d35FAD2F", decimals: 6, }, - wrappedDetails: new Map([ - [ - SOLANA_ECOSYSTEM_ID, - { - address: "2otzQWyoydNp4Ws1kV8J8WVYiun6wmuFMMbicgdoEULn", - decimals: 6, - }, - ], - ]), }, { id: "testnet-polygon-lp-usdc-usdt", @@ -125,7 +78,6 @@ const testnet: EvmChainConfig = { address: "0x1111111111111111111111111111111111111111", // TODO: Update decimals: 8, }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], diff --git a/packages/evm/src/walletAdapters/EvmWalletAdapter.ts b/packages/evm/src/walletAdapters/EvmWalletAdapter.ts index e2ee95028..3b16a1a11 100644 --- a/packages/evm/src/walletAdapters/EvmWalletAdapter.ts +++ b/packages/evm/src/walletAdapters/EvmWalletAdapter.ts @@ -1,6 +1,4 @@ import type { TokenDetails } from "@swim-io/core"; -import type { TokenProjectId } from "@swim-io/token-projects"; -import { TOKEN_PROJECTS_BY_ID } from "@swim-io/token-projects"; import { sleep } from "@swim-io/utils"; import type { Signer } from "ethers"; import { ethers } from "ethers"; @@ -29,7 +27,10 @@ export interface EvmWalletAdapter extends EventEmitter { readonly switchNetwork: (chainId: number) => Promise; readonly registerToken: ( tokenDetails: TokenDetails, - projectId: TokenProjectId, + tokenProject: { + readonly symbol: string; + readonly icon: string; + }, chainId: number, ) => Promise; readonly isUnlocked: () => Promise; @@ -190,7 +191,11 @@ export class EvmWeb3WalletAdapter public async registerToken( tokenDetails: TokenDetails, - projectId: TokenProjectId, + /** compatible with both TokenProjectV1 and TokenProjectV2 */ + tokenProject: { + readonly symbol: string; + readonly icon: string; + }, chainId: number, ): Promise { if (!this.walletProvider) { @@ -206,9 +211,9 @@ export class EvmWeb3WalletAdapter type: "ERC20", // Initially only supports ERC20, but eventually more! options: { address: tokenDetails.address, // The address that the token is at. - symbol: TOKEN_PROJECTS_BY_ID[projectId].symbol, // A ticker symbol or shorthand, up to 5 chars. + symbol: tokenProject.symbol, // A ticker symbol or shorthand, up to 5 chars. decimals: tokenDetails.decimals, // The number of decimals in the token - image: TOKEN_PROJECTS_BY_ID[projectId].icon, // A string url of the token logo + image: tokenProject.icon, // A string url of the token logo }, })) as boolean; return wasAdded; diff --git a/packages/solana/src/ecosystem.ts b/packages/solana/src/ecosystem.ts index ddc6cdecd..db6c2e5ee 100644 --- a/packages/solana/src/ecosystem.ts +++ b/packages/solana/src/ecosystem.ts @@ -1,4 +1,4 @@ -import type { GasToken, TokenDetails } from "@swim-io/core"; +import type { GasToken } from "@swim-io/core"; import { Env } from "@swim-io/core"; import { TokenProjectId } from "@swim-io/token-projects"; import { assertType } from "@swim-io/utils"; @@ -6,10 +6,6 @@ import { assertType } from "@swim-io/utils"; import type { SolanaChainConfig, SolanaEcosystemConfig } from "./protocol"; import { SOLANA_ECOSYSTEM_ID, SOLANA_PROTOCOL } from "./protocol"; -const EMPTY_MAP: ReadonlyMap = new Map(); -const BNB_ECOSYSTEM_ID = "bnb"; -const ETHEREUM_ECOSYSTEM_ID = "ethereum"; - /** Adapted from @solana/spl-token-registry ENV */ export enum SolanaChainId { MainnetBeta = 101, @@ -26,10 +22,6 @@ const mainnet: SolanaChainConfig = { portal: "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb", }, publicRpcUrls: ["https://solana-api.projectserum.com"], - swimUsdDetails: { - address: "BJUH9GJLaMSLV1E7B3SQLCy9eCfyr6zsrwGcpS2MkqR1", - decimals: 8, - }, routingContractAddress: "", // TODO: Add when deployed routingContractStateAddress: "", // TODO: Add when deployed twoPoolContractAddress: "", // TODO: Add when deployed @@ -41,22 +33,6 @@ const mainnet: SolanaChainConfig = { address: "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v", decimals: 6, }, - wrappedDetails: new Map([ - [ - ETHEREUM_ECOSYSTEM_ID, - { - address: "0x41f7B8b9b897276b7AAE926a9016935280b44E97", - decimals: 6, - }, - ], - [ - BNB_ECOSYSTEM_ID, - { - address: "0x91Ca579B0D47E5cfD5D0862c21D5659d39C8eCf0", - decimals: 6, - }, - ], - ]), }, { id: "mainnet-solana-usdt", @@ -65,22 +41,6 @@ const mainnet: SolanaChainConfig = { address: "Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB", decimals: 6, }, - wrappedDetails: new Map([ - [ - ETHEREUM_ECOSYSTEM_ID, - { - address: "0x1CDD2EaB61112697626F7b4bB0e23Da4FeBF7B7C", - decimals: 6, - }, - ], - [ - BNB_ECOSYSTEM_ID, - { - address: "0x49d5cC521F75e13fa8eb4E89E9D381352C897c96", - decimals: 6, - }, - ], - ]), }, { id: "mainnet-solana-gst", @@ -89,7 +49,6 @@ const mainnet: SolanaChainConfig = { address: "AFbX8oGjGpmVFywbVouvhQSRmiW2aR1mohfahi4Y2AdB", decimals: 9, }, - wrappedDetails: EMPTY_MAP, }, { id: "mainnet-solana-gmt", @@ -98,166 +57,6 @@ const mainnet: SolanaChainConfig = { address: "7i5KKsX2weiTkry7jA4ZwSuXGhs5eJBEjY8vVxR4pfRx", decimals: 9, }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, - nativeDetails: { - address: "BJUH9GJLaMSLV1E7B3SQLCy9eCfyr6zsrwGcpS2MkqR1", - decimals: 8, - }, - wrappedDetails: new Map([ - [ - ETHEREUM_ECOSYSTEM_ID, - { - address: "0x01F369bF2d5a62CE60B0a2E92143CD623BeCb0fB", - decimals: 8, - }, - ], - [ - BNB_ECOSYSTEM_ID, - { - address: "0xF78479d516A12b9cFb000951D19f67B4fE0B065d", - decimals: 8, - }, - ], - ]), - }, - { - id: "mainnet-solana-lp-meta-avalanche-usdc", - projectId: TokenProjectId.SwimAvalancheUsdcLp, - nativeDetails: { - address: "DKwsWeqHrB8R1u2DFMHKtq4iqaQNgPgUbHTJyXPqkTzK", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-avalanche-usdt", - projectId: TokenProjectId.SwimAvalancheUsdtLp, - nativeDetails: { - address: "5rwvDmUbcnZTwZ4Zywev2wnDbyDDD2vcsGU2Xmy7aRNS", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-polygon-usdc", - projectId: TokenProjectId.SwimPolygonUsdcLp, - nativeDetails: { - address: "ANFojEXhiEQQoovhBs77XmBQuqbe59UBygRWViyf4945", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-polygon-usdt", - projectId: TokenProjectId.SwimPolygonUsdtLp, - nativeDetails: { - address: "2Nx6L79dHHgHcJtNfZWukQkWZvf5h4bps34zuh1gjtdP", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-gst", - projectId: TokenProjectId.SwimSolanaGstBinanceGstLp, - nativeDetails: { - address: "8YYBkTNhpY9mFdCdZWM6mHNf8J6A9hGfimb33LEiiZ3x", - decimals: 9, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-gmt", - projectId: TokenProjectId.SwimSolanaGmtBinanceGmtLp, - nativeDetails: { - address: "2x7MjgopLXd3qETGLpY19cyZjHvVnGkrwVjTkJnBza4A", - decimals: 9, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-aurora-usdc", - projectId: TokenProjectId.SwimAuroraUsdcLp, - nativeDetails: { - address: "9qRe2nBrR2rTXxRaV1PZN9hZnqq3UXgoFWTbP6NE3MEu", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-aurora-usdt", - projectId: TokenProjectId.SwimAuroraUsdtLp, - nativeDetails: { - address: "4XPDxtGbcM7bAPKZxALd2s862n3WoG4xPPvyCPVULKAb", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-aurora-usn", - projectId: TokenProjectId.SwimAuroraUsnLp, - nativeDetails: { - address: "3eXCU7YoiCq3rZ6787pPFJE7TXBsKuTZ49wH2kFnuTeF", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-fantom-usdc", - projectId: TokenProjectId.SwimFantomUsdcLp, - nativeDetails: { - address: "J5ifGexAQTg76TresJhJSqTPJLT6BNxrV5rwNJTTz4Cx", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-karura-ausd", - projectId: TokenProjectId.SwimKaruraAusdLp, - nativeDetails: { - address: "8vzXSNVAX4fymEFahJFh1ypzDBFv3QMVaZ4GtJWHrRjU", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-karura-usdt", - projectId: TokenProjectId.SwimKaruraUsdtLp, - nativeDetails: { - address: "2sXvitirRSjgTTNzGNWAFZWSqEx87kDoTJvqG9JSyivh", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-meta-acala-ausd", - projectId: TokenProjectId.SwimAcalaAusdLp, - nativeDetails: { - address: "11111111111111111111111111111111", // TODO: Update - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-swim", - projectId: TokenProjectId.Swim, - nativeDetails: { - address: "swimnKEr963p7EbCjsSnBCoYwytuZHPm3zbq6fKLHXb", - decimals: 6, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "mainnet-solana-lp-swimlake", - projectId: TokenProjectId.XSwim, - nativeDetails: { - address: "SwiMNJ49SxkqMaVWLGGVRH25kE5dBnD2RQoiQUnKtMC", - decimals: 6, - }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], @@ -271,10 +70,6 @@ const testnet: SolanaChainConfig = { portal: "DZnkkTmCiFWfYTfT41X3Rd1kDgozqzxWaHqsw6W4x2oe", }, publicRpcUrls: ["https://api.devnet.solana.com"], - swimUsdDetails: { - address: "3ngTtoyP9GFybFifX1dr7gCFXFiM2Wr6NfXn6EuU7k6C", - decimals: 6, - }, routingContractAddress: "9z6G41AyXk73r1E4nTv81drQPtEqupCSAnsLdGV5WGfK", // TODO: Update if necessary routingContractStateAddress: "Dzx6CofYZQwJrvLctW9vbnNJX4ViqFoTV7bjcrWxUbwY", // TODO: Update if necessary twoPoolContractAddress: "8VNVtWUae4qMe535i4yL1gD3VTo8JhcfFEygaozBq8aM", @@ -286,7 +81,6 @@ const testnet: SolanaChainConfig = { address: "6iSRgpK4oiqJZuhpLsTecW3n9xBKUq9N3VPQN7RinYwq", decimals: 6, }, - wrappedDetails: EMPTY_MAP, }, { id: "testnet-solana-usdt", @@ -295,7 +89,6 @@ const testnet: SolanaChainConfig = { address: "8VbikoRxEoyYzTDzDcPTSsGk2E5mM7fK1WrVpKrVd75M", decimals: 6, }, - wrappedDetails: EMPTY_MAP, }, { id: "testnet-solana-gst", @@ -304,7 +97,6 @@ const testnet: SolanaChainConfig = { address: "FYxTtPiGxNSDouZQftVRHFqraFJyLvNbTXzZj8X2gKQP", decimals: 9, }, - wrappedDetails: EMPTY_MAP, }, { id: "testnet-solana-gmt", @@ -313,166 +105,6 @@ const testnet: SolanaChainConfig = { address: "3xsNPBpf7UAKpJsLTqiPqHT3ZBKPDndj1rJFM7xaSJcV", decimals: 9, }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, - nativeDetails: { - address: "5ctnNpb7h1SyPqZ8t8m2kCykrtDGVZBtZgYWv6UAeDhr", - decimals: 8, - }, - wrappedDetails: new Map([ - [ - ETHEREUM_ECOSYSTEM_ID, - { - address: "0x4DF39C514Eb1747bb4D89cA9Ee35718611590935", - decimals: 8, - }, - ], - [ - BNB_ECOSYSTEM_ID, - { - address: "0x84252522366DB2eA1dAaDe5E2C55CD90a50aC46e", - decimals: 8, - }, - ], - ]), - }, - { - id: "testnet-solana-swim", - projectId: TokenProjectId.Swim, - nativeDetails: { - address: "swimnKEr963p7EbCjsSnBCoYwytuZHPm3zbq6fKLHXb", - decimals: 6, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-swimlake", - projectId: TokenProjectId.XSwim, - nativeDetails: { - address: "A8UVBwvj1XcdP5okoMqkjhCQGLaqQ8iJDYnNxAMbsNNF", - decimals: 6, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-avalanche-usdc", - projectId: TokenProjectId.SwimAvalancheUsdcLp, - nativeDetails: { - address: "DU15RXzuPWTLC4tbAcQvtXbDkHFrY8u6CxgTdhz2Mt8c", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-avalanche-usdt", - projectId: TokenProjectId.SwimAvalancheUsdtLp, - nativeDetails: { - address: "D6PuZckpEcBhVcpfgjgbWnARhFD3ApHhvnxBGWR6MW5Z", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-polygon-usdc", - projectId: TokenProjectId.SwimPolygonUsdcLp, - nativeDetails: { - address: "6WBFbyA3XJ3T2BeqA9JbyZFfj3KTCRtnC8MJANBsVNrz", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-polygon-usdt", - projectId: TokenProjectId.SwimPolygonUsdtLp, - nativeDetails: { - address: "HH3RwS94BWhR4bKeNYGvr2CfSLRQ2Kq6EYSDTKgGLgET", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-gst", - projectId: TokenProjectId.SwimSolanaGstBinanceGstLp, - nativeDetails: { - address: "BM3sXSfRg1yKzf2AbTA5QV76MdnKHi9M8D7VCGzDEYM1", - decimals: 9, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-gmt", - projectId: TokenProjectId.SwimSolanaGmtBinanceGmtLp, - nativeDetails: { - address: "5VUZL2JcvbmjuT1DzDyWJ4mwtEH8unKyuQj3k38j8Ngs", - decimals: 9, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-aurora-usdc", - projectId: TokenProjectId.SwimAuroraUsdcLp, - nativeDetails: { - address: "AQiHPuuBPsq4MLLjLv2WHRFbrNB1JHZeR4mQGVJTwVHn", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-aurora-usdt", - projectId: TokenProjectId.SwimAuroraUsdtLp, - nativeDetails: { - address: "utXdXdUMaS5qrBDDUg5btQMGL2CedouzmMPbYMJPEZD", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-aurora-usn", - projectId: TokenProjectId.SwimAuroraUsnLp, - nativeDetails: { - address: "11111111111111111111111111111111", // TODO: Update - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-fantom-usdc", - projectId: TokenProjectId.SwimFantomUsdcLp, - nativeDetails: { - address: "4hmRgsk3hSdK1gXV7rg1pStwYtntKmbcFQyKqsZ4USis", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-karura-ausd", - projectId: TokenProjectId.SwimKaruraAusdLp, - nativeDetails: { - address: "4idDPnTYR4J9YhXmayKZYW8QBrASuuiTAxfkWUeaL3ap", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-karura-usdt", - projectId: TokenProjectId.SwimKaruraUsdtLp, - nativeDetails: { - address: "882uzB9euTbBQJ6MrGrvxjXSTQi23VBQZcLcTH4E5Xow", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "testnet-solana-lp-meta-acala-ausd", - projectId: TokenProjectId.SwimAcalaAusdLp, - nativeDetails: { - address: "BTbHtbUtDX5WAUSxPgELzy9VsbMbKAVFQ2hykNrD3X7L", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, }, ], pools: [ @@ -504,10 +136,6 @@ const localnet: SolanaChainConfig = { portal: "B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE", }, publicRpcUrls: ["http://127.0.0.1:8899"], - swimUsdDetails: { - address: "LPTufpWWSucDqq1hib8vxj1uJxTh2bkE7ZTo65LH4J2", - decimals: 8, - }, routingContractAddress: "", // TODO: Add when deployed routingContractStateAddress: "", // TODO: Add when deployed twoPoolContractAddress: "", // TODO: Add when deployed @@ -519,22 +147,6 @@ const localnet: SolanaChainConfig = { address: "USCAD1T3pV246XwC5kBFXpEjuudS1zT1tTNYhxby9vy", decimals: 6, }, - wrappedDetails: new Map([ - [ - ETHEREUM_ECOSYSTEM_ID, - { - address: "0x81681EC304dcfe2Ddad462E7e968C49A848410c3", - decimals: 6, - }, - ], - [ - BNB_ECOSYSTEM_ID, - { - address: "0x04C5Bf0f72FC1a9F50Ff3228C6285491ad00e13E", - decimals: 6, - }, - ], - ]), }, { id: "local-solana-usdt", @@ -543,64 +155,6 @@ const localnet: SolanaChainConfig = { address: "USTPJc7bSkXxRPP1ZdxihfxtfgWNrcRPrE4KEC6EK23", decimals: 6, }, - wrappedDetails: new Map([ - [ - ETHEREUM_ECOSYSTEM_ID, - { - address: "0xa22915e82eb27fb64988Efa3d2749838174ccCBE", - decimals: 6, - }, - ], - [ - BNB_ECOSYSTEM_ID, - { - address: "0x23F55d75CFBe4334031dc7a19bf030613E966b2B", - decimals: 6, - }, - ], - ]), - }, - { - id: "local-solana-lp-hexapool", - projectId: TokenProjectId.SwimUsd, - nativeDetails: { - address: "LPTufpWWSucDqq1hib8vxj1uJxTh2bkE7ZTo65LH4J2", - decimals: 8, - }, - wrappedDetails: new Map([ - [ - ETHEREUM_ECOSYSTEM_ID, - { - address: "0x56cd8686e818c0C29983eA32fa6938618b35923f", - decimals: 8, - }, - ], - [ - BNB_ECOSYSTEM_ID, - { - address: "0x7231BBdaB2F3814664f6E1f072A5ae0525709431", - decimals: 8, - }, - ], - ]), - }, - { - id: "local-solana-swim", - projectId: TokenProjectId.Swim, - nativeDetails: { - address: "SWMPqjB9AAtpCbatAEEGK67wNBCN1HDW6VypX7E5r9g", - decimals: 6, - }, - wrappedDetails: EMPTY_MAP, - }, - { - id: "local-solana-lp-swimlake", - projectId: TokenProjectId.XSwim, - nativeDetails: { - address: "xSwy12tTsuYwM2Hd7ceNmvDftgxJ2ZSTycjzAfrNwPW", - decimals: 8, - }, - wrappedDetails: EMPTY_MAP, }, ], pools: [], diff --git a/packages/solana/src/wormhole.ts b/packages/solana/src/wormhole.ts index 087db56df..e743bbff5 100644 --- a/packages/solana/src/wormhole.ts +++ b/packages/solana/src/wormhole.ts @@ -17,7 +17,7 @@ import type { VersionedTransactionResponse, } from "@solana/web3.js"; import { PublicKey } from "@solana/web3.js"; -import type { WrappedTokenInfo } from "@swim-io/core/types"; +import type { WrappedTokenInfo } from "@swim-io/core"; import { createMemoIx, createTx } from "./utils"; diff --git a/packages/token-projects/images/lp_gmt.svg b/packages/token-projects/images/lp_gmt.svg deleted file mode 100644 index 0900b51a5..000000000 --- a/packages/token-projects/images/lp_gmt.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-projects/images/lp_gst.svg b/packages/token-projects/images/lp_gst.svg deleted file mode 100644 index 22b4a48db..000000000 --- a/packages/token-projects/images/lp_gst.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-projects/images/sol.svg b/packages/token-projects/images/sol.svg deleted file mode 100644 index 8797740c5..000000000 --- a/packages/token-projects/images/sol.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-projects/images/swim.svg b/packages/token-projects/images/swim.svg deleted file mode 100644 index ff8ec695e..000000000 --- a/packages/token-projects/images/swim.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-projects/images/xswim.svg b/packages/token-projects/images/xswim.svg deleted file mode 100644 index 17de89231..000000000 --- a/packages/token-projects/images/xswim.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/packages/token-projects/src/projects.test.ts b/packages/token-projects/src/projects.test.ts index d6495e0ea..6e7c82dc1 100644 --- a/packages/token-projects/src/projects.test.ts +++ b/packages/token-projects/src/projects.test.ts @@ -28,6 +28,7 @@ describe("Token Project", () => { (tokenProject) => { /* eslint-disable jest/no-conditional-expect */ if (typeof tokenProject.tokenNumber !== "number") { + expect(tokenProject.isLp).toBe(true); expect(tokenProject.tokenNumber).toBeNull(); } else if (tokenProject.isStablecoin && tokenProject.isLp) { // case for swimUSD diff --git a/packages/token-projects/src/projects.ts b/packages/token-projects/src/projects.ts index d68a68e94..018ae393b 100644 --- a/packages/token-projects/src/projects.ts +++ b/packages/token-projects/src/projects.ts @@ -4,52 +4,20 @@ import AUSD_SVG from "./images/ausd"; import BUSD_SVG from "./images/busd"; import GMT_SVG from "./images/gmt"; import GST_SVG from "./images/gst"; -import LP_ACALA_AUSD_SVG from "./images/lp_acala_ausd"; -import LP_AURORA_USDC_SVG from "./images/lp_aurora_usdc"; -import LP_AURORA_USDT_SVG from "./images/lp_aurora_usdt"; -import LP_AURORA_USN_SVG from "./images/lp_aurora_usn"; -import LP_AVALANCHE_USDC_SVG from "./images/lp_avalanche_usdc"; -import LP_AVALANCHE_USDT_SVG from "./images/lp_avalanche_usdt"; -import LP_FANTOM_USDC_SVG from "./images/lp_fantom_usdc"; -import LP_GMT_SVG from "./images/lp_gmt"; -import LP_GST_SVG from "./images/lp_gst"; -import LP_KARURA_AUSD_SVG from "./images/lp_karura_ausd"; -import LP_KARURA_USDT_SVG from "./images/lp_karura_usdt"; -import LP_POLYGON_USDC_SVG from "./images/lp_polygon_usdc"; -import LP_POLYGON_USDT_SVG from "./images/lp_polygon_usdt"; -import SWIM_TOKEN_SVG from "./images/swim"; import SWIM_USD_SVG from "./images/swim_usd"; import USDC_SVG from "./images/usdc"; import USDT_SVG from "./images/usdt"; import USN_SVG from "./images/usn"; -import XSWIM_TOKEN_SVG from "./images/xswim"; export enum TokenProjectId { Ausd = "ausd", Busd = "busd", Gmt = "gmt", Gst = "gst", - Swim = "swim", - SwimAcalaAusdLp = "swim-acala-ausd-lp", - SwimAuroraUsdcLp = "swim-aurora-usdc-lp", - SwimAuroraUsdtLp = "swim-aurora-usdt-lp", - SwimAuroraUsnLp = "swim-aurora-usn-lp", - SwimAvalancheUsdcLp = "swim-avalanche-usdc-lp", - SwimAvalancheUsdtLp = "swim-avalanche-usdt-lp", - SwimFantomUsdcLp = "swim-fantom-usdc-lp", - SwimKaruraAusdLp = "swim-karura-ausd-lp", - SwimKaruraUsdtLp = "swim-karura-usdt-lp", - SwimPolygonUsdcLp = "swim-polygon-usdc-lp", - SwimPolygonUsdtLp = "swim-polygon-usdt-lp", - SwimSolanaGmtBinanceGmtLp = "swim-solana-gmt-binance-gst-lp", - SwimSolanaGstBinanceGstLp = "swim-solana-gst-binance-gst-lp", SwimUsd = "swim-usd", Usdc = "usdc", Usdt = "usdt", Usn = "usn", - XSwim = "xswim", - // V2 - SwimLpSolanaUsdcUsdt = "swim-lp-solana-usdc-usdt", SwimLpEthereumUsdcUsdt = "swim-lp-ethereum-usdc-usdt", SwimLpBnbBusdUsdt = "swim-lp-bnb-busd-usdt", SwimLpAvalancheUsdcUsdt = "swim-lp-avalanche-usdc-usdt", @@ -147,152 +115,6 @@ export const TOKEN_PROJECTS_BY_ID: ReadonlyRecord< }, [TokenProjectId.SwimUsd]: { id: TokenProjectId.SwimUsd, - symbol: "swimUSD", - displayName: "swimUSD (Swim Hexapool LP)", - icon: SWIM_USD_SVG, - isStablecoin: true, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.Swim]: { - id: TokenProjectId.Swim, - symbol: "SWIM", - displayName: "Swim Protocol Token", - icon: SWIM_TOKEN_SVG, - isStablecoin: false, - isLp: false, - tokenNumber: null, - }, - [TokenProjectId.XSwim]: { - id: TokenProjectId.XSwim, - symbol: "xSWIM", - displayName: "xSWIM (SwimLake LP)", - icon: XSWIM_TOKEN_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimAvalancheUsdcLp]: { - id: TokenProjectId.SwimAvalancheUsdcLp, - symbol: "SWIM-AVALANCHE-USDC-LP", - displayName: "Avalanche USDC LP", - icon: LP_AVALANCHE_USDC_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimAvalancheUsdtLp]: { - id: TokenProjectId.SwimAvalancheUsdtLp, - symbol: "SWIM-AVALANCHE-USDT-LP", - displayName: "Avalanche USDT LP", - icon: LP_AVALANCHE_USDT_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimPolygonUsdcLp]: { - id: TokenProjectId.SwimPolygonUsdcLp, - symbol: "SWIM-POLYGON-USDC-LP", - displayName: "Polygon USDC LP", - icon: LP_POLYGON_USDC_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimPolygonUsdtLp]: { - id: TokenProjectId.SwimPolygonUsdtLp, - symbol: "SWIM-POLYGON-USDT-LP", - displayName: "Polygon USDT LP", - icon: LP_POLYGON_USDT_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimSolanaGstBinanceGstLp]: { - id: TokenProjectId.SwimSolanaGstBinanceGstLp, - symbol: "solaGST-binaGST", - displayName: "Swim Solana GST Binance GST LP", - icon: LP_GST_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimSolanaGmtBinanceGmtLp]: { - id: TokenProjectId.SwimSolanaGmtBinanceGmtLp, - symbol: "solaGMT-binaGMT", - displayName: "Swim Solana GMT Binance GMT LP", - icon: LP_GMT_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimAuroraUsdcLp]: { - id: TokenProjectId.SwimAuroraUsdcLp, - symbol: "SWIM-AURORA-USDC-LP", - displayName: "Aurora USDC LP", - icon: LP_AURORA_USDC_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimAuroraUsdtLp]: { - id: TokenProjectId.SwimAuroraUsdtLp, - symbol: "SWIM-AURORA-USDT-LP", - displayName: "Aurora USDT LP", - icon: LP_AURORA_USDT_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimAuroraUsnLp]: { - id: TokenProjectId.SwimAuroraUsnLp, - symbol: "SWIM-AURORA-USN-LP", - displayName: "Aurora USN LP", - icon: LP_AURORA_USN_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimFantomUsdcLp]: { - id: TokenProjectId.SwimFantomUsdcLp, - symbol: "SWIM-FANTOM-USDC-LP", - displayName: "Fantom USDC LP", - icon: LP_FANTOM_USDC_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimKaruraAusdLp]: { - id: TokenProjectId.SwimKaruraAusdLp, - symbol: "SWIM-KARURA-AUSD-LP", - displayName: "Karura AUSD LP", - icon: LP_KARURA_AUSD_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimKaruraUsdtLp]: { - id: TokenProjectId.SwimKaruraUsdtLp, - symbol: "SWIM-KARURA-USDT-LP", - displayName: "Karura USDT LP", - icon: LP_KARURA_USDT_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - [TokenProjectId.SwimAcalaAusdLp]: { - id: TokenProjectId.SwimAcalaAusdLp, - symbol: "SWIM-ACALA-AUSD-LP", - displayName: "Acala AUSD LP", - icon: LP_ACALA_AUSD_SVG, - isStablecoin: false, - isLp: true, - tokenNumber: null, - }, - // V2 - // TODO: Reassign swimUSD to this token - [TokenProjectId.SwimLpSolanaUsdcUsdt]: { - id: TokenProjectId.SwimLpSolanaUsdcUsdt, symbol: "swimUSDv2", // TODO: update displayName: "swimUSD (v2)", // TODO: update icon: SWIM_USD_SVG, // TODO: update diff --git a/yarn.lock b/yarn.lock index 9170f8b16..2ade8ad9c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7426,27 +7426,7 @@ __metadata: languageName: node linkType: hard -"@swim-io/evm@npm:^0.40.0": - version: 0.40.0 - resolution: "@swim-io/evm@npm:0.40.0" - dependencies: - "@swim-io/core": ^0.40.0 - "@swim-io/evm-contracts": ^0.40.0 - "@swim-io/token-projects": ^0.40.0 - "@swim-io/utils": ^0.40.0 - graphql: ^16.6.0 - graphql-request: ^4.3.0 - moralis: ^1.8.0 - peerDependencies: - "@certusone/wormhole-sdk": ^0.6.2 - decimal.js: ^10.3.1 - ethers: ^5.6.9 - eventemitter3: ^4.0.7 - checksum: ba65ee3dcf51c9a4c1e329a7597b41c4226028f2fc76afd57c9e8185b20e04ef5563d47cdf017ec9aa122e148162408b16d544a167c6953b251a77fc83cebdfb - languageName: node - linkType: hard - -"@swim-io/evm@workspace:packages/evm": +"@swim-io/evm@workspace:^, @swim-io/evm@workspace:packages/evm": version: 0.0.0-use.local resolution: "@swim-io/evm@workspace:packages/evm" dependencies: @@ -7972,14 +7952,14 @@ __metadata: "@storybook/node-logger": ^6.5.10 "@storybook/react": ^6.5.10 "@swim-io/aptos": ^0.40.0 - "@swim-io/core": ^0.40.0 + "@swim-io/core": "workspace:^" "@swim-io/eslint-config": "workspace:^" - "@swim-io/evm": ^0.40.0 + "@swim-io/evm": "workspace:^" "@swim-io/evm-contracts": ^0.40.0 "@swim-io/pool-math": ^0.40.0 - "@swim-io/solana": ^0.40.0 + "@swim-io/solana": "workspace:^" "@swim-io/solana-contracts": ^0.40.0 - "@swim-io/token-projects": ^0.40.0 + "@swim-io/token-projects": "workspace:^" "@swim-io/tsconfig": "workspace:^" "@swim-io/utils": ^0.40.0 "@swim-io/wormhole": ^0.40.0