6.5 Verification (Optional)
If you want to verify the contracts on explorers like Etherscan, BscScan, etc., you can use Forge’s verify or manual verification. Since the TokenFactory likely uses constructor params, ensure you provide those (LayerZero endpoint, router, factory) when verifying.
For example:
forge verify-contract --chain-id 56 --num-of-optimizations 200 TokenFactory <BSC_FACTORY_ADDRESS> <YOUR_ETHERSCAN_API_KEY> "constructorParams..."
Where “constructorParams” are the addresses in the order they were given.
6.6 Testing the Deployment
Before opening it to users, test the cross-chain functionality on a smaller scale or testnets:
-
You could deploy to testnets (LayerZero supports testnets like Ethereum Sepolia, BSC testnet, etc. with different chain IDs) to simulate.
-
Call
createToken("TestToken","TT")on one factory (say Ethereum) – this should emit an event and deploy an ERC-20 on Ethereum.
-
Try a cross-chain buy from another chain’s factory for the new token:
-
You might need to manually register the token on the remote factories. Depending on implementation, when a token is created on the home chain, the home factory could send a message to others to register the token symbol or deploy remote token contracts. If not, the first cross-chain buy could trigger deployment. Just ensure the token exists on remote before buy, or modify code to deploy it.
-
-
Check that events
BoughtCrosschainMemeTokenfire and balances update correctly.
Once the system is verified to be working, you can proceed with real usage.
6.6 Testing the Deployment