Ethernaut Fallout

Diogo Pereira | diogo-pereira.com
3 min readJul 12, 2022

The Constructor Function

The constructor is a special function that is used to initialise contract’s state and variables. These are some of its key properties:

  • A contract can have only one constructor.
  • A constructor code is executed once when a contract is created and it is used to initialise contract state.
  • After a constructor code has executed, the final code is deployed to blockchain. This code includes public functions and code reachable through public functions. Constructor code or any internal method used only by the constructor are not included in final code.
  • A constructor can be either public or internal.
  • An internal constructor marks the contract as abstract.
  • In case, no constructor is defined, a default constructor is present in the contract.

Once again, our objective is to claim ownership of the following smart contract:

Based on my previous post, I will solve this challenge by leveraging my initial setup. For this, we…

--

--

Diogo Pereira | diogo-pereira.com

I help organisations build cyber-resilient applications, bring security awareness and mindset growth tips to interested individuals