# Solidity Level 3: Collections & Data Models

> Level 3: Collections & Data Models of the LoWisa Solidity course: Arrays and Mappings, Structs and Enums, Designing Contract State. 3 lessons and 9 ideas, each explained in one line.

Collections & Data Models is level 3 of 17 of the [LoWisa Solidity course](/courses/solidity/). It has 3 lessons and 9 ideas. Below is every lesson and what it teaches, in one line each.

## Arrays and Mappings

- **Mappings.** A **mapping** is the EVM’s key-value store: every key readable, none enumerable, defaults for the rest.
- **Arrays.** Storage **arrays** grow and shrink at real gas cost: unbounded iteration is a denial-of-service bug.
- **Enumeration patterns.** Enumerable sets pair a mapping with an **index** array: the standard pattern for listable members.

## Structs and Enums

- **Structs.** A **struct** groups fields: packed into slots, its layout an explicit gas decision.
- **Enums.** An **enum** names a closed set of states: Stage.Open, Stage.Settled: matched exhaustively by discipline.
- **Struct packing.** **Packing** small fields into one slot saves storage: uint128 pairs sharing what uint256 wastes.

## Designing Contract State

- **Minimal state.** The best contract state is **minimal**: every slot is attack surface, cost and migration burden.
- **Derived off-chain.** Anything computable from events derives **off-chain**: indexers, not storage, hold the history.
- **Invariants first.** State design starts from **invariants**: totals that must balance, stated before any field exists.

## Before and after this level

- **Before:** [Level 2: State & Data Locations](/courses/solidity/level-2-state-and-data-locations/): Contract Storage, Memory and Calldata, State Mutation.
- **Next:** [Level 4: Functions & Access](/courses/solidity/level-4-functions-and-access/): Visibility, Modifiers, Access-Control Patterns.

In the app each of these ideas is taught and then asked back, and the level ends with a checkpoint and flashcards. See [Checkpoints and flashcards](/help/checkpoints-and-flashcards/).

## Frequently asked questions

### What does Solidity Level 3: Collections & Data Models cover?

Arrays and Mappings, Structs and Enums, Designing Contract State: 3 lessons and 9 ideas.

### What should I know before this level?

The level before it, Level 2: State & Data Locations, which covers Contract Storage, Memory and Calldata, State Mutation.

## Learn Solidity on your phone

The first level is free. LoWisa is on Google Play and the App Store.

---

Source: https://lowisa.dev/courses/solidity/level-3-collections-and-data-models/ · Updated 2026-11-30
