# Approaching a fresh codebase: base contracts first, then imports, inheritance and state

Mentorship Series #2 · 6 December 2025 · [@0xfirefist](https://x.com/0xFireFist) · Sukukfi · Code4rena

Mentorship Series · [The Contest Academy](https://0xsimao.com/the-contest-academy) · 0xSimao

---

In the first day of the mentorship, we jumped straight into the Sukukfi [contest](https://code4rena.com/audits/2025-11-sukukfi) on Code4rena. Only 4 days left, so we decided to still go through it for the learning experience and also to try to cover at least some of the contracts.

**Lesson Summary:**

- Start with base contracts after cloning the repo (e.g., System Config, Decimals, Tokens) to build foundational understanding.
- Memorise the basic variables, mappings and structs early — they are the context you need for the complex parts.
- When opening a contract, review imports one-by-one: ask "Why this import? What's its purpose?"
- With OpenZeppelin libraries, always call the initializer for every inherited contract.
- `Ownable2Step` does not set the owner automatically — check whether `OwnableUpgradeable`'s initializer is used instead.
- Learn the OpenZeppelin libraries as you need them; avoid pre-emptive deep dives.
- Avoid the docs early on to prevent bias — use them later to check your understanding and to spot discrepancies worth exploring.
- Examine inheritance: ask "Why this contract? What's its purpose?" similar to imports.
- Study the state variables closely — memorise them, and use them to anticipate function behaviour and data flow.
- Overall approach: go line-by-line, building incremental understanding of the codebase.

https://youtu.be/NwOepULPoCU

Session video: https://youtu.be/NwOepULPoCU

---

Newer: [Pricing across asynchronous vault steps, and what to re-check when a function is spammed](https://0xsimao.com/the-contest-academy/mentorship-series-3) · Older: [Who 0xfirefist is, a year of full-time contests, and why they asked for mentorship](https://0xsimao.com/the-contest-academy/mentorship-series-1)
