Overview
The simplest starting point for Web3 development. Includes two contracts — a Counter for learning state management and a SimpleToken ERC-20 — with full test suites.| Difficulty | Beginner |
| Category | Basic |
| Chains | Ethereum |
| Services | None |
| License | Apache-2.0 |
Quick Start
Generated Files
my-app
dokrypt.yaml
foundry.toml
README.md
contracts
Counter.sol
SimpleToken.sol
test
Counter.t.sol
SimpleToken.t.sol
scripts
deploy.js
Configuration
Contracts
Counter.sol
A simple state management contract for learning the basics. Storage:uint256 public number— The stored counter value
| Function | Access | Description |
|---|---|---|
setNumber(uint256 newNumber) | Public | Set the counter to a specific value |
increment() | Public | Increase counter by 1 |
decrement() | Public | Decrease counter by 1 (reverts if 0) |
reset() | Public | Reset counter to 0 |
NumberChanged(uint256 newNumber)— Emitted on every state change
SimpleToken.sol
A minimal ERC-20 token implementation. Constructor:initialSupply tokens to the deployer.
Functions:
| Function | Access | Description |
|---|---|---|
transfer(address to, uint256 amount) | Public | Transfer tokens |
approve(address spender, uint256 amount) | Public | Approve spending |
transferFrom(address from, address to, uint256 amount) | Public | Transfer on behalf |
mint(address to, uint256 amount) | Owner only | Mint new tokens |
balanceOf(address account) | View | Get token balance |
allowance(address owner, address spender) | View | Get allowance |
Deployment
Testing
- Counter: increment, decrement, setNumber, reset, underflow revert
- SimpleToken: transfer, approve, transferFrom, mint, access control