6.1 Prerequisites
-
Foundry Installed: You should have Foundry’s tools (
forgeand
cast) installed.
-
Contracts & Scripts: The TokenFactory contracts, token contract, and libraries should be in your project. There should also be a deployment script (Solidity or TypeScript/JavaScript if using Foundry Anchor or Hardhat) prepared to deploy to multiple networks.
-
Private Keys and RPC URLs: Prepare a deployer private key with enough funds on each target chain (or separate keys per chain) and RPC endpoints for each chain (HTTP URLs). These can be set in environment variables or the Foundry config.
For example, you might have a
.env
file:
ETH_RPC_URL=https://mainnet.infura.io/v3/...
BSC_RPC_URL=https://bsc-dataseed.binance.org/
AVAX_RPC_URL=https://api.avax.network/ext/bc/C/rpc
BASE_RPC_URL=https://mainnet.base.org/...
ARB_RPC_URL=https://arb1.arbitrum.io/rpc
PRIVATE_KEY=<your_private_key>
And in
foundry.toml
set up named RPC endpoints and the private key (be careful with key management).
6.2 Compilation