Description:
EggHuntGame can be deployed with an EggstravaganzaNFT address, which has a gameContract set to either address(0) or a different gameContract. Until the EggstravaganzaNFT owner sets the newly deployed EggHuntGame contract through EggstravaganzaNFT::setGameContract, users won't be able to mint any found eggs.
EggHuntGame can be deployed with an EggVault address, which has a eggNFT set to either address(0) or a different EggstravaganzaNFT than the one used in the game. Until the EggVault owner sets same eggNFT contract through EggVault::setEggNFT, users won't be able to deposit any minted eggs.
Impact:
Users won't be able to mint and/or deposit any found eggs.
Proof of Concept:
Owner #1 deploys EggstravaganzaNFT with no gameContract address.
Owner #2 deploys a EggHuntGame using the EggstravaganzaNFT deployed by owner #1.
Owner #2 starts a new game.
User wins an egg, but can't mint it.
Owner #1 deploys EggVault with no eggNFT address.
Owner #2 deploys a EggHuntGame using the EggVault deployed by owner #1.
Owner #2 starts a new game.
User mints an egg, but can't deposit it.
Proof of Code:
Comment out the following line in EggGameTest::setUp function.
and place the following test in the same contract
Comment out the following line in EggGameTest::setUp function.
and place the following test in the same contract
Recommended Mitigation:
Before starting a game have checks inside the deployed EggHuntGame that EggstravaganzaNFT::gameContract is address(this) and EggVault::eggNFT is EggHuntGame(address(this))::eggNFT so for every started game contracts will match.
Use the suggestion from #1, but implement the EggVault::eggNFT check inside the contructor of EggHuntGame so the game can be deployed only if the contracts match, removing one check on game start and saving gas on contract deployment.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.