[Deployment] Need help with error while deploying contract on layer 2(zksync testnet) #683
-
EnvironmentTestnet L2 block numbern/a zkSolc Version10.8.1 zksync-ethers Version10.8.1 Minimal Reproducible Code or Repo Linkhttps://github.com/kientt265/zksync-project.git Does this work on other EVMs? (If yes, please list at least 1 of them)no Description of What Your Contract DoesI want to build an interactive web application between layer1 (ethereum) and layer2 (zksync). I have successfully deployed 2 contracts FundCoreL1.sol and FundBridgeL1.sol on ethereum sepolia. However, when I deployed the remaining 2 contracts to zksync testnet, I encountered an error. Additional Detailskien@DESKTOP-PFDK8AA MINGW64 /d/Workspace/Project/zksync-project-specialize (master) Compiling your contracts...
Starting migrations...
3_deploy_fund_core_l2.jsDeploying FundCoreL2 with params: 0x75a768bBBE1e082d7Be9E390A6FCecF728B60d84 0x0000000000000000000000000000000000008008 Deploying 'FundCoreL2'*** Deployment Failed *** "FundCoreL2" -- Failed to serialize transaction: toAddressIsNull. Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan. Error: *** Deployment Failed *** "FundCoreL2" -- Failed to serialize transaction: toAddressIsNull. Error: *** Deployment Failed *** "FundCoreL2" -- Failed to serialize transaction: toAddressIsNull.
Truffle v5.11.5 (core: 5.11.5) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The error message "Failed to serialize transaction: toAddressIsNull" typically indicates that the deployment script is trying to deploy a contract to an address that is not specified or is null. This can happen if the contract address or the constructor parameters for the contract are not correctly set in your deployment script. Here are a few steps you can take to troubleshoot and resolve this issue:
If after these checks the issue persists, you might want to simplify your deployment script to deploy a minimal version of the contract to isolate the issue further. This can help determine if the problem is with the contract code or the deployment script/environment. Your feedback helps us serve you better. If this fully addresses your question, please give it a thumbs up. If it doesn't, please give it a thumbs down. This will inform the community and team so we can improve our support. |
Beta Was this translation helpful? Give feedback.
@kientt265 Just a heads up, Truffle is planning on being discontinued soon so you'll want to look for another tool to use for deployment.
We have some tutorials on deploying with Hardhat and Foundry in our docs that might help you with this issue too https://docs.zksync.io/build/start-coding/zksync-101
One thing that stands out is in your FundBridgeL2 contract you are importing Il1Messenger.sol from something that doesn't exist. There is no
zksync-contracts
repo in the Matter Labs org. Check out the examples in our tutorials and see if those help you out.