Skip to content

Commit

Permalink
feat: add berachain
Browse files Browse the repository at this point in the history
  • Loading branch information
junjieit committed Feb 13, 2025
1 parent f6ced2f commit a7dbde8
Show file tree
Hide file tree
Showing 11 changed files with 62 additions and 35 deletions.
2 changes: 1 addition & 1 deletion packages/dodoex-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dodoex/api",
"version": "3.0.3-bartio.2",
"version": "3.0.3-bartio.3",
"description": "DODO API Kit",
"source": "src/index.ts",
"types": "dist/types/index.d.ts",
Expand Down
7 changes: 7 additions & 0 deletions packages/dodoex-api/src/chainConfig/basicToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,13 @@ export const basicTokenMap: {
wrappedTokenSymbol: 'WBERA',
wrappedTokenAddress: '0x7507c1dc16935B82698e4C63f2746A2fCf994dF8',
},
[ChainId.BERA_CHAIN]: {
...DEFAULT_BASIC_TOKEN,
symbol: 'BERA',
name: 'Wrapped BERA',
wrappedTokenSymbol: 'WBERA',
wrappedTokenAddress: '0x6969696969696969696969696969696969696969',
},
[ChainId.TAIKO]: {
...DEFAULT_BASIC_TOKEN,
wrappedTokenAddress: '0xA51894664A773981C6C112C43ce576f315d5b1B6',
Expand Down
2 changes: 2 additions & 0 deletions packages/dodoex-api/src/chainConfig/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export enum ChainId {

BARTIO_TESTNET = 80084,

BERA_CHAIN = 80094,

TAIKO = 167000,

PLUME = 98865,
Expand Down
15 changes: 15 additions & 0 deletions packages/dodoex-api/src/chainConfig/contractConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
plume,
plumeTestnet,
berachainTestnet,
berachain,
} from '@dodoex/dodo-contract-request';
import { ChainId } from './chain';

Expand Down Expand Up @@ -363,6 +364,20 @@ const contractMap: {
DODO_DPP_PROXY: berachainTestnet.DODODppProxy,
DODO_MINEV3_PROXY: berachainTestnet.DODOMineV3Proxy,
},
[ChainId.BERA_CHAIN]: {
MULTI_CALL: berachain.MulticallWithValid,
DODO_APPROVE: berachain.DODOApprove,
ERC20_HELPER: berachain.ERC20Helper,

ROUTE_V2_DATA_FETCH: berachain.DODOV2RouteHelper,
ROUTE_V1_DATA_FETCH: berachain.DODOV1PmmHelper,
CALLEE_HELPER: berachain.DODOCalleeHelper,

DODO_PROXY: berachain.DODOV2Proxy02,
DODO_DSP_PROXY: berachain.DODODspProxyWithoutGSP,
DODO_DPP_PROXY: berachain.DODODppProxy,
DODO_MINEV3_PROXY: berachain.DODOMineV3Proxy,
},
};

export default contractMap;
1 change: 1 addition & 0 deletions packages/dodoex-api/src/chainConfig/platform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export const platformIdMap: {
[ChainId.SEPOLIA]: 'sepolia',
[ChainId.DODO_CHAIN_TESTNET]: 'dodochain-testnet',
[ChainId.BARTIO_TESTNET]: 'berachain-testnet',
[ChainId.BERA_CHAIN]: 'berachain',
[ChainId.TAIKO]: 'taiko',
[ChainId.PLUME]: 'plume',
[ChainId.PLUME_TESTNET]: 'plume-testnet',
Expand Down
6 changes: 3 additions & 3 deletions packages/dodoex-widgets/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dodoex/widgets",
"version": "3.0.2-bartio.9",
"version": "3.0.2-bartio.10",
"description": "DODO Widgets",
"source": "src/index.tsx",
"types": "dist/types/index.d.ts",
Expand Down Expand Up @@ -58,10 +58,10 @@
},
"dependencies": {
"@babel/runtime": "^7.17.0",
"@dodoex/api": "3.0.3-bartio.2",
"@dodoex/api": "3.0.3-bartio.3",
"@dodoex/components": "3.0.3",
"@dodoex/contract-request": "^1.3.0",
"@dodoex/dodo-contract-request": "^1.9.0-alpha.9",
"@dodoex/dodo-contract-request": "^1.9.0-alpha.10",
"@dodoex/icons": "^2.0.2",
"@emotion/react": "^11.10.0",
"@emotion/styled": "^11.10.0",
Expand Down
15 changes: 13 additions & 2 deletions packages/dodoex-widgets/src/constants/chainList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ReactComponent as ScrollLogo } from '../assets/logo/networks/scroll.svg
import { ReactComponent as MantaLogo } from '../assets/logo/networks/manta.svg';
import { ReactComponent as MantleLogo } from '../assets/logo/networks/mantle.svg';
import { ReactComponent as DODOchainLogo } from '../assets/logo/networks/dodochain.svg';
import { ReactComponent as BartioTestnetLogo } from '../assets/logo/networks/bartio.svg';
import { ReactComponent as BerachainLogo } from '../assets/logo/networks/bartio.svg';
import { ReactComponent as TaikoLogo } from '../assets/logo/networks/taiko.svg';
import { ReactComponent as PlumeLogo } from '../assets/logo/networks/plume.svg';
import { ReactComponent as NeoxLogo } from '../assets/logo/networks/neox.svg';
Expand Down Expand Up @@ -165,13 +165,24 @@ export const chainListMap: Map<ChainId, ChainListItem> = new Map([
name: 'DODOchain testnet',
},
],
[
ChainId.BERA_CHAIN,
{
chainId: ChainId.BERA_CHAIN,
logo: BerachainLogo,
name: 'Berachain',
},
],
[
ChainId.BARTIO_TESTNET,
{
chainId: ChainId.BARTIO_TESTNET,
logo: BartioTestnetLogo,
logo: BerachainLogo,
name: 'Berachain bArtio',
mainnet: ChainId.BERA_CHAIN,
},
],
[
ChainId.TAIKO,
{
chainId: ChainId.TAIKO,
Expand Down
32 changes: 8 additions & 24 deletions packages/dodoex-widgets/src/constants/chains.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const rpcServerMap: {
[ChainId.SEPOLIA]: ['https://ethereum-sepolia-rpc.publicnode.com'],
[ChainId.DODO_CHAIN_TESTNET]: ['https://dodochain-testnet.alt.technology'],
[ChainId.BARTIO_TESTNET]: ['https://bartio.rpc.berachain.com'],
[ChainId.BERA_CHAIN]: ['https://rpc.berachain.com'],
[ChainId.TAIKO]: ['https://rpc.mainnet.taiko.xyz'],
[ChainId.PLUME]: ['https://phoenix-rpc.plumenetwork.xyz'],
[ChainId.PLUME_TESTNET]: ['https://test-rpc.plumenetwork.xyz'],
Expand All @@ -75,29 +76,6 @@ export const getRpcSingleUrlMap = (newRpcServerMap?: {
};
};

export const platformIdMap: {
[key in ChainId]: string;
} = {
[ChainId.MAINNET]: 'ethereum',
[ChainId.GOERLI]: 'goerli',
[ChainId.OPTIMISM]: 'optimism',
[ChainId.CONFLUX]: 'cfx',
[ChainId.BSC]: 'bsc',
[ChainId.OKCHAIN]: 'okex-chain',
[ChainId.POLYGON]: 'polygon',
[ChainId.ARBITRUM_ONE]: 'arbitrum',
[ChainId.AURORA]: 'aurora',
[ChainId.AVALANCHE]: 'avalanche', // Needs confirm
[ChainId.BASE]: 'base',
[ChainId.LINEA]: 'linea',
[ChainId.SCROLL]: 'scr',
[ChainId.MANTA]: 'manta',
[ChainId.MANTLE]: 'mantle',
[ChainId.SEPOLIA]: 'sepolia',
[ChainId.DODO_CHAIN_TESTNET]: 'dodochain-testnet',
[ChainId.BARTIO_TESTNET]: '',
};

export const scanUrlDomainMap: {
[key in ChainId]: string;
} = {
Expand All @@ -119,6 +97,7 @@ export const scanUrlDomainMap: {
[ChainId.SEPOLIA]: 'sepolia.etherscan.io',
[ChainId.DODO_CHAIN_TESTNET]: 'dodochain-testnet-explorer.alt.technology',
[ChainId.BARTIO_TESTNET]: 'bartio.beratrail.io',
[ChainId.BERA_CHAIN]: 'berascan.com',
[ChainId.TAIKO]: 'taikoscan.io',
[ChainId.PLUME]: 'phoenix-explorer.plumenetwork.xyz',
[ChainId.PLUME_TESTNET]: 'test-explorer.plumenetwork.xyz',
Expand Down Expand Up @@ -146,7 +125,8 @@ export const ThegraphKeyMap: {
[ChainId.MANTLE]: 'mantle',
[ChainId.SEPOLIA]: 'sepolia',
[ChainId.DODO_CHAIN_TESTNET]: 'dodochain-testnet',
[ChainId.BARTIO_TESTNET]: '',
[ChainId.BARTIO_TESTNET]: 'berachain-testnet',
[ChainId.BERA_CHAIN]: 'berachain',
[ChainId.TAIKO]: 'taiko',
[ChainId.PLUME]: 'plume',
[ChainId.PLUME_TESTNET]: 'plume-testnet',
Expand Down Expand Up @@ -179,6 +159,8 @@ export const blockTimeMap: {
[ChainId.PLUME_TESTNET]: 2600,
[ChainId.NEOX]: 12000,
[ChainId.MORPH]: 3200,
[ChainId.BARTIO_TESTNET]: 3000,
[ChainId.BERA_CHAIN]: 3000,
};

export const dexKeysMap: {
Expand Down Expand Up @@ -206,4 +188,6 @@ export const dexKeysMap: {
[ChainId.PLUME_TESTNET]: [],
[ChainId.NEOX]: [],
[ChainId.MORPH]: [],
[ChainId.BARTIO_TESTNET]: [],
[ChainId.BERA_CHAIN]: [],
};
6 changes: 5 additions & 1 deletion packages/dodoex-widgets/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,11 @@ export { TokenCard } from './components/Swap/components/TokenCard';
export { default as TokenLogo } from './components/TokenLogo';
export { FailedList } from './components/List/FailedList';
export { EmptyList } from './components/List/EmptyList';
export { getEtherscanPage } from './utils/address';
export {
getEtherscanPage,
ALGEBRA_POOL_DEPLOYER_ADDRESSES,
ALGEBRA_POOL_INIT_CODE_HASH,
} from './utils/address';
export {
formatReadableNumber,
formatTokenAmountNumber,
Expand Down
3 changes: 3 additions & 0 deletions packages/dodoex-widgets/src/utils/address.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const ALGEBRA_POOL_DEPLOYER_ADDRESSES: {
} = {
// [ChainId.Holesky]: '0x4777378A908A90862AdDedabF9388958Cbd020f1',
[ChainId.BARTIO_TESTNET]: '0x5Dc98916bC57A5391F9Df74002f266B6b187C339',
[ChainId.BERA_CHAIN]: '0x598f320907c2FFDBC715D591ffEcC3082bA14660',
};

export const ALGEBRA_POOL_INIT_CODE_HASH: {
Expand All @@ -22,6 +23,8 @@ export const ALGEBRA_POOL_INIT_CODE_HASH: {
// [ChainId.Holesky]: '0x4b9e4a8044ce5695e06fce9421a63b6f5c3db8a561eebb30ea4c775469e36eaf',
[ChainId.BARTIO_TESTNET]:
'0xb3fc09be5eb433d99b1ec89fd8435aaf5ffea75c1879e19028aa2414a14b3c85',
[ChainId.BERA_CHAIN]:
'0xb3fc09be5eb433d99b1ec89fd8435aaf5ffea75c1879e19028aa2414a14b3c85',
};

export const isSameAddress = (
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1857,10 +1857,10 @@
ethers "^6.13.2"
https-proxy-agent "^7.0.5"

"@dodoex/dodo-contract-request@^1.9.0-alpha.9":
version "1.9.0-alpha.9"
resolved "https://registry.yarnpkg.com/@dodoex/dodo-contract-request/-/dodo-contract-request-1.9.0-alpha.9.tgz#a308bf38d44a780d41ea214250ac2efd286b25a2"
integrity sha512-zP9eFRU3gCOzS0MiBEVLE9MtRVnZhy0B5lGk7KYQfxnI4IWV3blR+O02D9C0jxrWS4+D/3Wj95tYkivsb1avxQ==
"@dodoex/dodo-contract-request@^1.9.0-alpha.10":
version "1.9.0-alpha.10"
resolved "https://registry.yarnpkg.com/@dodoex/dodo-contract-request/-/dodo-contract-request-1.9.0-alpha.10.tgz#96fa9c405a8cc31ab8007a0a9bb4bee1288a8742"
integrity sha512-yEwHNyVAZWBc5f+vIhPxzQtyvVf8Qxw+1admQ1ykvT6nJxnfYabYYtbSIcrxGa+rGMENmVo+XFN9ccVxZAHuiw==
dependencies:
typescript "^5"

Expand Down

0 comments on commit a7dbde8

Please sign in to comment.