diff --git a/solution-1.md b/solution-1.md new file mode 100644 index 00000000..cb37a0b3 --- /dev/null +++ b/solution-1.md @@ -0,0 +1 @@ +https://twitter.com/Ambi_Cafephile/status/1641894160730030080?s=20 diff --git a/solution-2.md b/solution-2.md new file mode 100644 index 00000000..fed7d08d --- /dev/null +++ b/solution-2.md @@ -0,0 +1,23 @@ +Contract address - 0x2e6d93eec0f3ecb9d4b251cbc7d735aa02669a7c + +Transaction URL - https://explorer.public.zkevm-test.net/tx/0x185a267e9bcceff1d06b2deda5c677a7de72780d85733e260f626d347afe43fb + +```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("EssVee", "SV"){ + _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..9c76b99a --- /dev/null +++ b/solution-3.md @@ -0,0 +1,35 @@ +Transaction URL - https://explorer.public.zkevm-test.net/tx/0x225434340b65232b5e2c34b77584a363a7aeb34e9790a04219de3da6b57935c6 + +Contract address - 0x2e6d93eec0f3ecb9d4b251cbc7d735aa02669a7c + +```js +const Web3 = require('web3'); +const tokenAbi = process.env.TOKEN_ABI; + +const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545')); + +const tokenAddress = '0x2e6d93eec0f3ecb9d4b251cbc7d735aa02669a7c'; // Replace with the address of your token +const fromAddress = '0xCf270b31d7d047220717AB66b1C7DAC5cb1Ad0e7'; // Replace with the address you want to mint tokens from +const privateKey = 'YOUR_PRIVATE_KEY'; // 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', 100000); +```