Code Monkey home page Code Monkey logo

foundry-erc20-f23's Introduction

OurToken

OurToken is an ERC20 token contract that allows you to create your own token with a custom name, symbol, and initial supply. It inherits from the OpenZeppelin ERC20 contract, which provides a standard implementation of the ERC20 token standard.

Features

  • Customizable token name and symbol
  • Minting of tokens to the contract deployer's address
  • Standard ERC20 functionality (transfer, approve, transferFrom, etc.)

Usage

Hardhat

To use OurToken in your Hardhat project, follow these steps:

  1. Install the OpenZeppelin library:
npm install @openzeppelin/contracts

Copy the OurToken.sol file into your Hardhat project's contracts directory.

In your Hardhat configuration file (hardhat.config.js), make sure you have the following settings:

module.exports = {
  solidity: "0.8.18",
  // ...other configurations
};

Write a deployment script or test that deploys the OurToken contract with the desired initial supply:

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

async function deployOurToken() {
  const initialSupply = ethers.utils.parseEther("1000"); // 1000 tokens
  const OurToken = await ethers.getContractFactory("OurToken");
  const ourToken = await OurToken.deploy(initialSupply);
  await ourToken.deployed();
  console.log("OurToken deployed to:", ourToken.address);
}

Run the deployment script or test using Hardhat:

npx hardhat run scripts/deploy.js

Foundry To use OurToken in your Foundry project, follow these steps:

Copy the OurToken.sol file into your Foundry project's src directory.

Install the OpenZeppelin library using Foundry's dependency manager:

forge install OpenZeppelin/openzeppelin-contracts

Write a test or script that deploys the OurToken contract with the desired initial supply:

pragma solidity ^0.8.18;

import "forge-std/Test.sol";
import "../src/OurToken.sol";

contract OurTokenTest is Test {
    function testDeployOurToken() public {
        uint256 initialSupply = 1000 ether; // 1000 tokens
        OurToken ourToken = new OurToken(initialSupply);
        assertEq(ourToken.totalSupply(), initialSupply);
    }
}

Run the test or script using Foundry:

forge test

License This contract is released under the MIT License.# foundry-erc20-f23

foundry-erc20-f23's People

Contributors

z0ld3v avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.