Skip to content

Latest commit

 

History

History
75 lines (47 loc) · 2.29 KB

README.md

File metadata and controls

75 lines (47 loc) · 2.29 KB

some ethernaut solutions

Minimalist workspace with Foundry and ethers to test Ethernaut CTF solutions.

About

The Ethernaut is a Web3/Solidity based wargame inspired by overthewire.org, played in the Ethereum Virtual Machine. Each level is a smart contract that needs to be 'hacked'. The game is 100% open source and all levels are contributions made by other players. It operates on Sepolia Testnet.

The structure of this repository is modeled from the method used to test Ethernaut solutions in their official repository. I was also inspired by StErMi/foundry-ethernaut repo.

This is just my personal workspace which I decide to tidy-up a bit and make it public. Submissions of actual level instances are managed externally from this codebase. My player address is 0xA7a47ce31946D2d67196f0C95EC6314Df12FbCfa.

Explore the repo

Requirements

Clone and install dependencies

[email protected]:sofinico/some-ethernaut-solutions.git
cd some-ethernaut-solutions

Foundry deps

git submodule update --init --recursive

Node deps

npm install

Test a solution

forge test -vvv --match-contract TestLevelName

Tests contracts naming convention is Test + LevelName, i.e, TestNaughtCoin. -vvv flag is to show logs, but can be removed.

Tests

Run all solutions tests with Foundry

forge test

Some .ts files are present in test directory. These are helper scripts; sometimes tests and others just helpers to understand what was going on. To run these custom tests/helpers (coded using typescript + ethers), do

npm test LevelName.ts

Additional notes

openzeppelin-contracts

Version naming:

  • openzeppelin-contracts-06 corresponds to v3.4.2;
  • openzeppelin-contracts-08 corresponds to v4.7.3.

This is analogous as how it is done in ethernaut repo. This versioning install is done for example:

forge install openzeppelin-contracts-06=OpenZeppelin/[email protected]