From 334f41adecdd203900ba15853ae96236a7144c13 Mon Sep 17 00:00:00 2001 From: djperico <129557815+djperico@users.noreply.github.com> Date: Fri, 31 Mar 2023 22:01:22 +0000 Subject: [PATCH 1/3] added twitter link --- solution-1.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 solution-1.md diff --git a/solution-1.md b/solution-1.md new file mode 100644 index 00000000..0b591a92 --- /dev/null +++ b/solution-1.md @@ -0,0 +1 @@ +https://twitter.com/Deepakk99661160/status/1641922696127696897 \ No newline at end of file From d4d62f1cea6c6900b19d0328a036b7381861348b Mon Sep 17 00:00:00 2001 From: djperico <129557815+djperico@users.noreply.github.com> Date: Fri, 31 Mar 2023 22:18:56 +0000 Subject: [PATCH 2/3] solution 2 added --- solution-2.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 solution-2.md diff --git a/solution-2.md b/solution-2.md new file mode 100644 index 00000000..4cd471f3 --- /dev/null +++ b/solution-2.md @@ -0,0 +1,22 @@ +Transaction Hash - 0xe161994afc39adab79cefc693b2378a8a92adbcb11e8a3cd71f429485cb38b02 + +Contract Address - 0x0d5d0e413de5b7fcc1745c2e0ecb97616015c432 + +sol +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.7; + +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; +import "@openzeppelin/contracts/access/Ownable.sol"; + +contract MyToken is ERC20, ERC20Burnable, Ownable{ + + constructor() ERC20("zkEVM", "zkm"){ + _mint(msg.sender, 1000000 * 10 ** decimals());//whoever deployes the contract will own all the tokens + } + + function mint(address to, uint256 amount) public onlyOwner{ + _mint(to, amount); + } +} \ No newline at end of file From 54e96d8b91f1f923ba6758c6c320c9997b819c7f Mon Sep 17 00:00:00 2001 From: djperico <129557815+djperico@users.noreply.github.com> Date: Fri, 31 Mar 2023 22:22:55 +0000 Subject: [PATCH 3/3] sol3 added --- solution-3.md | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 solution-3.md diff --git a/solution-3.md b/solution-3.md new file mode 100644 index 00000000..8dcc2893 --- /dev/null +++ b/solution-3.md @@ -0,0 +1,36 @@ +Transaction Hash - 0x77a96dd76644f6071e6ff50046baec04916c6c1ae510c5f8c3d0264ab8db62aa + +Contract Address - 0x0d5d0e413de5b7fcc1745c2e0ecb97616015c432 + +Transaction URL - https://testnet-zkevm.polygonscan.com/tx/0x77a96dd76644f6071e6ff50046baec04916c6c1ae510c5f8c3d0264ab8db62aa + +js +const Web3 = require('web3'); +const tokenAbi = process.env.TOKEN_ABI; + +const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); + +const tokenAddress = ''; // Replace with the address of your token +const fromAddress = ''; // Replace with the address you want to mint tokens from +const privateKey = ''; // Replace with your private key + +const token = new web3.eth.Contract(tokenAbi, tokenAddress); + +async function mintToken(toAddress, amount) { + const nonce = await web3.eth.getTransactionCount(fromAddress); + const gasPrice = await web3.eth.getGasPrice(); + + const txParams = { + nonce: nonce, + gasPrice: gasPrice, + gasLimit: 500000, + to: tokenAddress, + value: 0, + data: token.methods.mint(toAddress, amount).encodeABI() + }; + + const signedTx = await web3.eth.accounts.signTransaction(txParams, privateKey); + const txReceipt = await web3.eth.sendSignedTransaction(signedTx.rawTransaction); +} + +mintToken('Address', 10); \ No newline at end of file