import { SDKToken } from '../type'; import { DexKey } from './dexConfig'; export enum ThegraphKeyMap { bsc = 'bsc', eth = 'ethereum-mainnet', ethereum = 'ethereum', heco = 'heco', polygon = 'polygon', arbitrum = 'arbitrum', okchain = 'okchain', boba = 'boba', optimism = 'optimism', moonriver = 'moonriver', aurora = 'aurora', avalanche = 'avalanche', gor = 'gor', kcs = 'kcs', basegor = 'basegor', cfx = 'cfx', scrAlpha = 'scr-alpha', base = 'base', linea = 'linea', scrSepolia = 'scr-sepolia', scr = 'scr', manta = 'manta', mantle = 'mantle', tokb = 'tokb', sep = 'sepolia', dodochainTestnet = 'dodochain-testnet', btr = 'btr', zircuitTestnet = 'zircuit-testnet', arbSep = 'arb-sep', zircuitMainnet = 'zircuit-mainnet', okb = 'okb', zeroSepolia = 'zero-testnet', zeroMainnet = 'zero-mainnet', hsk = 'hashkey', hemi = 'hemi' } export const ThegraphKeyChainIdMap = { [ThegraphKeyMap.bsc]: 56, [ThegraphKeyMap.eth]: 1, [ThegraphKeyMap.ethereum]: 1, [ThegraphKeyMap.gor]: 5, [ThegraphKeyMap.heco]: 128, [ThegraphKeyMap.polygon]: 137, [ThegraphKeyMap.arbitrum]: 42161, [ThegraphKeyMap.okchain]: 66, [ThegraphKeyMap.boba]: 288, [ThegraphKeyMap.optimism]: 10, [ThegraphKeyMap.moonriver]: 1285, [ThegraphKeyMap.aurora]: 1313161554, [ThegraphKeyMap.avalanche]: 43114, [ThegraphKeyMap.kcs]: 321, [ThegraphKeyMap.basegor]: 84531, [ThegraphKeyMap.cfx]: 1030, [ThegraphKeyMap.scrAlpha]: 534353, [ThegraphKeyMap.base]: 8453, [ThegraphKeyMap.linea]: 59144, [ThegraphKeyMap.scrSepolia]: 534351, [ThegraphKeyMap.scr]: 534352, [ThegraphKeyMap.manta]: 169, [ThegraphKeyMap.mantle]: 5000, [ThegraphKeyMap.tokb]: 195, [ThegraphKeyMap.sep]: 11155111, [ThegraphKeyMap.dodochainTestnet]: 53457, [ThegraphKeyMap.btr]: 200901, [ThegraphKeyMap.zircuitTestnet]: 48899, [ThegraphKeyMap.arbSep]: 421614, [ThegraphKeyMap.zircuitMainnet]: 48900, [ThegraphKeyMap.okb]: 196, [ThegraphKeyMap.zeroSepolia]: 4457845, [ThegraphKeyMap.zeroMainnet]: 543210, [ThegraphKeyMap.hsk]: 177, [ThegraphKeyMap.hemi]: 43111, }; /** * * @see https://docs.metamask.io/guide/rpc-api.html#wallet-addethereumchain */ interface AddChainParameter { chainId: string; // A 0x-prefixed hexadecimal string chainName: string; nativeCurrency: { name: string; symbol: string; // 2-6 characters long decimals: 18; }; rpcUrls: string[]; blockExplorerUrls?: string[]; iconUrls?: string[]; // Currently ignored. } // Ethereum 链或者是测试链钱包都会默认支持,只需要切换,不需要其他参数 interface AddEthereumChainParameter { // Ethereum | Rinkeby | Goerli | optimistic kovan | boba rinkeby | 97 | Sepolia chainId: '0x1' | '0x4' | '0x5' | '0x45' | '0x1c' | '0x61' | '0xaa36a7'; } export interface PrivacySwapSupplierEndpointI { key: string; name: string; logo: string; docUrl: string; /** 添加链的配置 */ addChainParameters: AddChainParameter; /** 是否在该节点的检查方法 */ isPrivacyEndpoint: { contract: string; rpcMethod: string; } | null; } /** * 链配置 * @see https://github.com/ethereum-lists/chains/blob/master/_data/chains/eip155-421611.json */ export interface Chain { /** 是否启用对这条链的支持 */ enable: boolean; name?: string; chainId: number; /** * @deprecated */ chain?: string; /** for price-api https://www.notion.so/dodotopia/7e47296da3e54a158e2af775f15d22ef network */ platformId: string; /** network 简称 */ network?: | 'ETH' | 'BSC' | 'Heco' | 'Polygon' | 'Arbitrum' | 'OKTC' | 'Optimism' | 'Goerli' | 'basegor' | 'cfx' | 'scr-alpha' | 'base' | 'linea' | 'scr-sepolia' | 'scr' | 'manta' | 'mantle' | 'tokb' | 'Sepolia' | 'dodochain-testnet' | 'btr' | 'zircuit-testnet' | 'arb-sep' | 'zircuit-mainnet' | 'okb' | 'zero-sepolia' | 'zero-mainnet' | 'hashkey' | 'hemi'; networkId?: number; /** online-config 对应的 url */ configUrl: string; /** online-nft-config 对应的 url */ nftConfigUrl?: string; /* subgraph where.chain 对应值 */ thegraphKey: ThegraphKeyMap; /// Used for fetching circulation. cirAddress?: string; fromTokenInit?: SDKToken; toTokenInit?: SDKToken; /** etherscan.io or bscscan.com website url domain */ scanUrlDomain: string; /** 出块时间:单位是毫秒; layer2 使用 主网 ETH 出块时间,主要用于计算挖矿相关数据(可以用 getBlockTime 方法计算得到) */ blockTime: number; /** * 是否是不稳定的出块时间 * @see https://www.notion.so/dodotopia/cfe980c59fb34c7eb4ccebf36df6cf1f?pvs=4 */ isUnstableBlockTime?: boolean; /** * --------- features --------- * @see https://www.notion.so/dodotopia/feature-410be668941d47cdbc67b3e730daed6b */ /** 是否支持 bsc 交易挖矿 */ bscTradeMiningEnable?: boolean; /** 是否支持 vDODO */ vDODOEnable?: boolean; /** 是否支持预挖矿 */ preminingEnable?: boolean; /** 是否支持 dsp 池子 */ dspPoolEnable?: boolean; /** 询价目标 */ providerCandidates: Array; /** 跨链交易询价目标 */ bridgeProviderCandidates: Array; /** gasprice 标准 */ gaspriceStandard: { good: 40000000000 | 20000000000; great: 30000000000 | 15000000000; }; /** 提交上链结果后对应的区块链浏览器,说明文案的 key */ viewOnScanKey: string; /** gas对应的预估上链时间 * @deprecated */ gasSelectSpeeds?: { rapid: string; fast: string; medium: string; }; /** 是否启用 nft 功能 */ nftEnable?: boolean; /** limit-order 合约地址,合约名称:DODOLimitOrder */ limitOrderContract?: string; /** limit-order bot 地址,合约名称:DODOLimitOrderBot */ limitOrderBotAddress?: string; /** dex 平台配置 key,从 dexConfig.ts 获取详情 */ dexKeys?: DexKey[]; /** * 添加链或切换链到 metamask 的配置 * @see https://docs.metamask.io/guide/rpc-api.html#usage-with-wallet-switchethereumchain */ addChainParameters: AddChainParameter | AddEthereumChainParameter; /** ledger app 名称 */ ledgerAppName?: string; /** 当前链是否为测试链 */ isTestNet?: boolean; /** * 是否启用 v2 路由,具有收费功能 * @deprecated 已全面启用,此字段废弃 */ routeV2Enable?: boolean; /** * 询价接口改造 * @see https://www.notion.so/dodotopia/802328f5601f49c0821076473bc2982d?pvs=4 */ routeV3Enable?: boolean; /** 交易最大滑点提示:如果是 5% 则为 5 */ swapSlippageMaxSlippagePercentage?: number; /** 隐私交易的 supplier 节点列表;数量大于0表示支持隐私交易 */ privacySwapSupplierEndpoints?: PrivacySwapSupplierEndpointI[]; /** 平台币预留部分 gas. 为 undefined 默认为 0.02 */ platformGasReserve?: number; /** dPoints banner 位置; 默认为 below-tabs */ dPointsBannerPosition?: 'above-tabs' | 'below-tabs'; } /** * 合约相关的配置 * 字段注释为合约在 etherscan 上的名称 */ export interface ContractConfigDataI { /** WETH9 or WrappedEther */ WETH: { symbol: string; address: string; decimals: number; name: string; source: string; }; /** DODOBscToken */ DODO_TOKEN: string; /** ERC20Helper */ ERC20_HELPER: string; /** DODOCalleeHelper */ CALLEE_HELPER: string; /** DODOApprove */ DODO_APPROVE: string; /** DODOApproveProxy */ DODO_APPROVE_PROXY?: string; /** DODOV2Proxy02 */ DODO_PROXY: string; /** DODODspProxy */ DODO_DSP_PROXY: string; /** * DODODspProxy * * DSPProxy 兼容DSP和GSP * * 不存在则不支持创建 GSP * * @see https://sepolia.etherscan.io/address/0xAf79850Be27E6f9BbBc6923C88661a997d0f7583#code * @see https://www.notion.so/dodotopia/GSP-0f5a4022c3f94eb39cefab995fd5ea7f?pvs=4 */ DODODspProxy?: string; /** DODODppProxy */ DODO_DPP_PROXY: string; /** DODOV1Proxy */ DODO_V1_PAIR_PROXY?: string; /** ERC20V3Factory */ ERC20V3_FACTORY: string; /** * CrowdPooling */ /** DODOCpProxy */ DODO_CP_PROXY_V2: string; /** FeeRateDIP3Impl */ FEE_RATE_IMPL: string; /** DODOMineV3Proxy */ DODO_MINEV3_PROXY: string; /** DODOStarterProxy */ DODO_STARTER_PROXY?: string; /** MulticallWithValid */ MULTI_CALL_WITH_VALID: string; /** DODOV1PmmHelper */ ROUTE_V1_DATA_FETCH: string; /** DODOV2RouteHelper */ ROUTE_V2_DATA_FETCH: string; /** vDODOToken */ vDODO?: string; vDODO_DODO_TEAM?: string; // DODONFT ROUTE_NFT_DATA_FETCH?: string; DODO_NFT_PROXY?: string; BUYOUT_MODEL?: string; DODO_NFT_REGISTER?: string; DODO_NFT_ERC721?: string; DODO_NFT_ERC1155?: string; DODO_NFTPOOL_PROXY?: string; DODO_NFT_APPROVE?: string; DODO_DROPS_PROXY?: string; /** * D3MM */ /** D3Proxy */ D3Proxy?: string; /** D3Vault */ D3Vault?: string; /** MarginTrading */ MARGIN_TRADING?: string; /** MarginTradingFactory */ MARGIN_TRADING_FACTORY?: string; /** InitializableImmutableAdminUpgradeabilityProxy */ AAVE_LENDING_POOL?: string; /** AaveProtocolDataProvider */ AAVE_PROTOCOL_DATA_PROVIDER?: string; /** LendingPoolAddressesProvider */ AAVE_LENDING_POOL_ADDRESSES_PROVIDER?: string; /** Account */ /** * _MAINTAINER_ * https://github.com/DODOEX/contractV2/blob/main/config/eth-config.js#L71 * 资金池默认的 maintainer * zirong 说这个有可能是数组,所以先预留了数组的类型 */ DEFAULT_MAINTAINER?: string | string[]; }