# leid19/lab3-comp5521-2026 architecture

> Architecture diagram of the GitHub repository leid19/lab3-comp5521-2026, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/leid19/lab3-comp5521-2026
- Repository: https://github.com/leid19/lab3-comp5521-2026

## Overview

This is a classroom ERC20 token demo: deploy My Simple Token (MST) to Sepolia, mint tokens to an account, and inspect balances. The contract provides token metadata and owner-only minting; the interaction scripts read and write its on-chain state. Etherscan verification is an optional deployment capability. The README describes a later HTLC exchange lesson, but no HTLC implementation appears in this repository. The graph reflects the sampled scripts and contract; it omits local tests and build configuration.

Main entry points: [`scripts/deploy.js`](https://github.com/leid19/lab3-comp5521-2026/blob/main/scripts/deploy.js) (Deploy MST), [`contracts/MySimpleToken.sol`](https://github.com/leid19/lab3-comp5521-2026/blob/main/contracts/MySimpleToken.sol) (MST contract), [`scripts/interact.js`](https://github.com/leid19/lab3-comp5521-2026/blob/main/scripts/interact.js) (Mint tokens), [`scripts/checkBalance.js`](https://github.com/leid19/lab3-comp5521-2026/blob/main/scripts/checkBalance.js) (Check balance)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_deployment["Deployment"]
  node_deploy["Deploy MST<br/>[deploy.js]"]
end

subgraph group_token["Token contract"]
  node_contract[("MST contract<br/>[MySimpleToken.sol]")]
end

subgraph group_operations["Token operations"]
  node_mint["Mint tokens<br/>[interact.js]"]
  node_balance["Check balance<br/>[checkBalance.js]"]
end

node_user(("Operator"))
node_sepolia{{"Sepolia"}}
node_etherscan{{"Etherscan"}}
node_recipient(("Token recipient"))

node_user -->|"runs"| node_deploy
node_deploy -->|"deploys"| node_contract
node_deploy -->|"broadcasts deployment"| node_sepolia
node_sepolia -->|"stores"| node_contract
node_user -->|"runs"| node_mint
node_mint -->|"reads and mints"| node_contract
node_mint -->|"mints to"| node_recipient
node_user -->|"runs"| node_balance
node_balance -->|"reads balance"| node_contract
node_deploy -.->|"verifies optionally"| node_etherscan

click node_deploy "https://github.com/leid19/lab3-comp5521-2026/blob/main/scripts/deploy.js"
click node_contract "https://github.com/leid19/lab3-comp5521-2026/blob/main/contracts/MySimpleToken.sol"
click node_mint "https://github.com/leid19/lab3-comp5521-2026/blob/main/scripts/interact.js"
click node_balance "https://github.com/leid19/lab3-comp5521-2026/blob/main/scripts/checkBalance.js"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_deploy toneBlue
class node_contract toneAmber
class node_mint,node_balance toneMint
class node_user,node_sepolia,node_etherscan,node_recipient toneIndigo
```

## Components

### Deployment

- [Deploy MST](https://github.com/leid19/lab3-comp5521-2026/blob/main/scripts/deploy.js): `scripts/deploy.js`

### Token contract

- [MST contract](https://github.com/leid19/lab3-comp5521-2026/blob/main/contracts/MySimpleToken.sol): `contracts/MySimpleToken.sol`

### Token operations

- [Mint tokens](https://github.com/leid19/lab3-comp5521-2026/blob/main/scripts/interact.js): `scripts/interact.js`
- [Check balance](https://github.com/leid19/lab3-comp5521-2026/blob/main/scripts/checkBalance.js): `scripts/checkBalance.js`

### Other components

- **Operator**
- **Sepolia**
- **Etherscan**
- **Token recipient**

## Connections

- Operator → Deploy MST: runs
- Deploy MST → MST contract: deploys
- Deploy MST → Sepolia: broadcasts deployment
- Sepolia → MST contract: stores
- Operator → Mint tokens: runs
- Mint tokens → MST contract: reads and mints
- Mint tokens → Token recipient: mints to
- Operator → Check balance: runs
- Check balance → MST contract: reads balance
- Deploy MST → Etherscan: verifies optionally
