Skip to content

Commit fddc420

Browse files
authored
chore: support monad testnet (#11228)
<!-- Before opening a pull request, please read the [contributing guidelines](https://github.com/pancakeswap/pancake-frontend/blob/develop/CONTRIBUTING.md) first --> <!-- start pr-codex --> --- ## PR-Codex overview This PR introduces support for `Monad Testnet` across various components in the codebase, including constants, configurations, and token definitions. It ensures that the new chain is integrated into the existing ecosystem. ### Detailed summary - Added `ChainId.MONAD_TESTNET` in multiple files. - Updated block times, token addresses, and configurations to include `Monad Testnet`. - Integrated `Monad Testnet` into network switchers and token definitions. - Modified constants and API endpoints for compatibility with `Monad Testnet`. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent bf21cf0 commit fddc420

File tree

41 files changed

+144
-19
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+144
-19
lines changed

apis/routing/src/provider.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { ChainId, getV3Subgraphs } from '@pancakeswap/chains'
22
import { OnChainProvider, SubgraphProvider } from '@pancakeswap/smart-router'
3+
import { GraphQLClient } from 'graphql-request'
34
import { createPublicClient, http } from 'viem'
45
import { bsc, bscTestnet, goerli, mainnet } from 'viem/chains'
5-
import { GraphQLClient } from 'graphql-request'
66

77
import { SupportedChainId } from './constants'
88

apps/aptos/components/NetworkSwitcher.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const evmChains = [
1717
{ id: 59144, name: 'Linea', chainName: 'linea' },
1818
{ id: 8453, name: 'Base', chainName: 'base' },
1919
{ id: 204, name: 'opBNB Mainnet', chainName: 'opBNB' },
20+
{ id: 10143, name: 'Monad Testnet', chainName: 'monad' },
2021
]
2122

2223
const NetworkSelect = () => {

apps/gamification/components/NetworkSwitcher.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export const SHORT_SYMBOL = {
155155
[ChainId.SEPOLIA]: 'sepolia',
156156
[ChainId.BASE_SEPOLIA]: 'Base Sepolia',
157157
[ChainId.ARBITRUM_SEPOLIA]: 'Arb Sepolia',
158+
[ChainId.MONAD_TESTNET]: 'tMonad',
158159
} as const satisfies Record<ChainId, string>
159160

160161
export const NetworkSwitcher = () => {

apps/gamification/config/nodes.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
baseGoerli,
1111
baseSepolia,
1212
linea,
13+
monadTestnet,
1314
opBNB,
1415
opBNBTestnet,
1516
polygonZkEvm,
@@ -84,6 +85,10 @@ export const SERVER_NODES = {
8485
[ChainId.SEPOLIA]: sepolia.rpcUrls.default.http,
8586
[ChainId.ARBITRUM_SEPOLIA]: arbitrumSepolia.rpcUrls.default.http,
8687
[ChainId.BASE_SEPOLIA]: baseSepolia.rpcUrls.default.http,
88+
[ChainId.MONAD_TESTNET]: [
89+
'https://testnet-rpc2.monad.xyz/52227f026fa8fac9e2014c58fbf5643369b3bfc6',
90+
...monadTestnet.rpcUrls.default.http,
91+
],
8792
} satisfies Record<ChainId, readonly string[]>
8893

8994
export const PUBLIC_NODES = {
@@ -156,4 +161,8 @@ export const PUBLIC_NODES = {
156161
[ChainId.SEPOLIA]: sepolia.rpcUrls.default.http,
157162
[ChainId.ARBITRUM_SEPOLIA]: arbitrumSepolia.rpcUrls.default.http,
158163
[ChainId.BASE_SEPOLIA]: baseSepolia.rpcUrls.default.http,
164+
[ChainId.MONAD_TESTNET]: [
165+
'https://testnet-rpc2.monad.xyz/52227f026fa8fac9e2014c58fbf5643369b3bfc6',
166+
...monadTestnet.rpcUrls.default.http,
167+
],
159168
} satisfies Record<ChainId, readonly string[]>

apps/web/src/components/NetworkSwitcher.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const NetworkSelect = ({ switchNetwork, chainId, isWrongNetwork }) => {
4545
{chains
4646
.filter((chain) => {
4747
if (chain.id === chainId) return true
48-
if ('testnet' in chain && chain.testnet) {
48+
if ('testnet' in chain && chain.testnet && chain.id !== ChainId.MONAD_TESTNET) {
4949
return showTestnet
5050
}
5151
return true
@@ -163,6 +163,7 @@ const SHORT_SYMBOL = {
163163
[ChainId.SEPOLIA]: 'sepolia',
164164
[ChainId.BASE_SEPOLIA]: 'Base Sepolia',
165165
[ChainId.ARBITRUM_SEPOLIA]: 'Arb Sepolia',
166+
[ChainId.MONAD_TESTNET]: 'tMonad',
166167
} as const satisfies Record<ChainId, string>
167168

168169
export const NetworkSwitcher = () => {

apps/web/src/config/chains.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
linea,
1515
lineaTestnet,
1616
mainnet,
17+
monadTestnet,
1718
opBNB,
1819
opBNBTestnet,
1920
polygonZkEvm,
@@ -93,4 +94,5 @@ export const CHAINS: [Chain, ...Chain[]] = [
9394
opBNB,
9495
opBNBTestnet,
9596
scrollSepolia,
97+
monadTestnet,
9698
]

apps/web/src/config/constants/contracts.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export default {
3939
[ChainId.OPBNB_TESTNET]: '0xcA11bde05977b3631167028862bE2a173976CA11',
4040
[ChainId.BASE_TESTNET]: '0xcA11bde05977b3631167028862bE2a173976CA11',
4141
[ChainId.SCROLL_SEPOLIA]: '0xcA11bde05977b3631167028862bE2a173976CA11',
42+
[ChainId.MONAD_TESTNET]: '0xcA11bde05977b3631167028862bE2a173976CA11',
4243
},
4344
pancakeProfile: {
4445
[ChainId.BSC]: '0xDf4dBf6536201370F95e06A0F8a7a70fE40E388a',
@@ -195,6 +196,7 @@ export default {
195196
[ChainId.BASE_TESTNET]: '0x8Ae8592a24CD13b7E09D2763E7d6A39E3c0D6bad',
196197
[ChainId.SCROLL_SEPOLIA]: '0x8Ae8592a24CD13b7E09D2763E7d6A39E3c0D6bad',
197198
[ChainId.SEPOLIA]: '0xbC203d7f83677c7ed3F7acEc959963E7F4ECC5C2',
199+
[ChainId.MONAD_TESTNET]: '0x295BA23629F0F18A28DA20F3Fb392558828b14A3',
198200
},
199201
quoter: V3_QUOTER_ADDRESSES,
200202
v3Airdrop: {

apps/web/src/config/constants/exchange.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import {
1515
bscTokens,
1616
lineaTestnetTokens,
1717
lineaTokens,
18+
monadTestnetTokens,
1819
opBnbTestnetTokens,
1920
opBnbTokens,
2021
polygonZkEvmTestnetTokens,
@@ -54,6 +55,7 @@ export const CHAIN_REFRESH_TIME = {
5455
[ChainId.SEPOLIA]: 12_000,
5556
[ChainId.BASE_SEPOLIA]: 6_000,
5657
[ChainId.ARBITRUM_SEPOLIA]: 6_000,
58+
[ChainId.MONAD_TESTNET]: 6_000,
5759
} as const satisfies Record<ChainId, number>
5860

5961
// used for display in the default list when adding liquidity
@@ -83,6 +85,7 @@ export const SUGGESTED_BASES: ChainTokenList = {
8385
[ChainId.SEPOLIA]: [scrollSepoliaTokens.usdc, scrollSepoliaTokens.weth],
8486
[ChainId.ARBITRUM_SEPOLIA]: [arbSepoliaTokens.usdc, arbSepoliaTokens.weth],
8587
[ChainId.BASE_SEPOLIA]: [baseSepoliaTokens.usdc, baseSepoliaTokens.weth],
88+
[ChainId.MONAD_TESTNET]: [monadTestnetTokens.usdc, monadTestnetTokens.busd],
8689
}
8790

8891
// used to construct the list of all pairs we consider by default in the frontend
@@ -107,6 +110,7 @@ export const BASES_TO_TRACK_LIQUIDITY_FOR: ChainTokenList = {
107110
[ChainId.SEPOLIA]: [sepoliaTokens.usdc, sepoliaTokens.weth],
108111
[ChainId.ARBITRUM_SEPOLIA]: [arbSepoliaTokens.usdc, arbSepoliaTokens.weth],
109112
[ChainId.BASE_SEPOLIA]: [baseSepoliaTokens.usdc, baseSepoliaTokens.weth],
113+
[ChainId.MONAD_TESTNET]: [monadTestnetTokens.usdc, monadTestnetTokens.busd],
110114
}
111115

112116
export const PINNED_PAIRS: { readonly [chainId in ChainId]?: [Token, Token][] } = {

apps/web/src/config/constants/lists.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const PANCAKE_OPBNB_DEFAULT = 'https://tokens.pancakeswap.finance/pancake
1414
export const PANCAKE_ETH_MM = 'https://tokens.pancakeswap.finance/pancakeswap-eth-mm.json'
1515
export const PANCAKE_BSC_MM = 'https://tokens.pancakeswap.finance/pancakeswap-bnb-mm.json'
1616
export const PANCAKE_ARB_MM = 'https://tokens.pancakeswap.finance/pancakeswap-arb-mm.json'
17+
export const PANCAKE_MONAD_TESTNET_DEFAULT = 'https://tokens.pancakeswap.finance/pancakeswap-monad-testnet-default.json'
1718

1819
const COINGECKO_ETH = 'https://tokens.coingecko.com/uniswap/all.json'
1920
// export const CMC = 'https://tokens.pancakeswap.finance/cmc.json' // not updated for a while
@@ -38,6 +39,7 @@ const OP_SUPER_CHAIN_URL =
3839
'https://raw.githubusercontent.com/ethereum-optimism/ethereum-optimism.github.io/master/optimism.tokenlist.json'
3940
const BASE_URLS = [PANCAKE_BASE_DEFAULT, OP_SUPER_CHAIN_URL, 'https://tokens.coingecko.com/base/all.json']
4041
const OPBNB_URLS = [PANCAKE_OPBNB_DEFAULT]
42+
const MONAD_TESTNET_URLS = [PANCAKE_MONAD_TESTNET_DEFAULT]
4143

4244
// List of official tokens list
4345
export const OFFICIAL_LISTS = [PANCAKE_EXTENDED, PANCAKE_ETH_DEFAULT]
@@ -58,6 +60,7 @@ export const DEFAULT_LIST_OF_LISTS: string[] = [
5860
...UNSUPPORTED_LIST_URLS, // need to load unsupported tokens as well
5961
...WARNING_LIST_URLS,
6062
...OPBNB_URLS,
63+
...MONAD_TESTNET_URLS,
6164
]
6265

6366
// default lists to be 'active' aka searched across
@@ -77,6 +80,7 @@ export const DEFAULT_ACTIVE_LIST_URLS: string[] = [
7780
OP_SUPER_CHAIN_URL,
7881
COINGECKO,
7982
COINGECKO_ETH,
83+
PANCAKE_MONAD_TESTNET_DEFAULT,
8084
]
8185

8286
export const MULTI_CHAIN_LIST_URLS: { [chainId: number]: string[] } = {
@@ -88,4 +92,5 @@ export const MULTI_CHAIN_LIST_URLS: { [chainId: number]: string[] } = {
8892
[ChainId.LINEA]: LINEA_URLS,
8993
[ChainId.BASE]: BASE_URLS,
9094
[ChainId.OPBNB]: OPBNB_URLS,
95+
[ChainId.MONAD_TESTNET]: MONAD_TESTNET_URLS,
9196
}

apps/web/src/config/constants/supportChains.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export const LIQUID_STAKING_SUPPORTED_CHAINS = [
88
ChainId.ETHEREUM,
99
ChainId.BSC_TESTNET,
1010
ChainId.ARBITRUM_GOERLI,
11+
ChainId.MONAD_TESTNET,
1112
]
1213
export const FIXED_STAKING_SUPPORTED_CHAINS = [ChainId.BSC]
1314

0 commit comments

Comments
 (0)