https://github.com/alchemyplatform/contract-puzzles
https://github.com/alchemyplatform/contract-puzzles
Last synced: 12 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/alchemyplatform/contract-puzzles
- Owner: alchemyplatform
- Created: 2021-02-17T04:14:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-02-04T14:04:19.000Z (over 3 years ago)
- Last Synced: 2024-05-21T04:11:07.203Z (about 2 years ago)
- Language: JavaScript
- Size: 177 KB
- Stars: 20
- Watchers: 4
- Forks: 158
- Open Issues: 4
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Contract Puzzles
The goal of the Smart Contract puzzles is to work on reading smart contracts and writing good tests to modify those smart contracts.
Each Game contract will have a storage variable called `isWon`:
```
bool public isWon;
```
The objective is to set this `isWon` to `true` without modifying the smart contract.
At the same time, you're more than welcome to use `console.log` from hardhat if you need to [debug your smart contracts](https://hardhat.org/tutorial/debugging-with-hardhat-network.html#solidity-console-log).
### Running the tests
First, install all the dependencies with `npm i`. Then, you can run all tests at once by running `npx hardhat test`. However, this might be frustrating when you are just trying to test an individual game.
If you are working on `Game1`, for instance, it will make more sense to run the test cases for the first game: `npx hardhat test test/game1Test.js`. Each Game contract will have a corresponding test file.
Your goal is to modify the tests to make the test case pass without modifying the smart contract (and leaving the `isWon` assertion in place).