Skip to content

Commit

Permalink
First Comit
Browse files Browse the repository at this point in the history
  • Loading branch information
Wajahat-Husain committed May 1, 2023
1 parent 107caf8 commit 36bcbc9
Show file tree
Hide file tree
Showing 8 changed files with 8,947 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .envExample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
ZKEVM_TESTNET_RPC_URL = https://rpc.public.zkevm-test.net
ZKEVM_MAINNET_RPC_URL = https://zkevm.polygonscan.com/

PRIVATE_KEY = Your Private Key

ETHERSCAN_ZKEVM_API_KEY = Your Api Key
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules
.env
coverage
coverage.json
typechain
typechain-types

# Hardhat files
cache
artifacts

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# ZkEvm-Hardhat
# ZkEvm-Hardhat
32 changes: 32 additions & 0 deletions contracts/zkEvmToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.9;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

contract ZkEvmToken is ERC20, ERC20Burnable, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");

uint256 private _maxSupply = 120000000*10**18;

constructor( ) ERC20("ZkEvmToken", "ZET") {
_grantRole(DEFAULT_ADMIN_ROLE, msg.sender);
_grantRole(MINTER_ROLE, msg.sender);
}

function mint(address to, uint256 amount) public onlyRole(MINTER_ROLE) {
require(totalSupply() + amount <= getMaxSupply(),"Reached Max-Supply limit");
_mint(to, amount);
}

function getMaxSupply() public view returns (uint256) {
return _maxSupply;
}

function updateMaxSupply(uint256 amount)public onlyRole(DEFAULT_ADMIN_ROLE) {
require(amount >= totalSupply(),"Max-Supply should be greater then Total-Supply");
_maxSupply = amount;
}

}
72 changes: 72 additions & 0 deletions hardhat.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
require("@nomicfoundation/hardhat-chai-matchers");
require("@nomicfoundation/hardhat-toolbox");
require('dotenv').config();
require("@nomiclabs/hardhat-etherscan");

const ZKEVM_MAINNET_RPC_URL = process.env.ZKEVM_MAINNET_RPC_URL;
const ZKEVM_TESTNET_RPC_URL = process.env.ZKEVM_TESTNET_RPC_URL;

const PRIVATE_KEY = process.env.PRIVATE_KEY;

const ETHERSCAN_ZKEVM_API_KEY = process.env.ETHERSCAN_ZKEVM_API_KEY;

task("accounts", "Prints the list of accounts", async () => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}

});

module.exports = {
mocha: {
timeout: 10000000000,
},
solidity: {
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
runs: 200
}
}
},
etherscan: {
apiKey: {
polygonZKEVMMainnet: ETHERSCAN_ZKEVM_API_KEY,
polygonZKEVMTestnet: ETHERSCAN_ZKEVM_API_KEY
},
customChains: [
{
network: "polygonZKEVMMainnet",
chainId: 1101,
urls: {
apiURL: "https://explorer.mainnet.zkevm-test.net/api",
browserURL: "https://explorer.mainnet.zkevm-test.net/"
}
},
{
network: "polygonZKEVMTestnet",
chainId: 1442,
urls: {
apiURL: "https://explorer.public.zkevm-test.net/api",
browserURL: "https://explorer.public.zkevm-test.net/"
}
}
],
timeout: 60000 // increase timeout to 1 minute (default is 20000ms)
},
networks: {
polygonZKEVMMainnet: {
url: ZKEVM_MAINNET_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 1101,
},
polygonZKEVMTestnet: {
url: ZKEVM_TESTNET_RPC_URL,
accounts: [PRIVATE_KEY],
chainId: 1442,
}
},

};
Loading

0 comments on commit 36bcbc9

Please sign in to comment.