Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zayd110_zkthon #373

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions solution-1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Tweet link:- https://twitter.com/PoodsSubto/status/1641866238123991062?s=20
22 changes: 22 additions & 0 deletions solution-2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Conntract address:- 0x3cad66dc94b96cd89e5bb5ac687e1f281bee40a8
transaction url:- https://explorer.public.zkevm-test.net/tx/0xea83c721a2d6bea840a95de49546bb13c16f10b28ace82ca5046ef97df0caed9

```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("zaid", "ZD"){
_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);
}
}
```
33 changes: 33 additions & 0 deletions solution-3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Transaction URL:- https://explorer.public.zkevm-test.net/tx/0xd932296f952d25e8c1ce9b702f12b9d6e4598a39b131718808f7247d96c2d528

```js
const Web3 = require('web3');
const tokenAbi = process.env.TOKEN_ABI;

const web3 = new Web3(new Web3.providers.HttpProvider('http://localhost:8545'));

const tokenAddress = '0x3cad66dc94b96cd89e5bb5ac687e1f281bee40a8';
const fromAddress = '0x9dB6Ecf939B8f15C13615122F433113DdD6FCd68';
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);
```