You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{HardhatUserConfig}from"hardhat/config";import"@matterlabs/hardhat-zksync-solc";import"@matterlabs/hardhat-zksync-upgradable";constconfig: HardhatUserConfig={defaultNetwork: "zkSyncTestnet",networks: {zkSyncTestnet: {zksync: true,url: "https://testnet.era.zksync.dev",ethNetwork: "goerli",},zkSyncMainnet: {url: "https://mainnet.era.zksync.io",ethNetwork: "mainnet",zksync: true,},dockerizedNode: {url: "http://localhost:3050",ethNetwork: "http://localhost:8545",zksync: true,},inMemoryNode: {url: "http://127.0.0.1:8011",ethNetwork: "",zksync: true,},hardhat: {zksync: true,},},zksolc: {version: "1.3.17",settings: {// find all available options in the official documentation// https://era.zksync.io/docs/tools/hardhat/hardhat-zksync-solc.html#configuration},},solidity: {version: "0.8.20",},};exportdefaultconfig;
Deployment Script (WITHOUT PRIVATE KEY)
import{Provider,Wallet,}from"zksync2-js";import{Deployer}from"@matterlabs/hardhat-zksync-deploy";import*ashrefrom"hardhat";require('dotenv').config();asyncfunctionmain(){constrpcUrl=hre.network.config.url;constprovider=newProvider(rpcUrl);console.log(`RPC URL: ${rpcUrl}`);constzkWallet=newWallet(process.env.WALLET_PRIVATE_KEY!);console.log(`Wallet address: ${zkWallet.address}`);constdeployer=newDeployer(hre,zkWallet);constcontractName="Gus";constcontract=awaitdeployer.loadArtifact(contractName);constbeacon=awaithre.zkUpgrades.deployBeacon(deployer.zkWallet,contract);awaitbeacon.deployed();console.log("Beacon deployed to:",beacon.address);constgus=awaithre.zkUpgrades.deployBeaconProxy(deployer.zkWallet,beacon,contract,[0]);awaitgus.deployed();console.log(contractName+" beacon proxy deployed to: ",gus.address);}// We recommend this pattern to be able to use async/await everywhere// and properly handle errors.main().catch((error)=>{console.error(error);process.exitCode=1;});
Contract Code
// SPDX-License-Identifier: MITpragma solidity^0.8.20;
import"@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import"@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
contractGusisInitializable, ERC20Upgradeable, OwnableUpgradeable {
function initialize() initializer public {
__ERC20_init("Gussiiii", "GUS");
__Ownable_init();
_mint(msg.sender, 200000*10**decimals());
}
function decimals() publicpureoverridereturns (uint8) {
return2;
}
// another functions
}
Does this work on other EVMs? (If yes, please list at least 1 of them)
In an example from docks using zksync-web3, but last version of hardhat-zksync-deploy working with zksync2-js.
So I have a trouble during the run script on this line:
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Environment
Testnet
zkSolc Version
1.3.17
zksync-web3 Version
zksync2-js ^0.2.2
Hardhat.config.ts
Deployment Script (WITHOUT PRIVATE KEY)
Contract Code
Does this work on other EVMs? (If yes, please list at least 1 of them)
Polygon, ZkSync (without proxy)
Description of What Your Contract Does
Simple ERC20 Token. Burn, Mint.
Repo Link (Optional)
No response
Additional Details
I want to deploy a simple ERC20 token contract using the proxy pattern as recommended documentation. I use hardhat-zksync-upgradeable plugin (1.0.0) and beacon proxy. Also, I use the simple example of deploying script from docks https://era.zksync.io/docs/tools/hardhat/hardhat-zksync-upgradable.html#full-code-for-deploy-beacon
In an example from docks using zksync-web3, but last version of hardhat-zksync-deploy working with zksync2-js.
So I have a trouble during the run script on this line:
Beta Was this translation helpful? Give feedback.
All reactions