Skip to content

Commit 94f9a5e

Browse files
committed
eth sender receiver
1 parent f2378f9 commit 94f9a5e

File tree

1 file changed

+134
-0
lines changed
  • ccip/cct/hardhat/tasks/native-gas-sender-receiver

1 file changed

+134
-0
lines changed

ccip/cct/hardhat/tasks/native-gas-sender-receiver/README.md

Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -461,3 +461,137 @@ The tasks work on all CCIP-supported testnet and mainnet networks:
461461
- **Polygon Amoy** / Polygon Mainnet
462462

463463
Each network automatically uses its native token pair (ETH/WETH, AVAX/WAVAX, MATIC/WMATIC, etc.).
464+
465+
## Adding a New Network
466+
467+
To add support for a new CCIP-enabled network, follow these steps:
468+
469+
### Step 1: Update Type Definitions
470+
471+
**File**: `config/types.ts`
472+
473+
Add the new network to both enums:
474+
475+
```typescript
476+
export enum Chains {
477+
// ... existing networks
478+
newNetworkName = "newNetworkName", // ADD THIS
479+
}
480+
481+
export enum EVMChains {
482+
// ... existing networks
483+
newNetworkName = "newNetworkName", // ADD THIS
484+
}
485+
```
486+
487+
### Step 2: Add Network Configuration
488+
489+
**File**: `config/config.json`
490+
491+
Add the network's CCIP infrastructure addresses:
492+
493+
```json
494+
{
495+
"newNetworkName": {
496+
"chainId": 12345,
497+
"chainSelector": "1234567890123456789",
498+
"router": "0xRouterAddressOnNewNetwork",
499+
"rmnProxy": "0xRMNProxyAddress",
500+
"tokenAdminRegistry": "0xTokenAdminRegistryAddress",
501+
"registryModuleOwnerCustom": "0xRegistryModuleOwnerAddress",
502+
"link": "0xLinkTokenAddress",
503+
"confirmations": 2,
504+
"nativeCurrencySymbol": "NEW",
505+
"chainType": "l1",
506+
"chainFamily": "evm"
507+
}
508+
}
509+
```
510+
511+
### Step 3: Add Network Connection
512+
513+
**File**: `config/networks.ts`
514+
515+
Add the network to the networks object:
516+
517+
```typescript
518+
const networks: Networks = {
519+
// ... existing networks
520+
[EVMChains.newNetworkName]: {
521+
type: "http",
522+
...configData.newNetworkName,
523+
url:
524+
process.env.NEW_NETWORK_RPC_URL ||
525+
"https://UNSET-PLEASE-SET-NEW_NETWORK_RPC_URL",
526+
gasPrice: undefined,
527+
nonce: undefined,
528+
accounts,
529+
},
530+
};
531+
```
532+
533+
### Step 4: Add Verification Support (Optional)
534+
535+
**File**: `hardhat.config.ts`
536+
537+
If the network needs custom verification settings:
538+
539+
```typescript
540+
chainDescriptors: {
541+
12345: { // New network's chainId
542+
name: "New Network Name",
543+
chainType: "generic",
544+
blockExplorers: {
545+
etherscan: {
546+
name: "NewScan",
547+
url: "https://newscan.io",
548+
apiUrl: "https://api.newscan.io/api",
549+
},
550+
},
551+
},
552+
}
553+
```
554+
555+
### Step 5: Environment Variables
556+
557+
Add the required environment variables using `npx env-enc set`:
558+
559+
- `NEW_NETWORK_RPC_URL` - RPC endpoint for the network
560+
- `NEWSCAN_API_KEY` - Block explorer API key (for verification)
561+
562+
### Step 6: Required CCIP Information
563+
564+
To get the configuration values, consult:
565+
566+
- **CCIP Mainnet Directory**: [https://docs.chain.link/ccip/directory/mainnet](https://docs.chain.link/ccip/directory/mainnet)
567+
- **CCIP Testnet Directory**: [https://docs.chain.link/ccip/directory/testnet](https://docs.chain.link/ccip/directory/testnet)
568+
- **CCIP Addresses**: Router, RMN Proxy, Token Admin Registry addresses
569+
- **Chain Selector**: Unique CCIP identifier for the network
570+
- **LINK Token**: LINK contract address on the network
571+
572+
### Step 7: Test the New Network
573+
574+
```bash
575+
# Deploy EtherSenderReceiver
576+
npx hardhat deployTokenSenderReceiver --network newNetworkName --verifycontract
577+
578+
# Test cross-chain transfer
579+
npx hardhat sendTokens \
580+
--contract 0xDeployedContract \
581+
--destinationchain ethereumSepolia \
582+
--receiver 0xRecipientAddress \
583+
--amount 0.001 \
584+
--network newNetworkName
585+
```
586+
587+
### Files Summary
588+
589+
| File | Purpose | Changes |
590+
| -------------------- | ---------------- | ------------------------------------- |
591+
| `config/types.ts` | Type definitions | Add to `Chains` and `EVMChains` enums |
592+
| `config/config.json` | CCIP addresses | Add network configuration object |
593+
| `config/networks.ts` | RPC connections | Add network connection settings |
594+
| `hardhat.config.ts` | Verification | Add chain descriptor (optional) |
595+
| Environment | Secrets | Add RPC URL and API key |
596+
597+
**Note**: All CCIP infrastructure addresses can be found in the [CCIP Mainnet Directory](https://docs.chain.link/ccip/directory/mainnet) and [CCIP Testnet Directory](https://docs.chain.link/ccip/directory/testnet) for each supported network.

0 commit comments

Comments
 (0)