[Deployment] Deploying Token contract with Create2Factory #717
-
EnvironmentMainnet L2 block numberNo response zkSolc Versionlatest: v1.5.4 zksync-ethers Version6.13.0 Minimal Reproducible Code or Repo Link
Does this work on other EVMs? (If yes, please list at least 1 of them)ETH Description of What Your Contract DoesTrying to ERC20 token contract deployment with the instructions given; Additional DetailsTypeError: contract.deployed is not a function
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It seems like you're encountering an issue with the In ZKsync, the deployment process does not use the
Here’s a revised version of your deployment function: export default async function deployContractWithArgs(name, symbol, totalSupply, decimals, dust) {
const salt = ethers.id("AT-Salt-515");
const deployTx = factory.getDeployTransaction(name, symbol, totalSupply, decimals, dust, {salt});
const response = await wallet.sendTransaction(deployTx);
await response.wait(); // This replaces the deployed() method
console.log("Contract deployed to:", response.contractAddress);
} This adjustment should align your deployment script with the capabilities of the 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.
It seems like you're encountering an issue with the
contract.deployed()
function not being recognized in your deployment script for an ERC20 token on ZKsync usingzksync-ethers
. This issue might be due to the differences in how contract deployment is handled in ZKsync compared to Ethereum.In ZKsync, the deployment process does not use the
deployed()
method as typically seen in Ethereum's Ethers.js. Instead, you should be using thegetDeployTransaction()
method fromContractFactory
, and then sending this transaction to the network. Here’s how you can adjust your deployment script:Generate the Deployment Transaction: You've correctly used
getDeployTransaction()
to create the deployment …