3c simple erc20 token lmao
This commit is contained in:
parent
0dcdd3b34d
commit
f03c0725d6
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
node_modules/
|
||||
deployments/
|
17
src/.gitignore
vendored
Normal file
17
src/.gitignore
vendored
Normal file
@ -0,0 +1,17 @@
|
||||
node_modules
|
||||
.env
|
||||
|
||||
# Hardhat files
|
||||
/cache
|
||||
/artifacts
|
||||
|
||||
# TypeChain files
|
||||
/typechain
|
||||
/typechain-types
|
||||
|
||||
# solidity-coverage files
|
||||
/coverage
|
||||
/coverage.json
|
||||
|
||||
# Hardhat Ignition default folder for deployments against a local node
|
||||
ignition/deployments/chain-31337
|
11
src/contracts/3c.sol
Normal file
11
src/contracts/3c.sol
Normal file
@ -0,0 +1,11 @@
|
||||
// SPDX-License-Identifier: MIT
|
||||
pragma solidity ^0.8.20;
|
||||
|
||||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
|
||||
|
||||
|
||||
contract CoinCoinCoin is ERC20 {
|
||||
constructor(uint256 initialSupply) ERC20("CoinCoinCoin", "3CCC") {
|
||||
_mint(msg.sender, initialSupply * 10 ** decimals()); // Mints tokens to the contract creator
|
||||
}
|
||||
}
|
20
src/hardhat.config.ts
Normal file
20
src/hardhat.config.ts
Normal file
@ -0,0 +1,20 @@
|
||||
import { HardhatUserConfig } from "hardhat/config";
|
||||
import "@nomicfoundation/hardhat-toolbox";
|
||||
import dotenv from "dotenv";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
const config: HardhatUserConfig = {
|
||||
solidity: "0.8.20",
|
||||
networks: {
|
||||
sepolia: {
|
||||
url: process.env.ALCHEMY_SEPOLIA_RPC,
|
||||
accounts: [process.env.PRIVATE_KEY as string],
|
||||
},
|
||||
},
|
||||
etherscan: {
|
||||
apiKey: process.env.ETHERSCAN_API_KEY, // Optional, for contract verification
|
||||
},
|
||||
};
|
||||
|
||||
export default config;
|
13
src/ignition/modules/3c.ts
Normal file
13
src/ignition/modules/3c.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { buildModule } from "@nomicfoundation/hardhat-ignition/modules";
|
||||
|
||||
const CoinCoinCoinModule = buildModule("CoinCoinCoinModule", (m) => {
|
||||
// Define an initial supply
|
||||
const initialSupply = m.getParameter("initialSupply", 1000n * 10n ** 18n); // 1000 tokens
|
||||
|
||||
// Deploy the contract with parameters
|
||||
const CoinCoinCoin = m.contract("CoinCoinCoin", [initialSupply]);
|
||||
|
||||
return { CoinCoinCoin };
|
||||
});
|
||||
|
||||
export default CoinCoinCoinModule;
|
7288
src/package-lock.json
generated
Normal file
7288
src/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
23
src/package.json
Normal file
23
src/package.json
Normal file
@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "src",
|
||||
"version": "1.0.0",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"type": "commonjs",
|
||||
"description": "",
|
||||
"devDependencies": {
|
||||
"@nomicfoundation/hardhat-toolbox": "^5.0.0",
|
||||
"dotenv": "^16.4.7",
|
||||
"hardhat": "^2.22.18",
|
||||
"hardhat-gas-reporter": "^2.2.2"
|
||||
},
|
||||
"dependencies": {
|
||||
"@openzeppelin/contracts": "^5.2.0",
|
||||
"ethers": "^6.13.5"
|
||||
}
|
||||
}
|
19
src/scripts/deploy.ts
Normal file
19
src/scripts/deploy.ts
Normal file
@ -0,0 +1,19 @@
|
||||
import { ethers } from "hardhat";
|
||||
|
||||
async function main() {
|
||||
const [deployer] = await ethers.getSigners();
|
||||
console.log(`Deploying contract with account: ${deployer.address}`);
|
||||
|
||||
const CoinCoinCoinFactory = await ethers.getContractFactory("CoinCoinCoin");
|
||||
const initialSupply = ethers.parseUnits("1000", 18);
|
||||
|
||||
const CoinCoinCoin = await CoinCoinCoinFactory.deploy(initialSupply);
|
||||
await CoinCoinCoin.waitForDeployment();
|
||||
console.log(`${await CoinCoinCoin.getAddress()}`);
|
||||
|
||||
}
|
||||
|
||||
main().catch((error) => {
|
||||
console.error(error);
|
||||
process.exitCode = 1;
|
||||
});
|
11
src/tsconfig.json
Normal file
11
src/tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es2020",
|
||||
"module": "commonjs",
|
||||
"esModuleInterop": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"strict": true,
|
||||
"skipLibCheck": true,
|
||||
"resolveJsonModule": true
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user