From 567d230ee97995b516e175b379a01e0f70b5d062 Mon Sep 17 00:00:00 2001 From: Chef Yogi <99634186+Chef-Yogi@users.noreply.github.com> Date: Fri, 8 Dec 2023 20:32:00 +0800 Subject: [PATCH] feat: support position manager defiedge vault (#8363) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### 🤖 Generated by Copilot at bd957dc ### Summary 🧮🌐🚀 This pull request adds support for two new third-party vault managers, `RANGE` and `DEFIEDGE`, on the Ethereum and Arbitrum One chains, and improves the UI and logic for displaying and interacting with the vaults. It updates the `position-managers` package with new constants, types, and vault configurations, and the `localization` package with new translations. It also refactors the `PCSVaultCard` and `VaultCards` components to handle different vault managers and strategies, and uses BigNumber for more accurate calculations in the `AddLiquidity` component. > _We're adding new vaults and chains to the code_ > _We're using BigNumber and React Query to lighten the load_ > _We're heaving away on the count of three_ > _We're the finest position managers on the sea_ ### Walkthrough * Rename `PCSVaultCard` component to `ThirdPartyVaultCard` and use BigNumber for ratio calculations ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-55dc4bd66468bf4ad92108e9920f2418ca27b683159f65a6fc435cff8cf3bcdfL1-R19), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-55dc4bd66468bf4ad92108e9920f2418ca27b683159f65a6fc435cff8cf3bcdfL28-R29), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-55dc4bd66468bf4ad92108e9920f2418ca27b683159f65a6fc435cff8cf3bcdfL59-R72)) * Update `VaultCards` component to import and use `ThirdPartyVaultCard` and `isThirdPartyVaultConfig` ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-28a90ac2b30d48c9aaabd08cbfbd4517a167eec04b03d41524eedac25e4e4bceL2-R2), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-28a90ac2b30d48c9aaabd08cbfbd4517a167eec04b03d41524eedac25e4e4bceL15-R15), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-28a90ac2b30d48c9aaabd08cbfbd4517a167eec04b03d41524eedac25e4e4bceL67-R69)) * Modify `AddLiquidity` component to use BigNumber for value changes and add currency decimals as dependencies ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-e2172cb44fb49510cc48b8b246d1ee1e65a184fd8008146c2216d719a5ae5bfbL138-R144)) * Adjust font size and alignment of vault name text in `CardTitle` component ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-e13d3c8b99ea19f9b73d928874e3d7143f17f4999bfcfd11e8d79f65674aa10fL52-R56)) * Add `ACTIVE`, `PASSIVE`, and `PEGGED` strategies to `getStrategyName` function and translations.json file ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-6bfbdfb10e99bf7d75c70a03c8e438ef930522c0b7c95889de1be7693c77a54dR10-R15), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-eb2ab983e2cefc22516cb7814c86346f4b2bd2b971980952868173095d48f459L2835-R2837)) * Add `RANGE` and `DEFIEDGE` managers to `MANAGER` enum and `MANAGERS_CONFIG` object ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-60ad90bd2d936600778ebc9fd0a8c9217b920833b4a9d26ec6053dd52c67dfdeR4-R5), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-60ad90bd2d936600778ebc9fd0a8c9217b920833b4a9d26ec6053dd52c67dfdeR24-R29)) * Add `ETHEREUM` and `ARBITRUM_ONE` chains to `SUPPORTED_CHAIN_IDS` array ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-e349e2e4d8f12a0b7cf06dddf1cf8a7d1ef03071789521e8fe58cb8c5ef1b61eL3-R3)) * Add vault configurations for `RANGE` manager on Ethereum and BSC chains and `DEFIEDGE` manager on Arbitrum One chain ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-a4755333e11111e38a01ff85584a3460c3dc101834572e9d7d895b56f3e62ce8L1-R61), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-c7eafa19538c1186cf38555f3c41f7cf7ef9b781701119dc190ad1a712b7c64aL3), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-c7eafa19538c1186cf38555f3c41f7cf7ef9b781701119dc190ad1a712b7c64aR119-R190), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-89cf6d54f12457c4cd264ae8fa32521b9e6b85de27423dc74c502e6098d00eb7R1-R25)) * Add vaults array for Arbitrum One chain to `VAULTS_CONFIG_BY_CHAIN` object and update `isThirdPartyVaultConfig` and `isPCSVaultConfig` functions ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-32a8dc64ed39e91853f42347e76c4384effe82bece9b6930e4f0306cdab618a6R7), [link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-32a8dc64ed39e91853f42347e76c4384effe82bece9b6930e4f0306cdab618a6L16-R26)) * Add `ACTIVE`, `PASSIVE`, and `PEGGED` strategies to `Strategy` enum ([link](https://github.com/pancakeswap/pancake-frontend/pull/8363/files?diff=unified&w=0#diff-815703f49c5369d61cb9201e297ff5e612d0f3c986fdc1fa1e7e79883a9c15ffR16-R18)) --- .github/workflows/testConfig.yml | 12 +++--- .github/workflows/tsCheck.yml | 6 +-- .github/workflows/unitTests.yml | 2 +- apps/web/src/config/__tests__/vaults.test.ts | 27 +++++++++---- .../PositionManagers/components/AprButton.tsx | 4 +- .../PositionManagers/components/CardTitle.tsx | 6 +-- .../PositionManagers/hooks/useFetchApr.ts | 8 ++-- .../views/PositionManagers/utils/strategy.ts | 2 + .../localization/src/config/translations.json | 3 +- packages/position-managers/constants/index.ts | 8 ---- .../src/constants/managers.ts | 2 + .../src/constants/supportedChains.ts | 10 ++++- .../src/constants/vaults/arb.ts | 26 +++++++++++++ .../src/constants/vaults/base.ts | 26 +++++++++++++ .../src/constants/vaults/bsc.ts | 38 +++++++++++++++++++ .../src/constants/vaults/index.ts | 15 ++++++-- .../src/constants/vaults/zkevm.ts | 23 +++++++++++ .../src/constants/vaults/zksync.ts | 26 +++++++++++++ packages/position-managers/src/types.ts | 3 +- 19 files changed, 206 insertions(+), 41 deletions(-) delete mode 100644 packages/position-managers/constants/index.ts create mode 100644 packages/position-managers/src/constants/vaults/arb.ts create mode 100644 packages/position-managers/src/constants/vaults/base.ts create mode 100644 packages/position-managers/src/constants/vaults/zkevm.ts create mode 100644 packages/position-managers/src/constants/vaults/zksync.ts diff --git a/.github/workflows/testConfig.yml b/.github/workflows/testConfig.yml index 7bb53b68f92e6..aa8128e23dc00 100644 --- a/.github/workflows/testConfig.yml +++ b/.github/workflows/testConfig.yml @@ -3,10 +3,10 @@ name: Test Config on: pull_request: paths: - - 'apps/web/src/config/**' - - 'packages/pools/src/**' - - 'packages/farms/constants/**' - - 'packages/tokens/src/**' + - "apps/web/src/config/**" + - "packages/pools/src/**" + - "packages/farms/constants/**" + - "packages/tokens/src/**" push: branches: - develop @@ -33,8 +33,8 @@ jobs: - name: Set up node@18 uses: actions/setup-node@v3 with: - cache: 'pnpm' - node-version: 18 + cache: "pnpm" + node-version: 18.18.2 - name: Get pnpm store directory id: pnpm-cache diff --git a/.github/workflows/tsCheck.yml b/.github/workflows/tsCheck.yml index cadc01f624681..cb6a8858834b7 100644 --- a/.github/workflows/tsCheck.yml +++ b/.github/workflows/tsCheck.yml @@ -19,8 +19,8 @@ jobs: - name: Set up node@18 uses: actions/setup-node@v3 with: - cache: 'pnpm' - node-version: 18 + cache: "pnpm" + node-version: 18.18.2 - name: Get pnpm store directory id: pnpm-cache @@ -66,7 +66,7 @@ jobs: uses: chefjackson/action-check-typescript@v1.1.3 if: steps.files.outputs.changed == 'true' env: - NODE_OPTIONS: '--max_old_space_size=4096' + NODE_OPTIONS: "--max_old_space_size=4096" with: repo-token: ${{ secrets.GITHUB_TOKEN }} use-check: true diff --git a/.github/workflows/unitTests.yml b/.github/workflows/unitTests.yml index 2791b15499a16..8ec2fe316b57c 100644 --- a/.github/workflows/unitTests.yml +++ b/.github/workflows/unitTests.yml @@ -28,7 +28,7 @@ jobs: - name: Set up node@18 uses: actions/setup-node@v3 with: - cache: 'pnpm' + cache: "pnpm" node-version: 18.18.2 - name: Get pnpm store directory diff --git a/apps/web/src/config/__tests__/vaults.test.ts b/apps/web/src/config/__tests__/vaults.test.ts index 1e306d926bef9..7569fccd89f68 100644 --- a/apps/web/src/config/__tests__/vaults.test.ts +++ b/apps/web/src/config/__tests__/vaults.test.ts @@ -1,11 +1,19 @@ import { ChainId } from '@pancakeswap/chains' -import { vaultsConfigChainMap } from '@pancakeswap/position-managers/constants' +import { VAULTS_CONFIG_BY_CHAIN } from '@pancakeswap/position-managers' import { positionManagerAdapterABI, positionManagerWrapperABI } from '@pancakeswap/position-managers/src/abi' import { pancakeV3PoolABI } from '@pancakeswap/v3-sdk' import { publicClient } from 'utils/client' +import { Address } from 'viem' import { describe, expect, it } from 'vitest' -const mainnetVaults = [vaultsConfigChainMap[ChainId.BSC], vaultsConfigChainMap[ChainId.ETHEREUM]] +const mainnetVaults = [ + VAULTS_CONFIG_BY_CHAIN[ChainId.BSC], + VAULTS_CONFIG_BY_CHAIN[ChainId.ETHEREUM], + VAULTS_CONFIG_BY_CHAIN[ChainId.ARBITRUM_ONE], + VAULTS_CONFIG_BY_CHAIN[ChainId.BASE], + VAULTS_CONFIG_BY_CHAIN[ChainId.ZKSYNC], + VAULTS_CONFIG_BY_CHAIN[ChainId.POLYGON_ZKEVM], +] function hasDuplicates(array: any[]) { return new Set(array).size !== array.length @@ -30,7 +38,8 @@ describe('Config position manger Vault', () => { () => { it.each(mainnetVaults.flat())('Config check adapter address & fee tier', async (vault) => { const client = publicClient({ chainId: vault.currencyA.chainId }) - const [adapterAddress, rewardTokenAddress] = await client.multicall({ + let adapterAddressForTest: Address = '0x' + const [adapterAddr, rewardTokenAddress] = await client.multicall({ contracts: [ { abi: positionManagerWrapperABI, @@ -45,21 +54,25 @@ describe('Config position manger Vault', () => { ], allowFailure: false, }) + // this is for some wrapper contract is not update the address of adapter + if (adapterAddr === '0x0000000000000000000000000000000000000000') adapterAddressForTest = vault.adapterAddress + else adapterAddressForTest = adapterAddr + const [poolAddress, token0Address, token1Address] = await client.multicall({ contracts: [ { abi: positionManagerAdapterABI, - address: adapterAddress, + address: adapterAddressForTest, functionName: 'pool', }, { abi: positionManagerAdapterABI, - address: adapterAddress, + address: adapterAddressForTest, functionName: 'token0', }, { abi: positionManagerAdapterABI, - address: adapterAddress, + address: adapterAddressForTest, functionName: 'token1', }, ], @@ -79,7 +92,7 @@ describe('Config position manger Vault', () => { expect( vault.adapterAddress, "Expected 'adapterAddress' to be the same as the value from the smart contract", - ).toBe(adapterAddress) + ).toBe(adapterAddressForTest) expect(vault.feeTier, "Expected 'feeTier' to be the same as the value from the smart contract").toBe(fee) expect( vault.earningToken.isToken ? vault.earningToken.address : '0x', diff --git a/apps/web/src/views/PositionManagers/components/AprButton.tsx b/apps/web/src/views/PositionManagers/components/AprButton.tsx index 99dfd7c22a983..39035b219fe46 100644 --- a/apps/web/src/views/PositionManagers/components/AprButton.tsx +++ b/apps/web/src/views/PositionManagers/components/AprButton.tsx @@ -1,13 +1,13 @@ import { useTranslation } from '@pancakeswap/localization' import { + CalculateIcon, Flex, + IconButton, RoiCalculatorModal, Skeleton, Text, useModal, useTooltip, - IconButton, - CalculateIcon, } from '@pancakeswap/uikit' import BigNumber from 'bignumber.js' import { useCakePrice } from 'hooks/useCakePrice' diff --git a/apps/web/src/views/PositionManagers/components/CardTitle.tsx b/apps/web/src/views/PositionManagers/components/CardTitle.tsx index b0b22f923c470..3d4e3fdcf7246 100644 --- a/apps/web/src/views/PositionManagers/components/CardTitle.tsx +++ b/apps/web/src/views/PositionManagers/components/CardTitle.tsx @@ -1,11 +1,11 @@ -import { memo, useMemo } from 'react' import { Currency } from '@pancakeswap/sdk' -import { FeeAmount } from '@pancakeswap/v3-sdk' import { Flex, Text } from '@pancakeswap/uikit' +import { FeeAmount } from '@pancakeswap/v3-sdk' +import { memo, useMemo } from 'react' import { CardHeader } from './CardLayout' +import { FarmTag, FeeTag, SingleTokenTag } from './Tags' import { TokenPairLogos } from './TokenPairLogos' -import { FeeTag, FarmTag, SingleTokenTag } from './Tags' interface Props { currencyA: Currency diff --git a/apps/web/src/views/PositionManagers/hooks/useFetchApr.ts b/apps/web/src/views/PositionManagers/hooks/useFetchApr.ts index b8f17e95d4c57..d2a453120b8ba 100644 --- a/apps/web/src/views/PositionManagers/hooks/useFetchApr.ts +++ b/apps/web/src/views/PositionManagers/hooks/useFetchApr.ts @@ -1,12 +1,12 @@ -import { useMemo } from 'react' import { ChainId } from '@pancakeswap/chains' -import { Address } from 'viem' -import { useQuery } from '@tanstack/react-query' -import { useActiveChainId } from 'hooks/useActiveChainId' import { POSITION_MANAGER_API, SUPPORTED_CHAIN_IDS as POSITION_MANAGERS_SUPPORTED_CHAINS, } from '@pancakeswap/position-managers' +import { useQuery } from '@tanstack/react-query' +import { useActiveChainId } from 'hooks/useActiveChainId' +import { useMemo } from 'react' +import { Address } from 'viem' export interface AprDataInfo { token0: number diff --git a/apps/web/src/views/PositionManagers/utils/strategy.ts b/apps/web/src/views/PositionManagers/utils/strategy.ts index e59ff37f25476..9c7fe28aa2da5 100644 --- a/apps/web/src/views/PositionManagers/utils/strategy.ts +++ b/apps/web/src/views/PositionManagers/utils/strategy.ts @@ -13,6 +13,8 @@ export function getStrategyName(t: TranslateFunction, strategy: Strategy) { return t('Passive') case Strategy.PEGGED: return t('Pegged') + case Strategy.ALO: + return t('Automated Liquidity Optimization') default: return '' } diff --git a/packages/localization/src/config/translations.json b/packages/localization/src/config/translations.json index dce46de342d9b..2498ac6b3d528 100644 --- a/packages/localization/src/config/translations.json +++ b/packages/localization/src/config/translations.json @@ -3094,5 +3094,6 @@ "Minutes": "Minutes", "Seconds": "Seconds", "PancakeSwap Meetup": "PancakeSwap Meetup", - "Spain": "Spain" + "Spain": "Spain", + "Automated Liquidity Optimization": "Automated Liquidity Optimization" } diff --git a/packages/position-managers/constants/index.ts b/packages/position-managers/constants/index.ts deleted file mode 100644 index 5ab282ec91a52..0000000000000 --- a/packages/position-managers/constants/index.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ChainId } from '@pancakeswap/chains' -import { vaults as bscVaults } from '../src/constants/vaults/bsc' -import { vaults as ethVaults } from '../src/constants/vaults/eth' - -export const vaultsConfigChainMap = { - [ChainId.ETHEREUM]: ethVaults, - [ChainId.BSC]: bscVaults, -} diff --git a/packages/position-managers/src/constants/managers.ts b/packages/position-managers/src/constants/managers.ts index 5ed4b7fa33199..1dd642b70749d 100644 --- a/packages/position-managers/src/constants/managers.ts +++ b/packages/position-managers/src/constants/managers.ts @@ -2,6 +2,7 @@ export enum MANAGER { PCS = 'pcs-position-manager', BRIL = 'bril-position-manager', RANGE = 'range-protocol-pr-position-manager', + DEFIEDGE = 'defiedge-position-manager', } export interface BaseManager { @@ -25,6 +26,7 @@ export const baseManagers: { [manager in MANAGER]: BaseManager } = { name: 'Range Protocol', introLink: 'https://www.rangeprotocol.com/', }, + [MANAGER.DEFIEDGE]: { id: MANAGER.DEFIEDGE, name: 'DefiEdge', introLink: 'https://www.defiedge.io/' }, } export const VERIFIED_MANAGERS = [MANAGER.PCS] diff --git a/packages/position-managers/src/constants/supportedChains.ts b/packages/position-managers/src/constants/supportedChains.ts index 458b9519f9d97..c95e26ade7e1d 100644 --- a/packages/position-managers/src/constants/supportedChains.ts +++ b/packages/position-managers/src/constants/supportedChains.ts @@ -1,5 +1,13 @@ import { ChainId } from '@pancakeswap/chains' -export const SUPPORTED_CHAIN_IDS = [ChainId.BSC, ChainId.BSC_TESTNET, ChainId.ETHEREUM] as const +export const SUPPORTED_CHAIN_IDS = [ + ChainId.BSC, + ChainId.BSC_TESTNET, + ChainId.ETHEREUM, + ChainId.ARBITRUM_ONE, + ChainId.BASE, + // ChainId.POLYGON_ZKEVM, + ChainId.ZKSYNC, +] as const export type SupportedChainId = (typeof SUPPORTED_CHAIN_IDS)[number] diff --git a/packages/position-managers/src/constants/vaults/arb.ts b/packages/position-managers/src/constants/vaults/arb.ts new file mode 100644 index 0000000000000..44df86f862891 --- /dev/null +++ b/packages/position-managers/src/constants/vaults/arb.ts @@ -0,0 +1,26 @@ +import { arbitrumTokens } from '@pancakeswap/tokens' +import { FeeAmount } from '@pancakeswap/v3-sdk' +import { Strategy, VaultConfig } from '../../types' +import { MANAGER } from '../managers' + +export const vaults: VaultConfig[] = [ + { + id: 1, + idByManager: 1, + name: 'DEFIEDGE', + address: '0x4fa0c6FC2d0d7b6cDa4215Ff09e8ed444F87dDB3', + adapterAddress: '0xaCAbb974b3c97f8F521634AcaC6ce1D9A1557BFb', + currencyA: arbitrumTokens.weth, + currencyB: arbitrumTokens.arb, + earningToken: arbitrumTokens.cake, + feeTier: FeeAmount.LOW, + strategy: Strategy.ALO, + manager: MANAGER.DEFIEDGE, + isSingleDepositToken: false, + allowDepositToken0: true, + allowDepositToken1: true, + managerInfoUrl: 'https://www.defiedge.io/', + strategyInfoUrl: 'https://docs.defiedge.io/category/strategy-manager', + learnMoreAboutUrl: 'https://docs.defiedge.io/category/strategy-manager', + }, +] diff --git a/packages/position-managers/src/constants/vaults/base.ts b/packages/position-managers/src/constants/vaults/base.ts new file mode 100644 index 0000000000000..f6dad848b3a53 --- /dev/null +++ b/packages/position-managers/src/constants/vaults/base.ts @@ -0,0 +1,26 @@ +import { baseTokens } from '@pancakeswap/tokens' +import { FeeAmount } from '@pancakeswap/v3-sdk' +import { Strategy, VaultConfig } from '../../types' +import { MANAGER } from '../managers' + +export const vaults: VaultConfig[] = [ + { + id: 1, + idByManager: 1, + name: 'DEFIEDGE', + address: '0x5fF47dE6F96937eB24d1Ae1A9036b5963418208b', + adapterAddress: '0xFB90a3F1822fa3Da84C984272a6266Cf336A1807', + currencyA: baseTokens.usdc, + currencyB: baseTokens.usdbc, + earningToken: baseTokens.cake, + feeTier: FeeAmount.LOWEST, + strategy: Strategy.ALO, + manager: MANAGER.DEFIEDGE, + isSingleDepositToken: false, + allowDepositToken0: true, + allowDepositToken1: true, + managerInfoUrl: 'https://www.defiedge.io/', + strategyInfoUrl: 'https://docs.defiedge.io/category/strategy-manager', + learnMoreAboutUrl: 'https://docs.defiedge.io/category/strategy-manager', + }, +] diff --git a/packages/position-managers/src/constants/vaults/bsc.ts b/packages/position-managers/src/constants/vaults/bsc.ts index 594c6791ed8a4..5c6ca65a7e8fe 100644 --- a/packages/position-managers/src/constants/vaults/bsc.ts +++ b/packages/position-managers/src/constants/vaults/bsc.ts @@ -4,6 +4,44 @@ import { Strategy, VaultConfig } from '../../types' import { MANAGER } from '../managers' export const vaults: VaultConfig[] = [ + { + id: 12, + idByManager: 1, + name: 'DEFIEDGE', + address: '0xf27fbD1c916672d6057416BA186FDde45fa980D7', + adapterAddress: '0xD9fA26BaB321763b1e77bCc0e18EDF7Ee0081962', + currencyA: bscTokens.cake, + currencyB: bscTokens.wbnb, + earningToken: bscTokens.cake, + feeTier: FeeAmount.MEDIUM, + strategy: Strategy.ALO, + manager: MANAGER.DEFIEDGE, + isSingleDepositToken: false, + allowDepositToken0: true, + allowDepositToken1: true, + managerInfoUrl: 'https://www.defiedge.io/', + strategyInfoUrl: 'https://docs.defiedge.io/category/strategy-manager', + learnMoreAboutUrl: 'https://docs.defiedge.io/category/strategy-manager', + }, + { + id: 13, + idByManager: 2, + name: 'DEFIEDGE', + address: '0x72A326D1e71Ff5c52849e3F27F7CFdA01eB27Fe7', + adapterAddress: '0xeC0cc9D2dfBc1Ba36B2843A8BCB3aF7dd4FdB891', + currencyA: bscTokens.usdt, + currencyB: bscTokens.wbnb, + earningToken: bscTokens.cake, + feeTier: FeeAmount.LOW, + strategy: Strategy.ALO, + manager: MANAGER.DEFIEDGE, + isSingleDepositToken: false, + allowDepositToken0: true, + allowDepositToken1: true, + managerInfoUrl: 'https://www.defiedge.io/', + strategyInfoUrl: 'https://docs.defiedge.io/category/strategy-manager', + learnMoreAboutUrl: 'https://docs.defiedge.io/category/strategy-manager', + }, { id: 11, idByManager: 7, diff --git a/packages/position-managers/src/constants/vaults/index.ts b/packages/position-managers/src/constants/vaults/index.ts index a306014c2c680..b62a51c9aec33 100644 --- a/packages/position-managers/src/constants/vaults/index.ts +++ b/packages/position-managers/src/constants/vaults/index.ts @@ -1,10 +1,13 @@ import { ChainId } from '@pancakeswap/chains' - import { PCSDuoTokenVaultConfig, VaultConfig } from '../../types' +import { MANAGER } from '../managers' import { SupportedChainId } from '../supportedChains' -import { vaults as ethVaults } from './eth' +import { vaults as arbVaults } from './arb' +import { vaults as baseVaults } from './base' import { vaults as bscVaults } from './bsc' -import { MANAGER } from '../managers' +import { vaults as ethVaults } from './eth' +import { vaults as zkevmVault } from './zkevm' +import { vaults as zksyncVault } from './zksync' export type VaultsConfigByChain = { [chainId in SupportedChainId]: VaultConfig[] @@ -13,6 +16,10 @@ export type VaultsConfigByChain = { export const VAULTS_CONFIG_BY_CHAIN = { [ChainId.ETHEREUM]: ethVaults, [ChainId.BSC]: bscVaults, + [ChainId.ARBITRUM_ONE]: arbVaults, + [ChainId.BASE]: baseVaults, + [ChainId.ZKSYNC]: zksyncVault, + [ChainId.POLYGON_ZKEVM]: zkevmVault, } export function isPCSVaultConfig(config: VaultConfig): config is PCSDuoTokenVaultConfig { @@ -20,5 +27,5 @@ export function isPCSVaultConfig(config: VaultConfig): config is PCSDuoTokenVaul } export function isThirdPartyVaultConfig(config: VaultConfig): config is PCSDuoTokenVaultConfig { - return config.manager === MANAGER.BRIL || config.manager === MANAGER.RANGE + return config.manager === MANAGER.BRIL || config.manager === MANAGER.RANGE || config.manager === MANAGER.DEFIEDGE } diff --git a/packages/position-managers/src/constants/vaults/zkevm.ts b/packages/position-managers/src/constants/vaults/zkevm.ts new file mode 100644 index 0000000000000..8b638f67edf65 --- /dev/null +++ b/packages/position-managers/src/constants/vaults/zkevm.ts @@ -0,0 +1,23 @@ +import { VaultConfig } from '../../types' + +export const vaults: VaultConfig[] = [ + // { + // id: 1, + // idByManager: 1, + // name: 'DEFIEDGE', + // address: '0xf018553be929c0B4Bd16360d1FB9c523Ec1F9612', + // adapterAddress: '0x656D34cc7602b08dA12A4C6bA80c9172Dcd8dF6c', + // currencyA: polygonZkEvmTokens.weth, + // currencyB: polygonZkEvmTokens.usdc, + // earningToken: polygonZkEvmTokens.matic, + // feeTier: FeeAmount.LOW, + // strategy: Strategy.ALO, + // manager: MANAGER.DEFIEDGE, + // isSingleDepositToken: false, + // allowDepositToken0: true, + // allowDepositToken1: true, + // managerInfoUrl: 'https://www.defiedge.io/', + // strategyInfoUrl: 'https://docs.defiedge.io/category/strategy-manager', + // learnMoreAboutUrl: 'https://docs.defiedge.io/category/strategy-manager', + // }, +] diff --git a/packages/position-managers/src/constants/vaults/zksync.ts b/packages/position-managers/src/constants/vaults/zksync.ts new file mode 100644 index 0000000000000..343eeba15cef0 --- /dev/null +++ b/packages/position-managers/src/constants/vaults/zksync.ts @@ -0,0 +1,26 @@ +import { zksyncTokens } from '@pancakeswap/tokens' +import { FeeAmount } from '@pancakeswap/v3-sdk' +import { Strategy, VaultConfig } from '../../types' +import { MANAGER } from '../managers' + +export const vaults: VaultConfig[] = [ + { + id: 1, + idByManager: 1, + name: 'DEFIEDGE', + address: '0x43Da8432E9015C6660B927d842CD239df28Ffacf', + adapterAddress: '0xa4a1306754c1Bf0d72BFCE38f408D5eaE3863c3B', + currencyA: zksyncTokens.usdc, + currencyB: zksyncTokens.weth, + earningToken: zksyncTokens.cake, + feeTier: FeeAmount.LOW, + strategy: Strategy.ALO, + manager: MANAGER.DEFIEDGE, + isSingleDepositToken: false, + allowDepositToken0: true, + allowDepositToken1: true, + managerInfoUrl: 'https://www.defiedge.io/', + strategyInfoUrl: 'https://docs.defiedge.io/category/strategy-manager', + learnMoreAboutUrl: 'https://docs.defiedge.io/category/strategy-manager', + }, +] diff --git a/packages/position-managers/src/types.ts b/packages/position-managers/src/types.ts index dab9f16f1c063..35e6cb753adef 100644 --- a/packages/position-managers/src/types.ts +++ b/packages/position-managers/src/types.ts @@ -2,7 +2,7 @@ import { Currency, CurrencyAmount, Percent, Price } from '@pancakeswap/sdk' import { FeeAmount } from '@pancakeswap/v3-sdk' import { Address, Hash } from 'viem' -import { MANAGER, BaseManager } from './constants/managers' +import { BaseManager, MANAGER } from './constants/managers' export enum OnChainActionType { ADD_LIQUIDITY, @@ -16,6 +16,7 @@ export enum Strategy { ACTIVE, PASSIVE, PEGGED, + ALO, } export interface OnChainActionResponse {