In this challenge the user is provided with a contract called Shop.sol
. The goal of this challenge is to set the variable price
to be less than 100.
- Create a contract
BuyerContract.sol
that has a function calledprice()
as it is what is expected by theShop
contract. - The
price()
function is called twice, at first call toprice()
it sets theisSold
variable to ourprice
value. We return101
to pass the condition. - Based on the
isSold
value we can on the second call toprice()
, return0
.
- Run Exploit!
forge test -vv -m test_challenge_21