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

Add ERC20 Juke token contract #8

Open
wants to merge 3 commits into
base: master
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
25 changes: 25 additions & 0 deletions packages/hardhat/contracts/Juke.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// contracts/Juke.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import "@openzeppelin/contracts/access/Ownable.sol";

contract Juke is ERC20, Ownable {
using SafeERC20 for IERC20;

constructor(address _owner) ERC20("Juke", "JUKE") {
transferOwnership(_owner);
// mint some tokens for testing
_mint(_owner, 1000000000000000000000000);
}

function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}

function burn(address from, uint256 amount) public onlyOwner {
_burn(from, amount);
}
}
27 changes: 0 additions & 27 deletions packages/hardhat/contracts/YourContract.sol

This file was deleted.

51 changes: 51 additions & 0 deletions packages/hardhat/deploy/00_deploy_juke_token.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// deploy/00_deploy_juke_token.js

const { ethers } = require("hardhat");

const localChainId = "31337";

// const sleep = (ms) =>
// new Promise((r) =>
// setTimeout(() => {
// console.log(`waited for ${(ms / 1000).toFixed(3)} seconds`);
// r();
// }, ms)
// );

module.exports = async ({ getNamedAccounts, deployments, getChainId }) => {
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
const chainId = await getChainId();

await deploy("Juke", {
from: deployer,
args: [ deployer ],
log: true,
});

// Uncomment this to transfer ownership to a different address
// const Juke = await ethers.getContract("Juke", deployer);
/*
await Juke.transferOwnership(
"ADDRESS_HERE"
);
*/

// Verify from the command line by running `yarn verify`.

// You can also Verify your contracts with Etherscan here.
// You don't want to verify on localhost
// try {
// if (chainId !== localChainId) {
// await run("verify:verify", {
// address: Juke.address,
// contract: "contracts/Juke.sol:Juke",
// constructorArguments: [],
// });
// }
// } catch (error) {
// console.error(error);
// }
};

module.exports.tags = ["Juke"];
81 changes: 0 additions & 81 deletions packages/hardhat/deploy/00_deploy_your_contract.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/hardhat/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ module.exports = {
solidity: {
compilers: [
{
version: "0.8.4",
version: "0.8.17",
settings: {
optimizer: {
enabled: true,
Expand Down
Loading