token-minter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Token Minter

代币铸造工具(Token Minter)

Overview

概述

This skill enables users to create custom ERC20 tokens by collecting parameters, generating Solidity code, setting up a Foundry project, building the contract, and deploying to a target EVM network.
本技能支持用户通过收集参数、生成Solidity代码、搭建Foundry项目、构建合约并部署至目标EVM网络,从而创建自定义ERC20代币。

Workflow

工作流程

Step 1: Collect Information

步骤1:收集信息

Collect the following parameters from the user:
  • Token name (e.g., "MyToken")
  • Token symbol (e.g., "MTK")
  • Decimals (default: 18)
  • Initial supply (default: 1000000)
  • Target network (default: sepolia)
从用户处收集以下参数:
  • 代币名称(例如:"MyToken")
  • 代币符号(例如:"MTK")
  • 小数位数(默认值:18)
  • 初始供应量(默认值:1000000)
  • 目标网络(默认值:sepolia)

Step 2: Generate ERC20 Contract

步骤2:生成ERC20合约

Use the provided script to generate the ERC20 contract code based on user parameters.
  • Run
    python scripts/generate_contract.py <name> <symbol> <decimals> <initial_supply>
    to generate the contract
  • The generated contract uses OpenZeppelin ERC20 standard
使用提供的脚本根据用户参数生成ERC20合约代码。
  • 运行
    python scripts/generate_contract.py <name> <symbol> <decimals> <initial_supply>
    生成合约
  • 生成的合约采用OpenZeppelin ERC20标准

Step 3: Initialize Forge Project

步骤3:初始化Forge项目

  • Create a temporary directory under
    ./tmp/
  • Initialize a new Foundry project:
    forge init
  • Place the generated contract in
    src/Contract.sol
  • ./tmp/
    下创建临时目录
  • 初始化新的Foundry项目:
    forge init
  • 将生成的合约放置在
    src/Contract.sol
    路径下

Step 4: Build Contract

步骤4:构建合约

  • Install dependencies:
    forge install OpenZeppelin/openzeppelin-contracts
  • Build the contract:
    forge build
  • 安装依赖:
    forge install OpenZeppelin/openzeppelin-contracts
  • 构建合约:
    forge build

Step 5: Deploy to Network

步骤5:部署至网络

  • Ensure a local cast wallet is created (prerequisite)
  • Get RPC URL for target network from https://chainlist.org/rpcs.json
  • Deploy using:
    forge create --rpc-url <network_rpc> --account <account_name> src/Contract.sol:MyToken --constructor-args <initial_supply> --broadcast
  • Verify deployment on the target network

Prerequisites

前提条件

  • Foundry installed (forge, cast commands available)
  • Local cast wallet created with
    cast wallet new
  • Sufficient funds on the deployment account for gas fees
  • 已安装Foundry(可使用forge、cast命令)
  • 已通过
    cast wallet new
    创建本地cast钱包
  • 部署账户拥有足够的资金用于支付Gas费

Resources

资源

scripts/

scripts/

  • generate_contract.py
    : Python script to generate ERC20 contract code with custom parameters
  • generate_contract.py
    :用于根据自定义参数生成ERC20合约代码的Python脚本

references/

references/

  • erc20_guide.md
    : Overview of ERC20 standard, required functions, events, and deployment considerations
  • erc20_guide.md
    :ERC20标准概述、所需函数、事件及部署注意事项

assets/

assets/

  • ERC20Template.sol
    : Template Solidity file for ERC20 contract generation
  • ERC20Template.sol
    :用于生成ERC20合约的Solidity模板文件