diff --git a/src/config/sidebar.ts b/src/config/sidebar.ts index 8de95417e7d..ffaf34c87d7 100644 --- a/src/config/sidebar.ts +++ b/src/config/sidebar.ts @@ -28,7 +28,7 @@ import chainlinkLocalV023Contents from "./sidebar/chainlink-local/api-reference/ */ export type SectionContent = { title: string - url: string + url?: string highlightAsCurrent?: string[] children?: SectionContent[] isCollapsible?: boolean @@ -1583,27 +1583,44 @@ export const SIDEBAR: Partial> = { url: "ccip/tutorials/evm/cross-chain-tokens", children: [ { - title: "Deploy and Register Using Remix IDE", - url: "ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-remix", - }, - { - title: "Register from an EOA (Burn & Mint)", - url: "ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-hardhat", - highlightAsCurrent: ["ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-foundry"], - }, - { - title: "Register from an EOA (Lock & Mint)", - url: "ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-lock-mint-hardhat", - highlightAsCurrent: ["ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-lock-mint-foundry"], - }, - { - title: "Set Token Pool rate limits", - url: "ccip/tutorials/evm/cross-chain-tokens/update-rate-limiters-hardhat", - highlightAsCurrent: ["ccip/tutorials/evm/cross-chain-tokens/update-rate-limiters-foundry"], + title: "Using Remix IDE", + children: [ + { + title: "Deploy and Register from an EOA", + url: "ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-remix", + }, + ], }, { - title: "Register from a Safe Smart Account (Burn & Mint)", - url: "ccip/tutorials/evm/cross-chain-tokens/register-from-safe-burn-mint-hardhat", + title: "Using Hardhat / Foundry", + children: [ + { + title: "Register from an EOA (Burn & Mint)", + url: "ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-hardhat", + highlightAsCurrent: ["ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-foundry"], + }, + { + title: "Register from an EOA (Lock & Mint)", + url: "ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-lock-mint-hardhat", + highlightAsCurrent: ["ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-lock-mint-foundry"], + }, + { + title: "Set Token Pool rate limits", + url: "ccip/tutorials/evm/cross-chain-tokens/update-rate-limiters-hardhat", + highlightAsCurrent: ["ccip/tutorials/evm/cross-chain-tokens/update-rate-limiters-foundry"], + }, + { + title: "Register from a Safe Smart Account (Burn & Mint)", + url: "ccip/tutorials/evm/cross-chain-tokens/register-from-safe-burn-mint-hardhat", + }, + { + title: "Configure Additional Networks", + url: "ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-hardhat", + highlightAsCurrent: [ + "ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-foundry", + ], + }, + ], }, ], }, diff --git a/src/content/ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-foundry.mdx b/src/content/ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-foundry.mdx new file mode 100644 index 00000000000..9e419067146 --- /dev/null +++ b/src/content/ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-foundry.mdx @@ -0,0 +1,134 @@ +--- +section: ccip +date: Last Modified +title: "Add CCIP Networks for Cross-Chain Token Tutorials (Foundry)" +metadata: + description: "Add CCIP network support to test burn-mint and lock-mint token tutorials on additional blockchains. Configure network settings, RPC endpoints, and CCIP contract addresses in Foundry." + excerpt: "burn-mint, lock-mint, token pools, CCIP networks, add network, Foundry configuration, cross-chain tokens, testnet, mainnet, RPC endpoints, CCIP Directory, EVM chains, network setup" + image: "/images/ccip/CCIP_enabled_tokens_flowchart.jpg" + datePublished: "2025-10-30" + lastModified: "2025-10-30" + estimatedTime: "5 minutes" + difficulty: "beginner" +--- + +import { Aside, PageTabs } from "@components" + + + +The [smart-contract-examples](https://github.com/smartcontractkit/smart-contract-examples/tree/main/ccip/cct/foundry) repository includes default configurations for common CCIP testnet networks. This guide shows how to add support for additional networks. + +## Add a Network + +Add the network configuration to [`script/HelperConfig.s.sol`](https://github.com/smartcontractkit/smart-contract-examples/blob/main/ccip/cct/foundry/script/HelperConfig.s.sol) + +```solidity +// Rest of the code... + +constructor() { + // Rest of the existing networks... + + else if (block.chainid == 11155420) { + activeNetworkConfig = getOptimismSepoliaConfig(); + } else { + revert("Unsupported network"); + } +} + +// Rest of the existing network configurations... + +function getOptimismSepoliaConfig() public pure returns (NetworkConfig memory) { + NetworkConfig memory optimismSepoliaConfig = NetworkConfig({ + chainSelector: 5224473277236331295, + router: 0x114A20A10b43D4115e5aeef7345a1A71d2a60C57, + rmnProxy: 0xb40A3109075965cc09E93719e33E748abf680dAe, + tokenAdminRegistry: 0x1d702b1FA12F347f0921C722f9D9166F00DEB67A, + registryModuleOwnerCustom: 0x49c4ba01dc6F5090f9df43Ab8F79449Db91A0CBB, + link: 0xE4aB69C077896252FAFBD49EFD26B5D171A32410, + confirmations: 2, + nativeCurrencySymbol: "ETH" + }); + return optimismSepoliaConfig; +} + +function getNetworkConfig(uint256 chainId) public pure returns (NetworkConfig memory) { + // Rest of the existing networks... + + else if (chainId == 11155420) { + return getOptimismSepoliaConfig(); + } else { + revert("Unsupported chain ID"); + } +} +``` + +Set the RPC URL: + +```env +RPC_URL_OPTIMISM_SEPOLIA="INSERT_YOUR_RPC_URL_HERE" +``` + + + +Save the `.env` file, then load the environment variable into the terminal session: + +```bash +source .env +``` + +The network is now available in all Foundry commands using `--rpc-url $RPC_URL_OPTIMISM_SEPOLIA`. + +## Configuration Fields + +| Field | Required | Description | Source | +| --------------------------- | -------- | ------------------------------------------------------------------ | ------------------------------------------------------------- | +| `chainSelector` | Yes | CCIP identifier for the network | [CCIP Directory](/ccip/directory) | +| `router` | Yes | CCIP Router contract address | [CCIP Directory](/ccip/directory) | +| `rmnProxy` | Yes | RMN Proxy contract address | [CCIP Directory](/ccip/directory) | +| `tokenAdminRegistry` | Yes | Token Admin Registry address | [CCIP Directory](/ccip/directory) | +| `registryModuleOwnerCustom` | Yes | Registry Module Owner address | [CCIP Directory](/ccip/directory) | +| `link` | Yes | LINK token contract address | [CCIP Directory](/ccip/directory) | +| `confirmations` | No | Number of block confirmations before considering transaction final | Blockchain's finality characteristics and your risk tolerance | +| `nativeCurrencySymbol` | No | Native gas token symbol (e.g., `"ETH"`, `"AVAX"`, `"POL"`) | Blockchain's official documentation | + +Find all CCIP addresses in the [CCIP Directory - Testnet](/ccip/directory/testnet) or [CCIP Directory - Mainnet](/ccip/directory/mainnet). + +## Test + +Deploy a token to verify the configuration: + +```bash +forge script script/DeployToken.s.sol --rpc-url $RPC_URL_OPTIMISM_SEPOLIA --private-key $PRIVATE_KEY --broadcast +``` + +## Contract Verification (Optional) + +Most networks are natively supported. Add `--verify` when deploying: + +```bash +forge script script/DeployToken.s.sol --rpc-url $RPC_URL_OPTIMISM_SEPOLIA --private-key $PRIVATE_KEY --broadcast --verify +``` + +For networks not in [Foundry's `StdChains.sol::StdChains::initializeStdChains()`](https://github.com/foundry-rs/forge-std/blob/master/src/StdChains.sol#L193) function, include the `--verifier`, `--verifier-url`, and `--verifier-api-key` flags together with `--verify` when deploying: + +```bash +forge script script/DeployToken.s.sol --rpc-url $RPC_URL_CUSTOM_NETWORK --private-key $PRIVATE_KEY --broadcast --verify --verifier custom --verifier-url $CUSTOM_EXPLORER_API_URL --verifier-api-key $CUSTOM_EXPLORER_API_KEY +``` + +With [Etherscan API V2](https://docs.etherscan.io/introduction), a single `ETHERSCAN_API_KEY` works across all Etherscan-compatible networks. diff --git a/src/content/ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-hardhat.mdx b/src/content/ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-hardhat.mdx new file mode 100644 index 00000000000..6c1f3d6ae9f --- /dev/null +++ b/src/content/ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-hardhat.mdx @@ -0,0 +1,122 @@ +--- +section: ccip +date: Last Modified +title: "Add CCIP Networks for Cross-Chain Token Tutorials (Hardhat)" +metadata: + description: "Add CCIP network support to test burn-mint and lock-mint token tutorials on additional blockchains. Configure network settings, RPC endpoints, and CCIP contract addresses in Hardhat." + excerpt: "burn-mint, lock-mint, token pools, CCIP networks, add network, Hardhat configuration, cross-chain tokens, testnet, mainnet, RPC endpoints, CCIP Directory, EVM chains, network setup" + image: "/images/ccip/CCIP_enabled_tokens_flowchart.jpg" + datePublished: "2025-10-30" + lastModified: "2025-10-30" + estimatedTime: "5 minutes" + difficulty: "beginner" +--- + +import { Aside, PageTabs } from "@components" + + + +The [smart-contract-examples](https://github.com/smartcontractkit/smart-contract-examples/tree/main/ccip/cct/hardhat) repository includes default configurations for common CCIP testnet networks. This guide shows how to add support for additional networks. + +## Add a Network + +Add the network configuration to [`config/networks.ts`](https://github.com/smartcontractkit/smart-contract-examples/blob/main/ccip/cct/hardhat/config/networks.ts): + +```typescript +export const configData = { + // ... existing networks + optimismSepolia: { + chainFamily: "evm", + chainId: 11155420, + chainSelector: "5224473277236331295", + router: "0x114A20A10b43D4115e5aeef7345a1A71d2a60C57", + rmnProxy: "0xb40A3109075965cc09E93719e33E748abf680dAe", + tokenAdminRegistry: "0x1d702b1FA12F347f0921C722f9D9166F00DEB67A", + registryModuleOwnerCustom: "0x49c4ba01dc6F5090f9df43Ab8F79449Db91A0CBB", + link: "0xE4aB69C077896252FAFBD49EFD26B5D171A32410", + confirmations: 2, + nativeCurrencySymbol: "ETH", + }, +} +``` + +Set the RPC URL: + +```bash +npx env-enc set OPTIMISM_SEPOLIA_RPC_URL +``` + + + +The network is now available in all Hardhat tasks using `--network optimismSepolia`. + +**Environment variable naming**: The system converts network names from camelCase to SNAKE_CASE and adds `_RPC_URL`. Examples: `optimismSepolia` → `OPTIMISM_SEPOLIA_RPC_URL`, `avalancheFuji` → `AVALANCHE_FUJI_RPC_URL`. + +## Configuration Fields + +| Field | Required | Description | Source | +| --------------------------- | -------- | ------------------------------------------------------------------------------ | -------------------------------------------------------------------------------------- | +| `chainFamily` | Yes | Blockchain VM type: `"evm"` for Ethereum-compatible chains, `"svm"` for Solana | `config/types.ts` | +| `chainId` | Yes | EVM chain ID | Blockchain's official documentation (preferred) or [ChainList](https://chainlist.org/) | +| `chainSelector` | Yes | CCIP identifier for the network | [CCIP Directory](/ccip/directory) | +| `router` | Yes | CCIP Router contract address | [CCIP Directory](/ccip/directory) | +| `rmnProxy` | Yes | RMN Proxy contract address | [CCIP Directory](/ccip/directory) | +| `tokenAdminRegistry` | Yes | Token Admin Registry address | [CCIP Directory](/ccip/directory) | +| `registryModuleOwnerCustom` | Yes | Registry Module Owner address | [CCIP Directory](/ccip/directory) | +| `link` | Yes | LINK token contract address | [CCIP Directory](/ccip/directory) | +| `confirmations` | No | Number of block confirmations before considering transaction final | Blockchain's finality characteristics and your risk tolerance | +| `nativeCurrencySymbol` | No | Native gas token symbol (e.g., `"ETH"`, `"AVAX"`, `"POL"`) | Blockchain's official documentation | + +Find all CCIP addresses in the [CCIP Directory - Testnet](/ccip/directory/testnet) or [CCIP Directory - Mainnet](/ccip/directory/mainnet). + +## Test + +Deploy a token to verify the configuration: + +```bash +npx hardhat deployToken --name "Test Token" --symbol TEST --network optimismSepolia +``` + +## Contract Verification (Optional) + +Most networks are natively supported. Add `--verifycontract` when deploying: + +```bash +npx hardhat deployToken --name "Test Token" --symbol TEST --network optimismSepolia --verifycontract +``` + +For networks not in [Hardhat's chain descriptors](https://github.com/NomicFoundation/hardhat/blob/main/v-next/hardhat/src/internal/builtin-plugins/network-manager/chain-descriptors.ts), add to `hardhat.config.ts`: + +```typescript +chainDescriptors: { + 12345: { + name: "New Network", + chainType: "generic", + blockExplorers: { + etherscan: { + name: "NewScan", + url: "https://newscan.io", + apiUrl: "https://api.newscan.io/api", + }, + }, + }, +} +``` + +With [Etherscan API V2](https://docs.etherscan.io/introduction), a single `ETHERSCAN_API_KEY` works across all Etherscan-compatible networks. diff --git a/src/content/ccip/tutorials/evm/cross-chain-tokens/index.mdx b/src/content/ccip/tutorials/evm/cross-chain-tokens/index.mdx index 0aa7c62b211..77ae56f7238 100644 --- a/src/content/ccip/tutorials/evm/cross-chain-tokens/index.mdx +++ b/src/content/ccip/tutorials/evm/cross-chain-tokens/index.mdx @@ -64,4 +64,8 @@ The tutorials will implement the logic of this process, which involves deploying - [Register from a Safe (Burn & Mint)](/ccip/tutorials/evm/cross-chain-tokens/register-from-safe-burn-mint-hardhat): Learn how to register a cross-chain token with the **Burn & Mint** mechanism using a Safe Smart Account. - [Hardhat version](/ccip/tutorials/evm/cross-chain-tokens/register-from-safe-burn-mint-hardhat) +- [Configure Additional Networks](/ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-hardhat): Learn how to configure your cross-chain tokens and pools to operate on additional networks beyond the initial setup. + - [Hardhat version](/ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-hardhat) + - [Foundry version](/ccip/tutorials/evm/cross-chain-tokens/configure-additional-networks-foundry) + diff --git a/src/content/ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-foundry.mdx b/src/content/ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-foundry.mdx index 329eb78edcb..c1832c703fb 100644 --- a/src/content/ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-foundry.mdx +++ b/src/content/ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-foundry.mdx @@ -7,7 +7,7 @@ metadata: image: "/images/ccip/CCIP_enabled_tokens_flowchart.jpg" excerpt: "Burn & Mint, Foundry, ERC-20, ERC20, token pools, admin, CCIP, validation" datePublished: "2024-10-29" - lastModified: "2025-10-22" + lastModified: "2025-10-30" estimatedTime: "40 minutes" difficulty: "intermediate" --- @@ -80,7 +80,6 @@ This tutorial will guide you through the process of enabling your own tokens in RPC_URL_FUJI= RPC_URL_ARBITRUM_SEPOLIA= ETHERSCAN_API_KEY= - ARBISCAN_API_KEY= ``` Variables to configure: @@ -88,7 +87,6 @@ This tutorial will guide you through the process of enabling your own tokens in - `RPC_URL_FUJI`: The RPC URL for the Fuji testnet. You can get this from the [Alchemy](https://www.alchemy.com/) or [Infura](https://infura.io/) website. - `RPC_URL_ARBITRUM_SEPOLIA`: The RPC URL for the Arbitrum Sepolia testnet. You can get this from the [Alchemy](https://www.alchemy.com/) or [Infura](https://infura.io/) website. - `ETHERSCAN_API_KEY`: An API key from Etherscan to verify your contracts. You can obtain one from [Etherscan](https://docs.etherscan.io/getting-started/viewing-api-usage-statistics). - - `ARBISCAN_API_KEY`: An API key from Arbiscan to verify your contracts on Arbitrum. See [this guide](https://docs.arbiscan.io/getting-started/viewing-api-usage-statistics) to get one from Arbiscan. 1. **Load the environment variables** into the terminal session where you will run the commands: @@ -118,6 +116,12 @@ Before running the scripts, you can customize the `config.json` within the `scri **Note**: If you decide to change the chain IDs in the `remoteChains` section to use different networks, you will also need to update your `.env` file with the appropriate RPC URLs for those networks. + + Example `config.json` file: ```json diff --git a/src/content/ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-hardhat.mdx b/src/content/ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-hardhat.mdx index 3b116a24b00..a017d5aff8b 100644 --- a/src/content/ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-hardhat.mdx +++ b/src/content/ccip/tutorials/evm/cross-chain-tokens/register-from-eoa-burn-mint-hardhat.mdx @@ -58,8 +58,8 @@ This tutorial will guide you through the process of enabling your own tokens in ``` @@ -105,6 +105,12 @@ This tutorial will guide you through the process of enabling your own tokens in 1. **Fund your EOA with LINK and native gas tokens**: Make sure your EOA has enough LINK and native gas tokens on Avalanche Fuji and Ethereum Sepolia to cover transaction fees. You can use the [Chainlink faucets](https://faucets.chain.link/) to get testnet tokens. + + ## Tutorial