Contracts and test for the January sale toy problem.
git clone https://github.com/0xMacro/january_sale.git
cd january_sale
npm install
npx hardhat test
The challenge is to get the tests to pass by editing contracts/FairBidder.sol
(for the first test) and contracts/CheatingBidder.sol
(for the second test), without making any changes to contracts/JanuarySaleItem.sol
or test/Sale.js
The first test just checks that the FairBidder contract can buy the sale item, which is easily done by bidding the reserve price or higher.
The second test requires the CheatingBidder to exploit a vulnerability to buy the sale item at a price of zero.