HYC Token (ERC-20) Smart Contract + Deployment Environment
1. Objective
Implement an ERC-20 compatible token called HYC and deploy it to an Ethereum node.
The goal of this task is only:
- Implement the Solidity contract
- Compile and deploy using Foundry
- Enable ERC-20 transfer calls from the CLI
The latest tech stack in 2026
2. Target Network
Network:
- Ethereum
Local development nodes already exist via Docker Compose:
anvil
gethThese nodes expose an RPC endpoint compatible with Ethereum JSON-RPC.
Example RPC
http://localhost:85453. Technology Stack
Smart contract framework:
- Foundry
ERC-20 implementation:
- OpenZeppelin contracts
Package manager priority:
- bun
- fallback → pnpm
Rust-based tooling requirements:
Formatter
- dprint
Solidity linter
- solhint
4. Project Structure
Recommended layout:
hyc-token/
│
├─ contracts/
│ └─ HYC.sol
│
├─ script/
│ └─ DeployHYC.s.sol
│
├─ test/
│
├─ foundry.toml
│
├─ package.json
│
└─ bun.lockb / pnpm-lock.yaml5. Install Dependencies
Prefer bun.
bun init
bun add @openzeppelin/contractsIf bun is not compatible with the environment:
pnpm init
pnpm add @openzeppelin/contractsInstall development tools:
bun add -d solhint
bun add -d dprint6. HYC Token Solidity Implementation
Create file:
contracts/HYC.solSolidity implementation:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.34;
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";
contract HYC is ERC20 {
constructor(uint256 initialSupply)
ERC20("hiromaily Coin", "HYC")
{
_mint(msg.sender, initialSupply);
}
}Token parameters:
Name: hiromaily Coin
Symbol: HYC
Decimals: 18Initial supply is minted to the deployer.
Example initial supply:
1_000_000 * 10^187. Foundry Configuration
Create foundry.toml.
Example:
[profile.default]
src = "contracts"
out = "out"
libs = ["node_modules"]
solc_version = "0.8.34"
optimizer = true
optimizer_runs = 200Compile contracts:
forge build8. Deployment Script
Create solidity file:
Example script:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.34;
import "forge-std/Script.sol";
import "../contracts/HYC.sol";
contract DeployHYC is Script {
function run() external {
uint256 deployerKey = vm.envUint("PRIVATE_KEY");
vm.startBroadcast(deployerKey);
new HYC(1_000_000 ether);
vm.stopBroadcast();
}
}9. Deploy to Local Ethereum Node
Example using Anvil:
forge script script/{deployment script}.sol \
--rpc-url http://localhost:8545 \
--broadcastOutput will include:
contract address
transaction hash
gas usageRecord the deployed token contract address.
10. Token Transfer Flow
The CLI wallet will interact with the deployed HYC token.
Transfer flow:
CLI
↓
encode ERC20 transfer()
↓
create EIP-1559 transaction
↓
sign transaction
↓
eth_sendRawTransaction
↓
Ethereum node11. ERC-20 Transfer Encoding
Function signature:
transfer(address,uint256)Method selector:
0xa9059cbbTransaction data format:
0xa9059cbb
<32 bytes recipient>
<32 bytes amount>Example:
to = token contract address
value = 0
data = encoded transfer call12. Example Raw Transaction
Example fields:
type: 0x2
chainId: 1
nonce: N
maxPriorityFeePerGas
maxFeePerGas
gas
to: HYC contract
value: 0
data: transfer calldataTransaction type:
EIP-1559.
13. Formatter Configuration dprint
use latest version
Example dprint.json.
{
"plugins": [
"https://plugins.dprint.dev/typescript-0.90.0.wasm"
]
}Run formatter:
dprint fmt14. Solidity Linting
Example .solhint.json.
{
"extends": "solhint:recommended"
}Run lint:
solhint contracts/**/*.sol15. Expected Outcome
After implementation:
- HYC ERC-20 token can be deployed to Ethereum node
- CLI can generate raw transactions
- CLI can perform:
HYC transferusing:
transfer(address,uint256)