Ethernaut Challenge 2 Walkthrough w Code

Yong kang Chia
Jun 21, 2022

Challenge 2

The key knowledge for this challenge is to know that Constructors are declared using the constructor keyword or a function with the same name as the contract, in this case Fallout, as the contract name is Fallout.sol.

Misnamed Function

However, in the image above, there is an error in constructor function naming which is misnamed Fal1out instead of Fal1out. This caused the function to be a public function instead of a constructor function.

Therefore all we need to do to exploit is to call await contract.Fal1out()

Solutions :

Hope that this short and sweet tutorial helped!

--

--

Yong kang Chia

Blockchain Developer. Chainlink Ex Spartan Group, Ex Netherminds