-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
107caf8
commit 36bcbc9
Showing
8 changed files
with
8,947 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
# ZkEvm-Hardhat | ||
# ZkEvm-Hardhat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, | ||
} | ||
}, | ||
|
||
}; |
Oops, something went wrong.