/ethernaut-foundry-detailed-solutions-sol

👾 𝗱𝗲𝘁𝗮𝗶𝗹𝗲𝗱 𝘀𝗼𝗹𝘂𝘁𝗶𝗼𝗻𝘀 𝗮𝗻𝗱 𝗳𝗼𝘂𝗻𝗱𝗿𝘆 𝗯𝗼𝗶𝗹𝗲𝗿𝗽𝗹𝗮𝘁𝗲𝘀 𝗳𝗼𝗿 𝗲𝗮𝗰𝗵 𝗲𝘁𝗵𝗲𝗿𝗻𝗮𝘂𝘁 𝗹𝗲𝘃𝗲𝗹

Primary LanguageSolidity

🧑🏻‍🚀 my ethernaut write-ups and solution in foundry


🔋 this project contains solutions for openzeppelin's ethernaut wargames. leveraging foundry, each level has a test set (.t.sol), a script set (.s.sol), and a write-up. some levels also have an exploit at src/.sol.
🔋 note that my "submission foundry scripts" intentionally contain the addresses of my instances hardcoded instead of in the .env file. this serves me as an arxiv, and it's harmless as i use a test wallet for this work.
🔋 by the way, do you remember overthewire? here is my WeChall profile from playing it in 2014.


levels


✅ 01. Fallback:
✅ 02. Fallout:
✅ 03. Coin Flip:
✅ 04. Telephone:
✅ 05. Token:
✅ 06. Delegation:
🔜 07. Force:
✅ 08. Vault:
🔜 09. King:
🔜 10. Reentrancy:
✅ 11. Elevator:
🔜 12. Privacy:
🔜 13. Gatekeeper One:
🔜 14. Gatekeeper Two:
🔜 15. Naught Coin:
🔜 16. Preservation:
🔜 17. Recovery:
🔜 18. Magic Number:
🔜 19. Alien Code:
🔜 20. Denial:
🔜 21. Shop:
🔜 22. Dex:
🔜 23. Dex Two:
🔜 24. Puzzle Wallet:
🔜 25. Motorbike:
🔜 26. Doubly Entry Point:
🔜 27. Good Samaritan:
🔜 28. Gatekeeper Three:
🔜 29. Switch:


installing


  • install foundry

  • create a .env (from .env.example) and add your private and private keys

  • add a sepolia rpc url to foundry.toml



running each level


  • you will find detailed instructions in each write-up, but as a general rule:

  • run tests with, for example,
    • forge test -vvvv, or, for example,
    • forge test -vvvv --match-path ./test/01/Fallback.t.sol

  • submit scripts with, for example,
    • forge script ./script/01/Fallback.s.sol --broadcast -vvvv --rpc-url sepolia