> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dokrypt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# evm-basic

> Beginner template with a Counter and ERC-20 token.

## 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

```bash theme={null}
dokrypt init my-app --template evm-basic
cd my-app
dokrypt up
```

## Generated Files

<Tree>
  <Tree.Folder name="my-app" defaultOpen>
    <Tree.File name="dokrypt.yaml" />

    <Tree.File name="foundry.toml" />

    <Tree.File name="README.md" />

    <Tree.Folder name="contracts" defaultOpen>
      <Tree.File name="Counter.sol" />

      <Tree.File name="SimpleToken.sol" />
    </Tree.Folder>

    <Tree.Folder name="test" defaultOpen>
      <Tree.File name="Counter.t.sol" />

      <Tree.File name="SimpleToken.t.sol" />
    </Tree.Folder>

    <Tree.Folder name="scripts" defaultOpen>
      <Tree.File name="deploy.js" />
    </Tree.Folder>
  </Tree.Folder>
</Tree>

## Configuration

```yaml theme={null}
version: "1"
name: my-app

settings:
  runtime: docker
  log_level: info
  accounts: 10
  account_balance: "10000"

chains:
  ethereum:
    engine: anvil
    chain_id: 31337
    block_time: "2s"

services: {}
```

## Contracts

### Counter.sol

A simple state management contract for learning the basics.

**Storage:**

* `uint256 public number` — The stored counter value

**Functions:**

| 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                   |

**Events:**

* `NumberChanged(uint256 newNumber)` — Emitted on every state change

### SimpleToken.sol

A minimal ERC-20 token implementation.

**Constructor:**

```solidity theme={null}
constructor(string memory name, string memory symbol, uint256 initialSupply)
```

Mints `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      |

**Constants:** 18 decimals

## Deployment

```bash theme={null}
npx hardhat run scripts/deploy.js --network localhost
```

The script deploys both Counter and SimpleToken and outputs their addresses.

## Testing

```bash theme={null}
dokrypt test run
```

Tests cover:

* Counter: increment, decrement, setNumber, reset, underflow revert
* SimpleToken: transfer, approve, transferFrom, mint, access control
