token-minter
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseToken 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 to generate the contract
python scripts/generate_contract.py <name> <symbol> <decimals> <initial_supply> - 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
- Find the network entry and use a reliable HTTPS RPC URL
- For Sepolia: typically "https://ethereum-sepolia.publicnode.com" or similar
- 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
- 确保已创建本地cast钱包(前提条件)
- 从https://chainlist.org/rpcs.json获取目标网络的RPC URL
- 找到对应网络条目并使用可靠的HTTPS RPC URL
- 对于Sepolia测试网:通常为"https://ethereum-sepolia.publicnode.com"或类似地址
- 使用以下命令部署:
forge create --rpc-url <network_rpc> --account <account_name> src/Contract.sol:MyToken --constructor-args <initial_supply> --broadcast - 在目标网络上验证部署结果
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钱包
cast wallet new - 部署账户拥有足够的资金用于支付Gas费
Resources
资源
scripts/
scripts/
- : Python script to generate ERC20 contract code with custom parameters
generate_contract.py
- :用于根据自定义参数生成ERC20合约代码的Python脚本
generate_contract.py
references/
references/
- : Overview of ERC20 standard, required functions, events, and deployment considerations
erc20_guide.md
- :ERC20标准概述、所需函数、事件及部署注意事项
erc20_guide.md
assets/
assets/
- : Template Solidity file for ERC20 contract generation
ERC20Template.sol
- :用于生成ERC20合约的Solidity模板文件
ERC20Template.sol