[Deployment] <Getting error while deploying transparent proxy contract> #301
-
EnvironmentTestnet zkSolc Versionlatest zksync-web3 Version^0.14.3 Hardhat.config.tsimport { HardhatUserConfig } from "hardhat/config";
import "@nomicfoundation/hardhat-toolbox";
import "@nomiclabs/hardhat-ethers";
import "@openzeppelin/hardhat-upgrades";
import "hardhat-deploy";
import "@nomiclabs/hardhat-ethers";
import "solidity-coverage";
import "@matterlabs/hardhat-zksync-deploy";
import "@matterlabs/hardhat-zksync-solc";
import "@matterlabs/hardhat-zksync-upgradable";
import dotenv from "dotenv";
dotenv.config();
const PRIVATE_KEY = process.env.PRIVATE_KEY;
if (!PRIVATE_KEY) {
throw Error("process.env.PRIVATE_KEY IS REQUIRED");
}
const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL;
if (!SEPOLIA_RPC_URL) {
throw Error("process.env.SEPOLIA_RPC_URL IS REQUIRED");
}
const config: HardhatUserConfig = {
solidity: {
version: "0.8.18",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
zksolc: {
version: "latest",
compilerSource: "binary",
settings: {},
},
defaultNetwork: "zkTestnet",
namedAccounts: {
deployer: {
default: 0,
},
},
networks: {
hardhat: {
allowUnlimitedContractSize: true,
},
zkTestnet: {
url: "https://sepolia.era.zksync.dev",
ethNetwork: SEPOLIA_RPC_URL,
zksync: true,
chainId: 300,
},
},
};
export default config; Deployment Script (WITHOUT PRIVATE KEY)import { HardhatRuntimeEnvironment } from "hardhat/types";
import { ABI, DeployFunction } from "hardhat-deploy/types";
import { PAYMENT_TOKENS } from "../constants";
import { utils, Wallet, Provider } from "zksync-web3";
import { Deployer } from "@matterlabs/hardhat-zksync-deploy";
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const contractName = "MarketPlace";
console.log("Deploying " + contractName + "...");
const PRIVATE_KEY: string = process.env.PRIVATE_KEY!;
const zkWallet = new Wallet(PRIVATE_KEY);
const deployer = new Deployer(hre, zkWallet);
console.log("Deployer address: ", deployer.ethWallet.address);
const network = await hre.ethers.provider.getNetwork();
const chainId = network.chainId.toString();
if (!Object.keys(PAYMENT_TOKENS).includes(chainId) && chainId !== "31337") {
throw new Error(`No payment tokens for chainId ${chainId}`);
}
let paymentTokens: string[] = PAYMENT_TOKENS[chainId as keyof typeof PAYMENT_TOKENS];
const contract = await deployer.loadArtifact(contractName);
const contractDeployed = await hre.zkUpgrades.deployProxy(
deployer.zkWallet,
contract,
[
paymentTokens,
"0x02dF0d9BA51Cb7E62f28fa2884c0AFaa0D84B3Cd",
deployer.ethWallet.address, // owner
],
{ initializer: "initialize" }
);
await contractDeployed.deployed();
console.log(contractName + " deployed to:", contractDeployed.address);
};
module.exports = func;
module.exports.tags = ["Deploy"]; Package.json{
"name": "hardhat-project",
"dependencies": {
"@ethersproject/providers": "^5.7.2",
"@matterlabs/hardhat-zksync-deploy": "^0.6.3",
"@matterlabs/hardhat-zksync-solc": "^0.4.1",
"@matterlabs/hardhat-zksync-upgradable": "^0.1.2",
"@nomicfoundation/hardhat-chai-matchers": "^1.0.6",
"@nomicfoundation/hardhat-network-helpers": "^1.0.8",
"@nomicfoundation/hardhat-toolbox": "^2.0.2",
"@nomiclabs/hardhat-ethers": "^2.0.3",
"@nomiclabs/hardhat-etherscan": "^3.1.7",
"@openzeppelin/contracts": "^4.8.2",
"@openzeppelin/contracts-upgradeable": "^4.8.2",
"@openzeppelin/hardhat-upgrades": "^1.22.1",
"@openzeppelin/upgrades": "^2.8.0",
"@openzeppelin/upgrades-core": "1.27.3",
"@typechain/ethers-v5": "^10.2.0",
"@typechain/hardhat": "^6.1.5",
"@types/chai": "^4.3.4",
"@types/mocha": "^10.0.1",
"@types/node": "^18.15.3",
"chai": "^4.3.7",
"dotenv": "^16.0.3",
"ethers": "^5.7.2",
"hardhat": "^2.17.0",
"hardhat-deploy": "^0.11.25",
"hardhat-deploy-ethers": "^0.3.0-beta.13",
"hardhat-gas-reporter": "^1.0.9",
"moment": "^2.29.4",
"solidity-coverage": "^0.8.2",
"solmate": "^6.7.0",
"ts-node": "^10.9.1",
"typechain": "^8.1.1",
"typescript": "^5.0.2",
"web3-utils": "^1.8.2",
"zksync-web3": "^0.14.3"
},
"devDependencies": {
"fs": "^0.0.1-security",
"path": "^0.12.7"
}
} Contract Codean nft marketplace contract Does this work on other EVMs? (If yes, please list at least 1 of them)yes. bnb,ethereum,polygon, zksync mainnet Description of What Your Contract DoesIts an nft marketplace Repo Link (Optional)No response Additional DetailsThis contract was on zksync goerli testnet. Now i want to migrate to sepolia. Its deploy Implementation and admin contract but not proxy.But i am getting this error. Deploying MarketPlace... |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 12 replies
-
Hi @FurkanSezal 👋 ! It's a little tough to tell from the information above what could be causing this deployment error just for Sepolia Testnet, is there any chance you could share your smart contracts with us? In the meantime, please recompile the contracts and try again, perhaps this was an issue with the cached local contracts. |
Beta Was this translation helpful? Give feedback.
There were quite a few changes I made to be able to deploy on Sepolia. Would it be easier if you let me create a PR for the repo and share it so you guys could see the differences or should I create a private PR and invite you to it?