Skip to content

Commit 945ead7

Browse files
Blessing-Circlehjchen-circleali-kafel
authored
feat: Add Monad Testnet support for CCTP transfers (#71)
- Added MONAD_TESTNET (chain ID 10143) - Configured Monad Testnet CCTP contract addresses: - USDC: 0x534b2f3A21130d7a60830c2Df862319e593943A3 - Token Messenger V2: 0x8FE6B999Dc680CcFDD5Bf7EB0974218be2542DAA - Message Transmitter V2: 0xE737e5cEBEEBa77EFE34D4aa090756590b1CE275 - Set destination domain to 15 - Added Monad Testnet chain definition with RPC and block explorer - Updated viem to v2.39.3 for arcTestnet support --------- Co-authored-by: Chen Hui Jing <huijing.chen@circle.com> Co-authored-by: Ali Kafel <ali.kafel@circle.com>
1 parent 6ac1f25 commit 945ead7

File tree

5 files changed

+67
-38
lines changed

5 files changed

+67
-38
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,7 @@ on:
66
jobs:
77
lint-and-test:
88
runs-on: ubuntu-latest
9-
permissions:
10-
id-token: write
119
steps:
12-
- name: Harden the runner (Audit all outbound calls)
13-
uses: step-security/harden-runner@95d9a5deda9de15063e7595e9719c11c38c90ae2 # v2.13.2
14-
with:
15-
egress-policy: block
16-
policy: global-allowed-endpoints-policy
17-
1810
- name: Check out repository code
1911
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2012
with:

package-lock.json

Lines changed: 33 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
"react-timer-hook": "^4.0.5",
3232
"tailwind-merge": "^3.3.1",
3333
"tailwindcss-animate": "^1.0.7",
34-
"viem": "^2.38.4"
34+
"viem": "^2.39.3"
3535
},
3636
"devDependencies": {
3737
"@tailwindcss/postcss": "^4.1.13",

src/hooks/use-cross-chain-transfer.ts

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,8 @@ import {
5050
xdcTestnet,
5151
hyperliquidEvmTestnet,
5252
inkSepolia,
53-
plumeSepolia
53+
plumeSepolia,
54+
arcTestnet
5455
} from "viem/chains";
5556
import { defineChain } from "viem";
5657

@@ -84,29 +85,6 @@ import { getBytes } from "ethers";
8485
import { SystemProgram } from "@solana/web3.js";
8586
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
8687

87-
// Custom Arc Testnet configuration
88-
const arcTestnet = defineChain({
89-
id: 5042002,
90-
name: "Arc Testnet",
91-
nativeCurrency: {
92-
decimals: 18,
93-
name: "USDC",
94-
symbol: "USDC",
95-
},
96-
rpcUrls: {
97-
default: {
98-
http: ["https://rpc.testnet.arc.network"],
99-
},
100-
},
101-
blockExplorers: {
102-
default: {
103-
name: "Arc Testnet Explorer",
104-
url: "https://testnet.arcscan.app/",
105-
},
106-
},
107-
testnet: true,
108-
});
109-
11088
// Custom Sonic Testnet configuration
11189
const sonicTestnet = defineChain({
11290
id: 14601,
@@ -153,6 +131,29 @@ const codexTestnet = defineChain({
153131
testnet: true,
154132
});
155133

134+
// Monad Testnet configuration
135+
const monadTestnet = defineChain({
136+
id: 10143,
137+
name: "Monad Testnet",
138+
nativeCurrency: {
139+
decimals: 18,
140+
name: "MON",
141+
symbol: "MON",
142+
},
143+
rpcUrls: {
144+
default: {
145+
http: ["https://testnet-rpc.monad.xyz"],
146+
},
147+
},
148+
blockExplorers: {
149+
default: {
150+
name: "Monad Explorer",
151+
url: "https://testnet.monadexplorer.com",
152+
},
153+
},
154+
testnet: true,
155+
});
156+
156157
export type TransferStep =
157158
| "idle"
158159
| "approving"
@@ -180,6 +181,7 @@ const chains = {
180181
[SupportedChainId.XDC_TESTNET]: xdcTestnet,
181182
[SupportedChainId.HYPEREVM_TESTNET]: hyperliquidEvmTestnet,
182183
[SupportedChainId.INK_SEPOLIA]: inkSepolia,
184+
[SupportedChainId.MONAD_TESTNET]: monadTestnet,
183185
};
184186

185187
export function useCrossChainTransfer() {

src/lib/chains.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export enum SupportedChainId {
3737
PLUME_SEPOLIA = 98867,
3838
HYPEREVM_TESTNET = 998,
3939
INK_SEPOLIA = 763373,
40+
MONAD_TESTNET = 10143,
4041
}
4142

4243
export const DEFAULT_MAX_FEE = 1000n;
@@ -61,6 +62,7 @@ export const CHAIN_TO_CHAIN_NAME: Record<number, string> = {
6162
[SupportedChainId.PLUME_SEPOLIA]: "Plume Sepolia",
6263
[SupportedChainId.HYPEREVM_TESTNET]: "HyperEvm Testnet",
6364
[SupportedChainId.INK_SEPOLIA]: "Ink Sepolia",
65+
[SupportedChainId.MONAD_TESTNET]: "Monad Testnet",
6466
};
6567

6668
export const CHAIN_IDS_TO_USDC_ADDRESSES: Record<number, Hex | string> = {
@@ -82,6 +84,7 @@ export const CHAIN_IDS_TO_USDC_ADDRESSES: Record<number, Hex | string> = {
8284
[SupportedChainId.PLUME_SEPOLIA]: "0xcB5f30e335672893c7eb944B374c196392C19D18",
8385
[SupportedChainId.HYPEREVM_TESTNET]: "0x2B3370eE501B4a559b57D449569354196457D8Ab",
8486
[SupportedChainId.INK_SEPOLIA]: "0xFabab97dCE620294D2B0b0e46C68964e326300Ac",
87+
[SupportedChainId.MONAD_TESTNET]: "0x534b2f3a21130d7a60830c2df862319e593943a3",
8588
};
8689

8790
export const CHAIN_IDS_TO_TOKEN_MESSENGER: Record<number, Hex | string> = {
@@ -103,6 +106,7 @@ export const CHAIN_IDS_TO_TOKEN_MESSENGER: Record<number, Hex | string> = {
103106
[SupportedChainId.PLUME_SEPOLIA]: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa",
104107
[SupportedChainId.HYPEREVM_TESTNET]: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa",
105108
[SupportedChainId.INK_SEPOLIA]: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa",
109+
[SupportedChainId.MONAD_TESTNET]: "0x8fe6b999dc680ccfdd5bf7eb0974218be2542daa",
106110
};
107111

108112
export const CHAIN_IDS_TO_MESSAGE_TRANSMITTER: Record<number, Hex | string> = {
@@ -124,6 +128,7 @@ export const CHAIN_IDS_TO_MESSAGE_TRANSMITTER: Record<number, Hex | string> = {
124128
[SupportedChainId.PLUME_SEPOLIA]: "0xe737e5cebeeba77efe34d4aa090756590b1ce275",
125129
[SupportedChainId.HYPEREVM_TESTNET]: "0xe737e5cebeeba77efe34d4aa090756590b1ce275",
126130
[SupportedChainId.INK_SEPOLIA]: "0xe737e5cebeeba77efe34d4aa090756590b1ce275",
131+
[SupportedChainId.MONAD_TESTNET]: "0xe737e5cebeeba77efe34d4aa090756590b1ce275",
127132
};
128133

129134
export const DESTINATION_DOMAINS: Record<number, number> = {
@@ -145,6 +150,7 @@ export const DESTINATION_DOMAINS: Record<number, number> = {
145150
[SupportedChainId.PLUME_SEPOLIA]: 22,
146151
[SupportedChainId.HYPEREVM_TESTNET]: 19,
147152
[SupportedChainId.INK_SEPOLIA]: 21,
153+
[SupportedChainId.MONAD_TESTNET]: 15,
148154
};
149155

150156
export const SUPPORTED_CHAINS = [
@@ -166,6 +172,7 @@ export const SUPPORTED_CHAINS = [
166172
SupportedChainId.PLUME_SEPOLIA,
167173
SupportedChainId.HYPEREVM_TESTNET,
168174
SupportedChainId.INK_SEPOLIA,
175+
SupportedChainId.MONAD_TESTNET,
169176
];
170177

171178
// Solana RPC endpoint

0 commit comments

Comments
 (0)