diff --git a/solution-1.md b/solution-1.md new file mode 100644 index 00000000..84e8f758 --- /dev/null +++ b/solution-1.md @@ -0,0 +1 @@ +https://twitter.com/Crypto71047574/status/1641904322500784135 diff --git a/solution-2.md b/solution-2.md new file mode 100644 index 00000000..56b3874e --- /dev/null +++ b/solution-2.md @@ -0,0 +1,20 @@ +Transaction Hash - 0xa21b305ae25d3140d6da963edd1b2a47bc879a14d7e74f4597bf6b941c0d2ddb + +Contract Address - 0x80aE9F84679fBAC039439deb279398AAaeBC7B6b + +```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 OurToken is ERC20, ERC20Burnable, Ownable{ + + constructor() ERC20("Maharsi007", "MZK"){ + _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); + } +} +``` diff --git a/solution-3.md b/solution-3.md new file mode 100644 index 00000000..ff82ee32 --- /dev/null +++ b/solution-3.md @@ -0,0 +1,37 @@ +Transaction Hash - 0xe2557c298bf2d98760a1b6d7e0df73601edb458e4ea8270343a76ad57a772f94 + +Contract Address - 0x80ae9f84679fbac039439deb279398aaaebc7b6b + +Transaction URL - https://explorer.public.zkevm-test.net/tx/0xe2557c298bf2d98760a1b6d7e0df73601edb458e4ea8270343a76ad57a772f94 + +```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); +```