https://github.com/adriangeorgem/contract-puzzles-repo
The objective is to set this isWon to true without modifying the smart contract and writing good tests
https://github.com/adriangeorgem/contract-puzzles-repo
assert chai hardhat hardhat-plugin mapping solidity solidity-contracts
Last synced: 3 months ago
JSON representation
The objective is to set this isWon to true without modifying the smart contract and writing good tests
- Host: GitHub
- URL: https://github.com/adriangeorgem/contract-puzzles-repo
- Owner: AdrianGeorgeM
- Created: 2023-02-06T20:54:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-02-07T20:25:11.000Z (over 2 years ago)
- Last Synced: 2025-01-12T14:46:32.553Z (4 months ago)
- Topics: assert, chai, hardhat, hardhat-plugin, mapping, solidity, solidity-contracts
- Language: JavaScript
- Homepage:
- Size: 224 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
## Contract Puzzles
Get all the tests passing green with ✅✅✅✅✅ check marks
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).