Skip to content

Instantly share code, notes, and snippets.

@Skyge
Created November 29, 2021 11:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Skyge/e1e829900ab0170b6ff20b39d654997b to your computer and use it in GitHub Desktop.
Save Skyge/e1e829900ab0170b6ff20b39d654997b to your computer and use it in GitHub Desktop.
// We require the Hardhat Runtime Environment explicitly here. This is optional
// but useful for running the script in a standalone fashion through `node <script>`.
//
// When running the script with `npx hardhat run <script>` you'll find the Hardhat
// Runtime Environment's members available in the global scope.
const hre = require("hardhat");
async function main() {
// Hardhat always runs the compile task when running scripts with its command
// line interface.
//
// If this script is run directly using `node` you may want to call compile
// manually to make sure everything is compiled
// await hre.run('compile');
// We get the contract to deploy
const Terito = await hre.ethers.getContractFactory("Terito");
const terito = await upgrades.deployProxy(Terito, [], {initializer: 'initialize'});
console.log("Terito deployed to:", terito.address);
}
// We recommend this pattern to be able to use async/await everywhere
// and properly handle errors.
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
require("@nomiclabs/hardhat-waffle");
require("@nomiclabs/hardhat-etherscan");
require('@openzeppelin/hardhat-upgrades');
// This is a sample Hardhat task. To learn how to create your own go to
// https://hardhat.org/guides/create-task.html
task("accounts", "Prints the list of accounts", async (taskArgs, hre) => {
const accounts = await hre.ethers.getSigners();
for (const account of accounts) {
console.log(account.address);
}
});
// TODO: Set your own configs
const infuraKey = Your_Infura_Key
const privateKey = Your_Private_Key
const etherscan_key = Your_Etherscan_Key
// You need to export an object to set up your config
// Go to https://hardhat.org/config/ to learn more
/**
* @type import('hardhat/config').HardhatUserConfig
*/
module.exports = {
networks: {
kovan: {
url: `https://kovan.infura.io/v3/${infuraKey}`,
accounts: [`0x${privateKey}`],
gas: 8000000,
gasPrice: 10000000000, // 10gWei
timeout: 200000,
},
},
solidity: {
version: "0.8.4",
settings: {
optimizer: {
enabled: false,
runs: 200,
},
},
},
etherscan: {
apiKey: etherscan_key,
},
};
{
"dependencies": {
"@nomiclabs/hardhat-ethers": "^2.0.2",
"@nomiclabs/hardhat-etherscan": "^2.1.8",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@openzeppelin/contracts-upgradeable": "4.4.0",
"@openzeppelin/hardhat-upgrades": "^1.12.0",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.5.1",
"hardhat": "^2.7.0"
}
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.2;
import "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol";
import "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/ERC20BurnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
/// @custom:security-contact luancsilva@protonmail.com
contract Terito is Initializable, ERC20Upgradeable, ERC20BurnableUpgradeable, OwnableUpgradeable {
/// @custom:oz-upgrades-unsafe-allow constructor
constructor() initializer {}
function initialize() initializer public {
__ERC20_init("Terito", "TRT");
__ERC20Burnable_init();
__Ownable_init();
_mint(msg.sender, 10000000 * 10 ** decimals());
}
function mint(address to, uint256 amount) public onlyOwner {
_mint(to, amount);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment