A Collection of Casino Heist's Challenges written in Foundry- Perfect for those who doesn't want to deploy anything and want to exercise their Test Writting skill in Foundry.
What you need to prepare:
- Foundry
- Snacks 🍫🍪
All the libraries such as Openzepplin Contracts is already included in the GitHub Repository.
This is the directory and its usage.
/src
- all vulnerable contracts here./test
- all testfile/reading-mats/docs
- all vulnerabilities Explanation/reading-mats/Mithrough
- all Mitigations & Walkthroughs
- Clone the Repository
git clone https://github.com/Kiinzu/foundry-casino-heist.git
-
You will find the Challenge in the
/src
accordingly to their Category.- Basic (Introductory)
- Common (Common Vulnerabilities)
- VIP (Easier Stuff, trust me)
-
You will find all the test in one folder
/test
(Basic, Common, VIP in one place). -
Some might require you to write Exploit Contract, some you can just edit the Test Directly. There will be
// Write Exploit Here
, that's the only place you should edit and some may includevm.warp()
, you might also want to change this if you think you need it.
// Example: test/MasterOfBlackjack.t.sol
function testIfSolved() public {
// Setup for Player
vm.startPrank(player, player);
vm.deal(player, 1 ether);
// Write Exploit here
vm.warp(19); // Feel free to change this to any block.timestamp that satisfy the requirement
vm.stopPrank();
assertEq(challSetup.isSolved(), true);
}
- To Test if solved, you can simply run this command
forge test test/MasterOfBlackjack.t.sol -vvvv
- That's it! You good to go.