Skip to content
Request an audit

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

In the first day of the mentorship, we jumped straight into the Sukukfi contest 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.
Watch the session on YouTube ↗
Message on Telegram All 62 posts